i have completed payment gateway integration on web , want same integration on mobile app, getting said error "un authorized transaction transaction initiated." while getting response, unable handle session or there issue in code. please me close.
**package com.payzak.epos;
import android.app.activity; import android.app.alertdialog; import android.content.dialoginterface; import android.content.intent; import android.graphics.bitmap; import android.net.http.sslerror; import android.os.bundle; import android.util.log; import android.webkit.cookiemanager; import android.webkit.cookiesyncmanager; import android.webkit.sslerrorhandler; import android.webkit.webview; import android.webkit.webviewclient; /** * created nivedha on 4/1/2017. */ public class activity_pg extends activity { public static string weburl,sessionid; @override public void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); setcontentview(r.layout.activity_pay_old); intent in = getintent(); weburl = in.getextras().getstring("url"); //sessionid = in.getextras().getstring("sessionid"); webview pgwebview = (webview)findviewbyid(r.id.pgwebview); pgwebview.getsettings().setjavascriptenabled(true); pgwebview.getsettings().setjavascriptcanopenwindowsautomatically(true); cookiesyncmanager cookiesyncmanager = cookiesyncmanager.createinstance(pgwebview.getcontext()); cookiemanager cookiemanager = cookiemanager.getinstance(); cookiemanager.setacceptcookie(true); cookiemanager.removesessioncookie(); //cookiemanager.setcookie("https://securepgtest.fssnet.co.in:443/pgway/", sessionid); cookiesyncmanager.sync(); pgwebview.setwebviewclient(new appwebviewclients()); pgwebview.loadurl(weburl); } public class mywebviewclient extends webviewclient { @override public boolean shouldoverrideurlloading(webview view, string url) { view.loadurl(url); return true; } } public class appwebviewclients extends webviewclient { public boolean shouldoverrideurlloading(webview view, string url) { log.d("tag", "shouldoverrideurlloading"); log.d("tag", "actualurl: " + weburl); log.d("tag", "newurl: " + url); view.loadurl(url); return true; } @override public void onpagestarted(webview view, string url, bitmap favicon) { super.onpagestarted(view, url, favicon); //show loading if isnt visible log.d("tag", "onpagestarted"); } public void onpagefinished(webview view, string url) { } public void onreceivederror(webview view, int errorcode, string description, string failingurl) { log.d("tag", "error description: " + description); log.d("tag", "failingurl: " + failingurl); } @override public void onreceivedsslerror(webview view, final sslerrorhandler handler, sslerror error) { try{ final alertdialog.builder builder = new alertdialog.builder(activity_pg.this); builder.setmessage("notification_error_ssl_cert_invalid"); builder.setpositivebutton("continue", new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { handler.proceed(); } }); builder.setnegativebutton("cancel", new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { handler.cancel(); } }); final alertdialog dialog = builder.create(); dialog.show(); }catch (exception e){ e.printstacktrace(); } } } }
Comments
Post a Comment