Closed sachinchoudhary085 closed 10 years ago
I need the same! +1
Oh, sorry, it seems I missed the notification on this ticket on Jun 12. Im afraid that the schema is not possible here, so you have to handle actual work in your callback listener...
Also, you need the MD and PaRes parameters to complete the transaction at merchant side.
I'm looking into that. I need to get the body of request. For now, visa client website is showing correctly, so authorize works perfectly. How should I get body of return request?
Thank you so much!
visa/mc website will issue a POST request to your dummy callback url provided, so even if android would be able to trigger a scheme event and launch an activity, you will not get the POST data there.
So basically, you simply need to set your own listener for D3SView component (d3sview.setAuthorizationListener(D3SViewAuthorizationListener), then invoke the "authorize(...)" method. Once 3DS process is finished at visa/mc web site, your listener callbackwill be called with the MD and PaRes data extracted.
Perfect, that's what I thought. I had to obtain these two paramaters from the body, but you already managed how to get them through html response :-)
Nice! Thanks!
Here is the sample usage from one of our production app.
webView = (D3SView) findViewById(R.id.p2p_view);
webView.setAuthorizationListener(this);
webView.authorize(getAcsUrl(), getMd(), getPareq(), DUMMY_RETURN_POSTBACK_URL);
and here is tthe listener:
@Override public void onAuthorizationCompleted(final String md, final String pares)
{
sendAuthResultToMerchant(md,pares);
}
@Override public void onAuthorizationStarted(D3SView d3SView)
{
}
@Override public void onAuthorizationWebPageLoadingProgressChanged(int i)
{
}
Yeah, that's was the main idea of this project - to perform all dirty stuff automatically there :)
There is something left. How do you get redirect url from the webview? With paypal payment I managed overriding url. So maybe I have to do a workaround to get that too.
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (check(url)) {
...
} else {
view.loadUrl(url);
}
return true;
}
Normally you don't need to do any redirects, this already handled by a component. Just provide some dummy url (like http://auth.done) for the authorize(...) mehtod - this url is simply passed to the visa/mc website and then used there to perform a POST request when auth is complete. This should not be a working url as request will not go physically to that server but will be intercepted instead.
You may also use alternate mehtod and to not provide such url. For this case, a default value will be used instead:
private String postbackUrl = "https://d3s.postback.com";
The physical "interception" is happened there: D3SView.java:126
public void onPageStarted(WebView view, String url, Bitmap icon)
{
if (!urlReturned)
{
if (url.startsWith(postbackUrl))
{
view.loadUrl(String.format("javascript:window.%s.processHTML(document.getElementsByTagName('html')[0].innerHTML);", JavaScriptNS));
urlReturned = true;
} else
{
super.onPageStarted(view, url, icon);
}
}
}
as you can see above, we execute injected JS code there to extract the actual POST parameters
In my case, I need to get that url.. from action parameter:
form name="xxx" method="POST" action="https://www.XXXX.com"
Wait, action parameter will contain exactly what you provide in authorize(...) method.
You're right... Newbie with external payments ;-) Thanks so much mate
Application url schema not working. i trying to use for call back url "activity_b".