cn.com.BTPaySDK
Class BTPay_SDKDemo
java.lang.Object
Activity
cn.com.BTPaySDK.BTPay_SDKDemo
- All Implemented Interfaces:
- OnReceiverListener
public class BTPay_SDKDemo
- extends Activity
- implements OnReceiverListener
Method Summary |
void |
onConfigurationChanged(Configuration newConfig)
|
void |
onCreate(Bundle savedInstanceState)
|
void |
onDestroy()
|
void |
OnEMVTransactionData(byte[] resultTags)
Call back function,this function will be called automatically if receive results from API startEMVTransaction().
|
void |
onPause()
|
void |
OnPinpadData(byte[] value,
int funcType)
Call back function,this function will be called automatically if finish PIN enter,cancel and timeout.
|
void |
onResume()
|
void |
onStart()
|
void |
onStop()
|
void |
OnSwipeMSRData(IDTMSRData card)
Call back function,this function will be called automatically if Card decode has been completed after swiping card. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BTPay_SDKDemo
public BTPay_SDKDemo()
onConfigurationChanged
public void onConfigurationChanged(Configuration newConfig)
onCreate
public void onCreate(Bundle savedInstanceState)
OnEMVTransactionData
public void OnEMVTransactionData(byte[] resultTags)
- Description copied from interface:
OnReceiverListener
- Call back function,this function will be called automatically if receive results from API startEMVTransaction().
- Specified by:
OnEMVTransactionData
in interface OnReceiverListener
- Parameters:
resultTags
- for Response code(2 bytes) + Response data(TLVs data returns back from ICC card).
Response code(2 bytes):
[0x00,0x00]- Approved,accept the online transaction.
[0x00,0x01]- Declined,decline the online transaction.
[0x00,0x02]- Go Online,request to go online;continue calling completeOnlineEMVTransaction to finish online authorization
[0x00,0x03]- Failed,transaction is terminate.
[0x00,0x05]- System Error, Application was not selected by kernel or ICC format Error or ICC missing data error.
[0x00,0x07]- Not Accept,ICC didn¡¯t accepted transaction.
[0x00,0x0A]- Fallback,application may fallback to magstripe technology.
[0x00,0x0C]- Cancel,transaction was cancel.
[0x00,0x0F]- Other Error.
[0x00,0x0D]- Time Out.
[0x00,0x10]- Offline approved,accept the offline transaction.
[0x00,0x11]- Offline declined,decline the offline transaction.
OnPinpadData
public void OnPinpadData(byte[] value,
int funcType)
- Description copied from interface:
OnReceiverListener
- Call back function,this function will be called automatically if finish PIN enter,cancel and timeout.
- Specified by:
OnPinpadData
in interface OnReceiverListener
- Parameters:
value
- for the PIN data.
1. funcType is EVENT_PINPAD_ENCRYPTED_PIN,call API getEncryptedPIN(),value is encrypted PIN and KSN.
a. MKSK-TDES:16 bytes ASCII encrypted PIN block.
b. DUKPT-TDES:20 bytes ASCII KSN and 16 bytes ASCII encrypted PIN block.
2. funcType is EVENT_PINPAD_NUMERIC,call API 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 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 getCardAccount(),value is encrypted Card account number and KSN(10 bytes).
5. funcType is EVENT_PINPAD_ENCRYPTED_DATA,call API 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 getFunctionKey(),value is function key.
0x43:"Cancel";
0x42:"Backspace";
0x45:"Enter";
0x23:"#";
0x2A:"*".
funcType
- for the PIN type or handle result,it was defined EVENT_PINPAD_* .
OnSwipeMSRData
public void OnSwipeMSRData(IDTMSRData card)
- Description copied from interface:
OnReceiverListener
- Call back function,this function will be called automatically if Card decode has been completed after swiping card.
- Specified by:
OnSwipeMSRData
in interface OnReceiverListener
- 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 -- 32 bytes if exist.
17. Track2 hash data -- 32 bytes if exist.
18. Track3 hash data -- 32 bytes if exist.
19. KSN -- 10 bytes.
onStart
public void onStart()
onResume
public void onResume()
onPause
public void onPause()
onStop
public void onStop()
onDestroy
public void onDestroy()