forked from xendit/xendit-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransaction.js
More file actions
32 lines (29 loc) · 931 Bytes
/
Copy pathtransaction.js
File metadata and controls
32 lines (29 loc) · 931 Bytes
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
const x = require('../xendit');
const { Transaction } = x;
const t = new Transaction({});
(async function() {
try {
const listTransactions = await t.listTransactions({
types: ['DISBURSEMENT', 'PAYMENT'],
statuses: ['PENDING', 'SUCCESS'],
channelCategories: ['BANK'],
createdDateFrom: new Date(
new Date().getTime() - 30 * 24 * 60 * 60 * 1000,
),
createdDateTo: new Date(),
});
// eslint-disable-next-line no-console
console.log('list transactions', listTransactions);
/* Will fail if there is no transaction data in the time period */
const getTransaction = await t.getTransaction({
id: listTransactions.data[0].id,
});
// eslint-disable-next-line no-console
console.log('get transaction', getTransaction);
process.exit(0);
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
process.exit(1);
}
})();