in-app-payments-react-native-plugin icon indicating copy to clipboard operation
in-app-payments-react-native-plugin copied to clipboard

Is there a way to check if setSquareApplicationId fails?

Open rahamin1 opened this issue 5 years ago • 4 comments

I tried to put it inside a try/catch clause, but it doesn't report any error (I have used an invalid Application ID).

rahamin1 avatar Feb 17 '20 17:02 rahamin1

This function won't fail with an invalid application id. However, when you try to actually generate a nonce, it would fail with an invalid application id. The setting of the application id doesn't do any checks for validity.

StephenJosey avatar Feb 18 '20 21:02 StephenJosey

Thanks Stephen.

  1. As you say, the call to SQIPCardEntry.startCardEntryFlow fails. However, the error doesn't say that the application ID is wrong, but that 'the card entry is unauthorized' (see the screenshot below). Is that what it should say?

image

  1. IMHO, the error should be raised on the initialization of the App, and not when generating the nonce. I suggest to change this issue from a question to an enhancement. Does this make sense?

rahamin1 avatar Feb 19 '20 14:02 rahamin1

Ah, yes, you're right I believe that is the real error. I've updated this to be an enhancement, it does make sense. Thank you for the feedback!

StephenJosey avatar Feb 19 '20 19:02 StephenJosey

Thanks Stephen. Regarding the error: I would expect something like "Invalid application id" and not "card unauthorized" which I understand to be something else.

So we have here: (1) an enhancement for reporting the error when setSquareApplicationId is called, and a (2) bug for the invalid error code.

If (1) is done, then (2) is not needed. If (1) is not done, then (2) needs to be fixed.

rahamin1 avatar Feb 20 '20 19:02 rahamin1

Thank you for your feedback. We have shared the feedback with our team.

CharmisG avatar Dec 09 '22 09:12 CharmisG