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 15, 2023
1 parent 9a7e146 commit 98f2b95
Show file tree
Hide file tree
Showing 33 changed files with 211 additions and 163 deletions.
8 changes: 4 additions & 4 deletions 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.0.0-beta.1
* Package version: 3.0.0-beta.2

# Getting Started

Expand Down Expand Up @@ -49,12 +49,12 @@ const xenditClient = new Xendit({
# Documentation

Find detailed API information and examples for each of our product’s by clicking the links below,
* [PaymentRequest](docs/PaymentRequest.md)
* [Payout](docs/Payout.md)
* [BalanceAndTransaction](docs/BalanceAndTransaction.md)
* [Invoice](docs/Invoice.md)
* [PaymentRequest](docs/PaymentRequest.md)
* [PaymentMethod](docs/PaymentMethod.md)
* [Refund](docs/Refund.md)
* [Invoice](docs/Invoice.md)
* [Payout](docs/Payout.md)


Further Reading
Expand Down
42 changes: 42 additions & 0 deletions docs/Balance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## Balance
You can use the APIs below to interface with Xendit's `Balance` API.
To start using the API, you need to destruct instantiated Xendit client or directly import the module and set the secret key.

```typescript
import { Xendit, Balance as BalanceClient } from 'xendit-node';

const xenditClient = new Xendit({secretKey: YOUR_SECRET_KEY})
const { Balance } = xenditClient

const xenditBalanceClient = new BalanceClient({secretKey: YOUR_SECRET_KEY})

// At this point, `Balance` and `xenditBalanceClient` will have no usage difference, for example:
// Balance.
// or
// xenditBalanceClient.
```
## Retrieves balances for a business, default to CASH type


### Function Signature
| Name | Value |
|--------------------|:-------------:|
| Function Name | `getBalance` |
| Request Parameters | [GetBalanceRequest](#request-parameters--GetBalanceRequest) |
| Return Type | [Balance](balance_and_transaction/models/Balance.md) |

### Request Parameters — `GetBalanceRequest`
| Field Name | Required | Type |
|-----------|:----------:|:----------:|
| accountType| | 'CASH' | 'HOLDING' | 'TAX' |
| currency| | string |
| forUserId| | string |
| idempotencyKey| | string |

### Usage Examples
#### Minimum API Usage
```typescript
import { Balance } from 'xendit-node/balance_and_transaction/models'

const response: Balance = await xenditBalanceClient.getBalance({ })
```
9 changes: 4 additions & 5 deletions docs/Invoice.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ const { Invoice } = xenditClient
const xenditInvoiceClient = new InvoiceClient({secretKey: YOUR_SECRET_KEY})

// At this point, `Invoice` and `xenditInvoiceClient` will have no usage difference, for example:
// Invoice.createInvoice()
// Invoice.
// or
// xenditInvoiceClient.createInvoice()
// xenditInvoiceClient.
```

## Create an invoice


Expand Down Expand Up @@ -114,7 +113,7 @@ const response: Invoice = await xenditInvoiceClient.getInvoiceById({
| Field Name | Required | Type |
|-----------|:----------:|:----------:|
| externalId| | string |
| statuses| | []string |
| statuses| | [[]InvoiceStatus](invoice/models/InvoiceStatus.md) |
| limit| | number |
| createdAfter| | Date |
| createdBefore| | Date |
Expand All @@ -123,7 +122,7 @@ const response: Invoice = await xenditInvoiceClient.getInvoiceById({
| expiredAfter| | Date |
| expiredBefore| | Date |
| lastInvoice| | string |
| clientTypes| | []string |
| clientTypes| | [[]InvoiceClientType](invoice/models/InvoiceClientType.md) |
| paymentChannels| | []string |
| onDemandLink| | string |
| recurringPaymentId| | string |
Expand Down
5 changes: 2 additions & 3 deletions docs/PaymentMethod.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ const { PaymentMethod } = xenditClient
const xenditPaymentMethodClient = new PaymentMethodClient({secretKey: YOUR_SECRET_KEY})

// At this point, `PaymentMethod` and `xenditPaymentMethodClient` will have no usage difference, for example:
// PaymentMethod.authPaymentMethod()
// PaymentMethod.
// or
// xenditPaymentMethodClient.authPaymentMethod()
// xenditPaymentMethodClient.
```

## Validate a payment method\'s linking OTP


Expand Down
5 changes: 2 additions & 3 deletions docs/PaymentRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ const { PaymentRequest } = xenditClient
const xenditPaymentRequestClient = new PaymentRequestClient({secretKey: YOUR_SECRET_KEY})

// At this point, `PaymentRequest` and `xenditPaymentRequestClient` will have no usage difference, for example:
// PaymentRequest.authorizePaymentRequest()
// PaymentRequest.
// or
// xenditPaymentRequestClient.authorizePaymentRequest()
// xenditPaymentRequestClient.
```

## Payment Request Authorize


Expand Down
5 changes: 2 additions & 3 deletions docs/Payout.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ const { Payout } = xenditClient
const xenditPayoutClient = new PayoutClient({secretKey: YOUR_SECRET_KEY})

// At this point, `Payout` and `xenditPayoutClient` will have no usage difference, for example:
// Payout.cancelPayout()
// Payout.
// or
// xenditPayoutClient.cancelPayout()
// 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.


Expand Down
5 changes: 2 additions & 3 deletions docs/Refund.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ const { Refund } = xenditClient
const xenditRefundClient = new RefundClient({secretKey: YOUR_SECRET_KEY})

// At this point, `Refund` and `xenditRefundClient` will have no usage difference, for example:
// Refund.cancelRefund()
// Refund.
// or
// xenditRefundClient.cancelRefund()
// xenditRefundClient.
```

##


Expand Down
48 changes: 2 additions & 46 deletions docs/BalanceAndTransaction.md → docs/Transaction.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,3 @@
## Balance
You can use the APIs below to interface with Xendit's `Balance` API.
To start using the API, you need to destruct instantiated Xendit client or directly import the module and set the secret key.

```typescript
import { Xendit, Balance as BalanceClient } from 'xendit-node';

const xenditClient = new Xendit({secretKey: YOUR_SECRET_KEY})
const { Balance } = xenditClient

const xenditBalanceClient = new BalanceClient({secretKey: YOUR_SECRET_KEY})

// At this point, `Balance` and `xenditBalanceClient` will have no usage difference, for example:
// Balance.getBalance()
// or
// xenditBalanceClient.getBalance()
```

## Retrieves balances for a business, default to CASH type


### Function Signature
| Name | Value |
|--------------------|:-------------:|
| Function Name | `getBalance` |
| Request Parameters | [GetBalanceRequest](#request-parameters--GetBalanceRequest) |
| Return Type | [Balance](balance_and_transaction/models/Balance.md) |

### Request Parameters — `GetBalanceRequest`
| Field Name | Required | Type |
|-----------|:----------:|:----------:|
| accountType| | 'CASH' | 'HOLDING' | 'TAX' |
| currency| | string |
| forUserId| | string |
| idempotencyKey| | string |

### Usage Examples
#### Minimum API Usage
```typescript
import { Balance } from 'xendit-node/balance_and_transaction/models'

const response: Balance = await xenditBalanceClient.getBalance({ })
```
## Transaction
You can use the APIs below to interface with Xendit's `Transaction` API.
To start using the API, you need to destruct instantiated Xendit client or directly import the module and set the secret key.
Expand All @@ -54,11 +11,10 @@ const { Transaction } = xenditClient
const xenditTransactionClient = new TransactionClient({secretKey: YOUR_SECRET_KEY})

// At this point, `Transaction` and `xenditTransactionClient` will have no usage difference, for example:
// Transaction.getAllTransactions()
// Transaction.
// or
// xenditTransactionClient.getAllTransactions()
// xenditTransactionClient.
```

## Get a list of transactions


Expand Down
12 changes: 12 additions & 0 deletions docs/invoice/models/AlternativeDisplayItem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# AlternativeDisplayItem

An object representing alternative display of a VA.

## Properties

| Name | Type | Required | Description |
| ------------ | ------------- | ------------- | ------------- |
| **type** | string | | Represent type of alternative display. |
**value** | string | | Represent value of alternative display value. |


1 change: 1 addition & 0 deletions docs/invoice/models/Bank.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ An object representing bank details for invoices.
**bankAccountNumber** | string | | The bank account number. |
**accountHolderName** | string | ✅ | The name of the account holder. |
**transferAmount** | number | | The transfer amount. |
**alternativeDisplays** | [[]AlternativeDisplayItem](AlternativeDisplayItem.md) | | |


1 change: 0 additions & 1 deletion docs/invoice/models/CreateInvoiceRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ An object representing for an invoice creation request.
**amount** | number | ✅ | The invoice amount. |
**payerEmail** | string | | The email address of the payer. |
**description** | string | | A description of the payment. |
**clientType** | string | | The client type (internal use). |
**invoiceDuration** | string | | The duration of the invoice. |
**callbackVirtualAccountId** | string | | The ID of the callback virtual account. |
**shouldSendEmail** | boolean | | Indicates whether email notifications should be sent. |
Expand Down
2 changes: 0 additions & 2 deletions docs/invoice/models/Invoice.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ An object representing details for an invoice.
| **id** | string | | The unique identifier for the invoice. |
**externalId** | string | ✅ | The external identifier for the invoice. |
**userId** | string | ✅ | The user ID associated with the invoice. |
**isHigh** | boolean | ✅ | Indicates if it\'s a high-value invoice. |
**payerEmail** | string | | The email address of the payer. |
**description** | string | | A description of the invoice. |
**paymentMethod** | [InvoicePaymentMethod](InvoicePaymentMethod.md) | | |
Expand All @@ -28,7 +27,6 @@ An object representing details for an invoice.
**availablePaylaters** | [[]Paylater](Paylater.md) | ✅ | An array of available pay-later options for payment. |
**shouldExcludeCreditCard** | boolean | | Indicates whether credit card payments should be excluded. |
**shouldSendEmail** | boolean | ✅ | Indicates whether email notifications should be sent. |
**clientType** | [InvoiceClientType](InvoiceClientType.md) | ✅ | |
**created** | Date | ✅ | Representing a date and time in ISO 8601 format. |
**updated** | Date | ✅ | Representing a date and time in ISO 8601 format. |
**successRedirectUrl** | string | | The URL to redirect to on successful payment. |
Expand Down
2 changes: 0 additions & 2 deletions docs/invoice/models/InvoiceClientType.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ Representing the client type or source of an invoice.

* `Mobile` (value: `'MOBILE'`)

* `Storefront` (value: `'STOREFRONT'`)


4 changes: 0 additions & 4 deletions docs/invoice/models/InvoiceStatus.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@ Representing the status of an invoice.

* `Pending` (value: `'PENDING'`)

* `Completing` (value: `'COMPLETING'`)

* `Paid` (value: `'PAID'`)

* `Settled` (value: `'SETTLED'`)

* `Expired` (value: `'EXPIRED'`)

* `Reminder` (value: `'REMINDER'`)


8 changes: 8 additions & 0 deletions docs/payment_method/models/EWalletChannelCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,12 @@ EWallet Channel Code

* `Zalopay` (value: `'ZALOPAY'`)

* `Wechatpay` (value: `'WECHATPAY'`)

* `Linepay` (value: `'LINEPAY'`)

* `Truemoney` (value: `'TRUEMONEY'`)

* `Alipay` (value: `'ALIPAY'`)


2 changes: 2 additions & 0 deletions docs/payment_method/models/VirtualAccountChannelCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ Virtual Account Channel Code

* `Msb` (value: `'MSB'`)

* `StandardChartered` (value: `'STANDARD_CHARTERED'`)


2 changes: 2 additions & 0 deletions docs/payment_request/models/VirtualAccountChannelCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ Virtual Account Channel Code

* `Msb` (value: `'MSB'`)

* `StandardChartered` (value: `'STANDARD_CHARTERED'`)


2 changes: 2 additions & 0 deletions docs/payout/models/ChannelCategory.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Category of channel code, as some channels might require more fields during proc

* `Ewallet` (value: `'EWALLET'`)

* `Otc` (value: `'OTC'`)


32 changes: 16 additions & 16 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@
/* eslint-disable */
export * from './runtime';

import { PaymentRequest } from './payment_request';
export { PaymentRequest } from './payment_request';

import { Payout } from './payout';
export { Payout } from './payout';

import { Transaction, Balance } from './balance_and_transaction';
export { Transaction, Balance } from './balance_and_transaction';

import { Invoice } from './invoice';
export { Invoice } from './invoice';
import { PaymentRequest } from './payment_request';
export { PaymentRequest } from './payment_request';

import { PaymentMethod } from './payment_method';
export { PaymentMethod } from './payment_method';

import { Refund } from './refund';
export { Refund } from './refund';

import { Invoice } from './invoice';
export { Invoice } from './invoice';

import { Payout } from './payout';
export { Payout } from './payout';


export interface XenditOpts {
secretKey: string;
xenditURL?: string;
}
export class Xendit {
opts: XenditOpts;
PaymentRequest: PaymentRequest;
Payout: Payout;
Transaction: Transaction;
Balance: Balance;
Invoice: Invoice;
PaymentRequest: PaymentRequest;
PaymentMethod: PaymentMethod;
Refund: Refund;
Invoice: Invoice;
Payout: Payout;


constructor({ secretKey: _secretKey, xenditURL: _xenditURL }: XenditOpts) {
Expand All @@ -54,19 +54,19 @@ export class Xendit {
}


this.PaymentRequest = new PaymentRequest(this.opts);

this.Payout = new Payout(this.opts);

this.Transaction = new Transaction(this.opts);
this.Balance = new Balance(this.opts);

this.Invoice = new Invoice(this.opts);
this.PaymentRequest = new PaymentRequest(this.opts);

this.PaymentMethod = new PaymentMethod(this.opts);

this.Refund = new Refund(this.opts);

this.Invoice = new Invoice(this.opts);

this.Payout = new Payout(this.opts);

}
}

Expand Down
Loading

0 comments on commit 98f2b95

Please sign in to comment.