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.

copy
fun diagnosis(
    diagnosisRequest: DiagnosisRequest,
    options: RequestOptions? = null,
    callBack: DiagnosisResultListener? = null
)

Parameters

Parameter name

Type

Required

Description

diagnosisRequest

DiagnosisRequest

Yes

Indicates the object that contains parameters for querying the global status of the payment terminal.

options

RequestOptions

NoIndicates the object that contains optional parameters in the API requests. 

callback

DiagnosisResultListener

NoThe callback that is used to return the query result. See callback for details.

callback

Parameter name

Type

Required

Description

result

DiagnosisResultData

NoIndicates the result of querying the payment terminal status.

Return values

Parameter name

Type

Required

Description

result

Result

Yes

Result of the API call.

networkStatus

String

Yes

Network connection status. Valid values are:

  • Y: Connected.
  • N:  Not connected. Please check the network status and router, and reconnect the terminal device to the network.

printerStatus

String

Yes

Printer status. Valid values are:

  • Y: Connected.
  • N: Not connected. Please check the terminal  printer.

globalStatus

String

Yes

Overall device status, used to prepare to receive requests. Valid values are:

  • Y: Connected.
  • N: Not connected. Please restart the terminal device.

Result codes

resultCode

resultStatus

resultMessage

Further action

SUCCESS

S

Success.

No action is required.

PROCESS_FAIL

F

A general business failure occurred. Do not retry.

Contact Antom Technical Support to troubleshoot the issue.

PROCESS_FAIL

F

The data format is invalid.

Contact Antom Technical Support to troubleshoot the issue.

PROCESS_FAIL

F

The public key pairing failed.

Contact Antom Technical Support to troubleshoot the issue.

TERMINAL_BUSY

F

The payment terminal is busy.Try again later.

DEVICE_NOT_CONNECT

F

The USB connection failed.
  • Check whether the initialization connection has been completed in your code. If not, perform initialization connection.
  • Check whether both ends of the USB connection are securely connected in your code. If not, connect the two devices again.

TIMEOUT_EXCEPTION

U

Response timeout.Check whether the payment terminal app is active. If not, activate it again.

UNKNOWN_EXCEPTION

U

The API call failed, which is caused by unknown reasons.Call the API again.

UNKNOWN_EXCEPTION

U

Failed to decrypt the data returned by the payment terminal.

Contact Antom Technical Support to troubleshoot the issue.

UNKNOWN_EXCEPTION

U

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:

copy
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:

copy
{
    "result":{
        "resultCode": "SUCCESS",
        "resultStatus": "S",
        "resultMessage": "Success."
    },
    "networkStatus": "Y",
    "printerStatus": "Y",
    "globalStatus": "Y"
}