Skip to content

Commit f191fb4

Browse files
Merge pull request #126 from xendit/invoice-paramsUpdate
invoice-paramsUpdate
2 parents b725385 + 013ca1c commit f191fb4

6 files changed

Lines changed: 28 additions & 8 deletions

File tree

examples/with_async/card.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const authID = '5e0461a96113354249aab7ee';
1818
externalID: Date.now().toString(), // use your system's ID of the transaction
1919
capture: false,
2020
metadata: {
21-
test: "data",
21+
test: `data`,
2222
},
2323
});
2424
console.log('charge created:', charge); // eslint-disable-line no-console

integration_test/va.test.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@ const x = require('./xendit.test');
22

33
const VirtualAcc = x.VirtualAcc;
44
const va = new VirtualAcc({});
5-
6-
module.exports = function() {
5+
function sleepFor(sleepDuration){
6+
var now = new Date().getTime();
7+
while(new Date().getTime() < now + sleepDuration){ /* Do nothing */ }
8+
}
9+
module.exports = function () {
710
return va
811
.getVABanks()
912
.then(banks => {
1013
return va.createFixedVA({
11-
externalID: new Date().toLocaleString(),
14+
externalID: 'VA-' + new Date().toLocaleString(),
1215
bankCode: banks[0].code,
1316
name: 'Stanley Nguyen',
1417
isClosed: true,
1518
expectedAmt: 10000,
1619
});
1720
})
18-
.then(({ id }) => va.getFixedVA({ id }))
21+
.then(({ id }) => {
22+
sleepFor(3000);
23+
return va.getFixedVA({ id })
24+
})
1925
.then(({ id }) => {
2026
return va.updateFixedVA({
2127
id,

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xendit-node",
3-
"version": "1.19.1",
3+
"version": "1.19.2",
44
"description": "NodeJS client for Xendit API",
55
"main": "index.js",
66
"types": "index.d.ts",

src/invoice/invoice.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ export = class Invoice {
2323
currency?: string;
2424
midLabel?: string;
2525
forUserID?: string;
26+
reminderTimeUnit?: string;
27+
reminderTime?: number;
28+
locale?: string;
29+
shouldAuthenticateCreditCard?: boolean;
30+
withFeeRule?: string;
2631
}): Promise<object>;
2732
getInvoice(data: { invoiceID: string; forUserID?: string }): Promise<object>;
2833
expireInvoice(data: {

src/invoice/invoice.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ Invoice.prototype.createInvoice = function(data) {
3737
headers['for-user-id'] = data.forUserID;
3838
}
3939

40+
if (data && data.withFeeRule) {
41+
headers['with-fee-rule'] = data.withFeeRule;
42+
}
43+
4044
fetchWithHTTPErr(`${this.API_ENDPOINT}/v2/invoices`, {
4145
method: 'POST',
4246
headers,
@@ -58,6 +62,10 @@ Invoice.prototype.createInvoice = function(data) {
5862
customer_notification_preference: data.customerNotificationPreference,
5963
items: data.items,
6064
fees: data.fees,
65+
reminder_time_unit: data.reminderTimeUnit,
66+
reminder_time: data.reminderTime,
67+
locale: data.locale,
68+
should_authenticate_credit_card: data.shouldAuthenticateCreditCard,
6169
}),
6270
})
6371
.then(resolve)

0 commit comments

Comments
 (0)