# E-shop leasing - II Documentation version 3.01, 24.10.2022 "AS Inbank filialas" e-Leasing+ online solution implementation and steps of integration into online platform of E-shop are described in this document. E-Leasing+ online solution consists of two cornerstone components: web service and remote web application. E-shop must program: 1. Get products list from Leasing+ (Optional if E-shop configured to use only one product). 2. Creating an application in the e-Leasing+ system. 3. E-shop to e-Leasing+ system client forwarding. 4. Return of clients from e-Leasing+ to E-shop 5. Clients' leasing contract state check E-shop server application (backend) will contact e-Leasing+ web service and transmit information about Client and his shopping cart in an exchange of a unique e-Leasing+ application token. With the unique token it will forward the Client to the e-Leasing+ system. In case the Client cancels the process or Leasing contract, Client is redirected to the E-shop along with the information of the leasing contract status. Data exchange between the E-shop and e-Leasing+ system is encoded in UTF-8 format. E-Leasing + implementation and integration steps are shown in the the following chapters. # URLs URL examples for test and live: |Test|Live| | :- | :- | |Please contact us at integration@inbank.lt for test data|https://api.mokilizingas.lt/api2/| # E-Leasing+ web service E-Leasing+ web service (WS) performs two main functions: Leasing application creation and final contract status check. WS client part must be implemented at the server level of E-shop (server side). The data exchange between E-shop and the WS must be through the secure socket layer (SSL). All API endpoints require authorization API key which must be provided in header with name `ix-api-key`. ## E-shop notification of any changes in contract completion In case of an important change during the process of contract completion, E-shop is informed to `alert_url` using POST method. Once the E-shop has the information, it must check the current status of [contract](./#operation/getRedirect). Status code indicates Leasing contract status.
Input parameters: |Attributes|Required|Type|Definition and Examples| | :- |:- |:- |:- | |appl_token|Yes|String|Unique Leasing application token| |order_id|Yes|String|Unique E-shop shopping cart id| |appl_phase|Yes|String|INIT, OPTION, DEAL, FINISH, [etc](#applicationphases)| |appl_status|Yes|String|OK or error code| |sha1|Yes|String|Generated SHA1 from symbols: `uuid`, `appl_token`, `appl_phase`, `appl_status`| |contract_no|No|String|If application in DEAL phase, then contract does not exist| |close_reason|No|String|The [reason](#closurelist) why an application was closed (e.g. phase = `CLOSED`)| Application token parameter identifies e-Leasing+ application. Order id is unique E-shop `order_id`. `uuid` is unique e-shop id assigned by Inbank. No output parameters exist.
List of application phases: |Phase|Description|Last Phase| | :- |:- |:- | |NEW|New application|No| |INIT|Data input|No| |EVAL|Evaluating|No| |REJECTED|Rejected|Yes| |OPTION|Options|No| |PROPOSAL|Proposal|No| |DEAL|Deal|No| |FINISH|Finish|Yes| |CANCEL|Cancel|Yes| |CLOSE|Close|Yes|

List of contract closure reasons: |Code|Description| | :- |:- | |UNFINANCEABLE|Client is unfinanceable| |KAC|Closed by our communication center| |EXPIRED|Application has expired| # Calculator integration Link for Mokilizingas | Inbank calculator integration: https://skaiciuokles.inbank.lt/doc/calculator Link for Mokilizingas | Inbank MOKI3,5,10 calculator integration: https://skaiciuokles.inbank.lt/doc/moki_calculator Link for Mokilizingas | Inbank custom calculator integration through API: https://skaiciuokles.inbank.lt/doc/api

## Servers Demo environment ``` https://api.mokilizingas.lt/apitest ``` Live environment ``` https://api.mokilizingas.lt/api2 ``` ## Security ### apiKeyAuth Type: apiKey In: header Name: ix-api-key ## Download OpenAPI description [E-shop leasing - II](https://docs.inbank.eu/_bundle/api/epos-lt-flow.yaml) ## Other ### Getting product information - [GET /eshop/{uuid}/v2/tariff](https://docs.inbank.eu/api/epos-lt-flow/other/gettraiff.md): GET /eshop/:uuid/v2/tariff This method is used to get all products information (pricing) from e-Leasing+ which are assigned to specific partner e-shop. If e-shop have assigned only one tariff this endpoint may not be used. To get all information about assigned tariffs/products to e-shop need provide e-shop uuid, this value is provided by "AS Inbank filialas". ### E-shop contract creation - [POST /eshop/v2/create](https://docs.inbank.eu/api/epos-lt-flow/other/postcontract.md): POST /eshop/v2/create This method is used to create contract and primal data exchange between E-shop and e-Leasing+ online platform. Data exchange is in the safe background mode (Server To Server). API key is provided by "AS Inbank filialas" once the contract is signed. Return_url is used to return user to E-shop webpage. Order_id parameter defines unique shopping cart id. Alert_Url is used to inform Eshop about major changes in the process. If the term attribute will be provided, the contract will be evaluated for that specific term without possibility to change it later in the process. The price attribute in shopping cart list order_json must be filled by price per unit. Error code attribute defines the result of the user authentication. If this value is empty - authentication was successful; otherwise error code will be filled, and the error definition will provide further information about the error. In case of successful authentication, appl_token parameter is filled with unique value; otherwise it is empty. appl_token attribute value is required for the further steps, this parameter is a unique identifier that is valid for only a certain period of time. ### Getting redirection URL to E-shop - [GET /eshop/{uuid}/{appl-token}/v2/redirect/url](https://docs.inbank.eu/api/epos-lt-flow/other/geturl.md): GET /eshop/:uuid/:appl-token/v2/redirect/url This endpoint returns a URL that is used to redirect the client to the correct e-Leasing+ system step. ### E-shop to e-Leasing+ forwarding - [GET /eshop/{appl-token}/v2/redirect](https://docs.inbank.eu/api/epos-lt-flow/other/getredirect.md): GET /eshop/:appl-token/v2/redirect Client from the E-shop is redirected to the e-Leasing+ system during this process. This communication happens at the level of Clients web browser. Therefore, the most important information regarding the E-shop shopping cart is provided during the process of application creation (during the background "Server To Server" process). ### e-Leasing+ to E-shop forwarding Client is forwarded/returned from the e-Leasing+ system to the E-shop during this process. HTML form is composed containing appl_token and order_id as parameters for the forwarding. Application token will be used to identify shopping cart in Leasing+ and order id and uuid will be used for validation. GET method forwards Client along with the parameters to the E-shop return_url address (see chapter). E-shop must check the status of contract at this step - endpoint ...eshop/v2/check (see chapter). ### Check the status of the leasing agreement - [POST /eshop/v2/check](https://docs.inbank.eu/api/epos-lt-flow/other/postcheck.md): POST /eshop/v2/check This method is used to check the leasing contract status. E-shop uses this method to find out what is the status of the Leasing contract. Unique appl_token with e-shop order_id and uuid must be provided to check agreement status. Parameters must be the same which were used to create an application.