On the onActivityResult(int requestCode, int resultCode, Intent data) The Intent data will contain the return value as extra all in String value. If there is a problem with the data sent to the application, an error code will be sent back into the TERMINALERRORCODE extraData, other wise, RSPCODE will be the response code from the switch.
Error Codes
Value of the error code if application reject:
| Error code value | Description |
|---|
-1 | API extra data is missing |
-2 | Amount or the Invoice sent is invalid |
-3 | Transaction type is invalid |
-5 | Invoice number is already voided |
-8 | Battery is too low (less than 8%) |
List of extra data receive:
| Extra data on activity result | Description | Type |
|---|
TERMINALERRORCODE | Terminal error code | Integer |
RSPCODE | Response code | String |
INVNBR | Invoice number | String |
TRXDATE | Transaction date | String |
TRXTIME | Transaction time | String |
CARDNUMBER | Masked card number | String |
EXPDATE | Expiration date of the card | String |
WSN | Workstation number | String |
MID | Merchant ID | String |
AMOUNT | Amount of the transaction | String |
ORIGINALAMOUNT | Original amount of the transaction if a partial transaction | String |
PARTIAL | If a partial redemption will be true | Boolean |
TCN | Transaction confirmation number | String |
TCR | Number of the transaction to cancel | String |
CTM | CTM value, extra data print on the receipt | String |
CLERKID | Clerk id | String |
Code Example
JavaScript
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
String value = "";
if (data != null )
{
value += "TERMINALERRORCODE = " + data.getIntExtra("TERMINALERRORCODE", 0) + "\n";
value += "WSN = " + data.getStringExtra("TERMID") + "\n";
value += "MID = " + data.getStringExtra("MID") + "\n";
value += "AMOUNT = " + data.getStringExtra("AMOUNT") + "\n";
value += "TRXDATE = " + data.getStringExtra("TRXDATE") + "\n";
value += "TRXTIME = " + data.getStringExtra("TRXTIME") + "\n";
value += "RSPCODE = " + data.getStringExtra("RSPCODE") + "\n";
value += "INVNBR = " + data.getStringExtra("INVNBR") + "\n";
value += "TCN = " + data.getStringExtra("TCN") + "\n";
value += "TCR = " + data.getStringExtra("TCR") + "\n";
value += "CTM = " + data.getStringExtra("CTM") + "\n";
value += "EXPDATE = " + data.getStringExtra("EXPDATE") + "\n";
value += "CARDNUMBER = " + data.getStringExtra("MASKEDCARDNBR") + "\n";
value += "CLERKID = " + data.getStringExtra("CLERKID") + "\n";
}
AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
alertDialog.setTitle("Alert");
alertDialog.setMessage(value);
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
alertDialog.show();
((TextView)findViewById(R.id.textView)).setText( "Response code = " + String.format("%03d",resultCode));
}