diagnosis
The diagnosis API is called by your POS to check the payment terminal status. Ensure to call this API before creating any payment request to ensure the payment terminal is ready to accept payment requests.
Method signature
When calling this method, please use the following standard method signature format.
fun diagnosis(
diagnosisRequest: DiagnosisRequest,
options: RequestOptions? = null,
callBack: DiagnosisResultListener? = null
)Parameters
Parameter name | Type | Required | Description |
diagnosisRequest | Yes | Indicates the object that contains parameters for querying the global status of the payment terminal. | |
options | No | Indicates the object that contains optional parameters in the API requests. | |
callback | No | The callback that is used to return the query result. See callback for details. |
callback
Parameter name | Type | Required | Description |
result | No | Indicates the result of querying the payment terminal status. |
Return values
Parameter name | Type | Required | Description |
result | Yes | Result of the API call. | |
networkStatus | String | Yes | Network connection status. Valid values are:
|
printerStatus | String | Yes | Printer status. Valid values are:
|
globalStatus | String | Yes | Overall device status, used to prepare to receive requests. Valid values are:
|
Result codes
resultCode | resultStatus | resultMessage | Further action |
|
| Success. | No action is required. |
|
| A general business failure occurred. Do not retry. | Contact Antom Technical Support to troubleshoot the issue. |
|
| The data format is invalid. | Contact Antom Technical Support to troubleshoot the issue. |
|
| The public key pairing failed. | Contact Antom Technical Support to troubleshoot the issue. |
|
| The payment terminal is busy. | Try again later. |
|
| The USB connection failed. |
|
|
| Response timeout. | Check whether the payment terminal app is active. If not, activate it again. |
|
| The API call failed, which is caused by unknown reasons. | Call the API again. |
|
| Failed to decrypt the data returned by the payment terminal. | Contact Antom Technical Support to troubleshoot the issue. |
|
| The message format is invalid. | Contact Antom Technical Support to troubleshoot the issue. |
Samples
The following sample code shows how to call the diagnosis API:
PaymentManager.diagnosis(
DiagnosisRequest(),
RequestOptions(5000L),
object : DiagnosisResultListener {
override fun result(result: DiagnosisResultData) {
responseTextView.post {
responseTextView.text = result.toString()
}
}
}
)The following code shows a sample of the response:
{
"result":{
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMessage": "Success."
},
"networkStatus": "Y",
"printerStatus": "Y",
"globalStatus": "Y"
}