Commit 216ee36f by NitefullWind

1. 兼容由POS传支付条码。 2. 不再检查条码卡bin。

parent 7de539ee
......@@ -119,7 +119,7 @@ void Control::Start(const char *indata, char *outdata)
_widget->ShowWithRequest(_posType, _posReqJsonObj);
if(reqType != refund)
if(reqType != refund && reqType != pay)
{
loop.exec();
}else
......@@ -583,12 +583,12 @@ void Control::Request(ReqType type, QStringList list)
_fmId = list[0];
bool isOk = true;
if(type == pay) {
if(!IsValidCode(list[0])) {
isOk = false;
SetResPonseWithMessage("23", QString::fromLocal8Bit("无效条码"));
}
}
// if(type == pay) {
// if(!IsValidCode(list[0])) {
// isOk = false;
// SetResPonseWithMessage("23", QString::fromLocal8Bit("无效条码"));
// }
// }
if(isOk) {
JsonFactory::GetJsonWithType(type, json, _posReqJsonObj, list);
......
......@@ -45,6 +45,7 @@
#define JSON_KEY_PAYACCOUNT "payAccount"
#define JSON_KEY_PAYTRANSID "payTransId"
#define JSON_KEY_TYPE "type"
#define JSON_KEY_CODE "code"
#define JSON_KEY_FMID "fmId"
#define JSON_KEY_EXT "ext"
#define JSON_KEYT_STATE "state"
......
......@@ -364,10 +364,26 @@ void HostWidget::ShowWithRequest(POSType posType, QJsonObject requestObj)
case pay: {
ShowWidget(ui->pay);
_curr_show_widget = ui->pay;
double Amount = FMTool::GetJsonValue(requestObj, JSON_KEY_TRANSAMOUNT).toInt()/100.0;
ui->label_pay_title->setText(QString::fromLocal8Bit("请扫描支付宝二维码"));
ui->btn_pay_exit->setText(QString::fromLocal8Bit("取消支付"));
ui->label_pay_money->setText(QString::fromLocal8Bit("需收取 ¥ %1").arg(Amount));
QString reqCode = requestObj[JSON_KEY_CODE].toString("");
if(reqCode.isEmpty()) {
double Amount = FMTool::GetJsonValue(requestObj, JSON_KEY_TRANSAMOUNT).toInt()/100.0;
ui->label_pay_title->setText(QString::fromLocal8Bit("请扫描支付宝二维码"));
ui->btn_pay_exit->setText(QString::fromLocal8Bit("取消支付"));
ui->label_pay_money->setText(QString::fromLocal8Bit("需收取 ¥ %1").arg(Amount));
} else {
ui->btn_pay_exit->hide();
ui->label_pay_money->hide();
_label_pay_timer->start(60, QString::fromLocal8Bit("%1 秒"));
QStringList list;
list.append(reqCode);
ui->label_pay_title->setText(QString::fromLocal8Bit("支付中/等待用户输入密码"));
_intertime.start(5*1000);
emit RequestWithType(pay, list);
}
break;
}
case refund: {
......
......@@ -402,7 +402,7 @@ int main(int argc, char *argv[])
// control.Start(as, b);
// char spccIn[MAX_BUF_LEN] = "{\"fmId\":\"11971709011000000002\",\"reqType\":352,\"storeId\":\"1713\",\"stationId\":\"1\",\"partnerId\":1438,\"operatorId\":\"0123\",\"transId\":301439,\"transAmount\":1,\"partnerOrderId\":\"909911039990170830002\",\"businessDate\":\"20170508\",\"products\":[{\"pid\":\"123\",\"name\":\"中杯拿铁\",\"price\":321,\"salesType\":\"NORMAL\"}]}";
char spccIn[MAX_BUF_LEN] = "{\"reqType\":352,\"storeId\":\"1713\",\"stationId\":\"1\",\"partnerId\":1438,\"operatorId\":\"0123\",\"transId\":301439,\"transAmount\":1,\"partnerOrderId\":\"201709280001\",\"businessDate\":\"20170830\"}";
char spccIn[MAX_BUF_LEN] = "{\"reqType\":352,\"storeId\":\"1713\",\"code\":\"1212121\", \"stationId\":\"1\",\"partnerId\":1438,\"operatorId\":\"0123\",\"transId\":301439,\"transAmount\":1,\"partnerOrderId\":\"201709280001\",\"businessDate\":\"20170830\"}";
// char spccIn[MAX_BUF_LEN] = "{\"fmId\":\"64761709011000001002\",\"reqType\":453,\"storeId\":\"17607\",\"stationId\":\"1\",\"partnerId\":1443,\"operatorId\":\"0123\",\"transId\":301439,\"transAmount\":1,\"partnerOrderId\":\"1365670843098735011754\",\"businessDate\":\"20170830\"}";
control.Start(spccIn, b);
......
......@@ -3,7 +3,7 @@
#define VER_MAJOR 0
#define VER_MINOR 2
#define VER_REVISION 3
#define VER_REVISION 4
#define VER_BUILD 0
......
......@@ -220,6 +220,7 @@ void TestSimphony::test_POSRequest_data()
"\"storeId\": \"1713\", "
"\"transAmount\": %3, "
"\"transId\": 301439 "
"\"code\": \"12312\" "
"}")
.arg(QDate::currentDate().toString("yyyyMMdd"))
.arg(CreatePartnerOrderId())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment