From bf1e643973980687635ff6ab0b527b9cd8661920 Mon Sep 17 00:00:00 2001 From: jillingk <93914435+jillingk@users.noreply.github.com> Date: Thu, 19 Jan 2023 16:57:26 +0100 Subject: [PATCH] [PW-7765] add create/disablePermit and simple UT (#1082) * add create/disablePermit and simple UT * Add serializer for Date objects and quick test Co-authored-by: Michael Paul --- src/__tests__/recurring.spec.ts | 56 ++++++++++++++++ src/services/recurring.ts | 59 ++++++++++++----- src/services/resource/RecurringResource.ts | 14 ++++ src/services/resource/recurring/disable.ts | 33 ---------- .../recurring/listRecurringDetails.ts | 33 ---------- .../resource/recurring/notifyShopper.ts | 33 ---------- .../recurring/scheduleAccountUpdater.ts | 33 ---------- src/typings/recurring/card.ts | 4 +- src/typings/recurring/createPermitRequest.ts | 58 +++++++++++++++++ src/typings/recurring/createPermitResult.ts | 40 ++++++++++++ src/typings/recurring/disablePermitRequest.ts | 39 +++++++++++ src/typings/recurring/disablePermitResult.ts | 39 +++++++++++ src/typings/recurring/models.ts | 21 ++++++ src/typings/recurring/permit.ts | 64 +++++++++++++++++++ src/typings/recurring/permitRestriction.ts | 43 +++++++++++++ src/typings/recurring/permitResult.ts | 39 +++++++++++ 16 files changed, 457 insertions(+), 151 deletions(-) create mode 100644 src/services/resource/RecurringResource.ts delete mode 100644 src/services/resource/recurring/disable.ts delete mode 100644 src/services/resource/recurring/listRecurringDetails.ts delete mode 100644 src/services/resource/recurring/notifyShopper.ts delete mode 100644 src/services/resource/recurring/scheduleAccountUpdater.ts create mode 100644 src/typings/recurring/createPermitRequest.ts create mode 100644 src/typings/recurring/createPermitResult.ts create mode 100644 src/typings/recurring/disablePermitRequest.ts create mode 100644 src/typings/recurring/disablePermitResult.ts create mode 100644 src/typings/recurring/permit.ts create mode 100644 src/typings/recurring/permitRestriction.ts create mode 100644 src/typings/recurring/permitResult.ts diff --git a/src/__tests__/recurring.spec.ts b/src/__tests__/recurring.spec.ts index 38bb1c0..3b9f24b 100644 --- a/src/__tests__/recurring.spec.ts +++ b/src/__tests__/recurring.spec.ts @@ -6,6 +6,9 @@ import { notifyShopperSuccess } from "../__mocks__/recurring/notifyShopperSucces import RecurringService from "../services/recurring"; import Client from "../client"; import { recurring } from "../typings"; +import {Permit} from "../typings/recurring/permit"; +import {CreatePermitRequest} from "../typings/recurring/createPermitRequest"; +import {ObjectSerializer} from "../typings/recurring/models"; const createRecurringDetailsRequest = (): recurring.RecurringDetailsRequest => { return { @@ -115,4 +118,57 @@ describe("Recurring", (): void => { fail(e); } }); + + test("should do a createPermit request", async (): Promise => { + const createPermitResultSuccess: recurring.CreatePermitResult = { + pspReference: "1234567890" + }; + + scope.post("/createPermit") + .reply(200, createPermitResultSuccess); + + const permit: Permit = { + validTillDate: new Date("2022-03-25"), + partnerId: "partnerID" + }; + + const request: recurring.CreatePermitRequest = { + permits: [permit], + merchantAccount: process.env.ADYEN_MERCHANT!, + shopperReference: "shopperRef", + recurringDetailReference: "recurringRef", + }; + + const serializedRequest: CreatePermitRequest = ObjectSerializer.serialize(request, "CreatePermitRequest"); + expect(serializedRequest.permits[0].validTillDate?.toString()).toBe("2022-03-25T00:00:00.000Z"); + + try { + const result = await recurringService.createPermit(request); + expect(result).toBeTruthy(); + } catch (e) { + fail(e); + } + }); + + test("should do a disablePermit request", async (): Promise => { + const disablePermitResultSuccess: recurring.DisablePermitResult = { + pspReference: "1234567890", + status: "disabled", + }; + + scope.post("/disablePermit") + .reply(200, disablePermitResultSuccess); + + const request: recurring.DisablePermitRequest = { + merchantAccount: process.env.ADYEN_MERCHANT!, + token: "permitToken" + }; + + try { + const result = await recurringService.disablePermit(request); + expect(result).toBeTruthy(); + } catch (e) { + fail(e); + } + }); }); diff --git a/src/services/recurring.ts b/src/services/recurring.ts index a2f1742..499563c 100644 --- a/src/services/recurring.ts +++ b/src/services/recurring.ts @@ -1,10 +1,6 @@ import Client from "../client"; import getJsonResponse from "../helpers/getJsonResponse"; import Service from "../service"; -import Disable from "./resource/recurring/disable"; -import ListRecurringDetails from "./resource/recurring/listRecurringDetails"; -import ScheduleAccountUpdater from "./resource/recurring/scheduleAccountUpdater"; -import NotifyShopper from "./resource/recurring/notifyShopper"; import { RecurringDetailsRequest, RecurringDetailsResult, @@ -13,50 +9,79 @@ import { ScheduleAccountUpdaterRequest, ScheduleAccountUpdaterResult, NotifyShopperRequest, - NotifyShopperResult + NotifyShopperResult, + CreatePermitRequest, + CreatePermitResult, + DisablePermitRequest, + DisablePermitResult, ObjectSerializer } from "../typings/recurring/models"; +import RecurringResource from "./resource/RecurringResource"; class Recurring extends Service { - private readonly _listRecurringDetails: ListRecurringDetails; - private readonly _disable: Disable; - private readonly _scheduleAccountUpdater: ScheduleAccountUpdater; - private readonly _notifyShopper: NotifyShopper; + private readonly _listRecurringDetails: RecurringResource; + private readonly _disable: RecurringResource; + private readonly _scheduleAccountUpdater: RecurringResource; + private readonly _notifyShopper: RecurringResource; + private readonly _createPermit: RecurringResource; + private readonly _disablePermit: RecurringResource; public constructor(client: Client) { super(client); - this._listRecurringDetails = new ListRecurringDetails(this); - this._disable = new Disable(this); - this._scheduleAccountUpdater = new ScheduleAccountUpdater(this); - this._notifyShopper = new NotifyShopper(this); + this._listRecurringDetails = new RecurringResource(this, "/listRecurringDetails"); + this._disable = new RecurringResource(this, "/disable"); + this._scheduleAccountUpdater = new RecurringResource(this, "/scheduleAccountUpdater"); + this._notifyShopper = new RecurringResource(this, "/notifyShopper"); + this._createPermit = new RecurringResource(this, "/createPermit"); + this._disablePermit = new RecurringResource(this, "/disablePermit") } - public listRecurringDetails(request: RecurringDetailsRequest): Promise { + public listRecurringDetails(recurringDetailsRequest: RecurringDetailsRequest): Promise { + const request: RecurringDetailsRequest = ObjectSerializer.serialize(recurringDetailsRequest, "RecurringDetailsRequest"); return getJsonResponse( this._listRecurringDetails, request, ); } - public disable(request: DisableRequest): Promise { + public disable(disableRequest: DisableRequest): Promise { + const request: DisableRequest = ObjectSerializer.serialize(disableRequest, "DisableRequest"); return getJsonResponse( this._disable, request, ); } - public scheduleAccountUpdater(request: ScheduleAccountUpdaterRequest): Promise { + public scheduleAccountUpdater(scheduleAccountUpdaterRequest: ScheduleAccountUpdaterRequest): Promise { + const request: ScheduleAccountUpdaterRequest = ObjectSerializer.serialize(scheduleAccountUpdaterRequest, "ScheduleAccountUpdaterRequest"); return getJsonResponse( this._scheduleAccountUpdater, request, ); } - public notifyShopper(request: NotifyShopperRequest): Promise { + public notifyShopper(notifyShopperRequest: NotifyShopperRequest): Promise { + const request: NotifyShopperRequest = ObjectSerializer.serialize(notifyShopperRequest, "NotifyShopperRequest"); return getJsonResponse( this._notifyShopper, request ); } + + public createPermit(createPermitRequest: CreatePermitRequest): Promise{ + const request: CreatePermitRequest = ObjectSerializer.serialize(createPermitRequest, "CreatePermitRequest"); + return getJsonResponse( + this._createPermit, + request + ); + } + + public disablePermit(disablePermitRequest: DisablePermitRequest): Promise{ + const request: DisablePermitRequest = ObjectSerializer.serialize(disablePermitRequest, "DisablePermitRequest"); + return getJsonResponse( + this._disablePermit, + request + ); + } } export default Recurring; diff --git a/src/services/resource/RecurringResource.ts b/src/services/resource/RecurringResource.ts new file mode 100644 index 0000000..41fc3c2 --- /dev/null +++ b/src/services/resource/RecurringResource.ts @@ -0,0 +1,14 @@ +import Client from "../../client"; +import Service from "../../service"; +import Resource from "../resource"; + +class RecurringResource extends Resource { + public constructor(service: Service, endpoint: string) { + super( + service, + `${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}${endpoint}` , + ); + } +} + +export default RecurringResource; \ No newline at end of file diff --git a/src/services/resource/recurring/disable.ts b/src/services/resource/recurring/disable.ts deleted file mode 100644 index 0f49705..0000000 --- a/src/services/resource/recurring/disable.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * ###### - * ###### - * ############ ####( ###### #####. ###### ############ ############ - * ############# #####( ###### #####. ###### ############# ############# - * ###### #####( ###### #####. ###### ##### ###### ##### ###### - * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### - * ###### ###### #####( ###### #####. ###### ##### ##### ###### - * ############# ############# ############# ############# ##### ###### - * ############ ############ ############# ############ ##### ###### - * ###### - * ############# - * ############ - * Adyen NodeJS API Library - * Copyright (c) 2020 Adyen B.V. - * This file is open source and available under the MIT license. - * See the LICENSE file for more info. - */ - -import Client from "../../../client"; -import Service from "../../../service"; -import Resource from "../../resource"; - -class Disable extends Resource { - public constructor(service: Service) { - super( - service, - `${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}/disable`, - ); - } -} - -export default Disable; diff --git a/src/services/resource/recurring/listRecurringDetails.ts b/src/services/resource/recurring/listRecurringDetails.ts deleted file mode 100644 index d7aaac4..0000000 --- a/src/services/resource/recurring/listRecurringDetails.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * ###### - * ###### - * ############ ####( ###### #####. ###### ############ ############ - * ############# #####( ###### #####. ###### ############# ############# - * ###### #####( ###### #####. ###### ##### ###### ##### ###### - * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### - * ###### ###### #####( ###### #####. ###### ##### ##### ###### - * ############# ############# ############# ############# ##### ###### - * ############ ############ ############# ############ ##### ###### - * ###### - * ############# - * ############ - * Adyen NodeJS API Library - * Copyright (c) 2020 Adyen B.V. - * This file is open source and available under the MIT license. - * See the LICENSE file for more info. - */ - -import Client from "../../../client"; -import Service from "../../../service"; -import Resource from "../../resource"; - -class ListRecurringDetails extends Resource { - public constructor(service: Service) { - super( - service, - `${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}/listRecurringDetails`, - ); - } -} - -export default ListRecurringDetails; diff --git a/src/services/resource/recurring/notifyShopper.ts b/src/services/resource/recurring/notifyShopper.ts deleted file mode 100644 index ee0ec2a..0000000 --- a/src/services/resource/recurring/notifyShopper.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * ###### - * ###### - * ############ ####( ###### #####. ###### ############ ############ - * ############# #####( ###### #####. ###### ############# ############# - * ###### #####( ###### #####. ###### ##### ###### ##### ###### - * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### - * ###### ###### #####( ###### #####. ###### ##### ##### ###### - * ############# ############# ############# ############# ##### ###### - * ############ ############ ############# ############ ##### ###### - * ###### - * ############# - * ############ - * Adyen NodeJS API Library - * Copyright (c) 2020 Adyen B.V. - * This file is open source and available under the MIT license. - * See the LICENSE file for more info. - */ - -import Client from "../../../client"; -import Service from "../../../service"; -import Resource from "../../resource"; - -class NotifyShopper extends Resource { - public constructor(service: Service) { - super( - service, - `${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}/notifyShopper`, - ); - } -} - -export default NotifyShopper; diff --git a/src/services/resource/recurring/scheduleAccountUpdater.ts b/src/services/resource/recurring/scheduleAccountUpdater.ts deleted file mode 100644 index 11fa87a..0000000 --- a/src/services/resource/recurring/scheduleAccountUpdater.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * ###### - * ###### - * ############ ####( ###### #####. ###### ############ ############ - * ############# #####( ###### #####. ###### ############# ############# - * ###### #####( ###### #####. ###### ##### ###### ##### ###### - * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### - * ###### ###### #####( ###### #####. ###### ##### ##### ###### - * ############# ############# ############# ############# ##### ###### - * ############ ############ ############# ############ ##### ###### - * ###### - * ############# - * ############ - * Adyen NodeJS API Library - * Copyright (c) 2020 Adyen B.V. - * This file is open source and available under the MIT license. - * See the LICENSE file for more info. - */ - -import Client from "../../../client"; -import Service from "../../../service"; -import Resource from "../../resource"; - -class ScheduleAccountUpdater extends Resource { - public constructor(service: Service) { - super( - service, - `${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}/scheduleAccountUpdater`, - ); - } -} - -export default ScheduleAccountUpdater; diff --git a/src/typings/recurring/card.ts b/src/typings/recurring/card.ts index 4faa202..a3b54c6 100644 --- a/src/typings/recurring/card.ts +++ b/src/typings/recurring/card.ts @@ -16,7 +16,7 @@ export class Card { /** * The card expiry month. Format: 2 digits, zero-padded for single digits. For example: * 03 = March * 11 = November */ - 'expiryMonth': string; + 'expiryMonth'?: string; /** * The card expiry year. Format: 4 digits. For example: 2020 */ @@ -32,7 +32,7 @@ export class Card { /** * The card number (4-19 characters). Do not use any separators. When this value is returned in a response, only the last 4 digits of the card number are returned. */ - 'number': string; + 'number'?: string; /** * The month component of the start date (for some UK debit cards only). */ diff --git a/src/typings/recurring/createPermitRequest.ts b/src/typings/recurring/createPermitRequest.ts new file mode 100644 index 0000000..3bb9231 --- /dev/null +++ b/src/typings/recurring/createPermitRequest.ts @@ -0,0 +1,58 @@ +/* + * The version of the OpenAPI document: v68 + * Contact: developer-experience@adyen.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit this class manually. + */ + +import { Permit } from './permit'; + +export class CreatePermitRequest { + /** + * The merchant account identifier, with which you want to process the transaction. + */ + 'merchantAccount': string; + /** + * The permits to create for this recurring contract. + */ + 'permits': Array; + /** + * The recurring contract the new permits will use. + */ + 'recurringDetailReference': string; + /** + * The shopper\'s reference to uniquely identify this shopper (e.g. user ID or account ID). + */ + 'shopperReference': string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "merchantAccount", + "baseName": "merchantAccount", + "type": "string" + }, + { + "name": "permits", + "baseName": "permits", + "type": "Array" + }, + { + "name": "recurringDetailReference", + "baseName": "recurringDetailReference", + "type": "string" + }, + { + "name": "shopperReference", + "baseName": "shopperReference", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return CreatePermitRequest.attributeTypeMap; + } +} + diff --git a/src/typings/recurring/createPermitResult.ts b/src/typings/recurring/createPermitResult.ts new file mode 100644 index 0000000..32598bd --- /dev/null +++ b/src/typings/recurring/createPermitResult.ts @@ -0,0 +1,40 @@ +/* + * The version of the OpenAPI document: v68 + * Contact: developer-experience@adyen.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit this class manually. + */ + +import { PermitResult } from './permitResult'; + +export class CreatePermitResult { + /** + * List of new permits. + */ + 'permitResultList'?: Array; + /** + * A unique reference associated with the request. This value is globally unique; quote it when communicating with us about this request. + */ + 'pspReference'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "permitResultList", + "baseName": "permitResultList", + "type": "Array" + }, + { + "name": "pspReference", + "baseName": "pspReference", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return CreatePermitResult.attributeTypeMap; + } +} + diff --git a/src/typings/recurring/disablePermitRequest.ts b/src/typings/recurring/disablePermitRequest.ts new file mode 100644 index 0000000..f5409d1 --- /dev/null +++ b/src/typings/recurring/disablePermitRequest.ts @@ -0,0 +1,39 @@ +/* + * The version of the OpenAPI document: v68 + * Contact: developer-experience@adyen.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit this class manually. + */ + + +export class DisablePermitRequest { + /** + * The merchant account identifier, with which you want to process the transaction. + */ + 'merchantAccount': string; + /** + * The permit token to disable. + */ + 'token': string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "merchantAccount", + "baseName": "merchantAccount", + "type": "string" + }, + { + "name": "token", + "baseName": "token", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DisablePermitRequest.attributeTypeMap; + } +} + diff --git a/src/typings/recurring/disablePermitResult.ts b/src/typings/recurring/disablePermitResult.ts new file mode 100644 index 0000000..3cd9468 --- /dev/null +++ b/src/typings/recurring/disablePermitResult.ts @@ -0,0 +1,39 @@ +/* + * The version of the OpenAPI document: v68 + * Contact: developer-experience@adyen.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit this class manually. + */ + + +export class DisablePermitResult { + /** + * A unique reference associated with the request. This value is globally unique; quote it when communicating with us about this request. + */ + 'pspReference'?: string; + /** + * Status of the disable request. + */ + 'status'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "pspReference", + "baseName": "pspReference", + "type": "string" + }, + { + "name": "status", + "baseName": "status", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DisablePermitResult.attributeTypeMap; + } +} + diff --git a/src/typings/recurring/models.ts b/src/typings/recurring/models.ts index 2836696..02e643c 100644 --- a/src/typings/recurring/models.ts +++ b/src/typings/recurring/models.ts @@ -12,11 +12,18 @@ export * from './address'; export * from './amount'; export * from './bankAccount'; export * from './card'; +export * from './createPermitRequest'; +export * from './createPermitResult'; +export * from './disablePermitRequest'; +export * from './disablePermitResult'; export * from './disableRequest'; export * from './disableResult'; export * from './name'; export * from './notifyShopperRequest'; export * from './notifyShopperResult'; +export * from './permit'; +export * from './permitRestriction'; +export * from './permitResult'; export * from './recurring'; export * from './recurringDetail'; export * from './recurringDetailsRequest'; @@ -31,11 +38,18 @@ import { Address } from './address'; import { Amount } from './amount'; import { BankAccount } from './bankAccount'; import { Card } from './card'; +import { CreatePermitRequest } from './createPermitRequest'; +import { CreatePermitResult } from './createPermitResult'; +import { DisablePermitRequest } from './disablePermitRequest'; +import { DisablePermitResult } from './disablePermitResult'; import { DisableRequest } from './disableRequest'; import { DisableResult } from './disableResult'; import { Name } from './name'; import { NotifyShopperRequest } from './notifyShopperRequest'; import { NotifyShopperResult } from './notifyShopperResult'; +import { Permit } from './permit'; +import { PermitRestriction } from './permitRestriction'; +import { PermitResult } from './permitResult'; import { Recurring } from './recurring'; import { RecurringDetail } from './recurringDetail'; import { RecurringDetailsRequest } from './recurringDetailsRequest'; @@ -67,11 +81,18 @@ let typeMap: {[index: string]: any} = { "Amount": Amount, "BankAccount": BankAccount, "Card": Card, + "CreatePermitRequest": CreatePermitRequest, + "CreatePermitResult": CreatePermitResult, + "DisablePermitRequest": DisablePermitRequest, + "DisablePermitResult": DisablePermitResult, "DisableRequest": DisableRequest, "DisableResult": DisableResult, "Name": Name, "NotifyShopperRequest": NotifyShopperRequest, "NotifyShopperResult": NotifyShopperResult, + "Permit": Permit, + "PermitRestriction": PermitRestriction, + "PermitResult": PermitResult, "Recurring": Recurring, "RecurringDetail": RecurringDetail, "RecurringDetailsRequest": RecurringDetailsRequest, diff --git a/src/typings/recurring/permit.ts b/src/typings/recurring/permit.ts new file mode 100644 index 0000000..05507c6 --- /dev/null +++ b/src/typings/recurring/permit.ts @@ -0,0 +1,64 @@ +/* + * The version of the OpenAPI document: v68 + * Contact: developer-experience@adyen.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit this class manually. + */ + +import { PermitRestriction } from './permitRestriction'; + +export class Permit { + /** + * Partner ID (when using the permit-per-partner token sharing model). + */ + 'partnerId'?: string; + /** + * The profile to apply to this permit (when using the shared permits model). + */ + 'profileReference'?: string; + 'restriction'?: PermitRestriction; + /** + * The key to link permit requests to permit results. + */ + 'resultKey'?: string; + /** + * The expiry date for this permit. + */ + 'validTillDate'?: Date; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "partnerId", + "baseName": "partnerId", + "type": "string" + }, + { + "name": "profileReference", + "baseName": "profileReference", + "type": "string" + }, + { + "name": "restriction", + "baseName": "restriction", + "type": "PermitRestriction" + }, + { + "name": "resultKey", + "baseName": "resultKey", + "type": "string" + }, + { + "name": "validTillDate", + "baseName": "validTillDate", + "type": "Date" + } ]; + + static getAttributeTypeMap() { + return Permit.attributeTypeMap; + } +} + diff --git a/src/typings/recurring/permitRestriction.ts b/src/typings/recurring/permitRestriction.ts new file mode 100644 index 0000000..c740a95 --- /dev/null +++ b/src/typings/recurring/permitRestriction.ts @@ -0,0 +1,43 @@ +/* + * The version of the OpenAPI document: v68 + * Contact: developer-experience@adyen.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit this class manually. + */ + +import { Amount } from './amount'; + +export class PermitRestriction { + 'maxAmount'?: Amount; + 'singleTransactionLimit'?: Amount; + /** + * Only a single payment can be made using this permit if set to true, otherwise multiple payments are allowed. + */ + 'singleUse'?: boolean; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "maxAmount", + "baseName": "maxAmount", + "type": "Amount" + }, + { + "name": "singleTransactionLimit", + "baseName": "singleTransactionLimit", + "type": "Amount" + }, + { + "name": "singleUse", + "baseName": "singleUse", + "type": "boolean" + } ]; + + static getAttributeTypeMap() { + return PermitRestriction.attributeTypeMap; + } +} + diff --git a/src/typings/recurring/permitResult.ts b/src/typings/recurring/permitResult.ts new file mode 100644 index 0000000..6ac3c22 --- /dev/null +++ b/src/typings/recurring/permitResult.ts @@ -0,0 +1,39 @@ +/* + * The version of the OpenAPI document: v68 + * Contact: developer-experience@adyen.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit this class manually. + */ + + +export class PermitResult { + /** + * The key to link permit requests to permit results. + */ + 'resultKey'?: string; + /** + * The permit token which is used to make payments by the partner company. + */ + 'token'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "resultKey", + "baseName": "resultKey", + "type": "string" + }, + { + "name": "token", + "baseName": "token", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return PermitResult.attributeTypeMap; + } +} +