omise-android icon indicating copy to clipboard operation
omise-android copied to clipboard

How to handle error mesage from Credit card activity?

Open AgungLaksana opened this issue 2 years ago • 2 comments

Expected behavior

I am using Credit Card Activity, and as far I know, I should handle the result in here

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    if (resultCode == RESULT_CANCELED) {
        // handle the cancellation
        return
    }

    if (requestCode == REQUEST_CC) {
        val token = data?.getParcelableExtra<Token>(EXTRA_TOKEN_OBJECT)
        // process your token here
    }
}

I have two questions.

  1. how to distinguish if I get error or paid successfully using credit card? because it seems like I still get the token id event if I test Insufficent Fund Case

on iOS SDK, I can differentiate very easily using the code below


extension ViewController: CreditCardFormViewControllerDelegate {
  func creditCardFormViewController(_ controller: CreditCardFormViewController, didSucceedWithToken token: Token) {
    dismissCreditCardForm()

    // Sends `Token` to your server to create a charge, or a customer object.
  }

  func creditCardFormViewController(_ controller: CreditCardFormViewController, didFailWithError error: Error) {
    dismissCreditCardForm()

    // Only important if we set `handleErrors = false`.
    // You can send errors to a logging service, or display them to the user here.
  }
}
  1. How to get the string error message?

Actual behavior

this is not a bug actually

Steps to reproduce the issue

this is not a bug actually

Logs

No response

Screenshots

No response

Name and version information

implementation 'co.omise:omise-android:4.+'

AgungLaksana avatar Mar 11 '24 12:03 AgungLaksana

@AgungLaksana Thanks for reaching out. We appreciate your inquiry and look into this. We will provide you with an update soon.

aashishgurung avatar Mar 12 '24 04:03 aashishgurung

Hello @AgungLaksana , The token creation for insufficient funds test card will be successful as the token will be used to create a charge and then the charge status will be failed. So the api calls will not fail, it will just have a different status at the charge level. The error processing is handled by the SDK side so you will receive the token only when the process is successful.

AnasNaouchi avatar Mar 27 '24 03:03 AnasNaouchi

We’re going to close this since there hasn’t been any activity for a while. If this issue is still relevant, please feel free to reopen it with more details and we’ll take another look.

aashishgurung avatar May 03 '24 08:05 aashishgurung