Closed igor-bv closed 4 years ago
Hello,
Thank you for reaching out to us.
https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/android/app/src/main/java/com/piasample/SDKModule.java#L444 Yes you are absolutely right about the above code in the current implementation, the loop gets into a never ending state, we will look into the issue and do the required changes.
For handling the error case on register api request you must break the loop in below code by making this condition false when the result is returned back to buildTransactionInfo
with null
values as arguments.
https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/android/app/src/main/java/com/piasample/SDKModule.java#L444
You can use any logic for identifying that the response for register api has been received with a null value which should break the while loop and let the code return null value to PiASDK via this line https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/android/app/src/main/java/com/piasample/SDKModule.java#L449
PiASDK will do the check for null and complete the payment flow by finishing the activity and sending back the result in onActivityResult
of SDKModule
https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/android/app/src/main/java/com/piasample/SDKModule.java#L81
Further you can handle the result from onActivityResult
and show an appropriate error to the users.
As of the current implementation, you will have result.isSuccess()
as false
https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/android/app/src/main/java/com/piasample/SDKModule.java#L87
But the result.getError()
will contain null
so you will have to handle the error with an appropriate message
https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/android/app/src/main/java/com/piasample/SDKModule.java#L93
We will take this point as well into consideration and make sure sdk returns an appropriate error code.
Thank you for pointing out the issue.
Please let us know if you have further questions!
Hello,
Thank you for reaching out to us.
Yes you are absolutely right about the above code in the current implementation, the loop gets into a never ending state, we will look into the issue and do the required changes. For handling the error case on register api request you must break the loop in below code by making this condition false when the result is returned back to
buildTransactionInfo
withnull
values as arguments. https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/android/app/src/main/java/com/piasample/SDKModule.java#L444You can use any logic for identifying that the response for register api has been received with a null value which should break the while loop and let the code return null value to PiASDK via this line https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/android/app/src/main/java/com/piasample/SDKModule.java#L449
PiASDK will do the check for null and complete the payment flow by finishing the activity and sending back the result in
onActivityResult
of SDKModule https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/android/app/src/main/java/com/piasample/SDKModule.java#L81Further you can handle the result from
onActivityResult
and show an appropriate error to the users.As of the current implementation, you will have
result.isSuccess()
as false https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/android/app/src/main/java/com/piasample/SDKModule.java#L87But the
result.getError()
will containnull
so you will have to handle the error with an appropriate message https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/android/app/src/main/java/com/piasample/SDKModule.java#L93We will take this point as well into consideration and make sure sdk returns an appropriate error code.
Thank you for pointing out the issue.
Please let us know if you have further questions!
Hi, thanks for the feedback. I'll add some logic as you suggested.
@Miss-PiA, hi! Could you please explain/clarify error handling case on register api request error(on android example at least). As far as I see error handler will call
buildTransactionInfo
withnull
values as arguments. https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/App.js#L117But as far as
getTransactionInfo
will run thewhile
loop whentransactionInfo == null
- this loop seems like became an infinite loop. https://github.com/Nets-mobile-acceptance/Netaxept-Android-SDK/blob/d01e89b5a5dc638d35eecb072e806f740c97d886/ReactNative/PiaSampleReactNative/android/app/src/main/java/com/piasample/SDKModule.java#L444So the questions are:
Thanks in advance!