diff --git a/README.md b/README.md index 828f3e0..c9bb380 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ The official Xendit Node SDK provides a simple and convenient way to call Xendit's REST API in applications written in Node. -* Package version: 3.3.0 +* Package version: 3.4.0 # Getting Started @@ -49,14 +49,14 @@ const xenditClient = new Xendit({ # Documentation Find detailed API information and examples for each of our product’s by clicking the links below, -* [Refund](docs/Refund.md) * [Invoice](docs/Invoice.md) -* [Payout](docs/Payout.md) -* [PaymentMethod](docs/PaymentMethod.md) * [PaymentRequest](docs/PaymentRequest.md) -* [Customer](docs/Customer.md) +* [PaymentMethod](docs/PaymentMethod.md) +* [Refund](docs/Refund.md) * [Transaction](docs/Transaction.md) * [Balance](docs/Balance.md) +* [Customer](docs/Customer.md) +* [Payout](docs/Payout.md) Further Reading diff --git a/balance_and_transaction/apis/Balance.ts b/balance_and_transaction/apis/Balance.ts index b5c8763..aeacdcb 100644 --- a/balance_and_transaction/apis/Balance.ts +++ b/balance_and_transaction/apis/Balance.ts @@ -26,7 +26,6 @@ export interface GetBalanceRequest { accountType?: GetBalanceAccountTypeEnum; currency?: string; forUserId?: string; - idempotencyKey?: string; } /** @@ -67,10 +66,6 @@ export class BalanceApi extends runtime.BaseAPI { headerParameters['for-user-id'] = String(requestParameters.forUserId); } - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); - } - const response = await this.request({ path: `/balance`, method: 'GET', diff --git a/balance_and_transaction/apis/Transaction.ts b/balance_and_transaction/apis/Transaction.ts index 5a26baf..2dd46a4 100644 --- a/balance_and_transaction/apis/Transaction.ts +++ b/balance_and_transaction/apis/Transaction.ts @@ -40,6 +40,11 @@ import { ValidationErrorToJSON, } from '../models'; +export interface GetTransactionByIDRequest { + id: string; + forUserId?: string; +} + export interface GetAllTransactionsRequest { forUserId?: string; types?: Array; @@ -55,13 +60,6 @@ export interface GetAllTransactionsRequest { limit?: number; afterId?: string; beforeId?: string; - idempotencyKey?: string; -} - -export interface GetTransactionByIDRequest { - id: string; - forUserId?: string; - idempotencyKey?: string; } /** @@ -80,6 +78,43 @@ export class TransactionApi extends runtime.BaseAPI { this.secretKey = secretKey; } + /** + * Get single specific transaction by transaction id. + * Get a transaction based on its id + */ + private async getTransactionByIDRaw(requestParameters: GetTransactionByIDRequest): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getTransactionByID.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); + + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); + } + + const response = await this.request({ + path: `/transactions/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => TransactionResponseFromJSON(jsonValue)); + } + + /** + * Get single specific transaction by transaction id. + * Get a transaction based on its id + */ + async getTransactionByID(requestParameters: GetTransactionByIDRequest): Promise { + const response = await this.getTransactionByIDRaw(requestParameters); + return await response.value(); + } + /** * Get a list of all transactions based on filter and search parameters. * Get a list of transactions @@ -146,10 +181,6 @@ export class TransactionApi extends runtime.BaseAPI { headerParameters['for-user-id'] = String(requestParameters.forUserId); } - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); - } - const response = await this.request({ path: `/transactions`, method: 'GET', @@ -169,45 +200,4 @@ export class TransactionApi extends runtime.BaseAPI { return await response.value(); } - /** - * Get single specific transaction by transaction id. - * Get a transaction based on its id - */ - private async getTransactionByIDRaw(requestParameters: GetTransactionByIDRequest): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getTransactionByID.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - - if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { - headerParameters['for-user-id'] = String(requestParameters.forUserId); - } - - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); - } - - const response = await this.request({ - path: `/transactions/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => TransactionResponseFromJSON(jsonValue)); - } - - /** - * Get single specific transaction by transaction id. - * Get a transaction based on its id - */ - async getTransactionByID(requestParameters: GetTransactionByIDRequest): Promise { - const response = await this.getTransactionByIDRaw(requestParameters); - return await response.value(); - } - } diff --git a/balance_and_transaction/models/ChannelsCategories.ts b/balance_and_transaction/models/ChannelsCategories.ts index da3ed6b..39e95bb 100644 --- a/balance_and_transaction/models/ChannelsCategories.ts +++ b/balance_and_transaction/models/ChannelsCategories.ts @@ -25,7 +25,8 @@ export const ChannelsCategories = { VirtualAccount: 'VIRTUAL_ACCOUNT', Xenplatform: 'XENPLATFORM', DirectBankTransfer: 'DIRECT_BANK_TRANSFER', - Other: 'OTHER' + Other: 'OTHER', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type ChannelsCategories = typeof ChannelsCategories[keyof typeof ChannelsCategories]; @@ -35,6 +36,11 @@ export function ChannelsCategoriesFromJSON(json: any): ChannelsCategories { } export function ChannelsCategoriesFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChannelsCategories { + if (json !== "" || json !== null) { + const key = Object.keys(ChannelsCategories)[Object.values(ChannelsCategories).indexOf(json)] + return ChannelsCategories[key] === undefined ? + ChannelsCategories['XenditEnumDefaultFallback'] : ChannelsCategories[key] + } return json as ChannelsCategories; } diff --git a/balance_and_transaction/models/Currency.ts b/balance_and_transaction/models/Currency.ts index bec08a3..363a4d4 100644 --- a/balance_and_transaction/models/Currency.ts +++ b/balance_and_transaction/models/Currency.ts @@ -173,7 +173,8 @@ export const Currency = { Yer: 'YER', Zar: 'ZAR', Zmw: 'ZMW', - Zwd: 'ZWD' + Zwd: 'ZWD', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type Currency = typeof Currency[keyof typeof Currency]; @@ -183,6 +184,11 @@ export function CurrencyFromJSON(json: any): Currency { } export function CurrencyFromJSONTyped(json: any, ignoreDiscriminator: boolean): Currency { + if (json !== "" || json !== null) { + const key = Object.keys(Currency)[Object.values(Currency).indexOf(json)] + return Currency[key] === undefined ? + Currency['XenditEnumDefaultFallback'] : Currency[key] + } return json as Currency; } diff --git a/balance_and_transaction/models/TransactionStatuses.ts b/balance_and_transaction/models/TransactionStatuses.ts index b43dfb8..6451af1 100644 --- a/balance_and_transaction/models/TransactionStatuses.ts +++ b/balance_and_transaction/models/TransactionStatuses.ts @@ -16,7 +16,8 @@ export const TransactionStatuses = { Pending: 'PENDING', Failed: 'FAILED', Reversed: 'REVERSED', - Voided: 'VOIDED' + Voided: 'VOIDED', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type TransactionStatuses = typeof TransactionStatuses[keyof typeof TransactionStatuses]; @@ -26,6 +27,11 @@ export function TransactionStatusesFromJSON(json: any): TransactionStatuses { } export function TransactionStatusesFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransactionStatuses { + if (json !== "" || json !== null) { + const key = Object.keys(TransactionStatuses)[Object.values(TransactionStatuses).indexOf(json)] + return TransactionStatuses[key] === undefined ? + TransactionStatuses['XenditEnumDefaultFallback'] : TransactionStatuses[key] + } return json as TransactionStatuses; } diff --git a/balance_and_transaction/models/TransactionTypes.ts b/balance_and_transaction/models/TransactionTypes.ts index 887a3ae..35f8023 100644 --- a/balance_and_transaction/models/TransactionTypes.ts +++ b/balance_and_transaction/models/TransactionTypes.ts @@ -24,7 +24,8 @@ export const TransactionTypes = { Cashback: 'CASHBACK', Topup: 'TOPUP', Withdrawal: 'WITHDRAWAL', - Other: 'OTHER' + Other: 'OTHER', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type TransactionTypes = typeof TransactionTypes[keyof typeof TransactionTypes]; @@ -34,6 +35,11 @@ export function TransactionTypesFromJSON(json: any): TransactionTypes { } export function TransactionTypesFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransactionTypes { + if (json !== "" || json !== null) { + const key = Object.keys(TransactionTypes)[Object.values(TransactionTypes).indexOf(json)] + return TransactionTypes[key] === undefined ? + TransactionTypes['XenditEnumDefaultFallback'] : TransactionTypes[key] + } return json as TransactionTypes; } diff --git a/customer/apis/Customer.ts b/customer/apis/Customer.ts index 9ecb725..6b3db5a 100644 --- a/customer/apis/Customer.ts +++ b/customer/apis/Customer.ts @@ -38,28 +38,24 @@ import { } from '../models'; export interface CreateCustomerRequest { - iDEMPOTENCYKEY?: string; - forUserId?: string; idempotencyKey?: string; + forUserId?: string; data?: CustomerRequest; } export interface GetCustomerRequest { id: string; forUserId?: string; - idempotencyKey?: string; } export interface GetCustomerByReferenceIDRequest { referenceId: string; forUserId?: string; - idempotencyKey?: string; } export interface UpdateCustomerRequest { id: string; forUserId?: string; - idempotencyKey?: string; data?: PatchCustomer; } @@ -91,18 +87,14 @@ export class CustomerApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; - if (requestParameters.iDEMPOTENCYKEY !== undefined && requestParameters.iDEMPOTENCYKEY !== null) { - headerParameters['IDEMPOTENCY-KEY'] = String(requestParameters.iDEMPOTENCYKEY); + if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { + headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); } if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { headerParameters['for-user-id'] = String(requestParameters.forUserId); } - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); - } - const response = await this.request({ path: `/customers`, method: 'POST', @@ -141,10 +133,6 @@ export class CustomerApi extends runtime.BaseAPI { headerParameters['for-user-id'] = String(requestParameters.forUserId); } - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); - } - const response = await this.request({ path: `/customers/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', @@ -186,10 +174,6 @@ export class CustomerApi extends runtime.BaseAPI { headerParameters['for-user-id'] = String(requestParameters.forUserId); } - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); - } - const response = await this.request({ path: `/customers`, method: 'GET', @@ -229,10 +213,6 @@ export class CustomerApi extends runtime.BaseAPI { headerParameters['for-user-id'] = String(requestParameters.forUserId); } - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); - } - const response = await this.request({ path: `/customers/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'PATCH', diff --git a/customer/models/AddressStatus.ts b/customer/models/AddressStatus.ts index 64d3faf..5e1f7d0 100644 --- a/customer/models/AddressStatus.ts +++ b/customer/models/AddressStatus.ts @@ -13,7 +13,8 @@ */ export const AddressStatus = { Active: 'ACTIVE', - Deleted: 'DELETED' + Deleted: 'DELETED', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type AddressStatus = typeof AddressStatus[keyof typeof AddressStatus]; @@ -23,6 +24,11 @@ export function AddressStatusFromJSON(json: any): AddressStatus { } export function AddressStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): AddressStatus { + if (json !== "" || json !== null) { + const key = Object.keys(AddressStatus)[Object.values(AddressStatus).indexOf(json)] + return AddressStatus[key] === undefined ? + AddressStatus['XenditEnumDefaultFallback'] : AddressStatus[key] + } return json as AddressStatus; } diff --git a/customer/models/EndCustomerStatus.ts b/customer/models/EndCustomerStatus.ts index bd00bf0..e702203 100644 --- a/customer/models/EndCustomerStatus.ts +++ b/customer/models/EndCustomerStatus.ts @@ -16,7 +16,8 @@ export const EndCustomerStatus = { Inactive: 'INACTIVE', Pending: 'PENDING', Blocked: 'BLOCKED', - Deleted: 'DELETED' + Deleted: 'DELETED', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type EndCustomerStatus = typeof EndCustomerStatus[keyof typeof EndCustomerStatus]; @@ -26,6 +27,11 @@ export function EndCustomerStatusFromJSON(json: any): EndCustomerStatus { } export function EndCustomerStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): EndCustomerStatus { + if (json !== "" || json !== null) { + const key = Object.keys(EndCustomerStatus)[Object.values(EndCustomerStatus).indexOf(json)] + return EndCustomerStatus[key] === undefined ? + EndCustomerStatus['XenditEnumDefaultFallback'] : EndCustomerStatus[key] + } return json as EndCustomerStatus; } diff --git a/customer/models/IdentityAccountType.ts b/customer/models/IdentityAccountType.ts index b60ca0e..cabc227 100644 --- a/customer/models/IdentityAccountType.ts +++ b/customer/models/IdentityAccountType.ts @@ -17,7 +17,8 @@ export const IdentityAccountType = { CreditCard: 'CREDIT_CARD', PayLater: 'PAY_LATER', Otc: 'OTC', - QrCode: 'QR_CODE' + QrCode: 'QR_CODE', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type IdentityAccountType = typeof IdentityAccountType[keyof typeof IdentityAccountType]; @@ -27,6 +28,11 @@ export function IdentityAccountTypeFromJSON(json: any): IdentityAccountType { } export function IdentityAccountTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): IdentityAccountType { + if (json !== "" || json !== null) { + const key = Object.keys(IdentityAccountType)[Object.values(IdentityAccountType).indexOf(json)] + return IdentityAccountType[key] === undefined ? + IdentityAccountType['XenditEnumDefaultFallback'] : IdentityAccountType[key] + } return json as IdentityAccountType; } diff --git a/customer/models/KYCDocumentSubType.ts b/customer/models/KYCDocumentSubType.ts index 2250155..f85b894 100644 --- a/customer/models/KYCDocumentSubType.ts +++ b/customer/models/KYCDocumentSubType.ts @@ -21,7 +21,8 @@ export const KYCDocumentSubType = { StudentId: 'STUDENT_ID', MilitaryId: 'MILITARY_ID', MedicalId: 'MEDICAL_ID', - Others: 'OTHERS' + Others: 'OTHERS', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type KYCDocumentSubType = typeof KYCDocumentSubType[keyof typeof KYCDocumentSubType]; @@ -31,6 +32,11 @@ export function KYCDocumentSubTypeFromJSON(json: any): KYCDocumentSubType { } export function KYCDocumentSubTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): KYCDocumentSubType { + if (json !== "" || json !== null) { + const key = Object.keys(KYCDocumentSubType)[Object.values(KYCDocumentSubType).indexOf(json)] + return KYCDocumentSubType[key] === undefined ? + KYCDocumentSubType['XenditEnumDefaultFallback'] : KYCDocumentSubType[key] + } return json as KYCDocumentSubType; } diff --git a/customer/models/KYCDocumentType.ts b/customer/models/KYCDocumentType.ts index 1fcc3e0..360c1fd 100644 --- a/customer/models/KYCDocumentType.ts +++ b/customer/models/KYCDocumentType.ts @@ -19,7 +19,8 @@ export const KYCDocumentType = { Passport: 'PASSPORT', Visa: 'VISA', BusinessRegistration: 'BUSINESS_REGISTRATION', - BusinessLicense: 'BUSINESS_LICENSE' + BusinessLicense: 'BUSINESS_LICENSE', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type KYCDocumentType = typeof KYCDocumentType[keyof typeof KYCDocumentType]; @@ -29,6 +30,11 @@ export function KYCDocumentTypeFromJSON(json: any): KYCDocumentType { } export function KYCDocumentTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): KYCDocumentType { + if (json !== "" || json !== null) { + const key = Object.keys(KYCDocumentType)[Object.values(KYCDocumentType).indexOf(json)] + return KYCDocumentType[key] === undefined ? + KYCDocumentType['XenditEnumDefaultFallback'] : KYCDocumentType[key] + } return json as KYCDocumentType; } diff --git a/docs/Balance.md b/docs/Balance.md index 21d5ffa..cf45f94 100644 --- a/docs/Balance.md +++ b/docs/Balance.md @@ -31,7 +31,6 @@ const xenditBalanceClient = new BalanceClient({secretKey: YOUR_SECRET_KEY}) | accountType| | 'CASH' | 'HOLDING' | 'TAX' | | currency| | string | | forUserId| | string | -| idempotencyKey| | string | ### Usage Examples #### Minimum API Usage diff --git a/docs/Customer.md b/docs/Customer.md index 768b0e8..44191af 100644 --- a/docs/Customer.md +++ b/docs/Customer.md @@ -28,9 +28,8 @@ const xenditCustomerClient = new CustomerClient({secretKey: YOUR_SECRET_KEY}) ### Request Parameters — `CreateCustomerRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| -| iDEMPOTENCYKEY| | string | -| forUserId| | string | | idempotencyKey| | string | +| forUserId| | string | | data| | [CustomerRequest](customer/models/CustomerRequest.md) | ### Usage Examples @@ -55,7 +54,6 @@ const response: Customer = await xenditCustomerClient.createCustomer({ }) |-----------|:----------:|:----------:| | id| ✅ | string | | forUserId| | string | -| idempotencyKey| | string | ### Usage Examples #### Minimum API Usage @@ -81,7 +79,6 @@ const response: Customer = await xenditCustomerClient.getCustomer({ |-----------|:----------:|:----------:| | referenceId| ✅ | string | | forUserId| | string | -| idempotencyKey| | string | ### Usage Examples #### Minimum API Usage @@ -107,7 +104,6 @@ const response: GetCustomerByReferenceID200Response = await xenditCustomerClient |-----------|:----------:|:----------:| | id| ✅ | string | | forUserId| | string | -| idempotencyKey| | string | | data| | [PatchCustomer](customer/models/PatchCustomer.md) | ### Usage Examples diff --git a/docs/Invoice.md b/docs/Invoice.md index 5b44a27..a95c5fa 100644 --- a/docs/Invoice.md +++ b/docs/Invoice.md @@ -29,6 +29,7 @@ const xenditInvoiceClient = new InvoiceClient({secretKey: YOUR_SECRET_KEY}) | Field Name | Required | Type | |-----------|:----------:|:----------:| | data| ✅ | [CreateInvoiceRequest](invoice/models/CreateInvoiceRequest.md) | +| forUserId| | string | ### Usage Examples #### Create Invoice Request @@ -49,31 +50,6 @@ const response: Invoice = await xenditInvoiceClient.createInvoice({ data }) ``` -## Manually expire an invoice - - -### Function Signature -| Name | Value | -|--------------------|:-------------:| -| Function Name | `expireInvoice` | -| Request Parameters | [ExpireInvoiceRequest](#request-parameters--ExpireInvoiceRequest) | -| Return Type | [Invoice](invoice/models/Invoice.md) | - -### Request Parameters — `ExpireInvoiceRequest` -| Field Name | Required | Type | -|-----------|:----------:|:----------:| -| invoiceId| ✅ | string | -| idempotencyKey| | string | - -### Usage Examples -#### Minimum API Usage -```typescript -import { Invoice } from 'xendit-node/invoice/models' - -const response: Invoice = await xenditInvoiceClient.expireInvoice({ - invoiceId: "5f4708b7bd394b0400b96276", -}) -``` ## Get invoice by invoice id @@ -88,7 +64,7 @@ const response: Invoice = await xenditInvoiceClient.expireInvoice({ | Field Name | Required | Type | |-----------|:----------:|:----------:| | invoiceId| ✅ | string | -| idempotencyKey| | string | +| forUserId| | string | ### Usage Examples #### Minimum API Usage @@ -112,6 +88,7 @@ const response: Invoice = await xenditInvoiceClient.getInvoiceById({ ### Request Parameters — `GetInvoicesRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| +| forUserId| | string | | externalId| | string | | statuses| | [[]InvoiceStatus](invoice/models/InvoiceStatus.md) | | limit| | number | @@ -126,7 +103,6 @@ const response: Invoice = await xenditInvoiceClient.getInvoiceById({ | paymentChannels| | []string | | onDemandLink| | string | | recurringPaymentId| | string | -| idempotencyKey| | string | ### Usage Examples #### Minimum API Usage @@ -135,3 +111,28 @@ import { Invoice } from 'xendit-node/invoice/models' const response: Invoice[] = await xenditInvoiceClient.getInvoices({ }) ``` +## Manually expire an invoice + + +### Function Signature +| Name | Value | +|--------------------|:-------------:| +| Function Name | `expireInvoice` | +| Request Parameters | [ExpireInvoiceRequest](#request-parameters--ExpireInvoiceRequest) | +| Return Type | [Invoice](invoice/models/Invoice.md) | + +### Request Parameters — `ExpireInvoiceRequest` +| Field Name | Required | Type | +|-----------|:----------:|:----------:| +| invoiceId| ✅ | string | +| forUserId| | string | + +### Usage Examples +#### Minimum API Usage +```typescript +import { Invoice } from 'xendit-node/invoice/models' + +const response: Invoice = await xenditInvoiceClient.expireInvoice({ + invoiceId: "5f4708b7bd394b0400b96276", +}) +``` diff --git a/docs/PaymentMethod.md b/docs/PaymentMethod.md index 18ca016..b7271c5 100644 --- a/docs/PaymentMethod.md +++ b/docs/PaymentMethod.md @@ -15,32 +15,6 @@ const xenditPaymentMethodClient = new PaymentMethodClient({secretKey: YOUR_SECRE // or // xenditPaymentMethodClient. ``` -## Validate a payment method\'s linking OTP - - -### Function Signature -| Name | Value | -|--------------------|:-------------:| -| Function Name | `authPaymentMethod` | -| Request Parameters | [AuthPaymentMethodRequest](#request-parameters--AuthPaymentMethodRequest) | -| Return Type | [PaymentMethod](payment_method/models/PaymentMethod.md) | - -### Request Parameters — `AuthPaymentMethodRequest` -| Field Name | Required | Type | -|-----------|:----------:|:----------:| -| paymentMethodId| ✅ | string | -| idempotencyKey| | string | -| data| | [PaymentMethodAuthParameters](payment_method/models/PaymentMethodAuthParameters.md) | - -### Usage Examples -#### Minimum API Usage -```typescript -import { PaymentMethod } from 'xendit-node/payment_method/models' - -const response: PaymentMethod = await xenditPaymentMethodClient.authPaymentMethod({ - paymentMethodId: "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822", -}) -``` ## Creates payment method @@ -54,6 +28,7 @@ const response: PaymentMethod = await xenditPaymentMethodClient.authPaymentMetho ### Request Parameters — `CreatePaymentMethodRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| +| forUserId| | string | | data| | [PaymentMethodParameters](payment_method/models/PaymentMethodParameters.md) | ### Usage Examples @@ -121,148 +96,174 @@ const response: PaymentMethod = await xenditPaymentMethodClient.createPaymentMet data }) ``` -## Expires a payment method +## Get payment method by ID ### Function Signature | Name | Value | |--------------------|:-------------:| -| Function Name | `expirePaymentMethod` | -| Request Parameters | [ExpirePaymentMethodRequest](#request-parameters--ExpirePaymentMethodRequest) | +| Function Name | `getPaymentMethodByID` | +| Request Parameters | [GetPaymentMethodByIDRequest](#request-parameters--GetPaymentMethodByIDRequest) | | Return Type | [PaymentMethod](payment_method/models/PaymentMethod.md) | -### Request Parameters — `ExpirePaymentMethodRequest` +### Request Parameters — `GetPaymentMethodByIDRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| | paymentMethodId| ✅ | string | -| idempotencyKey| | string | -| data| | [PaymentMethodExpireParameters](payment_method/models/PaymentMethodExpireParameters.md) | +| forUserId| | string | ### Usage Examples #### Minimum API Usage ```typescript import { PaymentMethod } from 'xendit-node/payment_method/models' -const response: PaymentMethod = await xenditPaymentMethodClient.expirePaymentMethod({ +const response: PaymentMethod = await xenditPaymentMethodClient.getPaymentMethodByID({ paymentMethodId: "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822", }) ``` -## Get all payment methods by filters +## Returns payments with matching PaymentMethodID. ### Function Signature | Name | Value | |--------------------|:-------------:| -| Function Name | `getAllPaymentMethods` | -| Request Parameters | [GetAllPaymentMethodsRequest](#request-parameters--GetAllPaymentMethodsRequest) | -| Return Type | [PaymentMethodList](payment_method/models/PaymentMethodList.md) | +| Function Name | `getPaymentsByPaymentMethodId` | +| Request Parameters | [GetPaymentsByPaymentMethodIdRequest](#request-parameters--GetPaymentsByPaymentMethodIdRequest) | +| Return Type | object | -### Request Parameters — `GetAllPaymentMethodsRequest` +### Request Parameters — `GetPaymentsByPaymentMethodIdRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| -| id| | []string | -| type| | []string | -| status| | [[]PaymentMethodStatus](payment_method/models/PaymentMethodStatus.md) | -| reusability| | [PaymentMethodReusability](payment_method/models/PaymentMethodReusability.md) | -| customerId| | string | -| referenceId| | string | -| afterId| | string | -| beforeId| | string | +| paymentMethodId| ✅ | string | +| forUserId| | string | +| paymentRequestId| | []string | +| paymentMethodId2| | []string | +| referenceId| | []string | +| paymentMethodType| | [[]PaymentMethodType](payment_method/models/PaymentMethodType.md) | +| channelCode| | []string | +| status| | []string | +| currency| | []string | +| createdGte| | Date | +| createdLte| | Date | +| updatedGte| | Date | +| updatedLte| | Date | | limit| | number | -| idempotencyKey| | string | ### Usage Examples #### Minimum API Usage ```typescript -import { PaymentMethodList } from 'xendit-node/payment_method/models' +import { } from 'xendit-node/payment_method/models' -const response: PaymentMethodList = await xenditPaymentMethodClient.getAllPaymentMethods({ }) +const response: object = await xenditPaymentMethodClient.getPaymentsByPaymentMethodId({ + paymentMethodId: "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822", +}) ``` -## Get payment method by ID +## Patch payment methods ### Function Signature | Name | Value | |--------------------|:-------------:| -| Function Name | `getPaymentMethodByID` | -| Request Parameters | [GetPaymentMethodByIDRequest](#request-parameters--GetPaymentMethodByIDRequest) | +| Function Name | `patchPaymentMethod` | +| Request Parameters | [PatchPaymentMethodRequest](#request-parameters--PatchPaymentMethodRequest) | | Return Type | [PaymentMethod](payment_method/models/PaymentMethod.md) | -### Request Parameters — `GetPaymentMethodByIDRequest` +### Request Parameters — `PatchPaymentMethodRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| | paymentMethodId| ✅ | string | -| idempotencyKey| | string | +| forUserId| | string | +| data| | [PaymentMethodUpdateParameters](payment_method/models/PaymentMethodUpdateParameters.md) | ### Usage Examples #### Minimum API Usage ```typescript import { PaymentMethod } from 'xendit-node/payment_method/models' -const response: PaymentMethod = await xenditPaymentMethodClient.getPaymentMethodByID({ +const response: PaymentMethod = await xenditPaymentMethodClient.patchPaymentMethod({ paymentMethodId: "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822", }) ``` -## Returns payments with matching PaymentMethodID. +## Get all payment methods by filters ### Function Signature | Name | Value | |--------------------|:-------------:| -| Function Name | `getPaymentsByPaymentMethodId` | -| Request Parameters | [GetPaymentsByPaymentMethodIdRequest](#request-parameters--GetPaymentsByPaymentMethodIdRequest) | -| Return Type | object | +| Function Name | `getAllPaymentMethods` | +| Request Parameters | [GetAllPaymentMethodsRequest](#request-parameters--GetAllPaymentMethodsRequest) | +| Return Type | [PaymentMethodList](payment_method/models/PaymentMethodList.md) | -### Request Parameters — `GetPaymentsByPaymentMethodIdRequest` +### Request Parameters — `GetAllPaymentMethodsRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| -| paymentMethodId| ✅ | string | -| paymentRequestId| | []string | -| paymentMethodId2| | []string | -| referenceId| | []string | -| paymentMethodType| | [[]PaymentMethodType](payment_method/models/PaymentMethodType.md) | -| channelCode| | []string | -| status| | []string | -| currency| | []string | -| createdGte| | Date | -| createdLte| | Date | -| updatedGte| | Date | -| updatedLte| | Date | +| forUserId| | string | +| id| | []string | +| type| | []string | +| status| | [[]PaymentMethodStatus](payment_method/models/PaymentMethodStatus.md) | +| reusability| | [PaymentMethodReusability](payment_method/models/PaymentMethodReusability.md) | +| customerId| | string | +| referenceId| | string | +| afterId| | string | +| beforeId| | string | | limit| | number | -| idempotencyKey| | string | ### Usage Examples #### Minimum API Usage ```typescript -import { } from 'xendit-node/payment_method/models' +import { PaymentMethodList } from 'xendit-node/payment_method/models' -const response: object = await xenditPaymentMethodClient.getPaymentsByPaymentMethodId({ +const response: PaymentMethodList = await xenditPaymentMethodClient.getAllPaymentMethods({ }) +``` +## Expires a payment method + + +### Function Signature +| Name | Value | +|--------------------|:-------------:| +| Function Name | `expirePaymentMethod` | +| Request Parameters | [ExpirePaymentMethodRequest](#request-parameters--ExpirePaymentMethodRequest) | +| Return Type | [PaymentMethod](payment_method/models/PaymentMethod.md) | + +### Request Parameters — `ExpirePaymentMethodRequest` +| Field Name | Required | Type | +|-----------|:----------:|:----------:| +| paymentMethodId| ✅ | string | +| forUserId| | string | +| data| | [PaymentMethodExpireParameters](payment_method/models/PaymentMethodExpireParameters.md) | + +### Usage Examples +#### Minimum API Usage +```typescript +import { PaymentMethod } from 'xendit-node/payment_method/models' + +const response: PaymentMethod = await xenditPaymentMethodClient.expirePaymentMethod({ paymentMethodId: "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822", }) ``` -## Patch payment methods +## Validate a payment method\'s linking OTP ### Function Signature | Name | Value | |--------------------|:-------------:| -| Function Name | `patchPaymentMethod` | -| Request Parameters | [PatchPaymentMethodRequest](#request-parameters--PatchPaymentMethodRequest) | +| Function Name | `authPaymentMethod` | +| Request Parameters | [AuthPaymentMethodRequest](#request-parameters--AuthPaymentMethodRequest) | | Return Type | [PaymentMethod](payment_method/models/PaymentMethod.md) | -### Request Parameters — `PatchPaymentMethodRequest` +### Request Parameters — `AuthPaymentMethodRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| | paymentMethodId| ✅ | string | -| idempotencyKey| | string | -| data| | [PaymentMethodUpdateParameters](payment_method/models/PaymentMethodUpdateParameters.md) | +| forUserId| | string | +| data| | [PaymentMethodAuthParameters](payment_method/models/PaymentMethodAuthParameters.md) | ### Usage Examples #### Minimum API Usage ```typescript import { PaymentMethod } from 'xendit-node/payment_method/models' -const response: PaymentMethod = await xenditPaymentMethodClient.patchPaymentMethod({ +const response: PaymentMethod = await xenditPaymentMethodClient.authPaymentMethod({ paymentMethodId: "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822", }) ``` @@ -280,7 +281,6 @@ const response: PaymentMethod = await xenditPaymentMethodClient.patchPaymentMeth | Field Name | Required | Type | |-----------|:----------:|:----------:| | paymentMethodId| ✅ | string | -| idempotencyKey| | string | | data| | [SimulatePaymentRequest](payment_method/models/SimulatePaymentRequest.md) | ### Usage Examples diff --git a/docs/PaymentRequest.md b/docs/PaymentRequest.md index 38f8f52..ff3091b 100644 --- a/docs/PaymentRequest.md +++ b/docs/PaymentRequest.md @@ -15,58 +15,6 @@ const xenditPaymentRequestClient = new PaymentRequestClient({secretKey: YOUR_SEC // or // xenditPaymentRequestClient. ``` -## Payment Request Authorize - - -### Function Signature -| Name | Value | -|--------------------|:-------------:| -| Function Name | `authorizePaymentRequest` | -| Request Parameters | [AuthorizePaymentRequestRequest](#request-parameters--AuthorizePaymentRequestRequest) | -| Return Type | [PaymentRequest](payment_request/models/PaymentRequest.md) | - -### Request Parameters — `AuthorizePaymentRequestRequest` -| Field Name | Required | Type | -|-----------|:----------:|:----------:| -| paymentRequestId| ✅ | string | -| idempotencyKey| | string | -| data| | [PaymentRequestAuthParameters](payment_request/models/PaymentRequestAuthParameters.md) | - -### Usage Examples -#### Minimum API Usage -```typescript -import { PaymentRequest } from 'xendit-node/payment_request/models' - -const response: PaymentRequest = await xenditPaymentRequestClient.authorizePaymentRequest({ - paymentRequestId: "pr-1fdaf346-dd2e-4b6c-b938-124c7167a822", -}) -``` -## Payment Request Capture - - -### Function Signature -| Name | Value | -|--------------------|:-------------:| -| Function Name | `capturePaymentRequest` | -| Request Parameters | [CapturePaymentRequestRequest](#request-parameters--CapturePaymentRequestRequest) | -| Return Type | [Capture](payment_request/models/Capture.md) | - -### Request Parameters — `CapturePaymentRequestRequest` -| Field Name | Required | Type | -|-----------|:----------:|:----------:| -| paymentRequestId| ✅ | string | -| idempotencyKey| | string | -| data| | [CaptureParameters](payment_request/models/CaptureParameters.md) | - -### Usage Examples -#### Minimum API Usage -```typescript -import { Capture } from 'xendit-node/payment_request/models' - -const response: Capture = await xenditPaymentRequestClient.capturePaymentRequest({ - paymentRequestId: "pr-1fdaf346-dd2e-4b6c-b938-124c7167a822", -}) -``` ## Create Payment Request @@ -81,6 +29,7 @@ const response: Capture = await xenditPaymentRequestClient.capturePaymentRequest | Field Name | Required | Type | |-----------|:----------:|:----------:| | idempotencyKey| | string | +| forUserId| | string | | data| | [PaymentRequestParameters](payment_request/models/PaymentRequestParameters.md) | ### Usage Examples @@ -204,6 +153,57 @@ const response: PaymentRequest = await xenditPaymentRequestClient.createPaymentR data }) ``` +## Get payment request by ID + + +### Function Signature +| Name | Value | +|--------------------|:-------------:| +| Function Name | `getPaymentRequestByID` | +| Request Parameters | [GetPaymentRequestByIDRequest](#request-parameters--GetPaymentRequestByIDRequest) | +| Return Type | [PaymentRequest](payment_request/models/PaymentRequest.md) | + +### Request Parameters — `GetPaymentRequestByIDRequest` +| Field Name | Required | Type | +|-----------|:----------:|:----------:| +| paymentRequestId| ✅ | string | +| forUserId| | string | + +### Usage Examples +#### Minimum API Usage +```typescript +import { PaymentRequest } from 'xendit-node/payment_request/models' + +const response: PaymentRequest = await xenditPaymentRequestClient.getPaymentRequestByID({ + paymentRequestId: "pr-1fdaf346-dd2e-4b6c-b938-124c7167a822", +}) +``` +## Get Payment Request Capture + + +### Function Signature +| Name | Value | +|--------------------|:-------------:| +| Function Name | `getPaymentRequestCaptures` | +| Request Parameters | [GetPaymentRequestCapturesRequest](#request-parameters--GetPaymentRequestCapturesRequest) | +| Return Type | [CaptureListResponse](payment_request/models/CaptureListResponse.md) | + +### Request Parameters — `GetPaymentRequestCapturesRequest` +| Field Name | Required | Type | +|-----------|:----------:|:----------:| +| paymentRequestId| ✅ | string | +| forUserId| | string | +| limit| | number | + +### Usage Examples +#### Minimum API Usage +```typescript +import { CaptureListResponse } from 'xendit-node/payment_request/models' + +const response: CaptureListResponse = await xenditPaymentRequestClient.getPaymentRequestCaptures({ + paymentRequestId: "pr-1fdaf346-dd2e-4b6c-b938-124c7167a822", +}) +``` ## Get all payment requests by filter @@ -217,13 +217,13 @@ const response: PaymentRequest = await xenditPaymentRequestClient.createPaymentR ### Request Parameters — `GetAllPaymentRequestsRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| +| forUserId| | string | | referenceId| | []string | | id| | []string | | customerId| | []string | | limit| | number | | beforeId| | string | | afterId| | string | -| idempotencyKey| | string | ### Usage Examples #### Minimum API Usage @@ -232,54 +232,55 @@ import { PaymentRequestListResponse } from 'xendit-node/payment_request/models' const response: PaymentRequestListResponse = await xenditPaymentRequestClient.getAllPaymentRequests({ }) ``` -## Get payment request by ID +## Payment Request Capture ### Function Signature | Name | Value | |--------------------|:-------------:| -| Function Name | `getPaymentRequestByID` | -| Request Parameters | [GetPaymentRequestByIDRequest](#request-parameters--GetPaymentRequestByIDRequest) | -| Return Type | [PaymentRequest](payment_request/models/PaymentRequest.md) | +| Function Name | `capturePaymentRequest` | +| Request Parameters | [CapturePaymentRequestRequest](#request-parameters--CapturePaymentRequestRequest) | +| Return Type | [Capture](payment_request/models/Capture.md) | -### Request Parameters — `GetPaymentRequestByIDRequest` +### Request Parameters — `CapturePaymentRequestRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| | paymentRequestId| ✅ | string | -| idempotencyKey| | string | +| forUserId| | string | +| data| | [CaptureParameters](payment_request/models/CaptureParameters.md) | ### Usage Examples #### Minimum API Usage ```typescript -import { PaymentRequest } from 'xendit-node/payment_request/models' +import { Capture } from 'xendit-node/payment_request/models' -const response: PaymentRequest = await xenditPaymentRequestClient.getPaymentRequestByID({ +const response: Capture = await xenditPaymentRequestClient.capturePaymentRequest({ paymentRequestId: "pr-1fdaf346-dd2e-4b6c-b938-124c7167a822", }) ``` -## Get Payment Request Capture +## Payment Request Authorize ### Function Signature | Name | Value | |--------------------|:-------------:| -| Function Name | `getPaymentRequestCaptures` | -| Request Parameters | [GetPaymentRequestCapturesRequest](#request-parameters--GetPaymentRequestCapturesRequest) | -| Return Type | [CaptureListResponse](payment_request/models/CaptureListResponse.md) | +| Function Name | `authorizePaymentRequest` | +| Request Parameters | [AuthorizePaymentRequestRequest](#request-parameters--AuthorizePaymentRequestRequest) | +| Return Type | [PaymentRequest](payment_request/models/PaymentRequest.md) | -### Request Parameters — `GetPaymentRequestCapturesRequest` +### Request Parameters — `AuthorizePaymentRequestRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| | paymentRequestId| ✅ | string | -| limit| | number | -| idempotencyKey| | string | +| forUserId| | string | +| data| | [PaymentRequestAuthParameters](payment_request/models/PaymentRequestAuthParameters.md) | ### Usage Examples #### Minimum API Usage ```typescript -import { CaptureListResponse } from 'xendit-node/payment_request/models' +import { PaymentRequest } from 'xendit-node/payment_request/models' -const response: CaptureListResponse = await xenditPaymentRequestClient.getPaymentRequestCaptures({ +const response: PaymentRequest = await xenditPaymentRequestClient.authorizePaymentRequest({ paymentRequestId: "pr-1fdaf346-dd2e-4b6c-b938-124c7167a822", }) ``` @@ -297,7 +298,7 @@ const response: CaptureListResponse = await xenditPaymentRequestClient.getPaymen | Field Name | Required | Type | |-----------|:----------:|:----------:| | paymentRequestId| ✅ | string | -| idempotencyKey| | string | +| forUserId| | string | ### Usage Examples #### Minimum API Usage diff --git a/docs/Payout.md b/docs/Payout.md index 6f8ff37..79d84f4 100644 --- a/docs/Payout.md +++ b/docs/Payout.md @@ -15,31 +15,6 @@ const xenditPayoutClient = new PayoutClient({secretKey: YOUR_SECRET_KEY}) // or // xenditPayoutClient. ``` -## API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. - - -### Function Signature -| Name | Value | -|--------------------|:-------------:| -| Function Name | `cancelPayout` | -| Request Parameters | [CancelPayoutRequest](#request-parameters--CancelPayoutRequest) | -| Return Type | [GetPayouts200ResponseDataInner](payout/models/GetPayouts200ResponseDataInner.md) | - -### Request Parameters — `CancelPayoutRequest` -| Field Name | Required | Type | -|-----------|:----------:|:----------:| -| id| ✅ | string | -| idempotencyKey| | string | - -### Usage Examples -#### Minimum API Usage -```typescript -import { GetPayouts200ResponseDataInner } from 'xendit-node/payout/models' - -const response: GetPayouts200ResponseDataInner = await xenditPayoutClient.cancelPayout({ - id: "disb-7baa7335-a0b2-4678-bb8c-318c0167f332", -}) -``` ## API to send money at scale to bank accounts & eWallets @@ -95,7 +70,7 @@ const response: GetPayouts200ResponseDataInner = await xenditPayoutClient.create | Field Name | Required | Type | |-----------|:----------:|:----------:| | id| ✅ | string | -| idempotencyKey| | string | +| forUserId| | string | ### Usage Examples #### Minimum API Usage @@ -122,7 +97,7 @@ const response: GetPayouts200ResponseDataInner = await xenditPayoutClient.getPay | currency| | string | | channelCategory| | [[]ChannelCategory](payout/models/ChannelCategory.md) | | channelCode| | string | -| idempotencyKey| | string | +| forUserId| | string | ### Usage Examples #### Minimum API Usage @@ -148,7 +123,7 @@ const response: Channel[] = await xenditPayoutClient.getPayoutChannels({ }) | limit| | number | | afterId| | string | | beforeId| | string | -| idempotencyKey| | string | +| forUserId| | string | ### Usage Examples #### Minimum API Usage @@ -159,3 +134,28 @@ const response: GetPayouts200Response = await xenditPayoutClient.getPayouts({ referenceId: "DISB-123", }) ``` +## API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. + + +### Function Signature +| Name | Value | +|--------------------|:-------------:| +| Function Name | `cancelPayout` | +| Request Parameters | [CancelPayoutRequest](#request-parameters--CancelPayoutRequest) | +| Return Type | [GetPayouts200ResponseDataInner](payout/models/GetPayouts200ResponseDataInner.md) | + +### Request Parameters — `CancelPayoutRequest` +| Field Name | Required | Type | +|-----------|:----------:|:----------:| +| id| ✅ | string | +| forUserId| | string | + +### Usage Examples +#### Minimum API Usage +```typescript +import { GetPayouts200ResponseDataInner } from 'xendit-node/payout/models' + +const response: GetPayouts200ResponseDataInner = await xenditPayoutClient.cancelPayout({ + id: "disb-7baa7335-a0b2-4678-bb8c-318c0167f332", +}) +``` diff --git a/docs/Refund.md b/docs/Refund.md index 9cde870..222a987 100644 --- a/docs/Refund.md +++ b/docs/Refund.md @@ -21,24 +21,23 @@ const xenditRefundClient = new RefundClient({secretKey: YOUR_SECRET_KEY}) ### Function Signature | Name | Value | |--------------------|:-------------:| -| Function Name | `cancelRefund` | -| Request Parameters | [CancelRefundRequest](#request-parameters--CancelRefundRequest) | +| Function Name | `createRefund` | +| Request Parameters | [CreateRefundRequest](#request-parameters--CreateRefundRequest) | | Return Type | [Refund](refund/models/Refund.md) | -### Request Parameters — `CancelRefundRequest` +### Request Parameters — `CreateRefundRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| -| refundID| ✅ | string | | idempotencyKey| | string | +| forUserId| | string | +| data| | [CreateRefund](refund/models/CreateRefund.md) | ### Usage Examples #### Minimum API Usage ```typescript import { Refund } from 'xendit-node/refund/models' -const response: Refund = await xenditRefundClient.cancelRefund({ - refundID: "rfd-1fdaf346-dd2e-4b6c-b938-124c7167a822", -}) +const response: Refund = await xenditRefundClient.createRefund({ }) ``` ## @@ -46,22 +45,25 @@ const response: Refund = await xenditRefundClient.cancelRefund({ ### Function Signature | Name | Value | |--------------------|:-------------:| -| Function Name | `createRefund` | -| Request Parameters | [CreateRefundRequest](#request-parameters--CreateRefundRequest) | +| Function Name | `getRefund` | +| Request Parameters | [GetRefundRequest](#request-parameters--GetRefundRequest) | | Return Type | [Refund](refund/models/Refund.md) | -### Request Parameters — `CreateRefundRequest` +### Request Parameters — `GetRefundRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| +| refundID| ✅ | string | | idempotencyKey| | string | -| data| | [CreateRefund](refund/models/CreateRefund.md) | +| forUserId| | string | ### Usage Examples #### Minimum API Usage ```typescript import { Refund } from 'xendit-node/refund/models' -const response: Refund = await xenditRefundClient.createRefund({ }) +const response: Refund = await xenditRefundClient.getRefund({ + refundID: "rfd-1fdaf346-dd2e-4b6c-b938-124c7167a822", +}) ``` ## @@ -76,6 +78,14 @@ const response: Refund = await xenditRefundClient.createRefund({ }) ### Request Parameters — `GetAllRefundsRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| +| forUserId| | string | +| paymentRequestId| | string | +| invoiceId| | string | +| paymentMethodType| | string | +| channelCode| | string | +| limit| | number | +| afterId| | string | +| beforeId| | string | ### Usage Examples #### Minimum API Usage @@ -90,22 +100,23 @@ const response: RefundList = await xenditRefundClient.getAllRefunds({ }) ### Function Signature | Name | Value | |--------------------|:-------------:| -| Function Name | `getRefund` | -| Request Parameters | [GetRefundRequest](#request-parameters--GetRefundRequest) | +| Function Name | `cancelRefund` | +| Request Parameters | [CancelRefundRequest](#request-parameters--CancelRefundRequest) | | Return Type | [Refund](refund/models/Refund.md) | -### Request Parameters — `GetRefundRequest` +### Request Parameters — `CancelRefundRequest` | Field Name | Required | Type | |-----------|:----------:|:----------:| | refundID| ✅ | string | | idempotencyKey| | string | +| forUserId| | string | ### Usage Examples #### Minimum API Usage ```typescript import { Refund } from 'xendit-node/refund/models' -const response: Refund = await xenditRefundClient.getRefund({ +const response: Refund = await xenditRefundClient.cancelRefund({ refundID: "rfd-1fdaf346-dd2e-4b6c-b938-124c7167a822", }) ``` diff --git a/docs/Transaction.md b/docs/Transaction.md index 5d7528b..dea227a 100644 --- a/docs/Transaction.md +++ b/docs/Transaction.md @@ -15,6 +15,31 @@ const xenditTransactionClient = new TransactionClient({secretKey: YOUR_SECRET_KE // or // xenditTransactionClient. ``` +## Get a transaction based on its id + + +### Function Signature +| Name | Value | +|--------------------|:-------------:| +| Function Name | `getTransactionByID` | +| Request Parameters | [GetTransactionByIDRequest](#request-parameters--GetTransactionByIDRequest) | +| Return Type | [TransactionResponse](balance_and_transaction/models/TransactionResponse.md) | + +### Request Parameters — `GetTransactionByIDRequest` +| Field Name | Required | Type | +|-----------|:----------:|:----------:| +| id| ✅ | string | +| forUserId| | string | + +### Usage Examples +#### Minimum API Usage +```typescript +import { TransactionResponse } from 'xendit-node/balance_and_transaction/models' + +const response: TransactionResponse = await xenditTransactionClient.getTransactionByID({ + id: "id_example", +}) +``` ## Get a list of transactions @@ -42,7 +67,6 @@ const xenditTransactionClient = new TransactionClient({secretKey: YOUR_SECRET_KE | limit| | number | | afterId| | string | | beforeId| | string | -| idempotencyKey| | string | ### Usage Examples #### Minimum API Usage @@ -51,29 +75,3 @@ import { TransactionsResponse } from 'xendit-node/balance_and_transaction/models const response: TransactionsResponse = await xenditTransactionClient.getAllTransactions({ }) ``` -## Get a transaction based on its id - - -### Function Signature -| Name | Value | -|--------------------|:-------------:| -| Function Name | `getTransactionByID` | -| Request Parameters | [GetTransactionByIDRequest](#request-parameters--GetTransactionByIDRequest) | -| Return Type | [TransactionResponse](balance_and_transaction/models/TransactionResponse.md) | - -### Request Parameters — `GetTransactionByIDRequest` -| Field Name | Required | Type | -|-----------|:----------:|:----------:| -| id| ✅ | string | -| forUserId| | string | -| idempotencyKey| | string | - -### Usage Examples -#### Minimum API Usage -```typescript -import { TransactionResponse } from 'xendit-node/balance_and_transaction/models' - -const response: TransactionResponse = await xenditTransactionClient.getTransactionByID({ - id: "id_example", -}) -``` diff --git a/docs/balance_and_transaction/models/ChannelsCategories.md b/docs/balance_and_transaction/models/ChannelsCategories.md index 9e5982c..dad326d 100644 --- a/docs/balance_and_transaction/models/ChannelsCategories.md +++ b/docs/balance_and_transaction/models/ChannelsCategories.md @@ -34,4 +34,7 @@ * `Other` (value: `'OTHER'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/balance_and_transaction/models/Currency.md b/docs/balance_and_transaction/models/Currency.md index 47343a2..25bf093 100644 --- a/docs/balance_and_transaction/models/Currency.md +++ b/docs/balance_and_transaction/models/Currency.md @@ -330,4 +330,7 @@ * `Zwd` (value: `'ZWD'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/balance_and_transaction/models/TransactionStatuses.md b/docs/balance_and_transaction/models/TransactionStatuses.md index 9833a71..ef24108 100644 --- a/docs/balance_and_transaction/models/TransactionStatuses.md +++ b/docs/balance_and_transaction/models/TransactionStatuses.md @@ -16,4 +16,7 @@ * `Voided` (value: `'VOIDED'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/balance_and_transaction/models/TransactionTypes.md b/docs/balance_and_transaction/models/TransactionTypes.md index 65697b8..c7fb5b2 100644 --- a/docs/balance_and_transaction/models/TransactionTypes.md +++ b/docs/balance_and_transaction/models/TransactionTypes.md @@ -32,4 +32,7 @@ * `Other` (value: `'OTHER'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/customer/models/AddressStatus.md b/docs/customer/models/AddressStatus.md index 2c455e6..b6cb7c1 100644 --- a/docs/customer/models/AddressStatus.md +++ b/docs/customer/models/AddressStatus.md @@ -10,4 +10,7 @@ * `Deleted` (value: `'DELETED'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/customer/models/EndCustomerStatus.md b/docs/customer/models/EndCustomerStatus.md index cc7c0ca..2731ddd 100644 --- a/docs/customer/models/EndCustomerStatus.md +++ b/docs/customer/models/EndCustomerStatus.md @@ -16,4 +16,7 @@ * `Deleted` (value: `'DELETED'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/customer/models/IdentityAccountType.md b/docs/customer/models/IdentityAccountType.md index 6a24388..5d5eba0 100644 --- a/docs/customer/models/IdentityAccountType.md +++ b/docs/customer/models/IdentityAccountType.md @@ -18,4 +18,7 @@ * `QrCode` (value: `'QR_CODE'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/customer/models/KycDocumentSubType.md b/docs/customer/models/KycDocumentSubType.md index 604b5fd..dc0ad92 100644 --- a/docs/customer/models/KycDocumentSubType.md +++ b/docs/customer/models/KycDocumentSubType.md @@ -26,4 +26,7 @@ * `Others` (value: `'OTHERS'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/customer/models/KycDocumentType.md b/docs/customer/models/KycDocumentType.md index 6bc9275..6d34fa6 100644 --- a/docs/customer/models/KycDocumentType.md +++ b/docs/customer/models/KycDocumentType.md @@ -22,4 +22,7 @@ * `BusinessLicense` (value: `'BUSINESS_LICENSE'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/invoice/models/BankCode.md b/docs/invoice/models/BankCode.md index 810aed7..8d87edf 100644 --- a/docs/invoice/models/BankCode.md +++ b/docs/invoice/models/BankCode.md @@ -26,4 +26,7 @@ Representing the available bank channels used for invoice-related transactions. * `Bnc` (value: `'BNC'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/invoice/models/DirectDebitType.md b/docs/invoice/models/DirectDebitType.md index 7c8f6f1..42af4e8 100644 --- a/docs/invoice/models/DirectDebitType.md +++ b/docs/invoice/models/DirectDebitType.md @@ -44,4 +44,7 @@ Representing the available Direct Debit channels used for invoice-related transa * `DcChinabank` (value: `'DC_CHINABANK'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/invoice/models/EwalletType.md b/docs/invoice/models/EwalletType.md index 33b559e..40bca8c 100644 --- a/docs/invoice/models/EwalletType.md +++ b/docs/invoice/models/EwalletType.md @@ -26,4 +26,7 @@ Representing the available eWallet channels used for invoice-related transaction * `Jeniuspay` (value: `'JENIUSPAY'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/invoice/models/InvoiceClientType.md b/docs/invoice/models/InvoiceClientType.md index efffcf2..ec3fbc4 100644 --- a/docs/invoice/models/InvoiceClientType.md +++ b/docs/invoice/models/InvoiceClientType.md @@ -18,4 +18,7 @@ Representing the client type or source of an invoice. * `Mobile` (value: `'MOBILE'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/invoice/models/InvoiceCurrency.md b/docs/invoice/models/InvoiceCurrency.md index 49f4f1f..6a82242 100644 --- a/docs/invoice/models/InvoiceCurrency.md +++ b/docs/invoice/models/InvoiceCurrency.md @@ -16,4 +16,7 @@ Representing the currency used for an invoice. * `Php` (value: `'PHP'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/invoice/models/InvoicePaymentMethod.md b/docs/invoice/models/InvoicePaymentMethod.md index ed5a15f..30a18c0 100644 --- a/docs/invoice/models/InvoicePaymentMethod.md +++ b/docs/invoice/models/InvoicePaymentMethod.md @@ -26,4 +26,7 @@ Representing the payment method used for an invoice. * `Paylater` (value: `'PAYLATER'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/invoice/models/InvoiceStatus.md b/docs/invoice/models/InvoiceStatus.md index 79dd27b..019ebc3 100644 --- a/docs/invoice/models/InvoiceStatus.md +++ b/docs/invoice/models/InvoiceStatus.md @@ -14,4 +14,7 @@ Representing the status of an invoice. * `Expired` (value: `'EXPIRED'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/invoice/models/NotificationChannel.md b/docs/invoice/models/NotificationChannel.md index da61671..58164b2 100644 --- a/docs/invoice/models/NotificationChannel.md +++ b/docs/invoice/models/NotificationChannel.md @@ -14,4 +14,7 @@ Representing a notification channel for sending messages. * `Viber` (value: `'viber'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/invoice/models/PaylaterType.md b/docs/invoice/models/PaylaterType.md index 232b416..ffbc1c3 100644 --- a/docs/invoice/models/PaylaterType.md +++ b/docs/invoice/models/PaylaterType.md @@ -18,4 +18,7 @@ Representing the available paylater channels used for invoice-related transactio * `Atome` (value: `'ATOME'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/invoice/models/QrCodeType.md b/docs/invoice/models/QrCodeType.md index db69989..137488c 100644 --- a/docs/invoice/models/QrCodeType.md +++ b/docs/invoice/models/QrCodeType.md @@ -10,4 +10,7 @@ Representing the available QR Code channels used for invoice-related transaction * `Promptpay` (value: `'PROMPTPAY'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/invoice/models/RetailOutletName.md b/docs/invoice/models/RetailOutletName.md index 06620b3..7e6613e 100644 --- a/docs/invoice/models/RetailOutletName.md +++ b/docs/invoice/models/RetailOutletName.md @@ -24,4 +24,7 @@ Representing the available retail outlet channels used for invoice-related trans * `Lbc` (value: `'LBC'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_method/models/DirectDebitChannelCode.md b/docs/payment_method/models/DirectDebitChannelCode.md index e7a3c72..4ded045 100644 --- a/docs/payment_method/models/DirectDebitChannelCode.md +++ b/docs/payment_method/models/DirectDebitChannelCode.md @@ -132,4 +132,7 @@ Direct Debit Channel Code * `UobFpxBusiness` (value: `'UOB_FPX_BUSINESS'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_method/models/DirectDebitType.md b/docs/payment_method/models/DirectDebitType.md index 219cdf3..d5306a9 100644 --- a/docs/payment_method/models/DirectDebitType.md +++ b/docs/payment_method/models/DirectDebitType.md @@ -12,4 +12,7 @@ * `BankRedirect` (value: `'BANK_REDIRECT'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_method/models/EWalletChannelCode.md b/docs/payment_method/models/EWalletChannelCode.md index ad5a207..177c984 100644 --- a/docs/payment_method/models/EWalletChannelCode.md +++ b/docs/payment_method/models/EWalletChannelCode.md @@ -46,4 +46,7 @@ EWallet Channel Code * `Alipay` (value: `'ALIPAY'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_method/models/OverTheCounterChannelCode.md b/docs/payment_method/models/OverTheCounterChannelCode.md index 73e48f2..f72550a 100644 --- a/docs/payment_method/models/OverTheCounterChannelCode.md +++ b/docs/payment_method/models/OverTheCounterChannelCode.md @@ -38,4 +38,7 @@ Over The Counter Channel Code * `Indomaret` (value: `'INDOMARET'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_method/models/PaymentMethodCountry.md b/docs/payment_method/models/PaymentMethodCountry.md index 3a1eca0..e75a836 100644 --- a/docs/payment_method/models/PaymentMethodCountry.md +++ b/docs/payment_method/models/PaymentMethodCountry.md @@ -16,4 +16,7 @@ * `My` (value: `'MY'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_method/models/PaymentMethodReusability.md b/docs/payment_method/models/PaymentMethodReusability.md index 86fa5b1..35f188a 100644 --- a/docs/payment_method/models/PaymentMethodReusability.md +++ b/docs/payment_method/models/PaymentMethodReusability.md @@ -10,4 +10,7 @@ * `OneTimeUse` (value: `'ONE_TIME_USE'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_method/models/PaymentMethodStatus.md b/docs/payment_method/models/PaymentMethodStatus.md index 639dca7..6356714 100644 --- a/docs/payment_method/models/PaymentMethodStatus.md +++ b/docs/payment_method/models/PaymentMethodStatus.md @@ -18,4 +18,7 @@ * `Failed` (value: `'FAILED'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_method/models/PaymentMethodType.md b/docs/payment_method/models/PaymentMethodType.md index 6f7ab3b..f7c7267 100644 --- a/docs/payment_method/models/PaymentMethodType.md +++ b/docs/payment_method/models/PaymentMethodType.md @@ -22,4 +22,7 @@ * `VirtualAccount` (value: `'VIRTUAL_ACCOUNT'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_method/models/QrCodeChannelCode.md b/docs/payment_method/models/QrCodeChannelCode.md index 6ce748c..bc9dc45 100644 --- a/docs/payment_method/models/QrCodeChannelCode.md +++ b/docs/payment_method/models/QrCodeChannelCode.md @@ -16,4 +16,7 @@ QR Code Channel Code * `Linkaja` (value: `'LINKAJA'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_method/models/VirtualAccountChannelCode.md b/docs/payment_method/models/VirtualAccountChannelCode.md index 119dc20..f691f52 100644 --- a/docs/payment_method/models/VirtualAccountChannelCode.md +++ b/docs/payment_method/models/VirtualAccountChannelCode.md @@ -36,4 +36,7 @@ Virtual Account Channel Code * `StandardChartered` (value: `'STANDARD_CHARTERED'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/DirectDebitChannelCode.md b/docs/payment_request/models/DirectDebitChannelCode.md index 893eb49..f7d6ed0 100644 --- a/docs/payment_request/models/DirectDebitChannelCode.md +++ b/docs/payment_request/models/DirectDebitChannelCode.md @@ -132,4 +132,7 @@ Direct Debit Channel Code * `UobFpxBusiness` (value: `'UOB_FPX_BUSINESS'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/DirectDebitType.md b/docs/payment_request/models/DirectDebitType.md index 219cdf3..d5306a9 100644 --- a/docs/payment_request/models/DirectDebitType.md +++ b/docs/payment_request/models/DirectDebitType.md @@ -12,4 +12,7 @@ * `BankRedirect` (value: `'BANK_REDIRECT'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/EWalletChannelCode.md b/docs/payment_request/models/EWalletChannelCode.md index a8c3bad..32201e6 100644 --- a/docs/payment_request/models/EWalletChannelCode.md +++ b/docs/payment_request/models/EWalletChannelCode.md @@ -44,4 +44,7 @@ Ewallet Channel Code * `Alipay` (value: `'ALIPAY'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/OverTheCounterChannelCode.md b/docs/payment_request/models/OverTheCounterChannelCode.md index 73e48f2..f72550a 100644 --- a/docs/payment_request/models/OverTheCounterChannelCode.md +++ b/docs/payment_request/models/OverTheCounterChannelCode.md @@ -38,4 +38,7 @@ Over The Counter Channel Code * `Indomaret` (value: `'INDOMARET'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/PaymentMethodReusability.md b/docs/payment_request/models/PaymentMethodReusability.md index 86fa5b1..35f188a 100644 --- a/docs/payment_request/models/PaymentMethodReusability.md +++ b/docs/payment_request/models/PaymentMethodReusability.md @@ -10,4 +10,7 @@ * `OneTimeUse` (value: `'ONE_TIME_USE'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/PaymentMethodStatus.md b/docs/payment_request/models/PaymentMethodStatus.md index 1190e09..9b36a74 100644 --- a/docs/payment_request/models/PaymentMethodStatus.md +++ b/docs/payment_request/models/PaymentMethodStatus.md @@ -16,4 +16,7 @@ * `Failed` (value: `'FAILED'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/PaymentMethodType.md b/docs/payment_request/models/PaymentMethodType.md index 66f2382..c7b02d5 100644 --- a/docs/payment_request/models/PaymentMethodType.md +++ b/docs/payment_request/models/PaymentMethodType.md @@ -18,4 +18,7 @@ * `VirtualAccount` (value: `'VIRTUAL_ACCOUNT'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/PaymentRequestCaptureMethod.md b/docs/payment_request/models/PaymentRequestCaptureMethod.md index cfd9529..95235de 100644 --- a/docs/payment_request/models/PaymentRequestCaptureMethod.md +++ b/docs/payment_request/models/PaymentRequestCaptureMethod.md @@ -10,4 +10,7 @@ * `Manual` (value: `'MANUAL'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/PaymentRequestCountry.md b/docs/payment_request/models/PaymentRequestCountry.md index 126a8c1..9c77d6d 100644 --- a/docs/payment_request/models/PaymentRequestCountry.md +++ b/docs/payment_request/models/PaymentRequestCountry.md @@ -16,4 +16,7 @@ * `My` (value: `'MY'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/PaymentRequestCurrency.md b/docs/payment_request/models/PaymentRequestCurrency.md index 7030e93..423ddda 100644 --- a/docs/payment_request/models/PaymentRequestCurrency.md +++ b/docs/payment_request/models/PaymentRequestCurrency.md @@ -16,4 +16,7 @@ * `Myr` (value: `'MYR'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/PaymentRequestInitiator.md b/docs/payment_request/models/PaymentRequestInitiator.md index f71cfe8..d43d100 100644 --- a/docs/payment_request/models/PaymentRequestInitiator.md +++ b/docs/payment_request/models/PaymentRequestInitiator.md @@ -10,4 +10,7 @@ * `Merchant` (value: `'MERCHANT'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/PaymentRequestStatus.md b/docs/payment_request/models/PaymentRequestStatus.md index eedb88c..d8f8fd1 100644 --- a/docs/payment_request/models/PaymentRequestStatus.md +++ b/docs/payment_request/models/PaymentRequestStatus.md @@ -22,4 +22,7 @@ * `AwaitingCapture` (value: `'AWAITING_CAPTURE'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/QrCodeChannelCode.md b/docs/payment_request/models/QrCodeChannelCode.md index 6d19e30..981c53e 100644 --- a/docs/payment_request/models/QrCodeChannelCode.md +++ b/docs/payment_request/models/QrCodeChannelCode.md @@ -14,4 +14,7 @@ QR Code Channel Code * `Promptpay` (value: `'PROMPTPAY'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payment_request/models/VirtualAccountChannelCode.md b/docs/payment_request/models/VirtualAccountChannelCode.md index 119dc20..f691f52 100644 --- a/docs/payment_request/models/VirtualAccountChannelCode.md +++ b/docs/payment_request/models/VirtualAccountChannelCode.md @@ -36,4 +36,7 @@ Virtual Account Channel Code * `StandardChartered` (value: `'STANDARD_CHARTERED'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payout/models/ChannelAccountType.md b/docs/payout/models/ChannelAccountType.md index 7e602fc..7848ca5 100644 --- a/docs/payout/models/ChannelAccountType.md +++ b/docs/payout/models/ChannelAccountType.md @@ -16,4 +16,7 @@ Available account types (applicable for MY_DUITNOW) * `BankAccount` (value: `'BANK_ACCOUNT'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/payout/models/ChannelCategory.md b/docs/payout/models/ChannelCategory.md index f0f4ec1..3dc6f40 100644 --- a/docs/payout/models/ChannelCategory.md +++ b/docs/payout/models/ChannelCategory.md @@ -12,4 +12,7 @@ Category of channel code, as some channels might require more fields during proc * `Otc` (value: `'OTC'`) + * `XenditEnumDefaultFallback` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. diff --git a/docs/refund/models/CreateRefundDefaultResponse.md b/docs/refund/models/GetAllRefundsDefaultResponse.md similarity index 85% rename from docs/refund/models/CreateRefundDefaultResponse.md rename to docs/refund/models/GetAllRefundsDefaultResponse.md index fcded37..753f48c 100644 --- a/docs/refund/models/CreateRefundDefaultResponse.md +++ b/docs/refund/models/GetAllRefundsDefaultResponse.md @@ -1,4 +1,4 @@ -# CreateRefundDefaultResponse +# GetAllRefundsDefaultResponse diff --git a/invoice/apis/Invoice.ts b/invoice/apis/Invoice.ts index e106734..1aa5b2d 100644 --- a/invoice/apis/Invoice.ts +++ b/invoice/apis/Invoice.ts @@ -45,19 +45,16 @@ import { export interface CreateInvoiceOperationRequest { data: CreateInvoiceRequest; -} - -export interface ExpireInvoiceRequest { - invoiceId: string; - idempotencyKey?: string; + forUserId?: string; } export interface GetInvoiceByIdRequest { invoiceId: string; - idempotencyKey?: string; + forUserId?: string; } export interface GetInvoicesRequest { + forUserId?: string; externalId?: string; statuses?: Array; limit?: number; @@ -72,7 +69,11 @@ export interface GetInvoicesRequest { paymentChannels?: Array; onDemandLink?: string; recurringPaymentId?: string; - idempotencyKey?: string; +} + +export interface ExpireInvoiceRequest { + invoiceId: string; + forUserId?: string; } /** @@ -106,6 +107,10 @@ export class InvoiceApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); + } + const response = await this.request({ path: `/v2/invoices/`, method: 'POST', @@ -125,41 +130,6 @@ export class InvoiceApi extends runtime.BaseAPI { return await response.value(); } - /** - * Manually expire an invoice - */ - private async expireInvoiceRaw(requestParameters: ExpireInvoiceRequest): Promise> { - if (requestParameters.invoiceId === null || requestParameters.invoiceId === undefined) { - throw new runtime.RequiredError('invoiceId','Required parameter requestParameters.invoiceId was null or undefined when calling expireInvoice.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); - } - - const response = await this.request({ - path: `/invoices/{invoice_id}/expire!`.replace(`{${"invoice_id"}}`, encodeURIComponent(String(requestParameters.invoiceId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => InvoiceFromJSON(jsonValue)); - } - - /** - * Manually expire an invoice - */ - async expireInvoice(requestParameters: ExpireInvoiceRequest): Promise { - const response = await this.expireInvoiceRaw(requestParameters); - return await response.value(); - } - /** * Get invoice by invoice id */ @@ -173,8 +143,8 @@ export class InvoiceApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ @@ -260,8 +230,8 @@ export class InvoiceApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ @@ -282,4 +252,39 @@ export class InvoiceApi extends runtime.BaseAPI { return await response.value(); } + /** + * Manually expire an invoice + */ + private async expireInvoiceRaw(requestParameters: ExpireInvoiceRequest): Promise> { + if (requestParameters.invoiceId === null || requestParameters.invoiceId === undefined) { + throw new runtime.RequiredError('invoiceId','Required parameter requestParameters.invoiceId was null or undefined when calling expireInvoice.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); + + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); + } + + const response = await this.request({ + path: `/invoices/{invoice_id}/expire!`.replace(`{${"invoice_id"}}`, encodeURIComponent(String(requestParameters.invoiceId))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => InvoiceFromJSON(jsonValue)); + } + + /** + * Manually expire an invoice + */ + async expireInvoice(requestParameters: ExpireInvoiceRequest): Promise { + const response = await this.expireInvoiceRaw(requestParameters); + return await response.value(); + } + } diff --git a/invoice/models/BankCode.ts b/invoice/models/BankCode.ts index 22ae5ca..72a1e01 100644 --- a/invoice/models/BankCode.ts +++ b/invoice/models/BankCode.ts @@ -21,7 +21,8 @@ export const BankCode = { Bjb: 'BJB', SahabatSampoerna: 'SAHABAT_SAMPOERNA', Cimb: 'CIMB', - Bnc: 'BNC' + Bnc: 'BNC', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type BankCode = typeof BankCode[keyof typeof BankCode]; @@ -31,6 +32,11 @@ export function BankCodeFromJSON(json: any): BankCode { } export function BankCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): BankCode { + if (json !== "" || json !== null) { + const key = Object.keys(BankCode)[Object.values(BankCode).indexOf(json)] + return BankCode[key] === undefined ? + BankCode['XenditEnumDefaultFallback'] : BankCode[key] + } return json as BankCode; } diff --git a/invoice/models/DirectDebitType.ts b/invoice/models/DirectDebitType.ts index 0a65f13..271eca1 100644 --- a/invoice/models/DirectDebitType.ts +++ b/invoice/models/DirectDebitType.ts @@ -30,7 +30,8 @@ export const DirectDebitType = { DdRcbc: 'DD_RCBC', DdChinabank: 'DD_CHINABANK', BaChinabank: 'BA_CHINABANK', - DcChinabank: 'DC_CHINABANK' + DcChinabank: 'DC_CHINABANK', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type DirectDebitType = typeof DirectDebitType[keyof typeof DirectDebitType]; @@ -40,6 +41,11 @@ export function DirectDebitTypeFromJSON(json: any): DirectDebitType { } export function DirectDebitTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): DirectDebitType { + if (json !== "" || json !== null) { + const key = Object.keys(DirectDebitType)[Object.values(DirectDebitType).indexOf(json)] + return DirectDebitType[key] === undefined ? + DirectDebitType['XenditEnumDefaultFallback'] : DirectDebitType[key] + } return json as DirectDebitType; } diff --git a/invoice/models/EwalletType.ts b/invoice/models/EwalletType.ts index fcbb2b7..d36e690 100644 --- a/invoice/models/EwalletType.ts +++ b/invoice/models/EwalletType.ts @@ -21,7 +21,8 @@ export const EwalletType = { Grabpay: 'GRABPAY', Astrapay: 'ASTRAPAY', Nexcash: 'NEXCASH', - Jeniuspay: 'JENIUSPAY' + Jeniuspay: 'JENIUSPAY', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type EwalletType = typeof EwalletType[keyof typeof EwalletType]; @@ -31,6 +32,11 @@ export function EwalletTypeFromJSON(json: any): EwalletType { } export function EwalletTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): EwalletType { + if (json !== "" || json !== null) { + const key = Object.keys(EwalletType)[Object.values(EwalletType).indexOf(json)] + return EwalletType[key] === undefined ? + EwalletType['XenditEnumDefaultFallback'] : EwalletType[key] + } return json as EwalletType; } diff --git a/invoice/models/InvoiceClientType.ts b/invoice/models/InvoiceClientType.ts index ce4848b..eba6d22 100644 --- a/invoice/models/InvoiceClientType.ts +++ b/invoice/models/InvoiceClientType.ts @@ -17,7 +17,8 @@ export const InvoiceClientType = { Integration: 'INTEGRATION', OnDemand: 'ON_DEMAND', Recurring: 'RECURRING', - Mobile: 'MOBILE' + Mobile: 'MOBILE', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type InvoiceClientType = typeof InvoiceClientType[keyof typeof InvoiceClientType]; @@ -27,6 +28,11 @@ export function InvoiceClientTypeFromJSON(json: any): InvoiceClientType { } export function InvoiceClientTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): InvoiceClientType { + if (json !== "" || json !== null) { + const key = Object.keys(InvoiceClientType)[Object.values(InvoiceClientType).indexOf(json)] + return InvoiceClientType[key] === undefined ? + InvoiceClientType['XenditEnumDefaultFallback'] : InvoiceClientType[key] + } return json as InvoiceClientType; } diff --git a/invoice/models/InvoiceCurrency.ts b/invoice/models/InvoiceCurrency.ts index 09aee7e..5d4c4a8 100644 --- a/invoice/models/InvoiceCurrency.ts +++ b/invoice/models/InvoiceCurrency.ts @@ -16,7 +16,8 @@ export const InvoiceCurrency = { Usd: 'USD', Thb: 'THB', Vnd: 'VND', - Php: 'PHP' + Php: 'PHP', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type InvoiceCurrency = typeof InvoiceCurrency[keyof typeof InvoiceCurrency]; @@ -26,6 +27,11 @@ export function InvoiceCurrencyFromJSON(json: any): InvoiceCurrency { } export function InvoiceCurrencyFromJSONTyped(json: any, ignoreDiscriminator: boolean): InvoiceCurrency { + if (json !== "" || json !== null) { + const key = Object.keys(InvoiceCurrency)[Object.values(InvoiceCurrency).indexOf(json)] + return InvoiceCurrency[key] === undefined ? + InvoiceCurrency['XenditEnumDefaultFallback'] : InvoiceCurrency[key] + } return json as InvoiceCurrency; } diff --git a/invoice/models/InvoicePaymentMethod.ts b/invoice/models/InvoicePaymentMethod.ts index a0dc1aa..7276777 100644 --- a/invoice/models/InvoicePaymentMethod.ts +++ b/invoice/models/InvoicePaymentMethod.ts @@ -21,7 +21,8 @@ export const InvoicePaymentMethod = { Ewallet: 'EWALLET', DirectDebit: 'DIRECT_DEBIT', BankTransfer: 'BANK_TRANSFER', - Paylater: 'PAYLATER' + Paylater: 'PAYLATER', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type InvoicePaymentMethod = typeof InvoicePaymentMethod[keyof typeof InvoicePaymentMethod]; @@ -31,6 +32,11 @@ export function InvoicePaymentMethodFromJSON(json: any): InvoicePaymentMethod { } export function InvoicePaymentMethodFromJSONTyped(json: any, ignoreDiscriminator: boolean): InvoicePaymentMethod { + if (json !== "" || json !== null) { + const key = Object.keys(InvoicePaymentMethod)[Object.values(InvoicePaymentMethod).indexOf(json)] + return InvoicePaymentMethod[key] === undefined ? + InvoicePaymentMethod['XenditEnumDefaultFallback'] : InvoicePaymentMethod[key] + } return json as InvoicePaymentMethod; } diff --git a/invoice/models/InvoiceStatus.ts b/invoice/models/InvoiceStatus.ts index e6bc5af..a3e34b0 100644 --- a/invoice/models/InvoiceStatus.ts +++ b/invoice/models/InvoiceStatus.ts @@ -15,7 +15,8 @@ export const InvoiceStatus = { Pending: 'PENDING', Paid: 'PAID', Settled: 'SETTLED', - Expired: 'EXPIRED' + Expired: 'EXPIRED', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type InvoiceStatus = typeof InvoiceStatus[keyof typeof InvoiceStatus]; @@ -25,6 +26,11 @@ export function InvoiceStatusFromJSON(json: any): InvoiceStatus { } export function InvoiceStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): InvoiceStatus { + if (json !== "" || json !== null) { + const key = Object.keys(InvoiceStatus)[Object.values(InvoiceStatus).indexOf(json)] + return InvoiceStatus[key] === undefined ? + InvoiceStatus['XenditEnumDefaultFallback'] : InvoiceStatus[key] + } return json as InvoiceStatus; } diff --git a/invoice/models/NotificationChannel.ts b/invoice/models/NotificationChannel.ts index a6d21ca..9224981 100644 --- a/invoice/models/NotificationChannel.ts +++ b/invoice/models/NotificationChannel.ts @@ -15,7 +15,8 @@ export const NotificationChannel = { Email: 'email', Sms: 'sms', Whatsapp: 'whatsapp', - Viber: 'viber' + Viber: 'viber', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type NotificationChannel = typeof NotificationChannel[keyof typeof NotificationChannel]; @@ -25,6 +26,11 @@ export function NotificationChannelFromJSON(json: any): NotificationChannel { } export function NotificationChannelFromJSONTyped(json: any, ignoreDiscriminator: boolean): NotificationChannel { + if (json !== "" || json !== null) { + const key = Object.keys(NotificationChannel)[Object.values(NotificationChannel).indexOf(json)] + return NotificationChannel[key] === undefined ? + NotificationChannel['XenditEnumDefaultFallback'] : NotificationChannel[key] + } return json as NotificationChannel; } diff --git a/invoice/models/PaylaterType.ts b/invoice/models/PaylaterType.ts index d43cdac..2597ee6 100644 --- a/invoice/models/PaylaterType.ts +++ b/invoice/models/PaylaterType.ts @@ -17,7 +17,8 @@ export const PaylaterType = { Uangme: 'UANGME', Billease: 'BILLEASE', Cashalo: 'CASHALO', - Atome: 'ATOME' + Atome: 'ATOME', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaylaterType = typeof PaylaterType[keyof typeof PaylaterType]; @@ -27,6 +28,11 @@ export function PaylaterTypeFromJSON(json: any): PaylaterType { } export function PaylaterTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaylaterType { + if (json !== "" || json !== null) { + const key = Object.keys(PaylaterType)[Object.values(PaylaterType).indexOf(json)] + return PaylaterType[key] === undefined ? + PaylaterType['XenditEnumDefaultFallback'] : PaylaterType[key] + } return json as PaylaterType; } diff --git a/invoice/models/QrCodeType.ts b/invoice/models/QrCodeType.ts index 5885382..91b3160 100644 --- a/invoice/models/QrCodeType.ts +++ b/invoice/models/QrCodeType.ts @@ -13,7 +13,8 @@ */ export const QrCodeType = { Qris: 'QRIS', - Promptpay: 'PROMPTPAY' + Promptpay: 'PROMPTPAY', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type QrCodeType = typeof QrCodeType[keyof typeof QrCodeType]; @@ -23,6 +24,11 @@ export function QrCodeTypeFromJSON(json: any): QrCodeType { } export function QrCodeTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): QrCodeType { + if (json !== "" || json !== null) { + const key = Object.keys(QrCodeType)[Object.values(QrCodeType).indexOf(json)] + return QrCodeType[key] === undefined ? + QrCodeType['XenditEnumDefaultFallback'] : QrCodeType[key] + } return json as QrCodeType; } diff --git a/invoice/models/RetailOutletName.ts b/invoice/models/RetailOutletName.ts index 51e2254..807da9e 100644 --- a/invoice/models/RetailOutletName.ts +++ b/invoice/models/RetailOutletName.ts @@ -20,7 +20,8 @@ export const RetailOutletName = { DpMlhuillier: 'DP_MLHUILLIER', DpPalawan: 'DP_PALAWAN', DpEcpaySchool: 'DP_ECPAY_SCHOOL', - Lbc: 'LBC' + Lbc: 'LBC', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type RetailOutletName = typeof RetailOutletName[keyof typeof RetailOutletName]; @@ -30,6 +31,11 @@ export function RetailOutletNameFromJSON(json: any): RetailOutletName { } export function RetailOutletNameFromJSONTyped(json: any, ignoreDiscriminator: boolean): RetailOutletName { + if (json !== "" || json !== null) { + const key = Object.keys(RetailOutletName)[Object.values(RetailOutletName).indexOf(json)] + return RetailOutletName[key] === undefined ? + RetailOutletName['XenditEnumDefaultFallback'] : RetailOutletName[key] + } return json as RetailOutletName; } diff --git a/package.json b/package.json index aa9a8ee..86368f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xendit-node", - "version": "3.3.0", + "version": "3.4.0", "description": "OpenAPI client for xendit-node", "author": "OpenAPI-Generator", "repository": { diff --git a/payment_method/apis/PaymentMethod.ts b/payment_method/apis/PaymentMethod.ts index ffae4e4..7f193eb 100644 --- a/payment_method/apis/PaymentMethod.ts +++ b/payment_method/apis/PaymentMethod.ts @@ -61,42 +61,19 @@ import { SimulatePaymentRequestToJSON, } from '../models'; -export interface AuthPaymentMethodRequest { - paymentMethodId: string; - idempotencyKey?: string; - data?: PaymentMethodAuthParameters; -} - export interface CreatePaymentMethodRequest { + forUserId?: string; data?: PaymentMethodParameters; } -export interface ExpirePaymentMethodRequest { - paymentMethodId: string; - idempotencyKey?: string; - data?: PaymentMethodExpireParameters | null; -} - -export interface GetAllPaymentMethodsRequest { - id?: Array; - type?: Array; - status?: Array; - reusability?: PaymentMethodReusability; - customerId?: string; - referenceId?: string; - afterId?: string; - beforeId?: string; - limit?: number; - idempotencyKey?: string; -} - export interface GetPaymentMethodByIDRequest { paymentMethodId: string; - idempotencyKey?: string; + forUserId?: string; } export interface GetPaymentsByPaymentMethodIdRequest { paymentMethodId: string; + forUserId?: string; paymentRequestId?: Array; paymentMethodId2?: Array; referenceId?: Array; @@ -109,18 +86,41 @@ export interface GetPaymentsByPaymentMethodIdRequest { updatedGte?: Date; updatedLte?: Date; limit?: number; - idempotencyKey?: string; } export interface PatchPaymentMethodRequest { paymentMethodId: string; - idempotencyKey?: string; + forUserId?: string; data?: PaymentMethodUpdateParameters; } +export interface GetAllPaymentMethodsRequest { + forUserId?: string; + id?: Array; + type?: Array; + status?: Array; + reusability?: PaymentMethodReusability; + customerId?: string; + referenceId?: string; + afterId?: string; + beforeId?: string; + limit?: number; +} + +export interface ExpirePaymentMethodRequest { + paymentMethodId: string; + forUserId?: string; + data?: PaymentMethodExpireParameters | null; +} + +export interface AuthPaymentMethodRequest { + paymentMethodId: string; + forUserId?: string; + data?: PaymentMethodAuthParameters; +} + export interface SimulatePaymentOperationRequest { paymentMethodId: string; - idempotencyKey?: string; data?: SimulatePaymentRequest; } @@ -140,46 +140,6 @@ export class PaymentMethodApi extends runtime.BaseAPI { this.secretKey = secretKey; } - /** - * This endpoint validates a payment method linking OTP - * Validate a payment method\'s linking OTP - */ - private async authPaymentMethodRaw(requestParameters: AuthPaymentMethodRequest): Promise> { - if (requestParameters.paymentMethodId === null || requestParameters.paymentMethodId === undefined) { - throw new runtime.RequiredError('paymentMethodId','Required parameter requestParameters.paymentMethodId was null or undefined when calling authPaymentMethod.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - - headerParameters['Content-Type'] = 'application/json'; - - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); - } - - const response = await this.request({ - path: `/v2/payment_methods/{paymentMethodId}/auth`.replace(`{${"paymentMethodId"}}`, encodeURIComponent(String(requestParameters.paymentMethodId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: PaymentMethodAuthParametersToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => PaymentMethodFromJSON(jsonValue)); - } - - /** - * This endpoint validates a payment method linking OTP - * Validate a payment method\'s linking OTP - */ - async authPaymentMethod(requestParameters: AuthPaymentMethodRequest): Promise { - const response = await this.authPaymentMethodRaw(requestParameters); - return await response.value(); - } - /** * This endpoint initiates creation of payment method * Creates payment method @@ -192,6 +152,10 @@ export class PaymentMethodApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); + } + const response = await this.request({ path: `/v2/payment_methods`, method: 'POST', @@ -213,12 +177,12 @@ export class PaymentMethodApi extends runtime.BaseAPI { } /** - * This endpoint expires a payment method and performs unlinking if necessary - * Expires a payment method + * Get payment method by ID + * Get payment method by ID */ - private async expirePaymentMethodRaw(requestParameters: ExpirePaymentMethodRequest): Promise> { + private async getPaymentMethodByIDRaw(requestParameters: GetPaymentMethodByIDRequest): Promise> { if (requestParameters.paymentMethodId === null || requestParameters.paymentMethodId === undefined) { - throw new runtime.RequiredError('paymentMethodId','Required parameter requestParameters.paymentMethodId was null or undefined when calling expirePaymentMethod.'); + throw new runtime.RequiredError('paymentMethodId','Required parameter requestParameters.paymentMethodId was null or undefined when calling getPaymentMethodByID.'); } const queryParameters: any = {}; @@ -226,69 +190,82 @@ export class PaymentMethodApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - headerParameters['Content-Type'] = 'application/json'; - - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ - path: `/v2/payment_methods/{paymentMethodId}/expire`.replace(`{${"paymentMethodId"}}`, encodeURIComponent(String(requestParameters.paymentMethodId))), - method: 'POST', + path: `/v2/payment_methods/{paymentMethodId}`.replace(`{${"paymentMethodId"}}`, encodeURIComponent(String(requestParameters.paymentMethodId))), + method: 'GET', headers: headerParameters, query: queryParameters, - body: PaymentMethodExpireParametersToJSON(requestParameters.data), }); return new runtime.JSONApiResponse(response, (jsonValue) => PaymentMethodFromJSON(jsonValue)); } /** - * This endpoint expires a payment method and performs unlinking if necessary - * Expires a payment method + * Get payment method by ID + * Get payment method by ID */ - async expirePaymentMethod(requestParameters: ExpirePaymentMethodRequest): Promise { - const response = await this.expirePaymentMethodRaw(requestParameters); + async getPaymentMethodByID(requestParameters: GetPaymentMethodByIDRequest): Promise { + const response = await this.getPaymentMethodByIDRaw(requestParameters); return await response.value(); } /** - * Get all payment methods by filters - * Get all payment methods by filters + * Returns payments with matching PaymentMethodID. + * Returns payments with matching PaymentMethodID. */ - private async getAllPaymentMethodsRaw(requestParameters: GetAllPaymentMethodsRequest): Promise> { + private async getPaymentsByPaymentMethodIdRaw(requestParameters: GetPaymentsByPaymentMethodIdRequest): Promise> { + if (requestParameters.paymentMethodId === null || requestParameters.paymentMethodId === undefined) { + throw new runtime.RequiredError('paymentMethodId','Required parameter requestParameters.paymentMethodId was null or undefined when calling getPaymentsByPaymentMethodId.'); + } + const queryParameters: any = {}; - if (requestParameters.id) { - queryParameters['id'] = requestParameters.id; + if (requestParameters.paymentRequestId) { + queryParameters['payment_request_id'] = requestParameters.paymentRequestId; } - if (requestParameters.type) { - queryParameters['type'] = requestParameters.type; + if (requestParameters.paymentMethodId2) { + queryParameters['payment_method_id'] = requestParameters.paymentMethodId2; + } + + if (requestParameters.referenceId) { + queryParameters['reference_id'] = requestParameters.referenceId; + } + + if (requestParameters.paymentMethodType) { + queryParameters['payment_method_type'] = requestParameters.paymentMethodType; + } + + if (requestParameters.channelCode) { + queryParameters['channel_code'] = requestParameters.channelCode; } if (requestParameters.status) { queryParameters['status'] = requestParameters.status; } - if (requestParameters.reusability !== undefined) { - queryParameters['reusability'] = requestParameters.reusability; + if (requestParameters.currency) { + queryParameters['currency'] = requestParameters.currency; } - if (requestParameters.customerId !== undefined) { - queryParameters['customer_id'] = requestParameters.customerId; + if (requestParameters.createdGte !== undefined) { + queryParameters['created[gte]'] = (requestParameters.createdGte as any).toISOString(); } - if (requestParameters.referenceId !== undefined) { - queryParameters['reference_id'] = requestParameters.referenceId; + if (requestParameters.createdLte !== undefined) { + queryParameters['created[lte]'] = (requestParameters.createdLte as any).toISOString(); } - if (requestParameters.afterId !== undefined) { - queryParameters['after_id'] = requestParameters.afterId; + if (requestParameters.updatedGte !== undefined) { + queryParameters['updated[gte]'] = (requestParameters.updatedGte as any).toISOString(); } - if (requestParameters.beforeId !== undefined) { - queryParameters['before_id'] = requestParameters.beforeId; + if (requestParameters.updatedLte !== undefined) { + queryParameters['updated[lte]'] = (requestParameters.updatedLte as any).toISOString(); } if (requestParameters.limit !== undefined) { @@ -298,36 +275,36 @@ export class PaymentMethodApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ - path: `/v2/payment_methods`, + path: `/v2/payment_methods/{paymentMethodId}/payments`.replace(`{${"paymentMethodId"}}`, encodeURIComponent(String(requestParameters.paymentMethodId))), method: 'GET', headers: headerParameters, query: queryParameters, }); - return new runtime.JSONApiResponse(response, (jsonValue) => PaymentMethodListFromJSON(jsonValue)); + return new runtime.JSONApiResponse(response); } /** - * Get all payment methods by filters - * Get all payment methods by filters + * Returns payments with matching PaymentMethodID. + * Returns payments with matching PaymentMethodID. */ - async getAllPaymentMethods(requestParameters: GetAllPaymentMethodsRequest = {}): Promise { - const response = await this.getAllPaymentMethodsRaw(requestParameters); + async getPaymentsByPaymentMethodId(requestParameters: GetPaymentsByPaymentMethodIdRequest): Promise { + const response = await this.getPaymentsByPaymentMethodIdRaw(requestParameters); return await response.value(); } /** - * Get payment method by ID - * Get payment method by ID + * This endpoint is used to toggle the ```status``` of an e-Wallet or a Direct Debit payment method to ```ACTIVE``` or ```INACTIVE```. This is also used to update the details of an Over-the-Counter or a Virtual Account payment method. + * Patch payment methods */ - private async getPaymentMethodByIDRaw(requestParameters: GetPaymentMethodByIDRequest): Promise> { + private async patchPaymentMethodRaw(requestParameters: PatchPaymentMethodRequest): Promise> { if (requestParameters.paymentMethodId === null || requestParameters.paymentMethodId === undefined) { - throw new runtime.RequiredError('paymentMethodId','Required parameter requestParameters.paymentMethodId was null or undefined when calling getPaymentMethodByID.'); + throw new runtime.RequiredError('paymentMethodId','Required parameter requestParameters.paymentMethodId was null or undefined when calling patchPaymentMethod.'); } const queryParameters: any = {}; @@ -335,82 +312,69 @@ export class PaymentMethodApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + headerParameters['Content-Type'] = 'application/json'; + + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ path: `/v2/payment_methods/{paymentMethodId}`.replace(`{${"paymentMethodId"}}`, encodeURIComponent(String(requestParameters.paymentMethodId))), - method: 'GET', + method: 'PATCH', headers: headerParameters, query: queryParameters, + body: PaymentMethodUpdateParametersToJSON(requestParameters.data), }); return new runtime.JSONApiResponse(response, (jsonValue) => PaymentMethodFromJSON(jsonValue)); } /** - * Get payment method by ID - * Get payment method by ID + * This endpoint is used to toggle the ```status``` of an e-Wallet or a Direct Debit payment method to ```ACTIVE``` or ```INACTIVE```. This is also used to update the details of an Over-the-Counter or a Virtual Account payment method. + * Patch payment methods */ - async getPaymentMethodByID(requestParameters: GetPaymentMethodByIDRequest): Promise { - const response = await this.getPaymentMethodByIDRaw(requestParameters); + async patchPaymentMethod(requestParameters: PatchPaymentMethodRequest): Promise { + const response = await this.patchPaymentMethodRaw(requestParameters); return await response.value(); } /** - * Returns payments with matching PaymentMethodID. - * Returns payments with matching PaymentMethodID. + * Get all payment methods by filters + * Get all payment methods by filters */ - private async getPaymentsByPaymentMethodIdRaw(requestParameters: GetPaymentsByPaymentMethodIdRequest): Promise> { - if (requestParameters.paymentMethodId === null || requestParameters.paymentMethodId === undefined) { - throw new runtime.RequiredError('paymentMethodId','Required parameter requestParameters.paymentMethodId was null or undefined when calling getPaymentsByPaymentMethodId.'); - } - + private async getAllPaymentMethodsRaw(requestParameters: GetAllPaymentMethodsRequest): Promise> { const queryParameters: any = {}; - if (requestParameters.paymentRequestId) { - queryParameters['payment_request_id'] = requestParameters.paymentRequestId; - } - - if (requestParameters.paymentMethodId2) { - queryParameters['payment_method_id'] = requestParameters.paymentMethodId2; - } - - if (requestParameters.referenceId) { - queryParameters['reference_id'] = requestParameters.referenceId; - } - - if (requestParameters.paymentMethodType) { - queryParameters['payment_method_type'] = requestParameters.paymentMethodType; + if (requestParameters.id) { + queryParameters['id'] = requestParameters.id; } - if (requestParameters.channelCode) { - queryParameters['channel_code'] = requestParameters.channelCode; + if (requestParameters.type) { + queryParameters['type'] = requestParameters.type; } if (requestParameters.status) { queryParameters['status'] = requestParameters.status; } - if (requestParameters.currency) { - queryParameters['currency'] = requestParameters.currency; + if (requestParameters.reusability !== undefined) { + queryParameters['reusability'] = requestParameters.reusability; } - if (requestParameters.createdGte !== undefined) { - queryParameters['created[gte]'] = (requestParameters.createdGte as any).toISOString(); + if (requestParameters.customerId !== undefined) { + queryParameters['customer_id'] = requestParameters.customerId; } - if (requestParameters.createdLte !== undefined) { - queryParameters['created[lte]'] = (requestParameters.createdLte as any).toISOString(); + if (requestParameters.referenceId !== undefined) { + queryParameters['reference_id'] = requestParameters.referenceId; } - if (requestParameters.updatedGte !== undefined) { - queryParameters['updated[gte]'] = (requestParameters.updatedGte as any).toISOString(); + if (requestParameters.afterId !== undefined) { + queryParameters['after_id'] = requestParameters.afterId; } - if (requestParameters.updatedLte !== undefined) { - queryParameters['updated[lte]'] = (requestParameters.updatedLte as any).toISOString(); + if (requestParameters.beforeId !== undefined) { + queryParameters['before_id'] = requestParameters.beforeId; } if (requestParameters.limit !== undefined) { @@ -420,36 +384,36 @@ export class PaymentMethodApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ - path: `/v2/payment_methods/{paymentMethodId}/payments`.replace(`{${"paymentMethodId"}}`, encodeURIComponent(String(requestParameters.paymentMethodId))), + path: `/v2/payment_methods`, method: 'GET', headers: headerParameters, query: queryParameters, }); - return new runtime.JSONApiResponse(response); + return new runtime.JSONApiResponse(response, (jsonValue) => PaymentMethodListFromJSON(jsonValue)); } /** - * Returns payments with matching PaymentMethodID. - * Returns payments with matching PaymentMethodID. + * Get all payment methods by filters + * Get all payment methods by filters */ - async getPaymentsByPaymentMethodId(requestParameters: GetPaymentsByPaymentMethodIdRequest): Promise { - const response = await this.getPaymentsByPaymentMethodIdRaw(requestParameters); + async getAllPaymentMethods(requestParameters: GetAllPaymentMethodsRequest = {}): Promise { + const response = await this.getAllPaymentMethodsRaw(requestParameters); return await response.value(); } /** - * This endpoint is used to toggle the ```status``` of an e-Wallet or a Direct Debit payment method to ```ACTIVE``` or ```INACTIVE```. This is also used to update the details of an Over-the-Counter or a Virtual Account payment method. - * Patch payment methods + * This endpoint expires a payment method and performs unlinking if necessary + * Expires a payment method */ - private async patchPaymentMethodRaw(requestParameters: PatchPaymentMethodRequest): Promise> { + private async expirePaymentMethodRaw(requestParameters: ExpirePaymentMethodRequest): Promise> { if (requestParameters.paymentMethodId === null || requestParameters.paymentMethodId === undefined) { - throw new runtime.RequiredError('paymentMethodId','Required parameter requestParameters.paymentMethodId was null or undefined when calling patchPaymentMethod.'); + throw new runtime.RequiredError('paymentMethodId','Required parameter requestParameters.paymentMethodId was null or undefined when calling expirePaymentMethod.'); } const queryParameters: any = {}; @@ -459,27 +423,67 @@ export class PaymentMethodApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ - path: `/v2/payment_methods/{paymentMethodId}`.replace(`{${"paymentMethodId"}}`, encodeURIComponent(String(requestParameters.paymentMethodId))), - method: 'PATCH', + path: `/v2/payment_methods/{paymentMethodId}/expire`.replace(`{${"paymentMethodId"}}`, encodeURIComponent(String(requestParameters.paymentMethodId))), + method: 'POST', headers: headerParameters, query: queryParameters, - body: PaymentMethodUpdateParametersToJSON(requestParameters.data), + body: PaymentMethodExpireParametersToJSON(requestParameters.data), }); return new runtime.JSONApiResponse(response, (jsonValue) => PaymentMethodFromJSON(jsonValue)); } /** - * This endpoint is used to toggle the ```status``` of an e-Wallet or a Direct Debit payment method to ```ACTIVE``` or ```INACTIVE```. This is also used to update the details of an Over-the-Counter or a Virtual Account payment method. - * Patch payment methods + * This endpoint expires a payment method and performs unlinking if necessary + * Expires a payment method */ - async patchPaymentMethod(requestParameters: PatchPaymentMethodRequest): Promise { - const response = await this.patchPaymentMethodRaw(requestParameters); + async expirePaymentMethod(requestParameters: ExpirePaymentMethodRequest): Promise { + const response = await this.expirePaymentMethodRaw(requestParameters); + return await response.value(); + } + + /** + * This endpoint validates a payment method linking OTP + * Validate a payment method\'s linking OTP + */ + private async authPaymentMethodRaw(requestParameters: AuthPaymentMethodRequest): Promise> { + if (requestParameters.paymentMethodId === null || requestParameters.paymentMethodId === undefined) { + throw new runtime.RequiredError('paymentMethodId','Required parameter requestParameters.paymentMethodId was null or undefined when calling authPaymentMethod.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); + + headerParameters['Content-Type'] = 'application/json'; + + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); + } + + const response = await this.request({ + path: `/v2/payment_methods/{paymentMethodId}/auth`.replace(`{${"paymentMethodId"}}`, encodeURIComponent(String(requestParameters.paymentMethodId))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: PaymentMethodAuthParametersToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => PaymentMethodFromJSON(jsonValue)); + } + + /** + * This endpoint validates a payment method linking OTP + * Validate a payment method\'s linking OTP + */ + async authPaymentMethod(requestParameters: AuthPaymentMethodRequest): Promise { + const response = await this.authPaymentMethodRaw(requestParameters); return await response.value(); } @@ -499,10 +503,6 @@ export class PaymentMethodApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); - } - const response = await this.request({ path: `/v2/payment_methods/{paymentMethodId}/payments/simulate`.replace(`{${"paymentMethodId"}}`, encodeURIComponent(String(requestParameters.paymentMethodId))), method: 'POST', diff --git a/payment_method/models/DirectDebitChannelCode.ts b/payment_method/models/DirectDebitChannelCode.ts index 03248b2..ccc9ddf 100644 --- a/payment_method/models/DirectDebitChannelCode.ts +++ b/payment_method/models/DirectDebitChannelCode.ts @@ -74,7 +74,8 @@ export const DirectDebitChannelCode = { PublicFpxBusiness: 'PUBLIC_FPX_BUSINESS', RhbFpxBusiness: 'RHB_FPX_BUSINESS', SchFpxBusiness: 'SCH_FPX_BUSINESS', - UobFpxBusiness: 'UOB_FPX_BUSINESS' + UobFpxBusiness: 'UOB_FPX_BUSINESS', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type DirectDebitChannelCode = typeof DirectDebitChannelCode[keyof typeof DirectDebitChannelCode]; @@ -84,6 +85,11 @@ export function DirectDebitChannelCodeFromJSON(json: any): DirectDebitChannelCod } export function DirectDebitChannelCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): DirectDebitChannelCode { + if (json !== "" || json !== null) { + const key = Object.keys(DirectDebitChannelCode)[Object.values(DirectDebitChannelCode).indexOf(json)] + return DirectDebitChannelCode[key] === undefined ? + DirectDebitChannelCode['XenditEnumDefaultFallback'] : DirectDebitChannelCode[key] + } return json as DirectDebitChannelCode; } diff --git a/payment_method/models/DirectDebitType.ts b/payment_method/models/DirectDebitType.ts index 5164ee3..1f6bb02 100644 --- a/payment_method/models/DirectDebitType.ts +++ b/payment_method/models/DirectDebitType.ts @@ -14,7 +14,8 @@ export const DirectDebitType = { DebitCard: 'DEBIT_CARD', BankAccount: 'BANK_ACCOUNT', - BankRedirect: 'BANK_REDIRECT' + BankRedirect: 'BANK_REDIRECT', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type DirectDebitType = typeof DirectDebitType[keyof typeof DirectDebitType]; @@ -24,6 +25,11 @@ export function DirectDebitTypeFromJSON(json: any): DirectDebitType { } export function DirectDebitTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): DirectDebitType { + if (json !== "" || json !== null) { + const key = Object.keys(DirectDebitType)[Object.values(DirectDebitType).indexOf(json)] + return DirectDebitType[key] === undefined ? + DirectDebitType['XenditEnumDefaultFallback'] : DirectDebitType[key] + } return json as DirectDebitType; } diff --git a/payment_method/models/EWalletChannelCode.ts b/payment_method/models/EWalletChannelCode.ts index a070660..15263ec 100644 --- a/payment_method/models/EWalletChannelCode.ts +++ b/payment_method/models/EWalletChannelCode.ts @@ -31,7 +31,8 @@ export const EWalletChannelCode = { Wechatpay: 'WECHATPAY', Linepay: 'LINEPAY', Truemoney: 'TRUEMONEY', - Alipay: 'ALIPAY' + Alipay: 'ALIPAY', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type EWalletChannelCode = typeof EWalletChannelCode[keyof typeof EWalletChannelCode]; @@ -41,6 +42,11 @@ export function EWalletChannelCodeFromJSON(json: any): EWalletChannelCode { } export function EWalletChannelCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): EWalletChannelCode { + if (json !== "" || json !== null) { + const key = Object.keys(EWalletChannelCode)[Object.values(EWalletChannelCode).indexOf(json)] + return EWalletChannelCode[key] === undefined ? + EWalletChannelCode['XenditEnumDefaultFallback'] : EWalletChannelCode[key] + } return json as EWalletChannelCode; } diff --git a/payment_method/models/OverTheCounterChannelCode.ts b/payment_method/models/OverTheCounterChannelCode.ts index ef95074..dd0f8ef 100644 --- a/payment_method/models/OverTheCounterChannelCode.ts +++ b/payment_method/models/OverTheCounterChannelCode.ts @@ -27,7 +27,8 @@ export const OverTheCounterChannelCode = { SmBills: 'SM_BILLS', RobinsonsBills: 'ROBINSONS_BILLS', Alfamart: 'ALFAMART', - Indomaret: 'INDOMARET' + Indomaret: 'INDOMARET', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type OverTheCounterChannelCode = typeof OverTheCounterChannelCode[keyof typeof OverTheCounterChannelCode]; @@ -37,6 +38,11 @@ export function OverTheCounterChannelCodeFromJSON(json: any): OverTheCounterChan } export function OverTheCounterChannelCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): OverTheCounterChannelCode { + if (json !== "" || json !== null) { + const key = Object.keys(OverTheCounterChannelCode)[Object.values(OverTheCounterChannelCode).indexOf(json)] + return OverTheCounterChannelCode[key] === undefined ? + OverTheCounterChannelCode['XenditEnumDefaultFallback'] : OverTheCounterChannelCode[key] + } return json as OverTheCounterChannelCode; } diff --git a/payment_method/models/PaymentMethodCountry.ts b/payment_method/models/PaymentMethodCountry.ts index 6b6e255..e7ba92f 100644 --- a/payment_method/models/PaymentMethodCountry.ts +++ b/payment_method/models/PaymentMethodCountry.ts @@ -16,7 +16,8 @@ export const PaymentMethodCountry = { Id: 'ID', Vn: 'VN', Th: 'TH', - My: 'MY' + My: 'MY', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaymentMethodCountry = typeof PaymentMethodCountry[keyof typeof PaymentMethodCountry]; @@ -26,6 +27,11 @@ export function PaymentMethodCountryFromJSON(json: any): PaymentMethodCountry { } export function PaymentMethodCountryFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentMethodCountry { + if (json !== "" || json !== null) { + const key = Object.keys(PaymentMethodCountry)[Object.values(PaymentMethodCountry).indexOf(json)] + return PaymentMethodCountry[key] === undefined ? + PaymentMethodCountry['XenditEnumDefaultFallback'] : PaymentMethodCountry[key] + } return json as PaymentMethodCountry; } diff --git a/payment_method/models/PaymentMethodReusability.ts b/payment_method/models/PaymentMethodReusability.ts index f085d23..2401449 100644 --- a/payment_method/models/PaymentMethodReusability.ts +++ b/payment_method/models/PaymentMethodReusability.ts @@ -13,7 +13,8 @@ */ export const PaymentMethodReusability = { MultipleUse: 'MULTIPLE_USE', - OneTimeUse: 'ONE_TIME_USE' + OneTimeUse: 'ONE_TIME_USE', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaymentMethodReusability = typeof PaymentMethodReusability[keyof typeof PaymentMethodReusability]; @@ -23,6 +24,11 @@ export function PaymentMethodReusabilityFromJSON(json: any): PaymentMethodReusab } export function PaymentMethodReusabilityFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentMethodReusability { + if (json !== "" || json !== null) { + const key = Object.keys(PaymentMethodReusability)[Object.values(PaymentMethodReusability).indexOf(json)] + return PaymentMethodReusability[key] === undefined ? + PaymentMethodReusability['XenditEnumDefaultFallback'] : PaymentMethodReusability[key] + } return json as PaymentMethodReusability; } diff --git a/payment_method/models/PaymentMethodStatus.ts b/payment_method/models/PaymentMethodStatus.ts index f0fe7db..291ff23 100644 --- a/payment_method/models/PaymentMethodStatus.ts +++ b/payment_method/models/PaymentMethodStatus.ts @@ -17,7 +17,8 @@ export const PaymentMethodStatus = { Inactive: 'INACTIVE', Pending: 'PENDING', RequiresAction: 'REQUIRES_ACTION', - Failed: 'FAILED' + Failed: 'FAILED', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaymentMethodStatus = typeof PaymentMethodStatus[keyof typeof PaymentMethodStatus]; @@ -27,6 +28,11 @@ export function PaymentMethodStatusFromJSON(json: any): PaymentMethodStatus { } export function PaymentMethodStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentMethodStatus { + if (json !== "" || json !== null) { + const key = Object.keys(PaymentMethodStatus)[Object.values(PaymentMethodStatus).indexOf(json)] + return PaymentMethodStatus[key] === undefined ? + PaymentMethodStatus['XenditEnumDefaultFallback'] : PaymentMethodStatus[key] + } return json as PaymentMethodStatus; } diff --git a/payment_method/models/PaymentMethodType.ts b/payment_method/models/PaymentMethodType.ts index 93b23eb..aa3a60c 100644 --- a/payment_method/models/PaymentMethodType.ts +++ b/payment_method/models/PaymentMethodType.ts @@ -19,7 +19,8 @@ export const PaymentMethodType = { Ewallet: 'EWALLET', OverTheCounter: 'OVER_THE_COUNTER', QrCode: 'QR_CODE', - VirtualAccount: 'VIRTUAL_ACCOUNT' + VirtualAccount: 'VIRTUAL_ACCOUNT', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaymentMethodType = typeof PaymentMethodType[keyof typeof PaymentMethodType]; @@ -29,6 +30,11 @@ export function PaymentMethodTypeFromJSON(json: any): PaymentMethodType { } export function PaymentMethodTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentMethodType { + if (json !== "" || json !== null) { + const key = Object.keys(PaymentMethodType)[Object.values(PaymentMethodType).indexOf(json)] + return PaymentMethodType[key] === undefined ? + PaymentMethodType['XenditEnumDefaultFallback'] : PaymentMethodType[key] + } return json as PaymentMethodType; } diff --git a/payment_method/models/QRCodeChannelCode.ts b/payment_method/models/QRCodeChannelCode.ts index 5b80780..478bd3d 100644 --- a/payment_method/models/QRCodeChannelCode.ts +++ b/payment_method/models/QRCodeChannelCode.ts @@ -16,7 +16,8 @@ export const QRCodeChannelCode = { Dana: 'DANA', Rcbc: 'RCBC', Promptpay: 'PROMPTPAY', - Linkaja: 'LINKAJA' + Linkaja: 'LINKAJA', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type QRCodeChannelCode = typeof QRCodeChannelCode[keyof typeof QRCodeChannelCode]; @@ -26,6 +27,11 @@ export function QRCodeChannelCodeFromJSON(json: any): QRCodeChannelCode { } export function QRCodeChannelCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): QRCodeChannelCode { + if (json !== "" || json !== null) { + const key = Object.keys(QRCodeChannelCode)[Object.values(QRCodeChannelCode).indexOf(json)] + return QRCodeChannelCode[key] === undefined ? + QRCodeChannelCode['XenditEnumDefaultFallback'] : QRCodeChannelCode[key] + } return json as QRCodeChannelCode; } diff --git a/payment_method/models/VirtualAccountChannelCode.ts b/payment_method/models/VirtualAccountChannelCode.ts index 7d77834..c185b0a 100644 --- a/payment_method/models/VirtualAccountChannelCode.ts +++ b/payment_method/models/VirtualAccountChannelCode.ts @@ -26,7 +26,8 @@ export const VirtualAccountChannelCode = { Vietcapital: 'VIETCAPITAL', Woori: 'WOORI', Msb: 'MSB', - StandardChartered: 'STANDARD_CHARTERED' + StandardChartered: 'STANDARD_CHARTERED', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type VirtualAccountChannelCode = typeof VirtualAccountChannelCode[keyof typeof VirtualAccountChannelCode]; @@ -36,6 +37,11 @@ export function VirtualAccountChannelCodeFromJSON(json: any): VirtualAccountChan } export function VirtualAccountChannelCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): VirtualAccountChannelCode { + if (json !== "" || json !== null) { + const key = Object.keys(VirtualAccountChannelCode)[Object.values(VirtualAccountChannelCode).indexOf(json)] + return VirtualAccountChannelCode[key] === undefined ? + VirtualAccountChannelCode['XenditEnumDefaultFallback'] : VirtualAccountChannelCode[key] + } return json as VirtualAccountChannelCode; } diff --git a/payment_request/apis/PaymentRequest.ts b/payment_request/apis/PaymentRequest.ts index c8c10ae..9fd12d9 100644 --- a/payment_request/apis/PaymentRequest.ts +++ b/payment_request/apis/PaymentRequest.ts @@ -34,47 +34,48 @@ import { PaymentRequestParametersToJSON, } from '../models'; -export interface AuthorizePaymentRequestRequest { - paymentRequestId: string; +export interface CreatePaymentRequestRequest { idempotencyKey?: string; - data?: PaymentRequestAuthParameters; + forUserId?: string; + data?: PaymentRequestParameters; } -export interface CapturePaymentRequestRequest { +export interface GetPaymentRequestByIDRequest { paymentRequestId: string; - idempotencyKey?: string; - data?: CaptureParameters; + forUserId?: string; } -export interface CreatePaymentRequestRequest { - idempotencyKey?: string; - data?: PaymentRequestParameters; +export interface GetPaymentRequestCapturesRequest { + paymentRequestId: string; + forUserId?: string; + limit?: number; } export interface GetAllPaymentRequestsRequest { + forUserId?: string; referenceId?: Array; id?: Array; customerId?: Array; limit?: number; beforeId?: string; afterId?: string; - idempotencyKey?: string; } -export interface GetPaymentRequestByIDRequest { +export interface CapturePaymentRequestRequest { paymentRequestId: string; - idempotencyKey?: string; + forUserId?: string; + data?: CaptureParameters; } -export interface GetPaymentRequestCapturesRequest { +export interface AuthorizePaymentRequestRequest { paymentRequestId: string; - limit?: number; - idempotencyKey?: string; + forUserId?: string; + data?: PaymentRequestAuthParameters; } export interface ResendPaymentRequestAuthRequest { paymentRequestId: string; - idempotencyKey?: string; + forUserId?: string; } /** @@ -94,14 +95,10 @@ export class PaymentRequestApi extends runtime.BaseAPI { } /** - * Payment Request Authorize - * Payment Request Authorize + * Create Payment Request + * Create Payment Request */ - private async authorizePaymentRequestRaw(requestParameters: AuthorizePaymentRequestRequest): Promise> { - if (requestParameters.paymentRequestId === null || requestParameters.paymentRequestId === undefined) { - throw new runtime.RequiredError('paymentRequestId','Required parameter requestParameters.paymentRequestId was null or undefined when calling authorizePaymentRequest.'); - } - + private async createPaymentRequestRaw(requestParameters: CreatePaymentRequestRequest): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -113,33 +110,37 @@ export class PaymentRequestApi extends runtime.BaseAPI { headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); } + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); + } + const response = await this.request({ - path: `/payment_requests/{paymentRequestId}/auth`.replace(`{${"paymentRequestId"}}`, encodeURIComponent(String(requestParameters.paymentRequestId))), + path: `/payment_requests`, method: 'POST', headers: headerParameters, query: queryParameters, - body: PaymentRequestAuthParametersToJSON(requestParameters.data), + body: PaymentRequestParametersToJSON(requestParameters.data), }); return new runtime.JSONApiResponse(response, (jsonValue) => PaymentRequestFromJSON(jsonValue)); } /** - * Payment Request Authorize - * Payment Request Authorize + * Create Payment Request + * Create Payment Request */ - async authorizePaymentRequest(requestParameters: AuthorizePaymentRequestRequest): Promise { - const response = await this.authorizePaymentRequestRaw(requestParameters); + async createPaymentRequest(requestParameters: CreatePaymentRequestRequest = {}): Promise { + const response = await this.createPaymentRequestRaw(requestParameters); return await response.value(); } /** - * Payment Request Capture - * Payment Request Capture + * Get payment request by ID + * Get payment request by ID */ - private async capturePaymentRequestRaw(requestParameters: CapturePaymentRequestRequest): Promise> { + private async getPaymentRequestByIDRaw(requestParameters: GetPaymentRequestByIDRequest): Promise> { if (requestParameters.paymentRequestId === null || requestParameters.paymentRequestId === undefined) { - throw new runtime.RequiredError('paymentRequestId','Required parameter requestParameters.paymentRequestId was null or undefined when calling capturePaymentRequest.'); + throw new runtime.RequiredError('paymentRequestId','Required parameter requestParameters.paymentRequestId was null or undefined when calling getPaymentRequestByID.'); } const queryParameters: any = {}; @@ -147,65 +148,67 @@ export class PaymentRequestApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - headerParameters['Content-Type'] = 'application/json'; - - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ - path: `/payment_requests/{paymentRequestId}/captures`.replace(`{${"paymentRequestId"}}`, encodeURIComponent(String(requestParameters.paymentRequestId))), - method: 'POST', + path: `/payment_requests/{paymentRequestId}`.replace(`{${"paymentRequestId"}}`, encodeURIComponent(String(requestParameters.paymentRequestId))), + method: 'GET', headers: headerParameters, query: queryParameters, - body: CaptureParametersToJSON(requestParameters.data), }); - return new runtime.JSONApiResponse(response, (jsonValue) => CaptureFromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => PaymentRequestFromJSON(jsonValue)); } /** - * Payment Request Capture - * Payment Request Capture + * Get payment request by ID + * Get payment request by ID */ - async capturePaymentRequest(requestParameters: CapturePaymentRequestRequest): Promise { - const response = await this.capturePaymentRequestRaw(requestParameters); + async getPaymentRequestByID(requestParameters: GetPaymentRequestByIDRequest): Promise { + const response = await this.getPaymentRequestByIDRaw(requestParameters); return await response.value(); } /** - * Create Payment Request - * Create Payment Request + * Get Payment Request Capture + * Get Payment Request Capture */ - private async createPaymentRequestRaw(requestParameters: CreatePaymentRequestRequest): Promise> { + private async getPaymentRequestCapturesRaw(requestParameters: GetPaymentRequestCapturesRequest): Promise> { + if (requestParameters.paymentRequestId === null || requestParameters.paymentRequestId === undefined) { + throw new runtime.RequiredError('paymentRequestId','Required parameter requestParameters.paymentRequestId was null or undefined when calling getPaymentRequestCaptures.'); + } + const queryParameters: any = {}; + if (requestParameters.limit !== undefined) { + queryParameters['limit'] = requestParameters.limit; + } + const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - headerParameters['Content-Type'] = 'application/json'; - - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ - path: `/payment_requests`, - method: 'POST', + path: `/payment_requests/{paymentRequestId}/captures`.replace(`{${"paymentRequestId"}}`, encodeURIComponent(String(requestParameters.paymentRequestId))), + method: 'GET', headers: headerParameters, query: queryParameters, - body: PaymentRequestParametersToJSON(requestParameters.data), }); - return new runtime.JSONApiResponse(response, (jsonValue) => PaymentRequestFromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => CaptureListResponseFromJSON(jsonValue)); } /** - * Create Payment Request - * Create Payment Request + * Get Payment Request Capture + * Get Payment Request Capture */ - async createPaymentRequest(requestParameters: CreatePaymentRequestRequest = {}): Promise { - const response = await this.createPaymentRequestRaw(requestParameters); + async getPaymentRequestCaptures(requestParameters: GetPaymentRequestCapturesRequest): Promise { + const response = await this.getPaymentRequestCapturesRaw(requestParameters); return await response.value(); } @@ -243,8 +246,8 @@ export class PaymentRequestApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ @@ -267,12 +270,12 @@ export class PaymentRequestApi extends runtime.BaseAPI { } /** - * Get payment request by ID - * Get payment request by ID + * Payment Request Capture + * Payment Request Capture */ - private async getPaymentRequestByIDRaw(requestParameters: GetPaymentRequestByIDRequest): Promise> { + private async capturePaymentRequestRaw(requestParameters: CapturePaymentRequestRequest): Promise> { if (requestParameters.paymentRequestId === null || requestParameters.paymentRequestId === undefined) { - throw new runtime.RequiredError('paymentRequestId','Required parameter requestParameters.paymentRequestId was null or undefined when calling getPaymentRequestByID.'); + throw new runtime.RequiredError('paymentRequestId','Required parameter requestParameters.paymentRequestId was null or undefined when calling capturePaymentRequest.'); } const queryParameters: any = {}; @@ -280,67 +283,69 @@ export class PaymentRequestApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + headerParameters['Content-Type'] = 'application/json'; + + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ - path: `/payment_requests/{paymentRequestId}`.replace(`{${"paymentRequestId"}}`, encodeURIComponent(String(requestParameters.paymentRequestId))), - method: 'GET', + path: `/payment_requests/{paymentRequestId}/captures`.replace(`{${"paymentRequestId"}}`, encodeURIComponent(String(requestParameters.paymentRequestId))), + method: 'POST', headers: headerParameters, query: queryParameters, + body: CaptureParametersToJSON(requestParameters.data), }); - return new runtime.JSONApiResponse(response, (jsonValue) => PaymentRequestFromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => CaptureFromJSON(jsonValue)); } /** - * Get payment request by ID - * Get payment request by ID + * Payment Request Capture + * Payment Request Capture */ - async getPaymentRequestByID(requestParameters: GetPaymentRequestByIDRequest): Promise { - const response = await this.getPaymentRequestByIDRaw(requestParameters); + async capturePaymentRequest(requestParameters: CapturePaymentRequestRequest): Promise { + const response = await this.capturePaymentRequestRaw(requestParameters); return await response.value(); } /** - * Get Payment Request Capture - * Get Payment Request Capture + * Payment Request Authorize + * Payment Request Authorize */ - private async getPaymentRequestCapturesRaw(requestParameters: GetPaymentRequestCapturesRequest): Promise> { + private async authorizePaymentRequestRaw(requestParameters: AuthorizePaymentRequestRequest): Promise> { if (requestParameters.paymentRequestId === null || requestParameters.paymentRequestId === undefined) { - throw new runtime.RequiredError('paymentRequestId','Required parameter requestParameters.paymentRequestId was null or undefined when calling getPaymentRequestCaptures.'); + throw new runtime.RequiredError('paymentRequestId','Required parameter requestParameters.paymentRequestId was null or undefined when calling authorizePaymentRequest.'); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; - } - const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + headerParameters['Content-Type'] = 'application/json'; + + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ - path: `/payment_requests/{paymentRequestId}/captures`.replace(`{${"paymentRequestId"}}`, encodeURIComponent(String(requestParameters.paymentRequestId))), - method: 'GET', + path: `/payment_requests/{paymentRequestId}/auth`.replace(`{${"paymentRequestId"}}`, encodeURIComponent(String(requestParameters.paymentRequestId))), + method: 'POST', headers: headerParameters, query: queryParameters, + body: PaymentRequestAuthParametersToJSON(requestParameters.data), }); - return new runtime.JSONApiResponse(response, (jsonValue) => CaptureListResponseFromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => PaymentRequestFromJSON(jsonValue)); } /** - * Get Payment Request Capture - * Get Payment Request Capture + * Payment Request Authorize + * Payment Request Authorize */ - async getPaymentRequestCaptures(requestParameters: GetPaymentRequestCapturesRequest): Promise { - const response = await this.getPaymentRequestCapturesRaw(requestParameters); + async authorizePaymentRequest(requestParameters: AuthorizePaymentRequestRequest): Promise { + const response = await this.authorizePaymentRequestRaw(requestParameters); return await response.value(); } @@ -358,8 +363,8 @@ export class PaymentRequestApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ diff --git a/payment_request/models/DirectDebitChannelCode.ts b/payment_request/models/DirectDebitChannelCode.ts index e19b459..da30f2d 100644 --- a/payment_request/models/DirectDebitChannelCode.ts +++ b/payment_request/models/DirectDebitChannelCode.ts @@ -74,7 +74,8 @@ export const DirectDebitChannelCode = { PublicFpxBusiness: 'PUBLIC_FPX_BUSINESS', RhbFpxBusiness: 'RHB_FPX_BUSINESS', SchFpxBusiness: 'SCH_FPX_BUSINESS', - UobFpxBusiness: 'UOB_FPX_BUSINESS' + UobFpxBusiness: 'UOB_FPX_BUSINESS', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type DirectDebitChannelCode = typeof DirectDebitChannelCode[keyof typeof DirectDebitChannelCode]; @@ -84,6 +85,11 @@ export function DirectDebitChannelCodeFromJSON(json: any): DirectDebitChannelCod } export function DirectDebitChannelCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): DirectDebitChannelCode { + if (json !== "" || json !== null) { + const key = Object.keys(DirectDebitChannelCode)[Object.values(DirectDebitChannelCode).indexOf(json)] + return DirectDebitChannelCode[key] === undefined ? + DirectDebitChannelCode['XenditEnumDefaultFallback'] : DirectDebitChannelCode[key] + } return json as DirectDebitChannelCode; } diff --git a/payment_request/models/DirectDebitType.ts b/payment_request/models/DirectDebitType.ts index 5164ee3..1f6bb02 100644 --- a/payment_request/models/DirectDebitType.ts +++ b/payment_request/models/DirectDebitType.ts @@ -14,7 +14,8 @@ export const DirectDebitType = { DebitCard: 'DEBIT_CARD', BankAccount: 'BANK_ACCOUNT', - BankRedirect: 'BANK_REDIRECT' + BankRedirect: 'BANK_REDIRECT', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type DirectDebitType = typeof DirectDebitType[keyof typeof DirectDebitType]; @@ -24,6 +25,11 @@ export function DirectDebitTypeFromJSON(json: any): DirectDebitType { } export function DirectDebitTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): DirectDebitType { + if (json !== "" || json !== null) { + const key = Object.keys(DirectDebitType)[Object.values(DirectDebitType).indexOf(json)] + return DirectDebitType[key] === undefined ? + DirectDebitType['XenditEnumDefaultFallback'] : DirectDebitType[key] + } return json as DirectDebitType; } diff --git a/payment_request/models/EWalletChannelCode.ts b/payment_request/models/EWalletChannelCode.ts index b9e1bf7..55675c5 100644 --- a/payment_request/models/EWalletChannelCode.ts +++ b/payment_request/models/EWalletChannelCode.ts @@ -30,7 +30,8 @@ export const EWalletChannelCode = { Wechatpay: 'WECHATPAY', Linepay: 'LINEPAY', Truemoney: 'TRUEMONEY', - Alipay: 'ALIPAY' + Alipay: 'ALIPAY', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type EWalletChannelCode = typeof EWalletChannelCode[keyof typeof EWalletChannelCode]; @@ -40,6 +41,11 @@ export function EWalletChannelCodeFromJSON(json: any): EWalletChannelCode { } export function EWalletChannelCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): EWalletChannelCode { + if (json !== "" || json !== null) { + const key = Object.keys(EWalletChannelCode)[Object.values(EWalletChannelCode).indexOf(json)] + return EWalletChannelCode[key] === undefined ? + EWalletChannelCode['XenditEnumDefaultFallback'] : EWalletChannelCode[key] + } return json as EWalletChannelCode; } diff --git a/payment_request/models/OverTheCounterChannelCode.ts b/payment_request/models/OverTheCounterChannelCode.ts index ef95074..dd0f8ef 100644 --- a/payment_request/models/OverTheCounterChannelCode.ts +++ b/payment_request/models/OverTheCounterChannelCode.ts @@ -27,7 +27,8 @@ export const OverTheCounterChannelCode = { SmBills: 'SM_BILLS', RobinsonsBills: 'ROBINSONS_BILLS', Alfamart: 'ALFAMART', - Indomaret: 'INDOMARET' + Indomaret: 'INDOMARET', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type OverTheCounterChannelCode = typeof OverTheCounterChannelCode[keyof typeof OverTheCounterChannelCode]; @@ -37,6 +38,11 @@ export function OverTheCounterChannelCodeFromJSON(json: any): OverTheCounterChan } export function OverTheCounterChannelCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): OverTheCounterChannelCode { + if (json !== "" || json !== null) { + const key = Object.keys(OverTheCounterChannelCode)[Object.values(OverTheCounterChannelCode).indexOf(json)] + return OverTheCounterChannelCode[key] === undefined ? + OverTheCounterChannelCode['XenditEnumDefaultFallback'] : OverTheCounterChannelCode[key] + } return json as OverTheCounterChannelCode; } diff --git a/payment_request/models/PaymentMethodReusability.ts b/payment_request/models/PaymentMethodReusability.ts index f085d23..2401449 100644 --- a/payment_request/models/PaymentMethodReusability.ts +++ b/payment_request/models/PaymentMethodReusability.ts @@ -13,7 +13,8 @@ */ export const PaymentMethodReusability = { MultipleUse: 'MULTIPLE_USE', - OneTimeUse: 'ONE_TIME_USE' + OneTimeUse: 'ONE_TIME_USE', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaymentMethodReusability = typeof PaymentMethodReusability[keyof typeof PaymentMethodReusability]; @@ -23,6 +24,11 @@ export function PaymentMethodReusabilityFromJSON(json: any): PaymentMethodReusab } export function PaymentMethodReusabilityFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentMethodReusability { + if (json !== "" || json !== null) { + const key = Object.keys(PaymentMethodReusability)[Object.values(PaymentMethodReusability).indexOf(json)] + return PaymentMethodReusability[key] === undefined ? + PaymentMethodReusability['XenditEnumDefaultFallback'] : PaymentMethodReusability[key] + } return json as PaymentMethodReusability; } diff --git a/payment_request/models/PaymentMethodStatus.ts b/payment_request/models/PaymentMethodStatus.ts index e3c4875..d2a2bb2 100644 --- a/payment_request/models/PaymentMethodStatus.ts +++ b/payment_request/models/PaymentMethodStatus.ts @@ -16,7 +16,8 @@ export const PaymentMethodStatus = { Inactive: 'INACTIVE', Pending: 'PENDING', Expired: 'EXPIRED', - Failed: 'FAILED' + Failed: 'FAILED', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaymentMethodStatus = typeof PaymentMethodStatus[keyof typeof PaymentMethodStatus]; @@ -26,6 +27,11 @@ export function PaymentMethodStatusFromJSON(json: any): PaymentMethodStatus { } export function PaymentMethodStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentMethodStatus { + if (json !== "" || json !== null) { + const key = Object.keys(PaymentMethodStatus)[Object.values(PaymentMethodStatus).indexOf(json)] + return PaymentMethodStatus[key] === undefined ? + PaymentMethodStatus['XenditEnumDefaultFallback'] : PaymentMethodStatus[key] + } return json as PaymentMethodStatus; } diff --git a/payment_request/models/PaymentMethodType.ts b/payment_request/models/PaymentMethodType.ts index e3b3c42..0a98e21 100644 --- a/payment_request/models/PaymentMethodType.ts +++ b/payment_request/models/PaymentMethodType.ts @@ -17,7 +17,8 @@ export const PaymentMethodType = { Ewallet: 'EWALLET', OverTheCounter: 'OVER_THE_COUNTER', QrCode: 'QR_CODE', - VirtualAccount: 'VIRTUAL_ACCOUNT' + VirtualAccount: 'VIRTUAL_ACCOUNT', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaymentMethodType = typeof PaymentMethodType[keyof typeof PaymentMethodType]; @@ -27,6 +28,11 @@ export function PaymentMethodTypeFromJSON(json: any): PaymentMethodType { } export function PaymentMethodTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentMethodType { + if (json !== "" || json !== null) { + const key = Object.keys(PaymentMethodType)[Object.values(PaymentMethodType).indexOf(json)] + return PaymentMethodType[key] === undefined ? + PaymentMethodType['XenditEnumDefaultFallback'] : PaymentMethodType[key] + } return json as PaymentMethodType; } diff --git a/payment_request/models/PaymentRequestCaptureMethod.ts b/payment_request/models/PaymentRequestCaptureMethod.ts index faa6e27..ad39496 100644 --- a/payment_request/models/PaymentRequestCaptureMethod.ts +++ b/payment_request/models/PaymentRequestCaptureMethod.ts @@ -13,7 +13,8 @@ */ export const PaymentRequestCaptureMethod = { Automatic: 'AUTOMATIC', - Manual: 'MANUAL' + Manual: 'MANUAL', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaymentRequestCaptureMethod = typeof PaymentRequestCaptureMethod[keyof typeof PaymentRequestCaptureMethod]; @@ -23,6 +24,11 @@ export function PaymentRequestCaptureMethodFromJSON(json: any): PaymentRequestCa } export function PaymentRequestCaptureMethodFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentRequestCaptureMethod { + if (json !== "" || json !== null) { + const key = Object.keys(PaymentRequestCaptureMethod)[Object.values(PaymentRequestCaptureMethod).indexOf(json)] + return PaymentRequestCaptureMethod[key] === undefined ? + PaymentRequestCaptureMethod['XenditEnumDefaultFallback'] : PaymentRequestCaptureMethod[key] + } return json as PaymentRequestCaptureMethod; } diff --git a/payment_request/models/PaymentRequestCountry.ts b/payment_request/models/PaymentRequestCountry.ts index a69b0b9..fb8bf9c 100644 --- a/payment_request/models/PaymentRequestCountry.ts +++ b/payment_request/models/PaymentRequestCountry.ts @@ -16,7 +16,8 @@ export const PaymentRequestCountry = { Ph: 'PH', Vn: 'VN', Th: 'TH', - My: 'MY' + My: 'MY', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaymentRequestCountry = typeof PaymentRequestCountry[keyof typeof PaymentRequestCountry]; @@ -26,6 +27,11 @@ export function PaymentRequestCountryFromJSON(json: any): PaymentRequestCountry } export function PaymentRequestCountryFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentRequestCountry { + if (json !== "" || json !== null) { + const key = Object.keys(PaymentRequestCountry)[Object.values(PaymentRequestCountry).indexOf(json)] + return PaymentRequestCountry[key] === undefined ? + PaymentRequestCountry['XenditEnumDefaultFallback'] : PaymentRequestCountry[key] + } return json as PaymentRequestCountry; } diff --git a/payment_request/models/PaymentRequestCurrency.ts b/payment_request/models/PaymentRequestCurrency.ts index 6cad834..b73b8cc 100644 --- a/payment_request/models/PaymentRequestCurrency.ts +++ b/payment_request/models/PaymentRequestCurrency.ts @@ -16,7 +16,8 @@ export const PaymentRequestCurrency = { Php: 'PHP', Vnd: 'VND', Thb: 'THB', - Myr: 'MYR' + Myr: 'MYR', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaymentRequestCurrency = typeof PaymentRequestCurrency[keyof typeof PaymentRequestCurrency]; @@ -26,6 +27,11 @@ export function PaymentRequestCurrencyFromJSON(json: any): PaymentRequestCurrenc } export function PaymentRequestCurrencyFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentRequestCurrency { + if (json !== "" || json !== null) { + const key = Object.keys(PaymentRequestCurrency)[Object.values(PaymentRequestCurrency).indexOf(json)] + return PaymentRequestCurrency[key] === undefined ? + PaymentRequestCurrency['XenditEnumDefaultFallback'] : PaymentRequestCurrency[key] + } return json as PaymentRequestCurrency; } diff --git a/payment_request/models/PaymentRequestInitiator.ts b/payment_request/models/PaymentRequestInitiator.ts index ba29f70..eb6049c 100644 --- a/payment_request/models/PaymentRequestInitiator.ts +++ b/payment_request/models/PaymentRequestInitiator.ts @@ -13,7 +13,8 @@ */ export const PaymentRequestInitiator = { Customer: 'CUSTOMER', - Merchant: 'MERCHANT' + Merchant: 'MERCHANT', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaymentRequestInitiator = typeof PaymentRequestInitiator[keyof typeof PaymentRequestInitiator]; @@ -23,6 +24,11 @@ export function PaymentRequestInitiatorFromJSON(json: any): PaymentRequestInitia } export function PaymentRequestInitiatorFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentRequestInitiator { + if (json !== "" || json !== null) { + const key = Object.keys(PaymentRequestInitiator)[Object.values(PaymentRequestInitiator).indexOf(json)] + return PaymentRequestInitiator[key] === undefined ? + PaymentRequestInitiator['XenditEnumDefaultFallback'] : PaymentRequestInitiator[key] + } return json as PaymentRequestInitiator; } diff --git a/payment_request/models/PaymentRequestStatus.ts b/payment_request/models/PaymentRequestStatus.ts index e86f6f4..270613f 100644 --- a/payment_request/models/PaymentRequestStatus.ts +++ b/payment_request/models/PaymentRequestStatus.ts @@ -19,7 +19,8 @@ export const PaymentRequestStatus = { Failed: 'FAILED', Voided: 'VOIDED', Unknown: 'UNKNOWN', - AwaitingCapture: 'AWAITING_CAPTURE' + AwaitingCapture: 'AWAITING_CAPTURE', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type PaymentRequestStatus = typeof PaymentRequestStatus[keyof typeof PaymentRequestStatus]; @@ -29,6 +30,11 @@ export function PaymentRequestStatusFromJSON(json: any): PaymentRequestStatus { } export function PaymentRequestStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentRequestStatus { + if (json !== "" || json !== null) { + const key = Object.keys(PaymentRequestStatus)[Object.values(PaymentRequestStatus).indexOf(json)] + return PaymentRequestStatus[key] === undefined ? + PaymentRequestStatus['XenditEnumDefaultFallback'] : PaymentRequestStatus[key] + } return json as PaymentRequestStatus; } diff --git a/payment_request/models/QRCodeChannelCode.ts b/payment_request/models/QRCodeChannelCode.ts index 16b83fe..9d4a1e3 100644 --- a/payment_request/models/QRCodeChannelCode.ts +++ b/payment_request/models/QRCodeChannelCode.ts @@ -15,7 +15,8 @@ export const QRCodeChannelCode = { Dana: 'DANA', Rcbc: 'RCBC', Linkaja: 'LINKAJA', - Promptpay: 'PROMPTPAY' + Promptpay: 'PROMPTPAY', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type QRCodeChannelCode = typeof QRCodeChannelCode[keyof typeof QRCodeChannelCode]; @@ -25,6 +26,11 @@ export function QRCodeChannelCodeFromJSON(json: any): QRCodeChannelCode { } export function QRCodeChannelCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): QRCodeChannelCode { + if (json !== "" || json !== null) { + const key = Object.keys(QRCodeChannelCode)[Object.values(QRCodeChannelCode).indexOf(json)] + return QRCodeChannelCode[key] === undefined ? + QRCodeChannelCode['XenditEnumDefaultFallback'] : QRCodeChannelCode[key] + } return json as QRCodeChannelCode; } diff --git a/payment_request/models/VirtualAccountChannelCode.ts b/payment_request/models/VirtualAccountChannelCode.ts index 7d77834..c185b0a 100644 --- a/payment_request/models/VirtualAccountChannelCode.ts +++ b/payment_request/models/VirtualAccountChannelCode.ts @@ -26,7 +26,8 @@ export const VirtualAccountChannelCode = { Vietcapital: 'VIETCAPITAL', Woori: 'WOORI', Msb: 'MSB', - StandardChartered: 'STANDARD_CHARTERED' + StandardChartered: 'STANDARD_CHARTERED', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type VirtualAccountChannelCode = typeof VirtualAccountChannelCode[keyof typeof VirtualAccountChannelCode]; @@ -36,6 +37,11 @@ export function VirtualAccountChannelCodeFromJSON(json: any): VirtualAccountChan } export function VirtualAccountChannelCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): VirtualAccountChannelCode { + if (json !== "" || json !== null) { + const key = Object.keys(VirtualAccountChannelCode)[Object.values(VirtualAccountChannelCode).indexOf(json)] + return VirtualAccountChannelCode[key] === undefined ? + VirtualAccountChannelCode['XenditEnumDefaultFallback'] : VirtualAccountChannelCode[key] + } return json as VirtualAccountChannelCode; } diff --git a/payout/apis/Payout.ts b/payout/apis/Payout.ts index fd617fd..82df693 100644 --- a/payout/apis/Payout.ts +++ b/payout/apis/Payout.ts @@ -28,11 +28,6 @@ import { GetPayouts200ResponseDataInnerToJSON, } from '../models'; -export interface CancelPayoutRequest { - id: string; - idempotencyKey?: string; -} - export interface CreatePayoutOperationRequest { idempotencyKey: string; forUserId?: string; @@ -41,14 +36,14 @@ export interface CreatePayoutOperationRequest { export interface GetPayoutByIdRequest { id: string; - idempotencyKey?: string; + forUserId?: string; } export interface GetPayoutChannelsRequest { currency?: string; channelCategory?: Array; channelCode?: string; - idempotencyKey?: string; + forUserId?: string; } export interface GetPayoutsRequest { @@ -56,7 +51,12 @@ export interface GetPayoutsRequest { limit?: number; afterId?: string; beforeId?: string; - idempotencyKey?: string; + forUserId?: string; +} + +export interface CancelPayoutRequest { + id: string; + forUserId?: string; } /** @@ -75,41 +75,6 @@ export class PayoutApi extends runtime.BaseAPI { this.secretKey = secretKey; } - /** - * API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. - */ - private async cancelPayoutRaw(requestParameters: CancelPayoutRequest): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling cancelPayout.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); - } - - const response = await this.request({ - path: `/v2/payouts/{id}/cancel`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => GetPayouts200ResponseDataInnerFromJSON(jsonValue)); - } - - /** - * API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. - */ - async cancelPayout(requestParameters: CancelPayoutRequest): Promise { - const response = await this.cancelPayoutRaw(requestParameters); - return await response.value(); - } - /** * API to send money at scale to bank accounts & eWallets */ @@ -165,8 +130,8 @@ export class PayoutApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ @@ -208,8 +173,8 @@ export class PayoutApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ @@ -259,8 +224,8 @@ export class PayoutApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { - headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); } const response = await this.request({ @@ -281,4 +246,39 @@ export class PayoutApi extends runtime.BaseAPI { return await response.value(); } + /** + * API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. + */ + private async cancelPayoutRaw(requestParameters: CancelPayoutRequest): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling cancelPayout.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); + + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); + } + + const response = await this.request({ + path: `/v2/payouts/{id}/cancel`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => GetPayouts200ResponseDataInnerFromJSON(jsonValue)); + } + + /** + * API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. + */ + async cancelPayout(requestParameters: CancelPayoutRequest): Promise { + const response = await this.cancelPayoutRaw(requestParameters); + return await response.value(); + } + } diff --git a/payout/models/ChannelAccountType.ts b/payout/models/ChannelAccountType.ts index d26ecc9..26b7a78 100644 --- a/payout/models/ChannelAccountType.ts +++ b/payout/models/ChannelAccountType.ts @@ -16,7 +16,8 @@ export const ChannelAccountType = { MobileNo: 'MOBILE_NO', Passport: 'PASSPORT', BusinessRegistration: 'BUSINESS_REGISTRATION', - BankAccount: 'BANK_ACCOUNT' + BankAccount: 'BANK_ACCOUNT', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type ChannelAccountType = typeof ChannelAccountType[keyof typeof ChannelAccountType]; @@ -26,6 +27,11 @@ export function ChannelAccountTypeFromJSON(json: any): ChannelAccountType { } export function ChannelAccountTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChannelAccountType { + if (json !== "" || json !== null) { + const key = Object.keys(ChannelAccountType)[Object.values(ChannelAccountType).indexOf(json)] + return ChannelAccountType[key] === undefined ? + ChannelAccountType['XenditEnumDefaultFallback'] : ChannelAccountType[key] + } return json as ChannelAccountType; } diff --git a/payout/models/ChannelCategory.ts b/payout/models/ChannelCategory.ts index 8259b1d..9eb404c 100644 --- a/payout/models/ChannelCategory.ts +++ b/payout/models/ChannelCategory.ts @@ -14,7 +14,8 @@ export const ChannelCategory = { Bank: 'BANK', Ewallet: 'EWALLET', - Otc: 'OTC' + Otc: 'OTC', + XenditEnumDefaultFallback: "UNKNOWN_ENUM_VALUE" } as const; export type ChannelCategory = typeof ChannelCategory[keyof typeof ChannelCategory]; @@ -24,6 +25,11 @@ export function ChannelCategoryFromJSON(json: any): ChannelCategory { } export function ChannelCategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChannelCategory { + if (json !== "" || json !== null) { + const key = Object.keys(ChannelCategory)[Object.values(ChannelCategory).indexOf(json)] + return ChannelCategory[key] === undefined ? + ChannelCategory['XenditEnumDefaultFallback'] : ChannelCategory[key] + } return json as ChannelCategory; } diff --git a/refund/apis/Refund.ts b/refund/apis/Refund.ts index 048f02c..960b21c 100644 --- a/refund/apis/Refund.ts +++ b/refund/apis/Refund.ts @@ -15,7 +15,7 @@ import type { CreateRefund404Response, CreateRefund409Response, CreateRefund503Response, - CreateRefundDefaultResponse, + GetAllRefundsDefaultResponse, Refund, RefundList, } from '../models'; @@ -32,27 +32,41 @@ import { CreateRefund409ResponseToJSON, CreateRefund503ResponseFromJSON, CreateRefund503ResponseToJSON, - CreateRefundDefaultResponseFromJSON, - CreateRefundDefaultResponseToJSON, + GetAllRefundsDefaultResponseFromJSON, + GetAllRefundsDefaultResponseToJSON, RefundFromJSON, RefundToJSON, RefundListFromJSON, RefundListToJSON, } from '../models'; -export interface CancelRefundRequest { - refundID: string; - idempotencyKey?: string; -} - export interface CreateRefundRequest { idempotencyKey?: string; + forUserId?: string; data?: CreateRefund; } export interface GetRefundRequest { refundID: string; idempotencyKey?: string; + forUserId?: string; +} + +export interface GetAllRefundsRequest { + forUserId?: string; + paymentRequestId?: string; + invoiceId?: string; + paymentMethodType?: string; + channelCode?: string; + limit?: number; + afterId?: string; + beforeId?: string; +} + +export interface CancelRefundRequest { + refundID: string; + idempotencyKey?: string; + forUserId?: string; } /** @@ -73,25 +87,28 @@ export class RefundApi extends runtime.BaseAPI { /** */ - private async cancelRefundRaw(requestParameters: CancelRefundRequest): Promise> { - if (requestParameters.refundID === null || requestParameters.refundID === undefined) { - throw new runtime.RequiredError('refundID','Required parameter requestParameters.refundID was null or undefined when calling cancelRefund.'); - } - + private async createRefundRaw(requestParameters: CreateRefundRequest): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); + headerParameters['Content-Type'] = 'application/json'; + if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); } + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); + } + const response = await this.request({ - path: `/refunds/{refundID}/cancel`.replace(`{${"refundID"}}`, encodeURIComponent(String(requestParameters.refundID))), + path: `/refunds`, method: 'POST', headers: headerParameters, query: queryParameters, + body: CreateRefundToJSON(requestParameters.data), }); return new runtime.JSONApiResponse(response, (jsonValue) => RefundFromJSON(jsonValue)); @@ -99,31 +116,36 @@ export class RefundApi extends runtime.BaseAPI { /** */ - async cancelRefund(requestParameters: CancelRefundRequest): Promise { - const response = await this.cancelRefundRaw(requestParameters); + async createRefund(requestParameters: CreateRefundRequest = {}): Promise { + const response = await this.createRefundRaw(requestParameters); return await response.value(); } /** */ - private async createRefundRaw(requestParameters: CreateRefundRequest): Promise> { + private async getRefundRaw(requestParameters: GetRefundRequest): Promise> { + if (requestParameters.refundID === null || requestParameters.refundID === undefined) { + throw new runtime.RequiredError('refundID','Required parameter requestParameters.refundID was null or undefined when calling getRefund.'); + } + const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); - headerParameters['Content-Type'] = 'application/json'; - if (requestParameters.idempotencyKey !== undefined && requestParameters.idempotencyKey !== null) { headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); } + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); + } + const response = await this.request({ - path: `/refunds`, - method: 'POST', + path: `/refunds/{refundID}`.replace(`{${"refundID"}}`, encodeURIComponent(String(requestParameters.refundID))), + method: 'GET', headers: headerParameters, query: queryParameters, - body: CreateRefundToJSON(requestParameters.data), }); return new runtime.JSONApiResponse(response, (jsonValue) => RefundFromJSON(jsonValue)); @@ -131,21 +153,53 @@ export class RefundApi extends runtime.BaseAPI { /** */ - async createRefund(requestParameters: CreateRefundRequest = {}): Promise { - const response = await this.createRefundRaw(requestParameters); + async getRefund(requestParameters: GetRefundRequest): Promise { + const response = await this.getRefundRaw(requestParameters); return await response.value(); } /** */ - private async getAllRefundsRaw(): Promise> { + private async getAllRefundsRaw(requestParameters: GetAllRefundsRequest): Promise> { const queryParameters: any = {}; + if (requestParameters.paymentRequestId !== undefined) { + queryParameters['payment_request_id'] = requestParameters.paymentRequestId; + } + + if (requestParameters.invoiceId !== undefined) { + queryParameters['invoice_id'] = requestParameters.invoiceId; + } + + if (requestParameters.paymentMethodType !== undefined) { + queryParameters['payment_method_type'] = requestParameters.paymentMethodType; + } + + if (requestParameters.channelCode !== undefined) { + queryParameters['channel_code'] = requestParameters.channelCode; + } + + if (requestParameters.limit !== undefined) { + queryParameters['limit'] = requestParameters.limit; + } + + if (requestParameters.afterId !== undefined) { + queryParameters['after_id'] = requestParameters.afterId; + } + + if (requestParameters.beforeId !== undefined) { + queryParameters['before_id'] = requestParameters.beforeId; + } + const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Authorization"] = "Basic " + btoa(this.secretKey + ":"); + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); + } + const response = await this.request({ - path: `/refunds/`, + path: `/refunds`, method: 'GET', headers: headerParameters, query: queryParameters, @@ -156,16 +210,16 @@ export class RefundApi extends runtime.BaseAPI { /** */ - async getAllRefunds(): Promise { - const response = await this.getAllRefundsRaw(); + async getAllRefunds(requestParameters: GetAllRefundsRequest = {}): Promise { + const response = await this.getAllRefundsRaw(requestParameters); return await response.value(); } /** */ - private async getRefundRaw(requestParameters: GetRefundRequest): Promise> { + private async cancelRefundRaw(requestParameters: CancelRefundRequest): Promise> { if (requestParameters.refundID === null || requestParameters.refundID === undefined) { - throw new runtime.RequiredError('refundID','Required parameter requestParameters.refundID was null or undefined when calling getRefund.'); + throw new runtime.RequiredError('refundID','Required parameter requestParameters.refundID was null or undefined when calling cancelRefund.'); } const queryParameters: any = {}; @@ -177,9 +231,13 @@ export class RefundApi extends runtime.BaseAPI { headerParameters['idempotency-key'] = String(requestParameters.idempotencyKey); } + if (requestParameters.forUserId !== undefined && requestParameters.forUserId !== null) { + headerParameters['for-user-id'] = String(requestParameters.forUserId); + } + const response = await this.request({ - path: `/refunds/{refundID}`.replace(`{${"refundID"}}`, encodeURIComponent(String(requestParameters.refundID))), - method: 'GET', + path: `/refunds/{refundID}/cancel`.replace(`{${"refundID"}}`, encodeURIComponent(String(requestParameters.refundID))), + method: 'POST', headers: headerParameters, query: queryParameters, }); @@ -189,8 +247,8 @@ export class RefundApi extends runtime.BaseAPI { /** */ - async getRefund(requestParameters: GetRefundRequest): Promise { - const response = await this.getRefundRaw(requestParameters); + async cancelRefund(requestParameters: CancelRefundRequest): Promise { + const response = await this.cancelRefundRaw(requestParameters); return await response.value(); } diff --git a/refund/models/CreateRefundDefaultResponse.ts b/refund/models/GetAllRefundsDefaultResponse.ts similarity index 56% rename from refund/models/CreateRefundDefaultResponse.ts rename to refund/models/GetAllRefundsDefaultResponse.ts index 32d5db3..7f2c87c 100644 --- a/refund/models/CreateRefundDefaultResponse.ts +++ b/refund/models/GetAllRefundsDefaultResponse.ts @@ -10,37 +10,37 @@ import { exists, mapValues } from '../../runtime'; /** * * @export - * @interface CreateRefundDefaultResponse + * @interface GetAllRefundsDefaultResponse */ -export interface CreateRefundDefaultResponse { +export interface GetAllRefundsDefaultResponse { /** * * @type {string} - * @memberof CreateRefundDefaultResponse + * @memberof GetAllRefundsDefaultResponse */ errorCode?: string; /** * * @type {string} - * @memberof CreateRefundDefaultResponse + * @memberof GetAllRefundsDefaultResponse */ message?: string; } /** - * Check if a given object implements the CreateRefundDefaultResponse interface. + * Check if a given object implements the GetAllRefundsDefaultResponse interface. */ -export function instanceOfCreateRefundDefaultResponse(value: object): boolean { +export function instanceOfGetAllRefundsDefaultResponse(value: object): boolean { let isInstance = true; return isInstance; } -export function CreateRefundDefaultResponseFromJSON(json: any): CreateRefundDefaultResponse { - return CreateRefundDefaultResponseFromJSONTyped(json, false); +export function GetAllRefundsDefaultResponseFromJSON(json: any): GetAllRefundsDefaultResponse { + return GetAllRefundsDefaultResponseFromJSONTyped(json, false); } -export function CreateRefundDefaultResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateRefundDefaultResponse { +export function GetAllRefundsDefaultResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetAllRefundsDefaultResponse { if ((json === undefined) || (json === null)) { return json; } @@ -51,7 +51,7 @@ export function CreateRefundDefaultResponseFromJSONTyped(json: any, ignoreDiscri }; } -export function CreateRefundDefaultResponseToJSON(value?: CreateRefundDefaultResponse | null): any { +export function GetAllRefundsDefaultResponseToJSON(value?: GetAllRefundsDefaultResponse | null): any { if (value === undefined) { return undefined; } diff --git a/refund/models/index.ts b/refund/models/index.ts index d58289f..2406531 100644 --- a/refund/models/index.ts +++ b/refund/models/index.ts @@ -6,6 +6,6 @@ export * from './CreateRefund403Response'; export * from './CreateRefund404Response'; export * from './CreateRefund409Response'; export * from './CreateRefund503Response'; -export * from './CreateRefundDefaultResponse'; +export * from './GetAllRefundsDefaultResponse'; export * from './Refund'; export * from './RefundList'; diff --git a/runtime.ts b/runtime.ts index b5f738e..4f9ac9b 100644 --- a/runtime.ts +++ b/runtime.ts @@ -136,7 +136,7 @@ export class BaseAPI { const headers = Object.assign({}, this.configuration.headers, context.headers); Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {}); headers['xendit-lib'] = 'node'; - headers['xendit-lib-ver'] = '3.3.0'; + headers['xendit-lib-ver'] = '3.4.0'; const initParams = { method: context.method, diff --git a/tsconfig.json b/tsconfig.json index 4567ec1..bb66d9b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,12 +1,12 @@ { "compilerOptions": { "declaration": true, - "target": "es5", + "target": "es2017", "module": "commonjs", "moduleResolution": "node", "outDir": "dist", "lib": [ - "es6", + "es2017", "dom" ], "typeRoots": [