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

Promise.reject() not running on iOS #9

Open
murrple-1 opened this issue Feb 12, 2020 · 3 comments
Open

Promise.reject() not running on iOS #9

murrple-1 opened this issue Feb 12, 2020 · 3 comments
Labels
question Further information is requested

Comments

@murrple-1
Copy link
Contributor

During testing around the behaviour noted in #8, I noted unexpected behaviour on iOS.

When calling startPayment() with onError set, cancelling the payment by pressing Cancel calls the listener with code = "ERROR_CANCELLED" and error = "Transaction Cancelled".

However, calling startPaymentPromise() in this way:

(async () => {
    try {
        const response = await AdyenPayment.startPaymentPromise(AdyenPayment.SCHEME, componentData, paymentDetails);
        console.log('Success', response);
    } catch (e) {
        console.log('Error', e);
    }
})();

does not cause the catch block to be run. This is unexpected, as I would expect console.log('Error', e) to output something like:

Error { "code": "ERROR_CANCELLED", "error": "Transaction Cancelled" }
@mkharibalaji
Copy link
Owner

That's Weird.Let me check...

@mkharibalaji
Copy link
Owner

mkharibalaji commented Feb 13, 2020

Hi @murrple-1 ,
It works as expected,

(async () => {
try{
        let response = await AdyenPayment.startPaymentPromise(AdyenPayment.SCHEME,componentData,paymentDetails)
        console.log(response);
      }catch(err){
        console.log("Error Code : ",err.code);
        console.log("Error Message ",err.message);
      }
})();

The only difference is you get the error object as

{code : "ERROR_CANCELLED", "message": "Transaction Cancelled"}

A Quick check - Did you remove the listener when switched testing to Promise way of catching the error ?

@mkharibalaji mkharibalaji added the question Further information is requested label Feb 13, 2020
@murrple-1
Copy link
Contributor Author

Further testing incoming

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

No branches or pull requests

2 participants