com.BTPaySDK
Interface OnReceiverListener
public interface OnReceiverListener
The interface includes the callback functions for card data, PIN data and EMV data.
The android activity should implement this interface then implement callback functions.
swipeMSRData
void swipeMSRData(IDTMSRData card)
- Call back function,this function will be called automatically if Card decode has been completed after swiping card.
- Parameters:
card
- the MSR data.
Card data.It is encrypted data and format is following:
1. Data Length low byte - 1 byte;
2. Data length high byte - 1 byte;
3. Card Encode Type - 1 byte.0x00/0x80-ISO/ABA format,0x01/0x81-AAMVA format,0x03/0x83-Other and 0x04/0x84-undecoded format.
4. Track1~3 Status - 1 byte.Bit0,1,2:Track1~3 decode and Bit3,4,5:Track1~3 sampling.
5. Track1 data length - 1 byte.This length is the plain card data's length.
6. Track2 data length - 1 byte.
7. Track3 data length - 1 byte.
8. Clear/mask data sent status - 1 byte.
Bit0:1--Track1 clear/mask status present,0--not present.
Bit1:1--Track2 clear/mask status present,0--not present.
Bit2:1--Track1 clear/mask status present,0--not present.
Bit3~Bit7:Reserved.Set to 0.
9.Encrypted/Hash data sent status - 1 byte.
Bit0:1--Track1 encrypted data present.
Bit1:1--Track2 encrypted data present.
Bit2:1--Track3 encrypted data present.
Bit3:1--Track1 hash data present.
Bit4:1--Track2 hash data present.
Bit5:1--Track3 hash data present.
Bit0:0.
Bit7:1--KSN present.
10. Track1 clear/mask data -- Var bytes.
11. Track2 clear/mask data -- Var bytes.
12. Track3 clear/mask data -- Var bytes.
13. Track1 encrypted data -- Var bytes.
14. Track2 encrypted data -- Var bytes.
15. Track3 encrypted data -- Var bytes.
16. Track1 hash data -- 20 bytes if exist.
17. Track2 hash data -- 20 bytes if exist.
18. Track3 hash data -- 20 bytes if exist.
19. KSN -- 10 bytes.
pinpadData
void pinpadData(byte[] value,
byte[] KSN,
OnReceiverListener.EVENT_PINPAD_Types funcType)
- Call back function,this function will be called automatically if finish PIN enter,cancel and timeout.
- Parameters:
value
- for the PIN data.
1. funcType is EVENT_PINPAD_ENCRYPTED_PIN,call API pin_getEncryptedPIN(),value is encrypted PIN.
16 bytes ASCII encrypted PIN block.
*
2. funcType is EVENT_PINPAD_NUMERIC,call API pin_getNumeric(),value is numeric keys.
For numeric keys,one length for keys + 16 bytes,each byte is two numeric keys,every key is the nibble of this byte.
The 'F' is the padding of the keys if the length of numeric keys is less than 32.
For example:input 7 numeric keys(2 5 7 8 9 0 6),the m_key buffer is 07 25 78 90 6F FF FF FF FF FF FF FF FF FF FF FF FF.
3. funcType is EVENT_PINPAD_AMOUNT,call API pin_getAmount(),value is amount keys.
For amount keys,one length for keys +16 bytes,each byte is two amount keys,every key is the nibble of this byte.
The 'F' is the padding of the keys if the length of amount keys is less than 32.
For example:input 7 amount keys(2 5 7 8 9 0 6),the m_Amount buffer is 07 25 78 90 6F FF FF FF FF FF FF FF FF FF FF FF FF.
Amount display on LCD is 25789.06.
4. funcType is EVENT_PINPAD_ACCOUNT,call API pin_getCardAccount(),value is encrypted Card account number.
5. funcType is EVENT_PINPAD_ENCRYPTED_DATA,call API pin_getEncryptedData().
eFlag = false:
value only is 0x06 and shows that API getEncryptedData successfully.
eFlag = true:
value for encrypted data + KSN(10 bytes).
plaint text data got from keypad encrypted by MSR dukpt key.
Plaint text data format(no more than 10 patterns):{Pattern 0} {Pattern 1}...{Pattern 9}.
6. funcType is EVENT_PINPAD_FUNCKEY,call API pin_getFunctionKey(),value is function key.
0x43:"Cancel";
0x42:"Backspace";
0x45:"Enter";
0x23:"#";
0x2A:"*".
KSN
- for Key Serial Number returns from pin_getEncryptedPIN, pin_getCardAccount or pin_getEncryptedData.funcType
- for the PIN type or handle result,it was defined EVENT_PINPAD_* .
emvTransactionData
void emvTransactionData(OnReceiverListener.EMV_RESULT_CODE_Types resultCode,
byte[] resultTags,
int errorCode)
- Call back function,this function will be called automatically if receive results from API emv_startEMVTransaction().
- Parameters:
resultCode
- for Response code.
EMV_RESULT_CODE_APPROVED - Approved,accept the online transaction.
EMV_RESULT_CODE_DECLINED - Declined,decline the online transaction.
EMV_RESULT_CODE_GO_ONLINE - Go Online,request to go online;continue calling emv_completeOnlineEMVTransaction to finish online authorization
EMV_RESULT_CODE_FAILED - Failed,transaction is terminate.
EMV_RESULT_CODE_SYSTEM_ERROR - System Error, Application was not selected by kernel or ICC format Error or ICC missing data error.
EMV_RESULT_CODE_NOT_ACCEPT - Not Accept,ICC didn't accepted transaction.
EMV_RESULT_CODE_FALLBACK - Fallback,application may fallback to magstripe technology.
EMV_RESULT_CODE_CANCEL - Cancel,transaction was cancel.
EMV_RESULT_CODE_OTHER_ERROR - Other Error.
EMV_RESULT_CODE_TIME_OUT - Time Out.
EMV_RESULT_CODE_OFFLINE_APPROVED - Offline approved,accept the offline transaction.
EMV_RESULT_CODE_OFFLINE_DECLINED- Offline declined,decline the offline transaction.
resultTags
- for Response data(TLVs data returns back from ICC card).
errorCode
- for error code which defined in BTPay_ErrorCode.
deviceConnected
void deviceConnected()
- Fires when device connects.
deviceDisconnected
void deviceDisconnected()
- Fires when device disconnects.