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

Production response is not parsed as object #4

Closed
mikaoelitiana opened this issue Aug 6, 2022 · 1 comment
Closed

Production response is not parsed as object #4

mikaoelitiana opened this issue Aug 6, 2022 · 1 comment

Comments

@mikaoelitiana
Copy link
Contributor

There are discrepancies in Mvola API response for GET Transaction Details on Sandbox vs Production.

Production response has trailing comma (c.f screenshot below), causing failure of JSON response parse. This cause the result to be returned as string instead of object.

Screenshot 2022-08-06 at 20 12 11

Sandbox does not have this trailing comma so the response is parsed as expected.

Screenshot 2022-08-06 at 20 28 46

@mikaoelitiana
Copy link
Contributor Author

As a work-around, I currently use JSON5 to re-parse the response

   let transaction = await mvola.transaction.get(
      ctx.request.body.transactionReference
    );

    if (typeof transaction === "string") {
      transaction = JSON5.parse(transaction);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant