diff --git a/examples/with_async/card.js b/examples/with_async/card.js index 0e09e20..7616ef1 100644 --- a/examples/with_async/card.js +++ b/examples/with_async/card.js @@ -18,7 +18,7 @@ const authID = '5e0461a96113354249aab7ee'; externalID: Date.now().toString(), // use your system's ID of the transaction capture: false, metadata: { - test: "data", + test: `data`, }, }); console.log('charge created:', charge); // eslint-disable-line no-console diff --git a/integration_test/va.test.js b/integration_test/va.test.js index 4ff1181..c62cc13 100644 --- a/integration_test/va.test.js +++ b/integration_test/va.test.js @@ -2,20 +2,26 @@ const x = require('./xendit.test'); const VirtualAcc = x.VirtualAcc; const va = new VirtualAcc({}); - -module.exports = function() { +function sleepFor(sleepDuration){ + var now = new Date().getTime(); + while(new Date().getTime() < now + sleepDuration){ /* Do nothing */ } +} +module.exports = function () { return va .getVABanks() .then(banks => { return va.createFixedVA({ - externalID: new Date().toLocaleString(), + externalID: 'VA-' + new Date().toLocaleString(), bankCode: banks[0].code, name: 'Stanley Nguyen', isClosed: true, expectedAmt: 10000, }); }) - .then(({ id }) => va.getFixedVA({ id })) + .then(({ id }) => { + sleepFor(3000); + return va.getFixedVA({ id }) + }) .then(({ id }) => { return va.updateFixedVA({ id, diff --git a/package-lock.json b/package-lock.json index c6ba547..46d03e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,12 @@ { "name": "xendit-node", - "version": "1.17.0", + "version": "1.19.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.15.0", + "name": "xendit-node", + "version": "1.19.1", "license": "MIT", "dependencies": { "node-fetch": "^2.6.1" diff --git a/package.json b/package.json index da976cc..d03b6de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xendit-node", - "version": "1.19.1", + "version": "1.19.2", "description": "NodeJS client for Xendit API", "main": "index.js", "types": "index.d.ts", diff --git a/src/invoice/invoice.d.ts b/src/invoice/invoice.d.ts index 28bb3ee..99bc5a5 100644 --- a/src/invoice/invoice.d.ts +++ b/src/invoice/invoice.d.ts @@ -23,6 +23,11 @@ export = class Invoice { currency?: string; midLabel?: string; forUserID?: string; + reminderTimeUnit?: string; + reminderTime?: number; + locale?: string; + shouldAuthenticateCreditCard?: boolean; + withFeeRule?: string; }): Promise; getInvoice(data: { invoiceID: string; forUserID?: string }): Promise; expireInvoice(data: { diff --git a/src/invoice/invoice.js b/src/invoice/invoice.js index e3cba9e..e9aee20 100644 --- a/src/invoice/invoice.js +++ b/src/invoice/invoice.js @@ -37,6 +37,10 @@ Invoice.prototype.createInvoice = function(data) { headers['for-user-id'] = data.forUserID; } + if (data && data.withFeeRule) { + headers['with-fee-rule'] = data.withFeeRule; + } + fetchWithHTTPErr(`${this.API_ENDPOINT}/v2/invoices`, { method: 'POST', headers, @@ -58,6 +62,10 @@ Invoice.prototype.createInvoice = function(data) { customer_notification_preference: data.customerNotificationPreference, items: data.items, fees: data.fees, + reminder_time_unit: data.reminderTimeUnit, + reminder_time: data.reminderTime, + locale: data.locale, + should_authenticate_credit_card: data.shouldAuthenticateCreditCard, }), }) .then(resolve)