LivotovLabs / 3DSView

Android UI component to process banking 3D Secure (MasterCard SecureCode / Verified By Visa) payment authorizations in Android apps.
Apache License 2.0
111 stars 51 forks source link

onAuthorizationCompleted() not called for some banks without enabling webview.getSettings().enableDomStorage() #12

Open rameezh88 opened 8 years ago

rameezh88 commented 8 years ago

Hi,

I'm trying to implement some 3d-secure logic in my app. It is for the Swedish market. I find that the D3SView successfully redirects to the correct URL, but once I authenticate the transaction, the onAuthorizationCompleted() method is not called. Can you please help me out in knowing if this is a common issue? I am working with this technology for the first time.

livotov commented 8 years ago

And what the bank authentication page says ? Any attempts to do a POST to a provided postback url

rameezh88 commented 8 years ago

I am not sure if it has tried to do a POST to the postback url. The steps I did were as follows:

  1. I used the Stripe payment platform to post my card info and postback URL. It returns a redirect URL.
  2. I used this redirect URL like so: d3sView.authorize(getIntent().getExtras().getString(Stripe3dSecure.REDIRECT_URL), "", "", getString(R.string.postback_url)); I am not sure about the PaReq and the ACS parameters here. I don't receive any such info from Stripe. Maybe you can make this clearer to me?
  3. The callback for onAuthorizationStarted() and onAuthorizationWebPageLoadingProgressChanged() are called. The Verified by Visa page connected to my Swedish bank account is opened with some options. Here I choose the "mobile bank ID" option.
  4. In Sweden, for this we use something called a mobile BankID app. So I open this app on my own personal iPhone, and enter my personal code to authenticate this transaction. The app itself will tell me if there has been a success or a failure in my code. In my case I have tested this several times by entering the correct code. I expect the success event to be reflected in my Android WebView, but I get no notification or callback. I have used this Verified by Visa feature many times on my iOS device and also on my Mac, and it seems to work well. Note also that the same feature works really well on the iOS version of the same app that I am working on. We are of course using the UIWebView component from iOS there, without any extra configurations.

Hope this helps in clarifying the issue. Please let me know if you have any more questions.

livotov commented 8 years ago

Well, the Stripe could be source of the problem. Because this component is intended to work with VISA/MC protocol (Verified By Visa / MasterCard Secure Code). PaReq and ACS are required values. Basically, ACS is the redirect url to a card issuer bank for performing an auth and it varies from card to card. Moreover, stripe cannot perform a 3DSecure authentication as it must be done at the card issuer bank web page which varies from card to card.

So, basically stripe should start the payment processing, return you the PaReq and ACS values. Then you use those values with 3DSView component which navigates to the card issuer bank web page and waits for authentication result. Then it gives you the PaReq return value you need then to send back to Stripe.

rameezh88 commented 8 years ago

Hi,

It was a false alarm. The issue was with the WebView settings itself. All I had to do was call webView.getSettings().enableDomStorage(); And then it worked.

livotov commented 8 years ago

Great it was sorted out. So it did not work until you added that method or removed ?

rameezh88 commented 8 years ago

That's right. It didn't work until then. Maybe this is something you could consider as well, for your WebView.

livotov commented 8 years ago

hmm, interesting.

livotov commented 8 years ago

Will check this at my side and probably I should add this configuration option into the library default setup. Thanks for discovering this issue !

Pahanuch commented 7 years ago

Hi. What about solution of this problem? Some banks works with webView.getSettings().setDomStorageEnabled(true);, But some banks need webView.getSettings().setDomStorageEnabled(false);

livotov commented 7 years ago

@Pahanuch shouldn't the enabled dom storage be enough for all banks even if they're don not require it ?

Pahanuch commented 7 years ago

I'm sorry, I don't understand. What I must to do to resolve this problem ?

livotov commented 7 years ago

@Pahanuch simply always set it to true: webView.getSettings().setDomStorageEnabled(true)

Pahanuch commented 7 years ago

Can you show example of your D3SActivity ? With D3SSViewAuthorizationListener onAuthorizationCompleted

By the way I need to load pages with delay postDelayed(() -> view.loadUrl(String.format("javascript:window.%s.processHTML(document.getElementsByTagName('html')[0].innerHTML);", JavaScriptNS)), 500);

Because App too fast get payment result method