forked from xendit/xendit-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathva.js
37 lines (31 loc) · 993 Bytes
/
va.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const x = require('../xendit');
const VirtualAcc = x.VirtualAcc;
const va = new VirtualAcc({});
(async function() {
try {
const banks = await va.getVABanks();
console.log('available va banks:', banks); // eslint-disable-line no-console
const fixedAcc = await va.createFixedVA({
externalID: '123',
bankCode: banks[0].code,
name: 'Stanley Nguyen',
});
// eslint-disable-next-line no-console
console.log('fixed va created:', fixedAcc);
const { id } = fixedAcc;
const retrievedAcc = await va.getFixedVA({ id });
// eslint-disable-next-line no-console
console.log('fixed va details:', retrievedAcc);
const updatedAcc = await va.updateFixedVA({
id,
suggestedAmt: 20,
expectedAmt: 30,
});
// eslint-disable-next-line no-console
console.log('updated va details:', updatedAcc);
process.exit(0);
} catch (e) {
console.error(e); // eslint-disable-line no-console
process.exit(1);
}
})();