-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
Description
Hi all,
I'm using this SDK with the demo credentials.
I was trying to test the payment, with this snippet:
const submitPayment = (accessToken, payment, tanSchemeId, state, redirectUri) => {
return new Promise((resolve, reject) => {
const session = new figo.Session(accessToken);
session.submit_payment(payment, tanSchemeId, state, redirectUri, (error, returnUrl) => {
if (error) {
console.log(error);
return reject(error);
}
return resolve(returnUrl);
});
});
};
const mockPayment = {
type: 'SEPA transfer',
name: 'Koodaa',
amount: 5.5,
purpose: 'test',
account_id: 'A1.1',
account_number: '4711951502',
bank_code: '90090042',
iban: ''
};
test('should be able to submit payment', async () => {
// addPayment will call session.add_payment and return a payment object
const payment = await addPayment(accessToken, mockPayment);
// submitPayment will call session.submit_payment (check above code)
const returnUrl = await submitPayment(accessToken, payment, '111111', 'state');
...
});And I got this:
/node_modules/figo/lib/figo.js:1090
callback(null, "https://" + Config.api_endpoint + "/task/start?id=" + result.task_token);
^
TypeError: Cannot read property 'task_token' of nullWhich I believe to be an error inside /lib/figo.js since it's doesn't invoke the callback with error but result, and this result object is null.
P.S: Please improve the documentation for this Nodejs SDK, I need to did into the source code to find out how it work. Thank you!