omise / omise-android

Omise Android SDK
https://docs.opn.ooo
Other
50 stars 32 forks source link

omise internet banking threading #41

Closed j2emanue closed 6 years ago

j2emanue commented 6 years ago

can you research if there is a treading issue. if i test too quickly on the authorize activity then odd time it fails. out of 10 times testing it can fail twice if i go too quickly hitting the success button produces failure at odd times. we want to put this in espresso test so we dont want it to be flaky. Confirmed i am passing in authorize uri and return uri to the activity. it all works just sometimes it fails if i go quickly.

chakrit commented 6 years ago

@j2emanue Can you explain more on the failure you mention. How exactly is the app failing? Are there error messages?

j2emanue commented 6 years ago

its not in production. never tried yet. but in the testing authorization activity. if i hit "success" too quickly sometimes it just produces a failure.

nuxzero commented 6 years ago

@j2emanue Can you show your failure please?

j2emanue commented 6 years ago

i dont have a stack trace as i am on client. im not sure what you want to see, could you clarify ? because the activityResult is called with result_ok even for failure or success. tell me this, is there some kind of time period between failures ? i mean can i retry the same payment multiple times very quickly or is there a wait time between retrying the same payment method ?

can you try this scenario. selected the siam commerical bank and do two payment failures. and then try a payment success. But you must do it quickly. very rapidly. it fails. are you you able to reproduce ?

let me explain in more detail the issue. so randomly in your testing/sandbox region i do a test transaction. i purposely fail the transaction and retry. When i retry i am pressing "success" button on the test screen. onActivityResult gets called. at this point i do not trust 3rd party for confirmation on client end, so i make a api call to our server to confirm payment with omise. our server brings me back payment failed. Our server is connecting to Omise to check the status of the payment. (can there be a timing issue here between omise and server ? )

so the sequence is like this --> buy something ---> make it fail initially --> mark it successful next time ---> confirm payment through my server (do not trust 3rd party from client side).

From client side how do i even know the payment was successful or failure ? everytime it brings me back RESULT_OK despite failure or success in onActivityResult. if i hit the back button i get RESULT_CANCELED which is already being handled. can you guys help ? or can we set up a meeting ?

here is one sandbox order that keeps failing. can your team check: https://pay.omise.co/offsites/ofsp_test_5b964gasdivbc0k93na/pay

but i waited 5 minutes and then it succeeded after failing multiple times.

implementation 'co.omise:omise-android:2.6.4'

pitiphong-p commented 6 years ago

When you said mark it successful next time you meant on a new charge? Also do you have a video recording of your scenario? So that we can understand more clearly and correctly.

j2emanue commented 6 years ago

let me explain what i have narrowed down the issue to be. after Omise sdk calls onActivityResult i call our servers to verify payment (through omise api) but sometimes the payment is marked as "pending". this is causing me to have to show the user that the transaction failed (since its not in a successful state). why did omise sdk not wait until status is either success or failure and then call onActivityResult. this can resolve my issues.

pitiphong-p commented 6 years ago

We've worked together with the Internet Banking team to address your issue. Please find our response below.

Once the customer follows the authorized URL, the authorization process is handled by a 3rd party, which in this case is the bank. The customer's activity/ behavior which occurs during this stage is beyond our control. The idea of having the AuthorizingPaymentActivity is to ease the integration of 3DS and other similar services for our merchants.

Since this stage of the transaction is handled by a 3rd party, the information we receive is quite limited. We are only informed whether the customer has completed the authorization process or has chosen to cancel the operation. So in the case where "onActivityResult is getting called but the transaction is showed as pending on the Omise dashboard", this may be caused by a delay in response from the bank to Omise. In most cases, the charge will be updated within a short moment, however, may take up to 30 minutes or an hour in some cases.

I hope this helps.

pitiphong-p commented 6 years ago

@j2emanue Does my comment help you on your issue? And do you any more question?

j2emanue commented 6 years ago

please close this ticket as resolved.