Skip to content

Commit 1783665

Browse files
krasimirkolevkalinkrustev
authored andcommitted
feat: zmk_arqc_arpc (#8)
1 parent 1461968 commit 1783665

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

payshield.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ PayshieldCodec.prototype.decode = function(buff, $meta) {
170170
if (!bodyObj) {
171171
throw new Error('Unable to match response errorCode!');
172172
}
173-
if (bodyObj.errorCode === '00' || bodyObj.errorCode === '02') {
173+
// 00 = No error
174+
// 01 = Verification failure or warning of imported key parity error (in some cases is warning)
175+
// 02 = Key inappropriate length for algorithm (in some cases is warning)
176+
if (['00', '01', '02'].includes(bodyObj.errorCode)) {
174177
bodyObj = bitsyntax.match(cmd.pattern, headObj.body);
175178
if (!bodyObj) {
176179
throw new Error('Unable to match pattern for opcode:' + commandName + '!');

payshield.messages.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939
"requestPattern": "cvk:33/string, account:12/string, \";\", expirationDate:4/string, serviceCode:3/string",
4040
"responsePattern": "errorCode:2/string, cvv:3/string"
4141
},
42+
"generateArqc": {
43+
"requestCode": "KW",
44+
"responseCode": "KX",
45+
"requestPattern": "modeFlag:1/string, schemeId:1/string, mkac:33/string, ivac:ivacLength/binary, panLength:panLengthLength/string, panSeqNo:panSeqNoLength/binary, delimiter1:delimiter1Length/string, branchHeightParams:branchHeightParamsLength/string, atc:2/binary, transactionDataLengthHex:transactionDataLengthLength/string, transactionData:transactionDataLengthDec/binary, delimiter2:delimiter2Length/string, arqc:8/binary, arc:arcLength/binary, csu:csuLength/string, padLength:padLengthLength/string, pad:padLength/string",
46+
"responsePattern": "errorCode:2/string, responseData/binary"
47+
},
4248
"verifyMac": {
4349
"requestCode": "M8",
4450
"responseCode": "M9",
@@ -127,5 +133,18 @@
127133
"responseCode": "DF",
128134
"requestPattern": "pvk:pvkLength/string, pin:cryptedPinLength/string, checkLength:2/string-left-zero, account:12/string, decimalisationTable:16/string, pinValidationData:12/string",
129135
"responsePattern": "errorCode:2/string, offset:12/string"
136+
},
137+
138+
"transladeBdkZmkLmk": {
139+
"requestCode": "DW",
140+
"responseCode": "DX",
141+
"requestPattern": "zmk:33/string, bdk:33/string, \";0X1\"",
142+
"responsePattern": "errorCode:2/string"
143+
},
144+
"transladeBdkLmkZmk": {
145+
"requestCode": "DY",
146+
"responseCode": "DZ",
147+
"requestPattern": "zmk:33/string, bdk:33/string",
148+
"responsePattern": "errorCode:2/string"
130149
}
131150
}

0 commit comments

Comments
 (0)