This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
developers:getting-started [2016/10/26 07:48] 127.0.0.1 external edit |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Developers - Getting started ====== | ||
- | |||
- | ====== 1. Android implementation of Papi ====== | ||
- | |||
- | //See DemoBank MainFragment.java example// | ||
- | |||
- | Prerequisites: | ||
- | |||
- | * [[https:// | ||
- | * [[https:// | ||
- | |||
- | 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()) | ||
- | |||
- | ===== 1.1. How to make an authentication request? ===== | ||
- | |||
- | - First create an instance of Papi \\ (only one per application / set of requests) | ||
- | - Prepare a handler which is going to be called when Papi is finished (see below) | ||
- | - Call Papi method aducidAuthentication (): | ||
- | |||
- | <font inherit/ | ||
- | |||
- | * **url** | ||
- | * **handler** | ||
- | |||
- | In your Handler override **handleMessage** (Message msg) and get the result: | ||
- | |||
- | <font inherit/ | ||
- | |||
- | < | ||
- | </ | ||
- | |||
- | The evaluate it - see Responses: | ||
- | |||
- | ===== 1.2. Responses ===== | ||
- | |||
- | Your code should evaluate these possible outcomes: | ||
- | |||
- | **<font inherit/ | ||
- | |||
- | **<font inherit/ | ||
- | |||
- | Your session is authenticated | ||
- | |||
- | In DemoBank, result.gerRedirect() contains link to page with account data | ||
- | |||
- | **<font inherit/ | ||
- | |||
- | **<font inherit/ | ||
- | |||
- | PEIG is not installed. To fix it, you can display a dialog and then open GooglePlay to install it: | ||
- | |||
- | < | ||
- | </ | ||
- | |||
- | **<font inherit/ | ||
- | |||
- | **<font inherit/ | ||
- | |||
- | Communication error occurred – either phone has no connectivity or destination cannot be reached (wrong URL or server is not running). | ||
- | |||
- | **<font inherit/ | ||
- | |||
- | **<font inherit/ | ||
- | |||
- | Custom application errors, authentication failed! | ||
- | |||
- | * result.getException() contains ADUCID exception, there are possible states: | ||
- | * result.notAcceptedByUser(): | ||
- | * result.isFactorAbsent(): | ||
- | * result.getData() contains error Message / reason | ||
- | * result.getRedirect() contains page that could be opened using browser / contains additional content to download/ display to the user. | ||
- | |||
- | //See PapiResult class for all details// | ||
- | |||
- | ===== 1.3. Retrieve data when <font inherit/ | ||
- | |||
- | 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/ | ||
- | |||
- | < | ||
- | </ | ||
- | * **parameters** | ||
- | * **AsyncHttpResponseHandler** | ||
- | ==== 1.3.1. Try to get data if not authenticated ==== | ||
- | |||
- | To check your setup, test if you get error response from the server | ||
- | |||
- | ===== 1.4. Advanced requests ===== | ||
- | |||
- | To accomplish a specific action like transaction use <font inherit/ | ||
- | |||
- | See DemoBank PaymentFragment.java example | ||
- | |||
- | <font inherit/ | ||
- | |||
- | * **url** | ||
- | * **methodName** | ||
- | * **parameters** | ||
- | * **handler** | ||
- | Get the result: | ||
- | |||
- | <font inherit/ | ||
- | |||
- | < | ||
- | </ | ||