Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session.submit_payment throws error: null task_token #35

Open
origamih opened this issue Apr 24, 2017 · 0 comments
Open

session.submit_payment throws error: null task_token #35

origamih opened this issue Apr 24, 2017 · 0 comments
Labels

Comments

@origamih
Copy link

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 null

Which 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!

@berend berend added the bug label May 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants