Professional Documents
Culture Documents
1
Table of Contents
Services List ...................................................................................................................................................... 3
Parameters List ................................................................................................................................................ 4
Web Services Description ................................................................................................................................ 7
API Resources and Methods ............................................................................................................................ 7
Register: ........................................................................................................................................................ 8
Request Parameters ................................................................................................................................. 8
Response Parameters .............................................................................................................................. 8
Upload: ........................................................................................................................................................ 10
Request Parameters ............................................................................................................................... 10
Response Parameters ............................................................................................................................ 11
Get Updates: ................................................................................................................................................ 12
Request Parameters ............................................................................................................................... 12
Response Parameters ............................................................................................................................ 12
Generate Ornic67: ...................................................................................................................................... 14
Resource info .......................................................................................................................................... 14
Request Parameters ............................................................................................................................... 14
Response Parameters ............................................................................................................................ 14
Glossary:.......................................................................................................................................................... 15
Conventions: ............................................................................................................................................... 15
Response Codes: ......................................................................................................................................... 15
Appendix: ........................................................................................................................................................ 18
HmacSha256Encode method: ................................................................................................................... 18
Sample Code: .......................................................................................................................................... 18
Examples of Calling HmacSha256Encode method: ............................................................................. 18
2
Services List
Service Name Service Description Method
Register terminal This service gets the terminal register
configurations from the central system
upon first deployment.
Update terminal This service gets the updates from the get_update
configurations central system.
3
Parameters List
Parameter Description Type
block_status This indicates whether or not there is a command boolean
to block the terminal.
4
receipts_threshold The number of receipts a terminal is allowed to int
issue without connecting to the central system.
service_id The service’s id. The service must be existed in the int
terminal unit.
5
authorization This parameter is to authorize each request and string
must be in the format: [user_id:signature]
6
Web Services Description
The web service is based on HTTP protocol using JSON MIME type.
The response listed under ‘Responses’ for each method is success response. For any
other response check Status Code table at the end of the document.
Path: https://[ SERVER URL]/E15/api/v2/offline_terminal/[METHOD URL]
Note: The exact SERVER URL is to be sent along with the rest of the testing setup information
via email.
7
Register:
This service gets the terminal configurations from the central system upon first deployment.
Method POST
URL register
Request Parameters
Response Parameters
user_id (int) Unique identifier for the logged in user to be used in the
process of receipt generation. Form:"user_id": integer
This parameter represents the services version.
version (int)
Form: version: integer
9
Upload:
This service patches the transactions that have been recorded offline in the terminal to the
central system.
Method POST
URL upload
Request Parameters
terminal_id (string) The terminal ID and password are used to authenticate the
terminal.
terminal_pass (string)
Form:"terminal_id":"string","terminal_pass":"string"
Form:
[{ receipt_no: string,
received_from:string,
date: string,
[Optional]description: string,
services:[{
service_id : integer,
service_fees: double
}],
total : double,
currency_id: int,
payment_method_id:int,
discount:int
}]
10
version (int) This parameter represents the services version. Form:
"version": int
Response Parameters
failure (array) This is a JSON array that contains receipts numbers that failed
uploading. Form:["receipt_no"]
11
Get Updates:
This service gets the updates from the central system.
Method POST
URL get_update
Request Parameters
Request Type Description
terminal_id (string) The terminal ID and password are used to
authenticate the terminal.
terminal_pass (string)
Form:{"terminal_id":"string","terminal_pass":"string"}
version (int)
Response Parameters
12
}]
}]
}]
time_threshold The period of time a terminal is allowed to reach without connecting to
(int) the central system. Form:"time_threshold": integer
money_thresho (int) Total amount to be collected in offline mode. Form:
ld "money_threshold": integer
receipts_thresh (int) This is the number of receipts a terminal is allowed to issue without
old connecting to the central system.Form:"receipts_threshold":integer
last_receipt_off (string) Last receipt generated in offline mode by
line machine.Form:"last_receipt_offline":string
(array) This is the available payment methods. This parameter takes the
payment_meth following form:
ods Form:[{"method_id": integer, "method_name": string}]
13
Generate Ornic67:
To generate ornic67.
Resource info
Method POST
URL generate_ornic67
Request Parameters
Response Parameters
14
Glossary:
Conventions:
Response Codes:
Below are the response codes used in this API.
200 OK
202 THIS_TRANSACTION_ALREADY_PAID
500 SYSTEM_ERROR
600 BAD_REQUEST_INSUFFICIENT_PARAMETERS
601 BAD_REQUEST_MISSING_VALUE
602 AUTHENTICATION_FAILURE
603 INVALID_UNIT
604 INVALID_APPLICATION_ID
605 INCORRECT_TOTAL
606 INVALID_SERVICE
607 INVALID_CURRENCY
608 INVALID_PAYER
609 INVALID_TRANSACTION_ID
610 INVALID_DISCOUNT_VALUE
15
611 INVALID_PAYMENT_DETAILS
612 INVALID_PAYMENT_METHOD
613 EMPTY_COMMENT
614 INVALID_DATE_FORMAT
615 FROM_DATE_SHOULD_BE_BEFORE_TO_DATE
616 INVALID_PHONE
617 INVALID_TERMINAL_ID
618 INVALID_INVOICE_NO
619 NEW_PASSWORD_DOES_NOT_MATCH_PATTERN
620 MISMATCH_IN_NEW_PASSWORD_AND_CONFIRMATION
621 SHORT_PIN
622 INSUFFICIENT_PERMISSION
623 INVALID_BANK_ID
624 MAXIMUM_TOTAL_AMOUNT_DIGITS_LENGTH_IS_10
625 STAMP_SERVICE_NOT_FOUND
626 FAILURE
627 INVALID_DATE
628 INCORRECT_AMOUNT
629 INVALID_AMOUNT_FORMAT
630 INVALID_TOTAL_AMOUNT_FORMAT
631 THIS_AMOUNT_EXCEED_AMOUNT_DUE
632 REVOKED_USER_OR_TERMINAL
633 ACCESS_DENIED
16
634 INVALID_UNIT_ID
635 INVALID_DELEGATION
636 INVALID_DELEGATE_FOR
637 VERSION_IS_UP_TO_DATE
638 SHOULD_UPDATE_VERSION
639 VERSION_NOT_EXISTS
650 INVALID_RECEIPT_ID
651 INVALID_RECEIPT_NO
652 RECEIPT_ALREADY_MARKED_FOR_DELETION
653 NO_OF_RECEIPTS_IS_INCORRECT
680 INVALID_ORNIC67_ID
681 ZERO_NEW_E15
682 SOME_RECEITS_MARKED_FOR_DELETION
690 THIS_INVOICE_ALREADY_CANCELED
691 THIS_INVOICE_ALREADY_PAID
692 THE_TERMINAL_UNIT_HAVE_NO_EXPIRATION_DATE
693 TICKET_COUNT_LARGER_THAN_TOTALAMOUNT
694 TO_DATE_SHOULD_BE_PASS_DATE
17
Appendix:
HmacSha256Encode method:
This method is used to create HmcSha256 signature encoded as base64 for Authorization. The
Users of E15 APIs should digitally sign their requests using it.
Where:
Key parameter is the shared key (secret) that is known for E15 and the user.
Data parameter is the data that is to be signed (Hmac) and it contains json request +
x_e15_date value.
Sample Code:
public static String HmacSha256Encode(String key, String data) {
try {
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secret_key = new
SecretKeySpec(Base64.decodeBase64(key.getBytes("UTF-8")), "HmacSHA256");
sha256_HMAC.init(secret_key);
return new
String(Base64.encodeBase64(sha256_HMAC.doFinal(data.getBytes("UTF-8"))));
}catch (Exception e) {e.printStackTrace();
}
return null;
}
}
HmacSha256Encode("2YYUNTOwq59B8Tw1d9U7lur5VuW4ywj3OVQSTF9MDo4=","{\
"terminal_id\”:\”123\”}" + "Wed Nov 5 16:15:00 AST 2015" + “Batool” +
“2f51ac461e84126ba0bf377b9965ac5047713d95”)
Where:
18
"2YYUNTOwq59B8Tw1d9U7lur5VuW4ywj3OVQSTF9MDo4=" is an example for
shared_key.
“{\"terminal_id\”: \”123}” is an example for json request.
Batool is an example for user_id.
“2f51ac461e84126ba0bf377b9965ac5047713d95” is an example for sha1(password).
19