Commit efc824a9 by 刘帅

支付&支付查询返回接口中增加trams_id字段,支付退款返回接口重新处理,status_code类型统一改为int

parent 886fbb67
......@@ -3,4 +3,4 @@ partner_id=1371
store_id=fm99999
pos_id=1
operator_id=001
business_date=20171205
business_date=20180103
......@@ -218,7 +218,7 @@ bool Convert::QueryPayResponse(QJsonObject &object)
if(object.contains("statusCode"))
{
statusCode = object.value("statusCode").toInt();
queryPayResponseObject.insert("status_code",QString::number(statusCode));
queryPayResponseObject.insert("status_code",statusCode);
}
if(statusCode != 100)
return true;
......@@ -284,22 +284,26 @@ bool Convert::QueryPayResponse(QJsonObject &object)
//支付退款回复转换
bool Convert::RefundPayResponse(QJsonObject &object)
{
QJsonObject refundPayResponseObject;
QJsonValue ext;
int statusCode = 100;
if(object.contains("statusCode"))
{
statusCode = object.value("statusCode").toInt();
refundPayResponseObject.insert("status_code",QString::number(statusCode));
refundPayResponseObject.insert("status_code",statusCode);
}
if(statusCode != 100)
if(object.contains("msg"))
{
refundPayResponseObject.insert("msg",QString::fromLocal8Bit("失败"));
qSwap(object,refundPayResponseObject);
return true;
QJsonValue msg = object.value("msg");
refundPayResponseObject.insert("msg",msg);
}
else
{
if(statusCode == 100)
refundPayResponseObject.insert("msg",QString::fromLocal8Bit("成功"));
else
refundPayResponseObject.insert("msg",QString::fromLocal8Bit("失败"));
}
refundPayResponseObject.insert("msg",QString::fromLocal8Bit("成功"));
if(object.contains("ext"))
{
......
......@@ -402,6 +402,13 @@ int QFmClient::ProcessPosReqData(QJsonObject& object)
if(object.contains("fm_cmd"))
{
fm_cmd = object.value("fm_cmd").toInt();
if(fm_cmd == FREEMUD_PAY || fm_cmd == QUERY_PAY)
{
if(object.contains("trans_id"))
trans_id = object.value("trans_id").toString();
else
trans_id.clear();
}
switch(fm_cmd)
{
case FREEMUD_PAY:
......@@ -793,6 +800,16 @@ int QFmClient::ProcessZhProxyRspData(int nType)
}
QJsonObject object = doc.object();
ConvertResponseJsonFormat(object,nType); //!转换JSON
//向pos返回数据中加入trans_id字段
if(nType == FREEMUD_PAY || nType == QUERY_PAY)
{
if(object.contains("status_code") && (object.value("status_code").toInt() == 100))
{
object.insert("trans_id",trans_id);
}
}
if(object.contains("status_code") && object.value("status_code").toInt() == 204)
{
return 204;
......@@ -977,7 +994,8 @@ void QFmClient::run()
}
}
//rlt = ProcessZhProxyRspDataAndSend2Pos(nResult);
int length = strlen(_sendbuf);
int length = strlen(_recvbuf);
QLOG_INFO()<<"send data to pos:\r\n"<<_recvbuf;
rlt = SendSocketData(_acceptedSock, _recvbuf, length, 0);
if (rlt != length)
{
......
......@@ -107,6 +107,7 @@ private:
STORE_INFO store_info;
Convert convert;
QString trans_id;
static unsigned int s_reqCount;
};
......
QT += core
QT -= gui
TARGET = qfmclient
TARGET = fmclient
CONFIG += console
CONFIG -= app_bundle
......
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