|
@@ -639,7 +639,8 @@ ErrorCodeEnum CPinPadFSM::GetEncryptText(SpReqAnsContext<PinPadService_GetInputS
|
|
|
ctxSM->Answer(Error_DevCommFailed, dwUserCode);
|
|
|
return Error_DevCommFailed;
|
|
|
}
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::SetAccNo").setCostTime(m_ullEndTime - m_ullBeginTime)();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::SetAccNo").setCostTime(m_ullEndTime - m_ullBeginTime)
|
|
|
+ ("req,timeout:%d,confirm:%d,length:%d,traceId:[%s]", ctxSM->Req.timeout, ctxSM->Req.confirm, ctxSM->Req.length, ctxSM->link.traceId.GetData());
|
|
|
|
|
|
m_ullBeginTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
errCode = m_hDevHelper->ActiveWorkingKey(1, 0);
|
|
@@ -688,7 +689,6 @@ ErrorCodeEnum CPinPadFSM::GetEncryptText(SpReqAnsContext<PinPadService_GetInputS
|
|
|
DWORD dwStart = GetTickCount();
|
|
|
DWORD dwEnd = GetTickCount();
|
|
|
bool bCancelInput = false;
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("req(pin)len:[%d],timeout:[%d],confirm:[%d],bExit(%d)", len, timeout, confirm, m_bExit);
|
|
|
while (elapsed < MAX_PINPAD_INPUT_TIMEOUT) {
|
|
|
if (m_bExit)
|
|
|
break;
|
|
@@ -945,8 +945,8 @@ int CPinPadFSM::GetInput(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadSer
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StopInput").setCostTime(m_ullEndTime - m_ullBeginTime)("StopInput cost(%d)ms", m_ullEndTime - m_ullBeginTime);
|
|
|
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)
|
|
|
- ("req acc.len:%d,confirm:%d,len:%d. ans:ck.len:%d", m_inputSMCtx->Req.account.GetLength(), m_inputSMCtx->Req.confirm
|
|
|
- , m_inputSMCtx->Req.length, m_inputSMCtx->Ans.checkcode.IsNullOrEmpty() ? 0 : m_inputSMCtx->Ans.checkcode.GetLength());
|
|
|
+ ("req acc.len:%d,confirm:%d,len:%d. ans:ck.len:%d,traceid[%s]", m_inputSMCtx->Req.account.GetLength(), m_inputSMCtx->Req.confirm
|
|
|
+ , m_inputSMCtx->Req.length, m_inputSMCtx->Ans.checkcode.IsNullOrEmpty() ? 0 : m_inputSMCtx->Ans.checkcode.GetLength(),m_inputSMCtx->link.traceId.GetData());
|
|
|
DbgToBeidou(m_inputSMCtx->link, "GetInput")();
|
|
|
m_bPinInput = false;
|
|
|
LogEvent(Severity_Middle, LOG_EVT_PINPAD_GREEN_OFF, "PinPad light off.");
|
|
@@ -955,7 +955,11 @@ int CPinPadFSM::GetInput(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadSer
|
|
|
{
|
|
|
ULLINT ullGetInputEnd = SP::Module::Comm::RVCGetTickCount();
|
|
|
LogWarn(Severity_Low, Error_Unexpect, PinPad_UserErrorCode_GetInput_TimeCost, CSimpleStringA::Format("%d", (ullGetInputEnd - ullGetInputBegin) / 1000));
|
|
|
- m_inputSMCtx->Answer(Error_Succeed);
|
|
|
+ if ((eErrCode = m_inputSMCtx->Answer(Error_Succeed)) != Error_Succeed)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setResultCode("RTA2617")("Answer:%d", eErrCode);
|
|
|
+ LogWarn(Severity_Low, Error_Unexpect, PinPad_UserErrorCode_Ctx_Answer_Error, CSimpleStringA::Format("Answer:%d", eErrCode));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
@@ -1302,16 +1306,17 @@ ErrorCodeEnum CPinPadFSM::GetEncryptTextJS(SpReqAnsContext<PinPadService_GetInpu
|
|
|
memcpy(accInfo.account, m_szAccount + 4, 12);
|
|
|
else
|
|
|
{
|
|
|
+ const DWORD dwCode(PinPad_UserErrorCode_PinPad_GetEncryptText_Get12Account_Error);
|
|
|
errMsg = CSimpleStringA::Format("Get12Account err(%s).", (const char*)ctxJS->Req.account);
|
|
|
if (IsInBusiness())
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_USER).setLogCode(PinPadService_LogCode_GetInputSM).
|
|
|
- setResultCode(GetEntityBase()->GetFunction()->UserCodeToRTACode(PinPad_UserErrorCode_PinPad_GetEncryptText_Get12Account_Error))(errMsg.GetData());
|
|
|
- LogError(Severity_High, Error_Unexpect, PinPad_UserErrorCode_PinPad_GetEncryptText_Get12Account_Error, errMsg.GetData());
|
|
|
+ setResultCode(GetEntityBase()->GetFunction()->UserCodeToRTACode(dwCode))(errMsg.GetData());
|
|
|
+ LogError(Severity_High, Error_Unexpect, dwCode, errMsg.GetData());
|
|
|
}
|
|
|
else
|
|
|
- LogWarn(Severity_High, Error_Unexpect, PinPad_UserErrorCode_PinPad_GetEncryptText_Get12Account_Error, errMsg.GetData());
|
|
|
- ctxJS->Answer(Error_DevCommFailed, PinPad_UserErrorCode_PinPad_GetEncryptText_Get12Account_Error);
|
|
|
+ LogWarn(Severity_High, Error_Unexpect, dwCode, errMsg.GetData());
|
|
|
+ ctxJS->Answer(Error_DevCommFailed, dwCode);
|
|
|
return Error_DevCommFailed;
|
|
|
}
|
|
|
|
|
@@ -1329,7 +1334,8 @@ ErrorCodeEnum CPinPadFSM::GetEncryptTextJS(SpReqAnsContext<PinPadService_GetInpu
|
|
|
ctxJS->Answer(Error_DevCommFailed, dwUserCode);
|
|
|
return Error_DevCommFailed;
|
|
|
}
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::SetAccNo").setCostTime(m_ullEndTime - m_ullBeginTime)();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::SetAccNo").setCostTime(m_ullEndTime - m_ullBeginTime)
|
|
|
+ ("req,timeout:%d,traceId:[%s]", ctxJS->Req.timeout, ctxJS->link.traceId.GetData());
|
|
|
|
|
|
m_ullBeginTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
errCode = m_hDevHelper->ActiveWorkingKey(1, 0);
|
|
@@ -1378,7 +1384,6 @@ ErrorCodeEnum CPinPadFSM::GetEncryptTextJS(SpReqAnsContext<PinPadService_GetInpu
|
|
|
DWORD dwStart = SP::Module::Comm::RVCGetTickCount();
|
|
|
DWORD dwEnd = SP::Module::Comm::RVCGetTickCount();
|
|
|
bool bCancelInput = false;
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("req(pin),timeout:[%d]", timeout);
|
|
|
while (elapsed < MAX_PINPAD_INPUT_TIMEOUT) {
|
|
|
if (readed >= CurrentPasswordLen)
|
|
|
break;
|
|
@@ -1443,10 +1448,13 @@ Err:
|
|
|
m_ullBeginTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
errCode = m_hDevHelper->GetPinBlock(pinBlk);
|
|
|
m_ullEndTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
+
|
|
|
+ ULLINT ullGetPinBlockCost = m_ullEndTime - m_ullBeginTime;
|
|
|
+ char* tmpCheckCode = new char[MAX_PIN_BLOCK_SIZE];
|
|
|
+ if (tmpCheckCode == NULL)
|
|
|
+ return Error_Resource;
|
|
|
+ memset(tmpCheckCode, 0, MAX_PIN_BLOCK_SIZE);
|
|
|
|
|
|
-
|
|
|
- LogWarn(Severity_Low, Error_Succeed, PinPad_UserErrorCode_PinPad_GetPinBlock_Call
|
|
|
- , CSimpleStringA::Format("{\"cost\":%d}", m_ullEndTime - m_ullBeginTime));
|
|
|
if (errCode == Error_Succeed)
|
|
|
{
|
|
|
char* tmpPinData = new char[MAX_PIN_BLOCK_SIZE];
|
|
@@ -1496,14 +1504,8 @@ Err:
|
|
|
}
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::EncryptData").setCostTime(m_ullEndTime - m_ullBeginTime)();
|
|
|
|
|
|
- char* tmpCheckCode = new char[MAX_PIN_BLOCK_SIZE];
|
|
|
- if (tmpCheckCode == NULL)
|
|
|
- return Error_Resource;
|
|
|
- memset(tmpCheckCode, 0, MAX_PIN_BLOCK_SIZE);
|
|
|
//HexBuf2StrBuf(dstInfo.data,&tmpCheckCode,dstInfo.dwSize);
|
|
|
memcpy(tmpCheckCode, dstInfo.data, dstInfo.dwSize);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("ckckck[%s], m_keySNSM:%s", tmpCheckCode, m_keySNSM.GetData());
|
|
|
-
|
|
|
|
|
|
if (strnicmp(tmpCheckCode, "9F1F7BFF6F5511384D9430531E538FD3", strlen("9F1F7BFF6F5511384D9430531E538FD3")) == 0)
|
|
|
SetErrorAndLog(Error_Unexpect, PinPad_UserErrorCode_KEY_LOST_SM, "", __FUNCTION__);
|
|
@@ -1537,8 +1539,14 @@ Err:
|
|
|
ctxJS->Answer(Error_DevCommFailed, dwUserCode);
|
|
|
return Error_DevCommFailed;
|
|
|
}
|
|
|
+ map<string, string> encryptTextInfo;
|
|
|
+ encryptTextInfo["text"] = "获取密文成功";
|
|
|
+ encryptTextInfo["ckCode"] = tmpCheckCode;
|
|
|
+ encryptTextInfo["keySN"] = m_keySNSM.GetData();
|
|
|
+ encryptTextInfo["getPinBlockCost"] = CSimpleStringA::Format("%d", ullGetPinBlockCost).GetData();
|
|
|
+
|
|
|
DbgWithLink(LOG_LEVEL_INFO, ctxJS->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setLogCode(PinPadService_LogCode_GetInputSM)
|
|
|
- .setAPI("DevAdapter::GetPinBlock").setCostTime(m_ullEndTime - m_ullBeginTime)("获取密文成功");
|
|
|
+ .setAPI("DevAdapter::GetPinBlock").setCostTime(m_ullEndTime - m_ullBeginTime)("%s", generateJsonStr(encryptTextInfo).second.c_str());
|
|
|
//oilyang@20240410 move to out space,after stopinput & turn off the light
|
|
|
//Sleep(100);
|
|
|
//ctxSM->Answer(Error_Succeed);
|
|
@@ -1574,7 +1582,8 @@ int CPinPadFSM::GetInputJS(SpReqAnsContext<PinPadService_GetInputJS_Req, PinPadS
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StopInput").setCostTime(m_ullEndTime - m_ullBeginTime)("StopInput cost(%d)ms", m_ullEndTime - m_ullBeginTime);
|
|
|
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)
|
|
|
- ("req acc.len:%d,ans.ck.len:%d", m_inputJSCtx->Req.account.GetLength(), m_inputJSCtx->Ans.checkcode.IsNullOrEmpty() ? 0 : m_inputJSCtx->Ans.checkcode.GetLength());
|
|
|
+ ("req acc.len:%d,ans.ck.len:%d,traceId:[%s]", m_inputJSCtx->Req.account.GetLength(), m_inputJSCtx->Ans.checkcode.IsNullOrEmpty() ? 0 : m_inputJSCtx->Ans.checkcode.GetLength()
|
|
|
+ , m_inputJSCtx->link.traceId.GetData());
|
|
|
DbgToBeidou(m_inputJSCtx->link, "GetInput")();
|
|
|
m_bPinInput = false;
|
|
|
LogEvent(Severity_Middle, LOG_EVT_PINPAD_GREEN_OFF, "PinPad light off.");
|
|
@@ -1583,7 +1592,11 @@ int CPinPadFSM::GetInputJS(SpReqAnsContext<PinPadService_GetInputJS_Req, PinPadS
|
|
|
{
|
|
|
ULLINT ullGetInputEnd = SP::Module::Comm::RVCGetTickCount();
|
|
|
LogWarn(Severity_Low, Error_Unexpect, PinPad_UserErrorCode_GetInput_TimeCost, CSimpleStringA::Format("%d", (ullGetInputEnd - ullGetInputBegin) / 1000));
|
|
|
- m_inputJSCtx->Answer(Error_Succeed);
|
|
|
+ if ((eErrCode = m_inputJSCtx->Answer(Error_Succeed)) != Error_Succeed)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setResultCode("RTA2617")("Answer:%d", eErrCode);
|
|
|
+ LogWarn(Severity_Low, Error_Unexpect, PinPad_UserErrorCode_Ctx_Answer_Error, CSimpleStringA::Format("Answer:%d", eErrCode));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return 0;
|