Skip to content

Commit

Permalink
Generated Xendit node SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
xendit-devx-bot committed Sep 27, 2023
1 parent 5d4cb5e commit 5c66e57
Show file tree
Hide file tree
Showing 15 changed files with 227 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/generate-release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ jobs:
id: parse-changelog
run: |
echo "changelog<<EOF" >> "$GITHUB_OUTPUT"
echo "${{ github.event.client_payload.changelog }}" | tr -s '%0A' '\n' >> "$GITHUB_OUTPUT"
echo "${{ github.event.client_payload.changelog }}" | sed -e 's/%0A/\n/g' >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Create Release
id: create-release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
with:
tag_name: v${{ github.event.client_payload.version }}
release_name: v${{ github.event.client_payload.version }}
tag_name: ${{ github.event.client_payload.version }}
release_name: ${{ github.event.client_payload.version }}
body: ${{ steps.parse-changelog.outputs.changelog }}
draft: false
prerelease: false
Expand All @@ -30,7 +30,7 @@ jobs:
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm i
- run: npm run custom-publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.0
* Package version: 3.2.0

# Getting Started

Expand Down
64 changes: 61 additions & 3 deletions docs/PaymentMethod.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,69 @@ const response: PaymentMethod = await xenditPaymentMethodClient.authPaymentMetho
| data| | [PaymentMethodParameters](payment_method/models/PaymentMethodParameters.md) |

### Usage Examples
#### Minimum API Usage
#### Account linking for E-Wallet

```typescript
import { PaymentMethod } from 'xendit-node/payment_method/models'
import { PaymentMethodParameters, PaymentMethod } from 'xendit-node/payment_method/models'

const data: PaymentMethodParameters = {
"ewallet" : {
"channelProperties" : {
"failureReturnUrl" : "https://redirect.me/failure",
"successReturnUrl" : "https://redirect.me/success",
"cancelReturnUrl" : "https://redirect.me/cancel"
},
"channelCode" : "OVO"
},
"metadata" : {
"sku" : "example-1234"
},
"reusability" : "MULTIPLE_USE",
"type" : "EWALLET",
"customer" : {
"type" : "INDIVIDUAL",
"referenceId" : "customer-123",
"individualDetail" : {
"surname" : "Doe",
"givenNames" : "John"
}
}
}

const response: PaymentMethod = await xenditPaymentMethodClient.createPaymentMethod({
data
})
```
#### Account linking for PH Direct Debit

const response: PaymentMethod = await xenditPaymentMethodClient.createPaymentMethod({ })
```typescript
import { PaymentMethodParameters, PaymentMethod } from 'xendit-node/payment_method/models'

const data: PaymentMethodParameters = {
"mobileNumber" : 628774494404,
"reusability" : "MULTIPLE_USE",
"type" : "DIRECT_DEBIT",
"directDebit" : {
"channelProperties" : {
"failureReturnUrl" : "https://redirect.me/failure",
"successReturnUrl" : "https://redirect.me/success"
},
"channelCode" : "BPI"
},
"email" : "testemail@email.com",
"customer" : {
"type" : "INDIVIDUAL",
"referenceId" : "customer-123",
"individualDetail" : {
"surname" : "Doe",
"givenNames" : "John"
}
}
}

const response: PaymentMethod = await xenditPaymentMethodClient.createPaymentMethod({
data
})
```
## Expires a payment method

Expand Down
122 changes: 117 additions & 5 deletions docs/PaymentRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,125 @@ const response: Capture = await xenditPaymentRequestClient.capturePaymentRequest
| data| | [PaymentRequestParameters](payment_request/models/PaymentRequestParameters.md) |

### Usage Examples
#### Minimum API Usage
#### E-Wallet One Time Payment via Redirect URL

```typescript
import { PaymentRequest } from 'xendit-node/payment_request/models'
import { PaymentRequestParameters, PaymentRequest } from 'xendit-node/payment_request/models'

const data: PaymentRequestParameters = {
"country" : "ID",
"amount" : 15000,
"paymentMethod" : {
"ewallet" : {
"channelProperties" : {
"successReturnUrl" : "https://redirect.me/success"
},
"channelCode" : "SHOPEEPAY"
},
"reusability" : "ONE_TIME_USE",
"type" : "EWALLET"
},
"currency" : "IDR",
"referenceId" : "example-ref-1234"
}

const response: PaymentRequest = await xenditPaymentRequestClient.createPaymentRequest({
data
})
```
#### Fixed amount dynamic QR

const response: PaymentRequest = await xenditPaymentRequestClient.createPaymentRequest({ })
```typescript
import { PaymentRequestParameters, PaymentRequest } from 'xendit-node/payment_request/models'

const data: PaymentRequestParameters = {
"amount" : 15000,
"metadata" : {
"sku" : "example-sku-1234"
},
"paymentMethod" : {
"qrCode" : {
"channelCode" : "“QRIS”"
},
"reusability" : "ONE_TIME_USE",
"type" : "QR_CODE"
},
"currency" : "IDR",
"referenceId" : "example-ref-1234"
}

const response: PaymentRequest = await xenditPaymentRequestClient.createPaymentRequest({
data
})
```
#### Fixed amount single use Virtual Account

```typescript
import { PaymentRequestParameters, PaymentRequest } from 'xendit-node/payment_request/models'

const data: PaymentRequestParameters = {
"country" : "ID",
"amount" : 15000,
"metadata" : {
"sku" : "example-sku-1234"
},
"paymentMethod" : {
"reusability" : "ONE_TIME_USE",
"type" : "VIRTUAL_ACCOUNT",
"virtualAccount" : {
"channelProperties" : {
"customerName" : "Ahmad Gunawan",
"expiresAt" : "2023-01-03T17:00:00Z"
},
"channelCode" : "BNI"
},
"referenceId" : "example-1234"
},
"currency" : "IDR",
"referenceId" : "example-ref-1234"
}

const response: PaymentRequest = await xenditPaymentRequestClient.createPaymentRequest({
data
})
```
#### Subsequent PH Direct Debit payments after account linking

```typescript
import { PaymentRequestParameters, PaymentRequest } from 'xendit-node/payment_request/models'

const data: PaymentRequestParameters = {
"amount" : 1500,
"metadata" : {
"sku" : "example-sku-1234"
},
"paymentMethodId" : "pm-9685a196-81e9-4c73-8d62-97df5aab2762",
"currency" : "PHP",
"referenceId" : "example-ref-1234"
}

const response: PaymentRequest = await xenditPaymentRequestClient.createPaymentRequest({
data
})
```
#### Subsequent tokenized E-Wallet payments after account linking

```typescript
import { PaymentRequestParameters, PaymentRequest } from 'xendit-node/payment_request/models'

const data: PaymentRequestParameters = {
"amount" : 15000,
"metadata" : {
"sku" : "example-sku-1234"
},
"paymentMethodId" : "pm-2b2c6092-2100-4843-a7fc-f5c7edac7efd",
"currency" : "IDR",
"referenceId" : "example-ref-1234"
}

const response: PaymentRequest = await xenditPaymentRequestClient.createPaymentRequest({
data
})
```
## Get all payment requests by filter

Expand Down Expand Up @@ -158,8 +272,6 @@ const response: PaymentRequest = await xenditPaymentRequestClient.getPaymentRequ
|-----------|:----------:|:----------:|
| paymentRequestId|| string |
| limit| | number |
| afterId| | string |
| beforeId| | string |
| idempotencyKey| | string |

### Usage Examples
Expand Down
6 changes: 6 additions & 0 deletions docs/invoice/models/BankCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@ Representing the available bank channels used for invoice-related transactions.

* `Bjb` (value: `'BJB'`)

* `SahabatSampoerna` (value: `'SAHABAT_SAMPOERNA'`)

* `Cimb` (value: `'CIMB'`)

* `Bnc` (value: `'BNC'`)


10 changes: 10 additions & 0 deletions docs/invoice/models/DirectDebitType.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,14 @@ Representing the available Direct Debit channels used for invoice-related transa

* `DdBcaKlikpay` (value: `'DD_BCA_KLIKPAY'`)

* `DdBdoEpay` (value: `'DD_BDO_EPAY'`)

* `DdRcbc` (value: `'DD_RCBC'`)

* `DdChinabank` (value: `'DD_CHINABANK'`)

* `BaChinabank` (value: `'BA_CHINABANK'`)

* `DcChinabank` (value: `'DC_CHINABANK'`)


6 changes: 6 additions & 0 deletions docs/invoice/models/EwalletType.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@ Representing the available eWallet channels used for invoice-related transaction

* `Grabpay` (value: `'GRABPAY'`)

* `Astrapay` (value: `'ASTRAPAY'`)

* `Nexcash` (value: `'NEXCASH'`)

* `Jeniuspay` (value: `'JENIUSPAY'`)


4 changes: 4 additions & 0 deletions docs/invoice/models/InvoiceCurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Representing the currency used for an invoice.

* `Usd` (value: `'USD'`)

* `Thb` (value: `'THB'`)

* `Vnd` (value: `'VND'`)

* `Php` (value: `'PHP'`)


5 changes: 4 additions & 1 deletion invoice/models/BankCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export const BankCode = {
Mandiri: 'MANDIRI',
Permata: 'PERMATA',
Bsi: 'BSI',
Bjb: 'BJB'
Bjb: 'BJB',
SahabatSampoerna: 'SAHABAT_SAMPOERNA',
Cimb: 'CIMB',
Bnc: 'BNC'
} as const;
export type BankCode = typeof BankCode[keyof typeof BankCode];

Expand Down
7 changes: 6 additions & 1 deletion invoice/models/DirectDebitType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ export const DirectDebitType = {
BcaKlikpay: 'BCA_KLIKPAY',
BaBcaKlikpay: 'BA_BCA_KLIKPAY',
DcBcaKlikpay: 'DC_BCA_KLIKPAY',
DdBcaKlikpay: 'DD_BCA_KLIKPAY'
DdBcaKlikpay: 'DD_BCA_KLIKPAY',
DdBdoEpay: 'DD_BDO_EPAY',
DdRcbc: 'DD_RCBC',
DdChinabank: 'DD_CHINABANK',
BaChinabank: 'BA_CHINABANK',
DcChinabank: 'DC_CHINABANK'
} as const;
export type DirectDebitType = typeof DirectDebitType[keyof typeof DirectDebitType];

Expand Down
5 changes: 4 additions & 1 deletion invoice/models/EwalletType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export const EwalletType = {
Paymaya: 'PAYMAYA',
Shopeepay: 'SHOPEEPAY',
Gcash: 'GCASH',
Grabpay: 'GRABPAY'
Grabpay: 'GRABPAY',
Astrapay: 'ASTRAPAY',
Nexcash: 'NEXCASH',
Jeniuspay: 'JENIUSPAY'
} as const;
export type EwalletType = typeof EwalletType[keyof typeof EwalletType];

Expand Down
2 changes: 2 additions & 0 deletions invoice/models/InvoiceCurrency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
export const InvoiceCurrency = {
Idr: 'IDR',
Usd: 'USD',
Thb: 'THB',
Vnd: 'VND',
Php: 'PHP'
} as const;
export type InvoiceCurrency = typeof InvoiceCurrency[keyof typeof InvoiceCurrency];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xendit-node",
"version": "3.1.0",
"version": "3.2.0",
"description": "OpenAPI client for xendit-node",
"author": "OpenAPI-Generator",
"repository": {
Expand Down
10 changes: 0 additions & 10 deletions payment_request/apis/PaymentRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ export interface GetPaymentRequestByIDRequest {
export interface GetPaymentRequestCapturesRequest {
paymentRequestId: string;
limit?: number;
afterId?: string;
beforeId?: string;
idempotencyKey?: string;
}

Expand Down Expand Up @@ -320,14 +318,6 @@ export class PaymentRequestApi extends runtime.BaseAPI {
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 + ":");

Expand Down
2 changes: 1 addition & 1 deletion runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.0';
headers['xendit-lib-ver'] = '3.2.0';

const initParams = {
method: context.method,
Expand Down

0 comments on commit 5c66e57

Please sign in to comment.