This is an old revision of the document!
See DemoBank MainFragment.java example
Prerequisites: used external libraries:
ADUCID PEIG API (Papi) provides simple way how to integrate ADUCID to custom client application. To keep session cookies, Papi uses http async client. (papi.getAsyncClient())
<font inherit/courier new;;inherit;;inherit>aducidAuthentication(String url, Handler handler)</font>
In your Handler override handleMessage (Message msg) and get the result:
<font inherit/courier new;;inherit;;inherit>PapiResult result = msg.getData().getParcelable(</font><font inherit/courier new;;green;;inherit>“result”</font> <font inherit/courier new;;inherit;;inherit>);</font>
The evaluate it - see Responses:
Your code should evaluate these possible outcomes:
<font inherit/courier new;;navy;;inherit>I.</font>
<font inherit/courier new;;navy;;inherit>if</font> <font inherit/courier new;;inherit;;inherit>result.isOK()</font>
Your session is authenticated
In DemoBank, result.gerRedirect() contains link to page with account data
<font inherit/courier new;;navy;;inherit>II.</font>
<font inherit/courier new;;navy;;inherit>else if</font> <font inherit/courier new;;inherit;;inherit>(result.peigNotInstalled())</font>
PEIG is not installed. To fix it, you can display a dialog and then open GooglePlay to install it:
//getPapi// ().installPEIG(getActivity());
<font inherit/courier new;;navy;;inherit>III.</font>
<font inherit/courier new;;navy;;inherit>else if</font> <font inherit/courier new;;inherit;;inherit>(result.</font><font inherit/courier new;;inherit;;inherit>isNetworkError())</font>
Communication error occurred – either phone has no connectivity or destination cannot be reached (wrong URL or server is not running).
<font inherit/courier new;;navy;;inherit>IV.</font>
<font inherit/courier new;;navy;;inherit>else {other exception / redirect / state}</font>
Custom application errors, authentication failed!
See PapiResult class for all details
In case I. your result is “OK” and your mobile application is authenticated. Use this session to contact your application server. AsyncHttpClient is used as http client to keep session cookies and GET/POST/PUT/DELETE operations. Following example shows how to use this client to GET a page when authenticated:
//getPapi// ().getAsyncClient().get(String url, RequestParams parameters, ResponseHandlerInterface responseHandler)
* url – target page / method URL, e.g. https://demobank.aducid.com/demobank/payment
To check your setup, test if you get error response from the server
To accomplish a specific action like transaction use <font inherit/courier new;;inherit;;inherit>aducidFullOperation()</font>
See DemoBank PaymentFragment.java example
<font inherit/courier new;;inherit;;inherit>aducidFullOperationPost(String url, String methodName,</font>RequestParams<font inherit/courier new;;inherit;;inherit>parameters, Handler handler)</font>
Get the result:
<font inherit/courier new;;inherit;;inherit>PapiResult result = msg.getData().getParcelable(</font><font inherit/courier new;;green;;inherit>“result”</font> <font inherit/courier new;;inherit;;inherit>);</font>
<font 10.0pt/arial,sans-serif;;inherit;;inherit>And parse it – see responses.</font>