xendit-node
Advanced tools
Comparing version 1.21.0 to 1.21.1
@@ -8,5 +8,15 @@ const x = require('../xendit'); | ||
// https://docs.xendit.co/xenpayments/payments-credit-cards-overview/credit-cards-integration-and-testing/collecting-card-details-tokenization/index.html | ||
const tokenID = '5e0461a86113354249aab7ec'; | ||
const authID = '5e0461a96113354249aab7ee'; | ||
// You can generate sample token/authentication data and replace it below | ||
// https://js.xendit.co/test_tokenize.html | ||
// https://js.xendit.co/test_authenticate.html | ||
const tokenID = '623d394d672113001b79c1a1'; | ||
const authID = '623d394d672113001b79c1a2'; | ||
function sleepFor(sleepDuration) { | ||
var now = new Date().getTime(); | ||
while (new Date().getTime() < now + sleepDuration) { | ||
/* Do nothing */ | ||
} | ||
} | ||
(async function() { | ||
@@ -28,3 +38,3 @@ try { | ||
const capture = await card.captureCharge({ | ||
chargeID: id, | ||
chargeID: charge.id, | ||
amount: 10000, | ||
@@ -34,5 +44,7 @@ }); | ||
sleepFor(3000); | ||
const refund = await card.createRefund({ | ||
chargeID: id, | ||
externalID: external_id, | ||
chargeID: charge.id, | ||
externalID: charge.external_id, | ||
amount: 5000, | ||
@@ -51,4 +63,4 @@ }); | ||
maxDiscountAmount: 5000, | ||
startTime: '2022-03-25T00:00:00.000Z', | ||
endTime: '2022-05-25T00:00:00.000Z', | ||
startTime: '2022-01-25T00:00:00.000Z', | ||
endTime: '2023-01-25T00:00:00.000Z', | ||
}); | ||
@@ -55,0 +67,0 @@ // eslint-disable-next-line max-len |
@@ -34,24 +34,2 @@ const x = require('../xendit'); | ||
console.log('retrieved customers', customers); | ||
customer = await c.updateCustomer({ | ||
id: customer.id, | ||
description: 'customer dummy', | ||
phoneNumber: '+628987654321', | ||
nationality: 'ID', | ||
dateOfBirth: '2000-06-13', | ||
addresses: [ | ||
{ | ||
streetLine1: 'jalan raya', | ||
country: 'ID', | ||
city: 'Jakarta', | ||
}, | ||
{ | ||
streetLine1: 'jalan raya 2', | ||
country: 'ID', | ||
city: 'Jakarta', | ||
}, | ||
], | ||
apiVersion: '2020-05-19', | ||
}); | ||
console.log('updated customer', customer); //eslint-disable-line no-console | ||
} catch (e) { | ||
@@ -58,0 +36,0 @@ console.error(e); // eslint-disable-line no-console |
@@ -18,2 +18,3 @@ const x = require('../xendit'); | ||
addresses: [], | ||
apiVersion: '2020-05-19', | ||
}); | ||
@@ -20,0 +21,0 @@ |
@@ -30,3 +30,3 @@ const x = require('../xendit'); | ||
amount: 1, | ||
sourceUserID: '5df358652ebad7084a70ac6c', | ||
sourceUserID: '623d3cda7012f7478e9a7e69', | ||
destinationUserID: account.user_id, | ||
@@ -33,0 +33,0 @@ }); |
@@ -8,5 +8,15 @@ const x = require('../xendit'); | ||
// https://docs.xendit.co/xenpayments/payments-credit-cards-overview/credit-cards-integration-and-testing/collecting-card-details-tokenization/index.html | ||
const tokenID = '5e0461a86113354249aab7ec'; | ||
const authID = '5e0461a96113354249aab7ee'; | ||
// You can generate sample token/authentication data and replace it below | ||
// https://js.xendit.co/test_tokenize.html | ||
// https://js.xendit.co/test_authenticate.html | ||
const tokenID = '6201f056382ab2001b4bc3d6'; | ||
const authID = '6205f8dcca71c0001bc26ae6'; | ||
function sleepFor(sleepDuration) { | ||
var now = new Date().getTime(); | ||
while (new Date().getTime() < now + sleepDuration) { | ||
/* Do nothing */ | ||
} | ||
} | ||
card | ||
@@ -33,2 +43,3 @@ .createCharge({ | ||
console.log('charge captured:', r); // eslint-disable-line no-console | ||
sleepFor(3000); | ||
return r; | ||
@@ -35,0 +46,0 @@ }) |
@@ -36,28 +36,2 @@ const x = require('../xendit'); | ||
}) | ||
.then(r => | ||
c.updateCustomer({ | ||
id: r.id, | ||
description: 'customer dummy', | ||
phoneNumber: '+628987654321', | ||
nationality: 'ID', | ||
dateOfBirth: '2000-06-13', | ||
addresses: [ | ||
{ | ||
streetLine1: 'jalan raya', | ||
country: 'ID', | ||
city: 'Jakarta', | ||
}, | ||
{ | ||
streetLine1: 'jalan raya 2', | ||
country: 'ID', | ||
city: 'Jakarta', | ||
}, | ||
], | ||
apiVersion: '2020-05-19', | ||
}), | ||
) | ||
.then(r => { | ||
console.log('updated customer', r); // eslint-disable-line no-console | ||
return r; | ||
}) | ||
.catch(e => { | ||
@@ -64,0 +38,0 @@ console.error(e); // eslint-disable-line no-console |
@@ -16,2 +16,3 @@ const x = require('../xendit'); | ||
addresses: [], | ||
apiVersion: '2020-05-19', | ||
}) | ||
@@ -18,0 +19,0 @@ .then(r => |
@@ -5,6 +5,6 @@ const x = require('./xendit.test'); | ||
const card = new Card({}); | ||
// 5e046a736113354249aab8bd old charge | ||
module.exports = function() { | ||
return card | ||
.getCharge({ chargeID: '5e046a736113354249aab8bd' }) | ||
.getCharge({ chargeID: '623d397a360c32001b0aeeda' }) | ||
.then(() => | ||
@@ -11,0 +11,0 @@ card.createPromotion({ |
@@ -17,26 +17,6 @@ const x = require('./xendit.test'); | ||
addresses: [], | ||
apiVersion: '2020-05-19', | ||
}) | ||
.then(r => c.getCustomer({ id: r.id })) | ||
.then(r => c.getCustomerByReferenceID({ referenceID: r.reference_id })) | ||
.then(r => | ||
c.updateCustomer({ | ||
id: r[0].id, | ||
description: 'customer dummy', | ||
phoneNumber: '+628987654321', | ||
nationality: 'ID', | ||
dateOfBirth: '2000-06-13', | ||
addresses: [ | ||
{ | ||
streetLine1: 'jalan raya', | ||
country: 'ID', | ||
city: 'Jakarta', | ||
}, | ||
{ | ||
streetLine1: 'jalan raya 2', | ||
country: 'ID', | ||
city: 'Jakarta', | ||
}, | ||
], | ||
}), | ||
) | ||
.then(() => { | ||
@@ -43,0 +23,0 @@ // eslint-disable-next-line no-console |
@@ -18,2 +18,3 @@ const x = require('./xendit.test'); | ||
addresses: [], | ||
apiVersion: '2020-05-19', | ||
}) | ||
@@ -20,0 +21,0 @@ .then(r => |
@@ -11,3 +11,3 @@ console.log('Starting Integration Test...'); // eslint-disable-line no-console | ||
require('./retail_outlet.test')(), | ||
require('./ewallet.test')(), | ||
// require('./ewallet.test')(), | ||
require('./qr_code.test')(), | ||
@@ -14,0 +14,0 @@ require('./platform.test')(), |
@@ -15,5 +15,5 @@ const x = require('./xendit.test'); | ||
}) | ||
.then(({ user_id }) => | ||
.then(r => | ||
p.setCallbackURL({ | ||
forUserID: user_id, | ||
forUserID: r.user_id, | ||
type: 'invoice', | ||
@@ -23,8 +23,8 @@ url: 'https://httpstat.us/200', | ||
) | ||
.then(({ user_id }) => | ||
.then(r => | ||
p.createTransfer({ | ||
reference: `example+${Date.now().toString()}`, | ||
amount: 1, | ||
sourceUserID: '5df358652ebad7084a70ac6c', | ||
destinationUserID: user_id, | ||
sourceUserID: '623d3cda7012f7478e9a7e69', | ||
destinationUserID: r.user_id, | ||
}), | ||
@@ -31,0 +31,0 @@ ) |
{ | ||
"name": "xendit-node", | ||
"version": "1.21.0", | ||
"version": "1.21.1", | ||
"description": "NodeJS client for Xendit API", | ||
@@ -13,3 +13,3 @@ "main": "index.js", | ||
"format": "prettier --config .prettierrc --write index.js ./**/*.{js,json,ts}", | ||
"gentoc": "markdown-toc -i README.md", | ||
"gentoc": "markdown-toc -i --bullets=- README.md", | ||
"release": "np", | ||
@@ -39,3 +39,3 @@ "report": "nyc -r text -r lcov npm run test", | ||
"README.md": [ | ||
"markdown-toc -i", | ||
"markdown-toc -i --bullets=-", | ||
"git add" | ||
@@ -42,0 +42,0 @@ ] |
211
README.md
@@ -19,102 +19,102 @@ # Xendit API Node.js Client | ||
- [Usage](#usage) | ||
* [Card Services](#card-services) | ||
+ [Create charge](#create-charge) | ||
+ [Capture charge](#capture-charge) | ||
+ [Get charge](#get-charge) | ||
+ [Create authorization](#create-authorization) | ||
+ [Reverse authorization](#reverse-authorization) | ||
+ [Create refund](#create-refund) | ||
+ [Create promotion](#create-promotion) | ||
* [Virtual Account Services](#virtual-account-services) | ||
+ [Get banks with available virtual account service](#get-banks-with-available-virtual-account-service) | ||
+ [Create a fixed virtual account](#create-a-fixed-virtual-account) | ||
+ [Get details of your fixed virtual account](#get-details-of-your-fixed-virtual-account) | ||
+ [Update details of your fixed virtual account](#update-details-of-your-fixed-virtual-account) | ||
+ [Get details of a VA payment](#get-details-of-a-va-payment) | ||
* [Disbursement Services](#disbursement-services) | ||
+ [Get banks with available disbursement service](#get-banks-with-available-disbursement-service) | ||
+ [Create a disbursement](#create-a-disbursement) | ||
+ [Create a batch of disbursements](#create-a-batch-of-disbursements) | ||
+ [Get a disbursement by ID](#get-a-disbursement-by-id) | ||
* [Invoice Services](#invoice-services) | ||
+ [Create an invoice](#create-an-invoice) | ||
+ [Get an invoice](#get-an-invoice) | ||
+ [Expire an invoice](#expire-an-invoice) | ||
+ [Get all invoices](#get-all-invoices) | ||
* [Recurring Payments Services](#recurring-payments-services) | ||
+ [Create recurring payment](#create-recurring-payment) | ||
+ [Get recurring payment](#get-recurring-payment) | ||
+ [Edit recurring payment](#edit-recurring-payment) | ||
+ [Stop recurring payment](#stop-recurring-payment) | ||
+ [Pause recurring payment](#pause-recurring-payment) | ||
+ [Resume recurring payment](#resume-recurring-payment) | ||
* [Recurring Services](#recurring-services) | ||
+ [Create recurring schedule](#create-recurring-schedule) | ||
+ [Edit recurring schedule](#edit-recurring-schedule) | ||
+ [Get recurring schedule](#get-recurring-schedule) | ||
+ [Create recurring plan](#create-recurring-plan) | ||
+ [Create recurring plan with schedule](#create-recurring-plan-with-schedule) | ||
+ [Edit recurring plan](#edit-recurring-plan) | ||
+ [Get recurring plan](#get-recurring-plan) | ||
+ [Deactivate recurring plan](#deactivate-recurring-plan) | ||
+ [Edit recurring cycle](#edit-recurring-cycle) | ||
+ [Get recurring cycle](#get-recurring-cycle) | ||
+ [Get all recurring cycles](#get-all-recurring-cycles) | ||
+ [Cancel recurring cycle](#cancel-recurring-cycle) | ||
* [Payout Services](#payout-services) | ||
+ [Create a payout](#create-a-payout) | ||
+ [Get a payout](#get-a-payout) | ||
+ [Void a payout](#void-a-payout) | ||
* [EWallet Services](#ewallet-services) | ||
+ [Create payment](#create-payment) | ||
+ [Get payment](#get-payment) | ||
+ [Create an ewallet charge](#create-an-ewallet-charge) | ||
+ [Get an ewallet charge status](#get-an-ewallet-charge-status) | ||
+ [Void an ewallet charge](#void-an-ewallet-charge) | ||
+ [Initialize tokenization](#initialize-tokenization) | ||
+ [Unlink tokenization](#unlink-tokenization) | ||
+ [Create payment method (E-Wallet)](#create-payment-method-e-wallet) | ||
+ [Get payment methods by customer ID (E-Wallet)](#get-payment-methods-by-customer-id-e-wallet) | ||
* [Balance Services](#balance-services) | ||
+ [Get balance](#get-balance) | ||
* [Retail Outlet Services](#retail-outlet-services) | ||
+ [Create fixed payment code](#create-fixed-payment-code) | ||
+ [Get fixed payment code](#get-fixed-payment-code) | ||
+ [Get payments by fixed payment code ID](#get-payments-by-fixed-payment-code-id) | ||
+ [Update fixed payment code](#update-fixed-payment-code) | ||
+ [Simulate payment for RO (only in dev mode)](#simulate-payment-for-ro-only-in-dev-mode) | ||
* [QR Code Services](#qr-code-services) | ||
+ [Create code](#create-code) | ||
+ [Get code](#get-code) | ||
+ [Simulate payment for QR (only in dev mode)](#simulate-payment-for-qr-only-in-dev-mode) | ||
+ [Get payments by external ID](#get-payments-by-external-id) | ||
* [Customer services](#customer-services) | ||
+ [Create customer](#create-customer) | ||
+ [Get customer](#get-customer) | ||
+ [Get customer by reference ID](#get-customer-by-reference-id) | ||
+ [Update customer](#update-customer) | ||
* [Direct debit services](#direct-debit-services) | ||
+ [Initialize linked account tokenization](#initialize-linked-account-tokenization) | ||
+ [Validate OTP for Linked Account Token](#validate-otp-for-linked-account-token) | ||
+ [Retrieve accessible accounts by linked account token](#retrieve-accessible-accounts-by-linked-account-token) | ||
+ [Create payment method (Direct Debit)](#create-payment-method-direct-debit) | ||
+ [Get payment methods by customer ID (Direct Debit)](#get-payment-methods-by-customer-id-direct-debit) | ||
+ [Create direct debit payment](#create-direct-debit-payment) | ||
+ [Validate OTP for direct debit payment](#validate-otp-for-direct-debit-payment) | ||
+ [Get direct debit payment status by ID](#get-direct-debit-payment-status-by-id) | ||
+ [Get direct debit payment status by reference ID](#get-direct-debit-payment-status-by-reference-id) | ||
* [Report Service](#report-service) | ||
+ [Generate Report](#generate-report) | ||
+ [Get Report](#get-report) | ||
* [Transaction Service](#transaction-service) | ||
+ [Get Transaction](#get-transaction) | ||
+ [List Transactions](#list-transactions) | ||
* [XenPlatform Service](#xenplatform-service) | ||
+ [Create sub-account](#create-sub-account) | ||
+ [Create sub-account using V2](#create-sub-account-using-v2) | ||
+ [Get sub-account by ID](#get-sub-account-by-id) | ||
+ [Update sub-account](#update-sub-account) | ||
+ [Set Callback URL](#set-callback-url) | ||
+ [Create transfers](#create-transfers) | ||
+ [Create fee rules](#create-fee-rules) | ||
- [Card Services](#card-services) | ||
- [Create charge](#create-charge) | ||
- [Capture charge](#capture-charge) | ||
- [Get charge](#get-charge) | ||
- [Create authorization](#create-authorization) | ||
- [Reverse authorization](#reverse-authorization) | ||
- [Create refund](#create-refund) | ||
- [Create promotion](#create-promotion) | ||
- [Virtual Account Services](#virtual-account-services) | ||
- [Get banks with available virtual account service](#get-banks-with-available-virtual-account-service) | ||
- [Create a fixed virtual account](#create-a-fixed-virtual-account) | ||
- [Get details of your fixed virtual account](#get-details-of-your-fixed-virtual-account) | ||
- [Update details of your fixed virtual account](#update-details-of-your-fixed-virtual-account) | ||
- [Get details of a VA payment](#get-details-of-a-va-payment) | ||
- [Disbursement Services](#disbursement-services) | ||
- [Get banks with available disbursement service](#get-banks-with-available-disbursement-service) | ||
- [Create a disbursement](#create-a-disbursement) | ||
- [Create a batch of disbursements](#create-a-batch-of-disbursements) | ||
- [Get a disbursement by ID](#get-a-disbursement-by-id) | ||
- [Invoice Services](#invoice-services) | ||
- [Create an invoice](#create-an-invoice) | ||
- [Get an invoice](#get-an-invoice) | ||
- [Expire an invoice](#expire-an-invoice) | ||
- [Get all invoices](#get-all-invoices) | ||
- [Recurring Payments Services](#recurring-payments-services) | ||
- [Create recurring payment](#create-recurring-payment) | ||
- [Get recurring payment](#get-recurring-payment) | ||
- [Edit recurring payment](#edit-recurring-payment) | ||
- [Stop recurring payment](#stop-recurring-payment) | ||
- [Pause recurring payment](#pause-recurring-payment) | ||
- [Resume recurring payment](#resume-recurring-payment) | ||
- [Recurring Services](#recurring-services) | ||
- [Create recurring schedule](#create-recurring-schedule) | ||
- [Edit recurring schedule](#edit-recurring-schedule) | ||
- [Get recurring schedule](#get-recurring-schedule) | ||
- [Create recurring plan](#create-recurring-plan) | ||
- [Create recurring plan with schedule](#create-recurring-plan-with-schedule) | ||
- [Edit recurring plan](#edit-recurring-plan) | ||
- [Get recurring plan](#get-recurring-plan) | ||
- [Deactivate recurring plan](#deactivate-recurring-plan) | ||
- [Edit recurring cycle](#edit-recurring-cycle) | ||
- [Get recurring cycle](#get-recurring-cycle) | ||
- [Get all recurring cycles](#get-all-recurring-cycles) | ||
- [Cancel recurring cycle](#cancel-recurring-cycle) | ||
- [Payout Services](#payout-services) | ||
- [Create a payout](#create-a-payout) | ||
- [Get a payout](#get-a-payout) | ||
- [Void a payout](#void-a-payout) | ||
- [EWallet Services [SOON TO BE DEPRECATED - MAR 31 2022]](#ewallet-services-soon-to-be-deprecated---mar-31-2022) | ||
- [Create payment](#create-payment) | ||
- [Get payment](#get-payment) | ||
- [Create an ewallet charge](#create-an-ewallet-charge) | ||
- [Get an ewallet charge status](#get-an-ewallet-charge-status) | ||
- [Void an ewallet charge](#void-an-ewallet-charge) | ||
- [Initialize tokenization](#initialize-tokenization) | ||
- [Unlink tokenization](#unlink-tokenization) | ||
- [Create payment method (E-Wallet)](#create-payment-method-e-wallet) | ||
- [Get payment methods by customer ID (E-Wallet)](#get-payment-methods-by-customer-id-e-wallet) | ||
- [Balance Services](#balance-services) | ||
- [Get balance](#get-balance) | ||
- [Retail Outlet Services](#retail-outlet-services) | ||
- [Create fixed payment code](#create-fixed-payment-code) | ||
- [Get fixed payment code](#get-fixed-payment-code) | ||
- [Get payments by fixed payment code ID](#get-payments-by-fixed-payment-code-id) | ||
- [Update fixed payment code](#update-fixed-payment-code) | ||
- [Simulate payment for RO (only in dev mode)](#simulate-payment-for-ro-only-in-dev-mode) | ||
- [QR Code Services](#qr-code-services) | ||
- [Create code](#create-code) | ||
- [Get code](#get-code) | ||
- [Simulate payment for QR (only in dev mode)](#simulate-payment-for-qr-only-in-dev-mode) | ||
- [Get payments by external ID](#get-payments-by-external-id) | ||
- [Customer services](#customer-services) | ||
- [Create customer](#create-customer) | ||
- [Get customer](#get-customer) | ||
- [Get customer by reference ID](#get-customer-by-reference-id) | ||
- [Update customer](#update-customer) | ||
- [Direct debit services](#direct-debit-services) | ||
- [Initialize linked account tokenization](#initialize-linked-account-tokenization) | ||
- [Validate OTP for Linked Account Token](#validate-otp-for-linked-account-token) | ||
- [Retrieve accessible accounts by linked account token](#retrieve-accessible-accounts-by-linked-account-token) | ||
- [Create payment method (Direct Debit)](#create-payment-method-direct-debit) | ||
- [Get payment methods by customer ID (Direct Debit)](#get-payment-methods-by-customer-id-direct-debit) | ||
- [Create direct debit payment](#create-direct-debit-payment) | ||
- [Validate OTP for direct debit payment](#validate-otp-for-direct-debit-payment) | ||
- [Get direct debit payment status by ID](#get-direct-debit-payment-status-by-id) | ||
- [Get direct debit payment status by reference ID](#get-direct-debit-payment-status-by-reference-id) | ||
- [Report Service](#report-service) | ||
- [Generate Report](#generate-report) | ||
- [Get Report](#get-report) | ||
- [Transaction Service](#transaction-service) | ||
- [Get Transaction](#get-transaction) | ||
- [List Transactions](#list-transactions) | ||
- [XenPlatform Service](#xenplatform-service) | ||
- [Create sub-account](#create-sub-account) | ||
- [Create sub-account using V2](#create-sub-account-using-v2) | ||
- [Get sub-account by ID](#get-sub-account-by-id) | ||
- [Update sub-account](#update-sub-account) | ||
- [Set Callback URL](#set-callback-url) | ||
- [Create transfers](#create-transfers) | ||
- [Create fee rules](#create-fee-rules) | ||
- [Contributing](#contributing) | ||
@@ -640,2 +640,3 @@ | ||
``` | ||
### Recurring Services | ||
@@ -748,2 +749,3 @@ | ||
#### Create recurring plan with schedule | ||
```ts | ||
@@ -885,4 +887,7 @@ r.createPlan(data: { | ||
### EWallet Services | ||
### EWallet Services [SOON TO BE DEPRECATED - MAR 31 2022] | ||
Deprecation notice here: <https://docs.xendit.co/api-deprecation/2019-ewallet> | ||
We will continue working on developing the SDK to support the new EWallet service | ||
Instanitiate EWallet service using constructor that has been injected with Xendit keys | ||
@@ -1447,3 +1452,3 @@ | ||
t.getTransaction({ | ||
id: "txn_123" | ||
id: 'txn_123', | ||
}) | ||
@@ -1455,3 +1460,3 @@ .then(res => { | ||
console.error(`Get Transaction Failed with Error: ${e.message}`); | ||
}) | ||
}); | ||
``` | ||
@@ -1458,0 +1463,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1614
246799
6831