|
@@ -15,7 +15,7 @@
|
|
|
static DcCommonInfo *ShmDcCommonData = NULL;
|
|
|
static SelectGunInfo *ShmSelectGunInfo = NULL;
|
|
|
static struct SysInfoData *pSysInfo = NULL;
|
|
|
-#define PREAUTHMONEY 1
|
|
|
+#define PREAUTHMONEY 1000
|
|
|
bool isDeductDb_ready;
|
|
|
//------------------------------------------------------------------------------
|
|
|
static char *rfidPortName = "/dev/ttyS2";
|
|
@@ -343,6 +343,30 @@ void WritePayResult(int result ,uint8_t gunIndex)
|
|
|
memcpy(&ShmDcCommonData->TransactionInfo[gunIndex].VemData,&ShmDcCommonData->pCreditCard[gunIndex].VemData,64);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+void PreAuthCompleteToCardReader(int fd,uint8_t gunIndex)
|
|
|
+{
|
|
|
+ int result = 0;
|
|
|
+ result = CreditCardPreAuthComplete(fd,(int)ShmDcCommonData->finalcost[pSysInfo->CurGunSelected] ,"TCC Test",
|
|
|
+ &ShmDcCommonData->pCreditCard[gunIndex].VemData[0],
|
|
|
+ &ShmDcCommonData->pCreditCard[gunIndex]);
|
|
|
+ //result = 1;
|
|
|
+ if (result > 0 ) {
|
|
|
+ log_info("Credit Card Spend Money:%.1f",ShmDcCommonData->finalcost[gunIndex]);
|
|
|
+ pSysInfo->SystemPage = _PAGE_COMPLETE;
|
|
|
+ WritePayResult(TRUE,gunIndex);
|
|
|
+ ShmDcCommonData->PayPass_flag[gunIndex] = TRUE;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ log_info("PAYING FAIL");
|
|
|
+ ShmDcCommonData->PayPass_flag[gunIndex] = FALSE;
|
|
|
+ pSysInfo->SystemPage = _PAGE_PAYFAIL;
|
|
|
+ WritePayResult(FALSE,gunIndex);
|
|
|
+ }
|
|
|
+ if (isDeductDb_ready == TRUE) {
|
|
|
+ InsertDeductInfo(gunIndex,&ShmDcCommonData->TransactionInfo[gunIndex]);
|
|
|
+ }
|
|
|
+}
|
|
|
static int InitialRfidPort(void)
|
|
|
{
|
|
|
int fd = open(rfidPortName, O_RDWR);
|
|
@@ -457,33 +481,19 @@ void CreateRfidFork(void)
|
|
|
}
|
|
|
|
|
|
if (ShmDcCommonData->StopCharge[gunIndex] == TRUE && ShmDcCommonData->finalcost_flag[gunIndex]) {
|
|
|
- ShmDcCommonData->StopCharge[gunIndex] = FALSE;
|
|
|
- StopGunInfoTimeoutDet(gunIndex); //Timeout_FinalCost
|
|
|
- result = CreditCardPreAuthComplete(fd,1 /*(int)ShmDcCommonData->finalcost[pSysInfo->CurGunSelected]*/ ,"TCC Test",
|
|
|
- &ShmDcCommonData->pCreditCard[gunIndex].VemData[0],
|
|
|
- &ShmDcCommonData->pCreditCard[gunIndex]);
|
|
|
- //result = 1;
|
|
|
- if (result > 0 ) {
|
|
|
- log_info("Credit Card Spend Money:%.1f",ShmDcCommonData->finalcost[gunIndex]);
|
|
|
- pSysInfo->SystemPage = _PAGE_COMPLETE;
|
|
|
- WritePayResult(TRUE,gunIndex);
|
|
|
- ShmDcCommonData->PayPass_flag[gunIndex] = TRUE;
|
|
|
+ if (ShmDcCommonData->finalcost[gunIndex] <= 0) {
|
|
|
|
|
|
} else {
|
|
|
- log_info("PAYING FAIL");
|
|
|
- ShmDcCommonData->PayPass_flag[gunIndex] = FALSE;
|
|
|
- pSysInfo->SystemPage = _PAGE_PAYFAIL;
|
|
|
- WritePayResult(FALSE,gunIndex);
|
|
|
+ ShmDcCommonData->StopCharge[gunIndex] = FALSE;
|
|
|
+ StopGunInfoTimeoutDet(gunIndex); //Timeout_FinalCost
|
|
|
+ PreAuthCompleteToCardReader(fd,gunIndex);
|
|
|
+ ShmDcCommonData->PayFinish[gunIndex] = TRUE;
|
|
|
}
|
|
|
- if (isDeductDb_ready == TRUE) {
|
|
|
- InsertDeductInfo(gunIndex,&ShmDcCommonData->TransactionInfo[gunIndex]);
|
|
|
- }
|
|
|
- ShmDcCommonData->PayFinish[gunIndex] = TRUE;
|
|
|
}
|
|
|
-
|
|
|
} // for
|
|
|
- if (is_idle == TRUE && tm->tm_min%2 == 0 &&
|
|
|
+ if (is_idle == TRUE && tm->tm_min%15 == 0 &&
|
|
|
pSysInfo->SystemPage == _PAGE_IDLE && ShmDcCommonData->reupload_deduct_status == 0) {
|
|
|
+ sleep(1);
|
|
|
if (DB_GetReDeductInfo(&ReAuthComplete_Index,&ShmDcCommonData->ReAuthComplete) == PASS ) {
|
|
|
|
|
|
result = CreditCardPreAuthComplete(fd,(int)ShmDcCommonData->ReAuthComplete.Amount ,"TCC Test",
|