|
|
@@ -5302,6 +5302,7 @@ int CCardIssuerFSM::SplitDevModelInfo()
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+ CheckSupportRf();
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@@ -5437,6 +5438,7 @@ void CCardIssuerFSM::CheckSupportRf()
|
|
|
if (m_csRF.Compare("Y") == 0) {
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("szModel,RF=%s", m_csRF.GetData());
|
|
|
m_bSupportRF = true;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
CAutoArray<CSimpleStringA> arr = m_rfVendorList.Split('|');
|
|
|
@@ -5447,6 +5449,7 @@ void CCardIssuerFSM::CheckSupportRf()
|
|
|
m_bSupportRF = true;
|
|
|
}
|
|
|
}
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
int CCardIssuerFSM::EjectJS(SpReqAnsContext<CardIssuerStandService_EjectJS_Req, CardIssuerStandService_EjectJS_Ans>::Pointer ctx)
|
|
|
@@ -6189,7 +6192,7 @@ int CCardIssuerFSM::CheckCardType(CSimpleStringA cardNo, bool bReadMag, int& ICt
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-int CCardIssuerFSM::PreOnlineJS_Contact(SpReqAnsContext<CardIssuerStandService_ReadJS_Req, CardIssuerStandService_ReadJS_Ans>::Pointer ctx, bool bContinue)
|
|
|
+int CCardIssuerFSM::PreOnlineJS_ReadViaContact(SpReqAnsContext<CardIssuerStandService_ReadJS_Req, CardIssuerStandService_ReadJS_Ans>::Pointer ctx, bool bContinue)
|
|
|
{
|
|
|
//oiltmp TODO? need to judge if need movecard to the position?
|
|
|
LOG_FUNCTION();
|
|
|
@@ -6345,8 +6348,8 @@ int CCardIssuerFSM::PreOnlineJS_Contact(SpReqAnsContext<CardIssuerStandService_R
|
|
|
|
|
|
m_pCardProcess->TermRiskManage();
|
|
|
CSimpleStringA taaResult;
|
|
|
- BYTE bt9f27 = 0;
|
|
|
- int retTAA = m_pCardProcess->TermActionAnalyze(CARD_MACHINE_ISSUER, m_hDevHelper, taaResult, true, m_bCDA, bt9f27);
|
|
|
+ m_btCID = 0;
|
|
|
+ int retTAA = m_pCardProcess->TermActionAnalyze(CARD_MACHINE_ISSUER, m_hDevHelper, taaResult, true, m_bCDA, m_btCID);
|
|
|
if (retTAA != 0) {
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnlineJS_Contact>, TermActionAnalyze, retTAA:%d, taaResult:%s", retTAA, taaResult.GetData());
|
|
|
}
|
|
|
@@ -6362,194 +6365,10 @@ int CCardIssuerFSM::PreOnlineJS_Contact(SpReqAnsContext<CardIssuerStandService_R
|
|
|
break;
|
|
|
}
|
|
|
ctx->Ans.result = taaResult;
|
|
|
-
|
|
|
- if (ctx->Ans.result.GetLength() == 0)
|
|
|
- {
|
|
|
- if (m_bSupportRF) {
|
|
|
- bContinue = true; //继续后面的非接流程
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnlineJS_Contact>,TermActionAnalyze result len = 0");
|
|
|
- ctx->Ans.icState = 0;
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
- }
|
|
|
- return -1;
|
|
|
- }
|
|
|
-
|
|
|
- string tmpResult, actionType, result = "", baseICData = "";
|
|
|
- tmpResult = ctx->Ans.result;
|
|
|
- char* pSomeICData = new char[ONE_K];
|
|
|
- ZeroMemory(pSomeICData, ONE_K);
|
|
|
- int lenRet = m_pCardProcess->ConstructARQCData(tmpResult.substr(6, 4).c_str(), m_pDataToARQC, pSomeICData);
|
|
|
- baseICData = pSomeICData;
|
|
|
- if (pSomeICData != NULL) {
|
|
|
- delete[]pSomeICData;
|
|
|
- }
|
|
|
- char arqcLen[8];
|
|
|
- ZeroMemory(arqcLen, sizeof(arqcLen));
|
|
|
- _itoa(lenRet, arqcLen, 10);
|
|
|
-
|
|
|
- ICData track2(false, 0x57, 0x00), ICCardSerial(false, 0x5f, 0x34), appExpiryDate(false, 0x5f, 0x24), icPAN(false, 0x5a, 0x00);
|
|
|
- ErrorCodeEnum eErr = Error_Unexpect;
|
|
|
- CSimpleStringA t2ICTrack2(""), cardType("0"), csExpireDate("");
|
|
|
-
|
|
|
- char* pExpireDate = new char[12];//获取ic有效期
|
|
|
- ZeroMemory(pExpireDate, 12);
|
|
|
- if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC, appExpiryDate, false, 0) == -1)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA23E1")("<PreOnlineJS_Contact>, can't find expire date");
|
|
|
- if (m_bSupportRF) {
|
|
|
- bContinue = true; //继续后面的非接流程
|
|
|
- delete[] pExpireDate;
|
|
|
- return -1;
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- HexBuf2StrBuf(appExpiryDate.value, &pExpireDate, appExpiryDate.lenth);
|
|
|
- csExpireDate = pExpireDate;
|
|
|
- }
|
|
|
- delete[] pExpireDate;
|
|
|
-
|
|
|
-
|
|
|
- char* pICCardSerial = new char[4];//获取ic序号
|
|
|
- ZeroMemory(pICCardSerial, 4);
|
|
|
- if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC, ICCardSerial, false) == -1)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA23E1")("<PreOnlineJS_Contact>, can't find card serial.");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //oiltmp@20250808 TODO:add ic tag-value to ic data list
|
|
|
- //HexBuf2StrBuf(ICCardSerial.value, &pICCardSerial, ICCardSerial.lenth);
|
|
|
- //t2ICCardSerial = pICCardSerial;
|
|
|
- }
|
|
|
- delete[] pICCardSerial;
|
|
|
-
|
|
|
-
|
|
|
- char* pICTrack2 = new char[128];//获取等效磁条2
|
|
|
- ZeroMemory(pICTrack2, 128);
|
|
|
- if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC, track2, false, 0) == -1)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA23E1")("<PreOnlineCrossJS_Contact>, ic no track2 data");
|
|
|
- l_beginTime = GetTickCountRVC();
|
|
|
- eErr = m_hDevHelper->ReleaseIC();
|
|
|
- l_endTime = GetTickCountRVC();
|
|
|
- if (eErr != Error_Succeed) {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ReleaseIC, "DevAdapter::ReleaseIC", __FUNCTION__, false, l_endTime - l_beginTime, "", "");
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::ReleaseIC").setCostTime(l_endTime - l_beginTime)("PreOnlineJS_Contact::ReleaseIC");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- HexBuf2StrBuf(track2.value, &pICTrack2, track2.lenth);
|
|
|
- t2ICTrack2 = pICTrack2;
|
|
|
- }
|
|
|
- delete[]pICTrack2;
|
|
|
-
|
|
|
- char* pPAN = new char[20];//Primary Account Number. var length, max cn19
|
|
|
- ZeroMemory(pPAN, 20);
|
|
|
- if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC, icPAN, false) == -1)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__).setResultCode("RTA23E1")("can't find PAN(tag:5a)");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- HexBuf2StrBuf(icPAN.value, &pPAN, icPAN.lenth);
|
|
|
- m_currCardNo = pPAN;
|
|
|
- LogWarn(Severity_Low, Error_Unexpect, CardIssuer_UserErrorCode_CardBin, SP::Module::Util::DataMask(SP::Module::Util::DataMask_CardAccount, m_currCardNo).GetData());
|
|
|
- }
|
|
|
- delete[] pPAN;
|
|
|
-
|
|
|
- //80 1e 80 0008 328ab54bfc986b85 07010103a0b000010a010000000000754048769000
|
|
|
- if (m_pCardProcess->GetP1() == 0x1) {
|
|
|
- actionType = "ARQC";
|
|
|
- }
|
|
|
- else {
|
|
|
- actionType = "";
|
|
|
- }
|
|
|
- //【55域】
|
|
|
- // 基本域:
|
|
|
- // 9F26 8b 应用密文AC
|
|
|
- // 9F27 1b 密文信息数据
|
|
|
- // 9F10 max.32b 发卡行应用数据IAD
|
|
|
- // 9F37 4b 不可预知数
|
|
|
- // 9F36 2b 应用交易计数器ATC
|
|
|
- // 95 5b 终端验证结果TVR
|
|
|
- // 9A 3cn 交易日期(6位有效数字,YYMMDD)
|
|
|
- // 9C 1cn 交易类型(2位有效数字)
|
|
|
- // 9F02 6cn 授权金额(12位有效数字)
|
|
|
- // 5F2A 2cn 交易货币代码(3位有效数字)
|
|
|
- // 82 2b 应用交互特征AIP
|
|
|
- // 9F1A 2cn 终端国家代码(3位有效数字)
|
|
|
- // 9F03 6cn 其他金额(12位有效数字)
|
|
|
- // 9F33 3b 终端性能 "E0C900"
|
|
|
-
|
|
|
- // 可选域:
|
|
|
- //添加9F26,9F27,9F10,9F33的数据
|
|
|
- char* pCID = new char[4];
|
|
|
- ZeroMemory(pCID, 4);
|
|
|
- HexBuf2StrBuf(&bt9f27, &pCID, 1);
|
|
|
- char* pIssueBankLen = new char[4];
|
|
|
- ZeroMemory(pIssueBankLen, 4);
|
|
|
- int len9f10 = tmpResult.length() - 26 - 4;
|
|
|
- int lenHigh, lenLow;
|
|
|
- len9f10 = len9f10 / 2;
|
|
|
- lenHigh = len9f10 / 16;
|
|
|
- lenLow = len9f10 % 16;
|
|
|
- BYTE bt9f10;
|
|
|
- bt9f10 = (lenHigh << 4) + lenLow;
|
|
|
- HexBuf2StrBuf(&bt9f10, &pIssueBankLen, 1);
|
|
|
- baseICData += "9F2608" + tmpResult.substr(10, 16) + "9F2701" + pCID + "9F10" + pIssueBankLen + tmpResult.substr(26, tmpResult.length() - 26 - 4) + "9F3303" + "E0C900";
|
|
|
-
|
|
|
- //json格式返回
|
|
|
- std::map<std::string, std::string> msgInfo;
|
|
|
- msgInfo["ACTION"] = actionType.c_str();
|
|
|
- msgInfo["ATC_CODE"] = tmpResult.substr(6, 4).c_str();
|
|
|
- msgInfo["ARQC_CODE"] = tmpResult.substr(10, 16).c_str();
|
|
|
- msgInfo["MAC"] = tmpResult.substr(26, tmpResult.length() - 26 - 4).c_str();
|
|
|
- CSimpleStringA arqcLenStr = arqcLen;
|
|
|
- msgInfo["ARQC_SIZE"] = arqcLenStr.GetData();
|
|
|
- CSimpleStringA arqcData = m_pDataToARQC;
|
|
|
- msgInfo["ARQC_DATA"] = arqcData.GetData();
|
|
|
- msgInfo["T2TRACK2_DATA"] = t2ICTrack2;
|
|
|
- msgInfo["EXPIRE_DATE"] = csExpireDate;
|
|
|
- msgInfo["IC_TAGS"] = baseICData.c_str();
|
|
|
-
|
|
|
- std::pair<bool, std::string> strResult;
|
|
|
- strResult = generateJsonStr(msgInfo);
|
|
|
- result = strResult.second.c_str();
|
|
|
-
|
|
|
- //DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("data to host result=%s,len=%d", result.c_str(), result.length());
|
|
|
-
|
|
|
- string txtresult = "ACTION," + actionType + "|" + "ATCCODE," + tmpResult.substr(6, 4) + "|" + "ARQCCODE," + tmpResult.substr(10, 16) + "|"
|
|
|
- + "MAC," + tmpResult.substr(26, tmpResult.length() - 26 - 4) + "|" + "ARQCSIZE," + string(arqcLen) + "|ARQCDATA, " + m_pDataToARQC + "|"
|
|
|
- + "T2TRACK2(len)," + CSimpleStringA::Format("%d", t2ICTrack2.GetLength()).GetData() + "|"
|
|
|
- + "EXPIREDATE(len)," + csExpireDate.GetData() + "|"
|
|
|
- + "ICTAGS, " + CSimpleStringA::Format("%d", baseICData.length()).GetData();
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<PreOnlineJS_Contact>, data to host(less)[%s]", txtresult.c_str());
|
|
|
-
|
|
|
- if (pCID != NULL)
|
|
|
- delete[]pCID;
|
|
|
- if (pIssueBankLen != NULL)
|
|
|
- delete[]pIssueBankLen;
|
|
|
-
|
|
|
- if (m_pDataToARQC != NULL)
|
|
|
- {
|
|
|
- delete[]m_pDataToARQC;
|
|
|
- m_pDataToARQC = NULL;
|
|
|
- }
|
|
|
-
|
|
|
- ctx->Ans.result = result.c_str();
|
|
|
- ctx->Ans.icState = 0;
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR040220306")();
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-int CCardIssuerFSM::PreOnlineJS_RF(SpReqAnsContext<CardIssuerStandService_ReadJS_Req, CardIssuerStandService_ReadJS_Ans>::Pointer ctx, bool bContinue)
|
|
|
+int CCardIssuerFSM::PreOnlineJS_ReadViaRF(SpReqAnsContext<CardIssuerStandService_ReadJS_Req, CardIssuerStandService_ReadJS_Ans>::Pointer ctx, bool bContinue)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
long l_beginTime, l_endTime;
|
|
|
@@ -6688,8 +6507,8 @@ int CCardIssuerFSM::PreOnlineJS_RF(SpReqAnsContext<CardIssuerStandService_ReadJS
|
|
|
|
|
|
m_pCardProcess->TermRiskManage();
|
|
|
CSimpleStringA taaResult;
|
|
|
- BYTE bt9f27 = 0;
|
|
|
- int retTAA = m_pCardProcess->TermActionAnalyze(CARD_MACHINE_ISSUER_RF, m_hDevHelper, taaResult, true, m_bCDA, bt9f27);
|
|
|
+ m_btCID = 0;
|
|
|
+ int retTAA = m_pCardProcess->TermActionAnalyze(CARD_MACHINE_ISSUER_RF, m_hDevHelper, taaResult, true, m_bCDA, m_btCID);
|
|
|
if (retTAA != 0) {
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnlineJS_RF>, TermActionAnalyze, retTAA:%d, taaResult:%s", retTAA, taaResult.GetData());
|
|
|
}
|
|
|
@@ -6705,10 +6524,13 @@ int CCardIssuerFSM::PreOnlineJS_RF(SpReqAnsContext<CardIssuerStandService_ReadJS
|
|
|
break;
|
|
|
}
|
|
|
ctx->Ans.result = taaResult;
|
|
|
-
|
|
|
- if (ctx->Ans.result.GetLength() == 0)//oiltmp no need to preonline?
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+int CCardIssuerFSM::PreOnlineJS_ICDataProcess(SpReqAnsContext<CardIssuerStandService_ReadJS_Req, CardIssuerStandService_ReadJS_Ans>::Pointer ctx)
|
|
|
+{
|
|
|
+ LOG_FUNCTION();
|
|
|
+ if (ctx->Ans.result.GetLength() == 0)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnlineJS_RF>,TermActionAnalyze result len = 0");
|
|
|
ctx->Ans.icState = 0;
|
|
|
ctx->Answer(Error_Succeed);
|
|
|
return 0;
|
|
|
@@ -6720,25 +6542,30 @@ int CCardIssuerFSM::PreOnlineJS_RF(SpReqAnsContext<CardIssuerStandService_ReadJS
|
|
|
ZeroMemory(pSomeICData, ONE_K);
|
|
|
int lenRet = m_pCardProcess->ConstructARQCData(tmpResult.substr(6, 4).c_str(), m_pDataToARQC, pSomeICData);
|
|
|
baseICData = pSomeICData;
|
|
|
- if (pSomeICData != NULL)
|
|
|
+ if (pSomeICData != NULL) {
|
|
|
delete[]pSomeICData;
|
|
|
+ }
|
|
|
char arqcLen[8];
|
|
|
ZeroMemory(arqcLen, sizeof(arqcLen));
|
|
|
_itoa(lenRet, arqcLen, 10);
|
|
|
|
|
|
-
|
|
|
ICData track2(false, 0x57, 0x00), ICCardSerial(false, 0x5f, 0x34), appExpiryDate(false, 0x5f, 0x24), icPAN(false, 0x5a, 0x00);
|
|
|
- string t2ICCardSerial(""), t2ICTrack2(""), t2ICExpireDate("");
|
|
|
+ ErrorCodeEnum eErr = Error_Unexpect;
|
|
|
+ CSimpleStringA t2ICTrack2(""), cardType("0"), csExpireDate("");
|
|
|
|
|
|
char* pExpireDate = new char[12];//获取ic有效期
|
|
|
ZeroMemory(pExpireDate, 12);
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC, appExpiryDate, false, 0) == -1)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA23E1")("<PreOnlineJS_RF>, can't find expire date");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA23E1")("<PreOnlineJS_Contact>, can't find expire date");
|
|
|
+ if (m_bSupportRF) {
|
|
|
+ delete[] pExpireDate;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
HexBuf2StrBuf(appExpiryDate.value, &pExpireDate, appExpiryDate.lenth);
|
|
|
- t2ICExpireDate = pExpireDate;
|
|
|
+ csExpireDate = pExpireDate;
|
|
|
}
|
|
|
delete[] pExpireDate;
|
|
|
|
|
|
@@ -6747,22 +6574,31 @@ int CCardIssuerFSM::PreOnlineJS_RF(SpReqAnsContext<CardIssuerStandService_ReadJS
|
|
|
ZeroMemory(pICCardSerial, 4);
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC, ICCardSerial, false) == -1)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA23E1")("<PreOnlineJS_RF>, can't find card serial.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA23E1")("<PreOnlineJS_Contact>, can't find card serial.");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- HexBuf2StrBuf(ICCardSerial.value, &pICCardSerial, ICCardSerial.lenth);
|
|
|
- t2ICCardSerial = pICCardSerial;
|
|
|
+ //oiltmp@20250808 TODO:add ic tag-value to ic data list
|
|
|
+ //HexBuf2StrBuf(ICCardSerial.value, &pICCardSerial, ICCardSerial.lenth);
|
|
|
+ //t2ICCardSerial = pICCardSerial;
|
|
|
}
|
|
|
delete[] pICCardSerial;
|
|
|
|
|
|
|
|
|
-
|
|
|
char* pICTrack2 = new char[128];//获取等效磁条2
|
|
|
ZeroMemory(pICTrack2, 128);
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC, track2, false, 0) == -1)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA23E1")("<PreOnlineJS_RF>, ic no track2 data");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA23E1")("<PreOnlineCrossJS_Contact>, ic no track2 data");
|
|
|
+ m_ullBeginTime = GetTickCountRVC();
|
|
|
+ eErr = m_hDevHelper->ReleaseIC();
|
|
|
+ m_ullEndTime = GetTickCountRVC();
|
|
|
+ if (eErr != Error_Succeed) {
|
|
|
+ SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ReleaseIC, "DevAdapter::ReleaseIC", __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, "", "");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::ReleaseIC").setCostTime(m_ullEndTime - m_ullBeginTime)("PreOnlineJS_Contact::ReleaseIC");
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -6813,7 +6649,7 @@ int CCardIssuerFSM::PreOnlineJS_RF(SpReqAnsContext<CardIssuerStandService_ReadJS
|
|
|
//添加9F26,9F27,9F10,9F33的数据
|
|
|
char* pCID = new char[4];
|
|
|
ZeroMemory(pCID, 4);
|
|
|
- HexBuf2StrBuf(&bt9f27, &pCID, 1);
|
|
|
+ HexBuf2StrBuf(&m_btCID, &pCID, 1);
|
|
|
char* pIssueBankLen = new char[4];
|
|
|
ZeroMemory(pIssueBankLen, 4);
|
|
|
int len9f10 = tmpResult.length() - 26 - 4;
|
|
|
@@ -6826,13 +6662,6 @@ int CCardIssuerFSM::PreOnlineJS_RF(SpReqAnsContext<CardIssuerStandService_ReadJS
|
|
|
HexBuf2StrBuf(&bt9f10, &pIssueBankLen, 1);
|
|
|
baseICData += "9F2608" + tmpResult.substr(10, 16) + "9F2701" + pCID + "9F10" + pIssueBankLen + tmpResult.substr(26, tmpResult.length() - 26 - 4) + "9F3303" + "E0C900";
|
|
|
|
|
|
- //result = "ACTION," + actionType + "|" + "ATCCODE," + tmpResult.substr(6, 4) + "|" + "ARQCCODE," + tmpResult.substr(10, 16) + "|"
|
|
|
- // + "MAC," + tmpResult.substr(26, tmpResult.length() - 26 - 4) + "|" + "ARQCSIZE," + string(arqcLen) + "|"
|
|
|
- // + "ARQCDATA," + m_pDataToARQC + "|EXPIREDATE," + pExpireDate + "|T2ACCOUNT," + t2ICAccount + "|T2CARDSERIAL," + t2ICCardSerial
|
|
|
- // + "|T2CVC," + t2ICCVC + "|T2TRACK2," + t2ICTrack2 + "|CARDCAT," + cardType + "|ICTAGS," + baseICData + "|MAGT2," + (const char*)csMagT2Track
|
|
|
- // + "|MAGT3," + (const char*)csMagT3Track + "|MAGACCOUNT," + (const char*)csMagAccout + "|MAGREGION," + (const char*)csMagRegion
|
|
|
- // + "|MAGCARDSERIAL," + (const char*)csMagCardSerial + "|MAGCVC," + (const char*)csMagCVC + "|MAGEXPIREDATAE," + (const char*)csMagExpireDate;
|
|
|
-
|
|
|
//json格式返回
|
|
|
std::map<std::string, std::string> msgInfo;
|
|
|
msgInfo["ACTION"] = actionType.c_str();
|
|
|
@@ -6843,9 +6672,8 @@ int CCardIssuerFSM::PreOnlineJS_RF(SpReqAnsContext<CardIssuerStandService_ReadJS
|
|
|
msgInfo["ARQC_SIZE"] = arqcLenStr.GetData();
|
|
|
CSimpleStringA arqcData = m_pDataToARQC;
|
|
|
msgInfo["ARQC_DATA"] = arqcData.GetData();
|
|
|
- msgInfo["T2TRACK2_DATA"] = t2ICTrack2.c_str();
|
|
|
- msgInfo["EXPIRE_DATE"] = t2ICExpireDate.c_str();
|
|
|
- msgInfo["T2CARD_SERIAL"] = t2ICCardSerial.c_str();
|
|
|
+ msgInfo["T2TRACK2_DATA"] = t2ICTrack2;
|
|
|
+ msgInfo["EXPIRE_DATE"] = csExpireDate;
|
|
|
msgInfo["IC_TAGS"] = baseICData.c_str();
|
|
|
|
|
|
std::pair<bool, std::string> strResult;
|
|
|
@@ -6856,9 +6684,8 @@ int CCardIssuerFSM::PreOnlineJS_RF(SpReqAnsContext<CardIssuerStandService_ReadJS
|
|
|
|
|
|
string txtresult = "ACTION," + actionType + "|" + "ATCCODE," + tmpResult.substr(6, 4) + "|" + "ARQCCODE," + tmpResult.substr(10, 16) + "|"
|
|
|
+ "MAC," + tmpResult.substr(26, tmpResult.length() - 26 - 4) + "|" + "ARQCSIZE," + string(arqcLen) + "|ARQCDATA, " + m_pDataToARQC + "|"
|
|
|
- + "T2TRACK2(len)," + CSimpleStringA::Format("%d", t2ICTrack2.length()).GetData() + "|"
|
|
|
- + "EXPIREDATE(len)," + CSimpleStringA::Format("%d", t2ICExpireDate.length()).GetData() + "|"
|
|
|
- + "T2CARDSERIAL(len), " + CSimpleStringA::Format("%d", t2ICCardSerial.length()).GetData() + "|"
|
|
|
+ + "T2TRACK2(len)," + CSimpleStringA::Format("%d", t2ICTrack2.GetLength()).GetData() + "|"
|
|
|
+ + "EXPIREDATE(len)," + csExpireDate.GetData() + "|"
|
|
|
+ "ICTAGS, " + CSimpleStringA::Format("%d", baseICData.length()).GetData();
|
|
|
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<PreOnlineJS_Contact>, data to host(less)[%s]", txtresult.c_str());
|
|
|
@@ -6875,10 +6702,9 @@ int CCardIssuerFSM::PreOnlineJS_RF(SpReqAnsContext<CardIssuerStandService_ReadJS
|
|
|
}
|
|
|
|
|
|
ctx->Ans.result = result.c_str();
|
|
|
- ctx->Ans.icState = 1;//成功
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
- LogWarn(Severity_Low, Error_Succeed, CardIssuer_UserErrorCode_ReadByRF, CSimpleStringA::Format("PreOnline_RF ok.iIssue:%d ", m_issueStatus));
|
|
|
+ ctx->Ans.icState = 0;
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR040220306")();
|
|
|
+ ctx->Answer(Error_Succeed);
|
|
|
return 0;
|
|
|
}
|
|
|
int CCardIssuerFSM::ReadJS(SpReqAnsContext<CardIssuerStandService_ReadJS_Req, CardIssuerStandService_ReadJS_Ans>::Pointer ctx)
|
|
|
@@ -6886,25 +6712,76 @@ int CCardIssuerFSM::ReadJS(SpReqAnsContext<CardIssuerStandService_ReadJS_Req, Ca
|
|
|
switch (ctx->Req.mode)
|
|
|
{
|
|
|
case ReadMode_MagOnly:
|
|
|
+ ReadMag(ctx);
|
|
|
+ ctx->Answer(Error_Succeed);
|
|
|
break;
|
|
|
case ReadMode_ContactICFirst:
|
|
|
+ {
|
|
|
+ //read via contact, if failed and support RF,to read via RF
|
|
|
+ int ret = PreOnlineJS_ReadViaContact(ctx, m_bSupportRF);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("ret:%d, m_bSupportRF:%d", ret, m_bSupportRF);
|
|
|
+ if (ret != 0 && m_bSupportRF)
|
|
|
+ PreOnlineJS_ReadViaRF(ctx, false);
|
|
|
+ PreOnlineJS_ICDataProcess(ctx);
|
|
|
+ }
|
|
|
break;
|
|
|
case ReadMode_ContactlessICFirst:
|
|
|
+ {
|
|
|
+ //if support RF, read via RF, if failed then read via contact
|
|
|
+ int ret = -1;
|
|
|
+ if (m_bSupportRF)
|
|
|
+ ret = PreOnlineJS_ReadViaRF(ctx, true);
|
|
|
+ if (ret != 0)
|
|
|
+ PreOnlineJS_ReadViaContact(ctx, false);
|
|
|
+ PreOnlineJS_ICDataProcess(ctx);
|
|
|
+ }
|
|
|
break;
|
|
|
case ReadMode_ContactlessICOnly:
|
|
|
+ {
|
|
|
+ if (m_bSupportRF)
|
|
|
+ {
|
|
|
+ if (PreOnlineJS_ReadViaRF(ctx, false) == 0)
|
|
|
+ PreOnlineJS_ICDataProcess(ctx);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_NotSupportRF);
|
|
|
+ }
|
|
|
break;
|
|
|
case ReadMode_Mag_ContactICFirst:
|
|
|
{
|
|
|
- //first read mag, then read via contact, if failed and support rf,to read via contactless
|
|
|
+ //first read mag, then read via contact, if failed and support RF,to read via RF
|
|
|
ReadMag(ctx);
|
|
|
- int ret = PreOnlineJS_Contact(ctx, m_bSupportRF);
|
|
|
+ int ret = PreOnlineJS_ReadViaContact(ctx, m_bSupportRF);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("ret:%d, m_bSupportRF:%d", ret, m_bSupportRF);
|
|
|
if (ret != 0 && m_bSupportRF)
|
|
|
- PreOnlineJS_RF(ctx, false);
|
|
|
+ PreOnlineJS_ReadViaRF(ctx, false);
|
|
|
+ PreOnlineJS_ICDataProcess(ctx);
|
|
|
}
|
|
|
break;
|
|
|
case ReadMode_Mag_ContactlessICFirst:
|
|
|
+ {
|
|
|
+ //first read mag, if support RF, read via RF, if failed then read via contact
|
|
|
+ int ret = -1;
|
|
|
+ ReadMag(ctx);
|
|
|
+ if (m_bSupportRF)
|
|
|
+ ret = PreOnlineJS_ReadViaRF(ctx, true);
|
|
|
+ if (ret != 0)
|
|
|
+ PreOnlineJS_ReadViaContact(ctx, false);
|
|
|
+ PreOnlineJS_ICDataProcess(ctx);
|
|
|
+ }
|
|
|
break;
|
|
|
case ReadMode_Mag_ContactlessICOnly:
|
|
|
+ {
|
|
|
+ int ret = -1;
|
|
|
+ ReadMag(ctx);
|
|
|
+ if (m_bSupportRF)
|
|
|
+ {
|
|
|
+ if (PreOnlineJS_ReadViaRF(ctx, false) == 0)
|
|
|
+ PreOnlineJS_ICDataProcess(ctx);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ ctx->Answer(Error_Succeed);
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
break;
|