This method must be called when you want to carry out communication tests with the servers that the terminal communicates with. At the end of the execution, the EchoTestResults object will be returned, containing information about each test performed.
Methods
| Signature |
Description |
void startEchoTest(PaymentCallback paymentCallback) |
Starts the process to perform the communication tests. |
Parameters
| Name |
Type |
Mandatory |
Description |
callback |
PaymentCallback |
Yes |
Interface que será executada para notificações de sucesso ou erro. |
Parameter details
callback
| Name |
Type |
Mandatory |
Description |
onSuccess |
|
|
Method for notification on success |
|
|
|
|
onError |
|
|
Method for notification in case of error. |
ErrorData.paymentsResponseCode |
String |
Yes |
Response code for the error that occurred. See Response Codes |
ErrorData.responseMessage |
String |
Yes |
Descriptive message of the cause of the error. |
Example
public class MyActivity extends Activity implements PaymentClient.PaymentCallback {
private PaymentClient paymentClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_payment);
paymentClient = new PaymentClientImpl();
}
@Override
protected void onResume() {
super.onResume();
paymentClient.bind(this);
}
@Override
protected void onDestroy() {
try {
paymentClient.unbind(this);
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
super.onDestroy();
}
public void doExecute(){
ApplicationInfo appInfo = new ApplicationInfo();
appInfo.setCredentials(new Credentials("demo-app", "TOKEN-KEY-DEMO"));
appInfo.setSoftwareVersion("1.0.0.0");
try {
paymentClient.startEchoTest(this);
} catch (ClientException e) {
Log.e(TAG, "Error while doing the test", e);
}
}
@Override
public void onError(Object data) {
Log.e(TAG, "Error: " + errorData.getResponseMessage());
}
@Override
public void onSuccess(Object data) {
CommTestResults results = (CommTestResults) data;
Log.i(TAG, results.toString());
}
}
Return
| Name |
Type |
Description |
isConnectedNetwork |
boolean |
Identifies if you are connected to any network, be it Wi-Fi or Data Chip. |
networkLevel |
int |
Signal level of the connected network. |
isPaystoreInit |
boolean |
Indicates whether Initialization with Paystore is available. |
isStoreStatus |
boolean |
Indicates whether the App Store is available. |
storeResponseTime |
Long |
App Store response time. |
acquirerResults |
List<AcquirerCommTestResults> |
List with results of communication tests with acquirers. |
serverName |
String |
Server name. |
serverStatus |
boolean |
Indicates whether the server is available. |
serverMeanResponseTime |
Long |
Average server test response time (if you have more than one acquirer, this time is the average of all installed acquirers). |
AcquirerCommTestResults
| Name |
Type |
Description |
acquirerName |
String |
Purchaser's name. |
acquirerStatus |
CommTestStatus |
Indicates whether communication with the acquirer is available. |
acquirerResponseTime |
Long |
Test response time with the acquirer. |
serverName |
String |
Server name. |
serverStatus |
CommTestStatus |
Indicates whether the server is available. |
serverResponseTime |
Long |
Test response time with the server. |
CommTestStatus
| Name |
Description |
| NONE |
There is no communication. |
| ONLINE |
Communication is Online. |
| OFFLINE |
Communication is offline |