Repository navigation
Expand file tree
/
Copy pathexample.js
More file actions
58 lines (38 loc) · 1.46 KB
/
Copy pathexample.js
File metadata and controls
58 lines (38 loc) · 1.46 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { ReservedAccount } from "./src/collection.js";
import { Transaction } from "./src/collection.js";
const inst = new ReservedAccount('sandbox')
const instance = new Transaction('sandbox')
//const inst1 = new ReservedAccount('sandbox')
let payload = {"customerName":"Tester","customerEmail":"tester@tester.com",
"amount":2000,"paymentDescription":"Hello World","accountName":"benji"};
//console.log(instance.isTokenSet)
//console.log(await instance.getToken(true))
/*function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
for(let i=0;i<11;i=i+1){
await new Promise(resolve => setTimeout(resolve, 10000));
console.log(await instance.getToken(true))
}*/
const [codes,token] = await instance.getToken()
const [rCode,resp] = await instance.initTransaction(
token,
payload.amount,
payload.customerName,
payload.customerEmail,
payload.paymentDescription,{paymentMethods:["CARD"],metaData:{phoneNumber:"08088523241"}})
/*
const [rCodes,resps] = await inst.createReservedAccount(
token,
payload.customerName,
payload.customerEmail,
payload.accountName,
{preferredBanks:["035"],getAllAvailableBanks:false})
*/
const [code,resp] = await inst.reservedAccountTransactions(token,'e2dcf09daa9ceb877ffdb97c2f3c915fcf3b83f9')
//console.log(token)
//console.log(resp)
console.log(resp)
//const [code,response] = await instance.createReservedAccountV2(token,'test','test@tester.com','test')