Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sbkpay
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhenfei.zhang
sbkpay
Commits
fa1d4bd8
Commit
fa1d4bd8
authored
Nov 11, 2020
by
wuyang.zou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、优化之前逻辑代码与注释;
2、Version: 3.20.11.3
parent
e9d99937
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
27 additions
and
416 deletions
+27
-416
sbkpay/DataProcess/fmnetwork.h
+0
-1
sbkpay/DataProcess/rollback.h
+1
-1
sbkpay/control.cpp
+3
-1
sbkpay/control.h
+1
-9
sbkpay/fmp_settings.h
+1
-0
sbkpay/fmtool.h
+0
-1
sbkpay/global.h
+18
-1
sbkpay/hostwidget.h
+1
-2
sbkpay/jsonfactory.h
+0
-130
sbkpay/labelstimer.h
+1
-0
sbkpay/main.cpp
+1
-2
sbkpay/requestmodel.h
+0
-87
sbkpay/rspfactory.h
+0
-180
sbkpay/sbkpay.pri
+0
-1
No files found.
sbkpay/DataProcess/fmnetwork.h
View file @
fa1d4bd8
...
...
@@ -4,7 +4,6 @@
#include <QObject>
#include <QByteArray>
#include "global.h"
#include "requestmodel.h"
class
FMNetWork
:
public
QObject
{
...
...
sbkpay/DataProcess/rollback.h
View file @
fa1d4bd8
...
...
@@ -8,7 +8,7 @@
#include <QPointer>
#include <QSemaphore>
#include "fmp_settings.h"
#include "
requestmode
l.h"
#include "
globa
l.h"
#include "fmglobal.h"
class
QSqlDatabase
;
...
...
sbkpay/control.cpp
View file @
fa1d4bd8
...
...
@@ -503,7 +503,9 @@ bool Control::GetJson(ReqType type,QJsonObject &json, const QByteArray array, QS
json
.
insert
(
JSON_KEY_FMID
,
_fmId
);
if
(
type
==
REFUND
&&
json
.
contains
(
JSON_KEY_STATUSCODE
)
&&
json
[
JSON_KEY_STATUSCODE
].
toInt
()
==
100
)
json
.
insert
(
JSON_KET_CLIENTREF
,
FMTool
::
GetString
(
_request
.
Amount
,
12
));
json
.
insert
(
JSON_KET_CLIENTREF
,
QString
(
"0"
)
);
// 未发现 成员变量 _request 被赋值; 故使用 0 字符替代;
//json.insert(JSON_KET_CLIENTREF, FMTool::GetString(_request.Amount, 12));
RspFactory
::
GetResponseJson
(
type
,
_responseJsonObj
,
json
);
...
...
sbkpay/control.h
View file @
fa1d4bd8
#
ifndef
CONTROL_H
#define CONTROL_H
#include "
requestmode
l.h"
#include "
globa
l.h"
#include "hostwidget.h"
#include "fmp_settings.h"
#include <QObject>
...
...
@@ -32,10 +32,6 @@ signals:
private
:
void
GetResponse
(
QString
errormessage
,
AlipayResponse
&
response
);
void
GetErrorResponse
(
QString
errormessage
,
AlipayResponse
&
response
);
void
CheckDllEnvironmentNormal
();
void
CheckQsslSupportsSslError
();
...
...
@@ -54,8 +50,6 @@ private:
void
Request
(
ReqType
type
,
QStringList
list
);
bool
GetJson
(
QByteArray
&
json
,
QString
&
error
);
bool
GetJson
(
ReqType
type
,
QJsonObject
&
json
,
const
QByteArray
array
,
QString
&
error
);
bool
HttpPost
(
QString
url
,
QByteArray
&
outdata
,
const
QByteArray
&
indata
,
QString
content
,
QString
accept
,
QString
&
error
,
int
timeout
,
ReqType
reqType
);
...
...
@@ -73,8 +67,6 @@ public slots:
void
OnInterrupt
();
private
:
struct
AlipayRequest
_request
;
struct
AlipayResponse
_response
;
QJsonObject
_posReqJsonObj
;
QJsonObject
_responseJsonObj
;
...
...
sbkpay/fmp_settings.h
View file @
fa1d4bd8
...
...
@@ -20,6 +20,7 @@ public:
public
:
QVariant
GetValue
(
const
QString
&
k
,
QVariant
default_val
);
bool
SetValue
(
const
QString
&
k
,
QVariant
v
);
/**
* @brief GetAllKeys
* 获取所有key,如果参数g不为空,则获取该group下的所有Key
...
...
sbkpay/fmtool.h
View file @
fa1d4bd8
...
...
@@ -6,7 +6,6 @@
#include <windows.h>
#include <QString>
#include <QDebug>
#include "requestmodel.h"
#include "global.h"
class
FMTool
...
...
sbkpay/global.h
View file @
fa1d4bd8
#ifndef GLOBAL
#
ifndef
GLOBAL
#define GLOBAL
#define EXE_ROLLBACK "rollback.dll"
...
...
@@ -86,4 +86,21 @@
#define JSON_REQTYPE_PRINTER 85
#define JSON_REQTYPE_FIND 2
typedef
enum
{
SIGN
,
// 签到 - 0
MANAGE
,
// 管理 - 1
PAY
,
// 支付 - 2
REFUND
,
// 退货 - 3
FINDS
,
// 交易查询 - 4
ENDDAY
,
// 日结单打印 - 5
SHIFT
,
// 打印交接班 - 6 [已淘汰,不使用]
AGAIN_PRINT
,
// 重新打印 - 7
EC_SIGN
=
350
,
// 签到 - 350 = 350-350 = 0 对应上面 "签到"
EC_FINDS
=
354
,
// 查询 - 354 = 354-350 = 4 对应上面 "交易查询"
}
ReqType
;
#endif // GLOBAL
sbkpay/hostwidget.h
View file @
fa1d4bd8
...
...
@@ -2,7 +2,7 @@
#define HOSTWIDGET_H
#include "fmp_window.h"
#include "
requestmode
l.h"
#include "
globa
l.h"
#include "fmp_settings.h"
#include <QWidget>
#include <QList>
...
...
@@ -78,7 +78,6 @@ private:
QList
<
QWidget
*>
_widgetlist
;
QWidget
*
_curr_show_widget
;
AlipayRequest
_data
;
QJsonObject
_posReqJsonObj
;
LabelsTimer
*
_label_pay_timer
;
...
...
sbkpay/jsonfactory.h
View file @
fa1d4bd8
#
ifndef
JSONFACTORY
#define JSONFACTORY
#include "requestmodel.h"
#include "global.h"
#include "fmtool.h"
#include <QJsonObject>
...
...
@@ -51,53 +50,6 @@ private:
}
//支付
static
bool
GetPayJson
(
QJsonObject
&
json
,
const
AlipayRequest
&
request
,
QStringList
list
)
{
if
(
list
.
size
()
!=
1
||
list
[
0
].
isEmpty
())
return
false
;
json
.
insert
(
JSON_KEY_VER
,
DEFAULT_JSON_VER_VALUE
);
json
.
insert
(
JSON_KEY_REQTYPE
,
JSON_REQTYPE_PAY
);
json
.
insert
(
JSON_KEY_PARTNERID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
PlatNo
),
4
).
toInt
());
json
.
insert
(
JSON_KEY_STOREID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
StoreNo
),
20
));
json
.
insert
(
JSON_KEY_STATIONID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
DeviceNo
),
6
));
json
.
insert
(
JSON_KEY_OPERATORID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
CashierNo
),
6
));
json
.
insert
(
JSON_KEY_TRANSID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
CashTraceNo
),
6
));
json
.
insert
(
JSON_KEY_BUSINESSDATE
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
BusinessDay
),
8
));
json
.
insert
(
JSON_KEY_CODE
,
list
[
0
]);
json
.
insert
(
JSON_KEY_TRANSAMOUNT
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
Amount
),
12
).
toInt
());
json
.
insert
(
JSON_KEY_UNAMOUNT
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
non_sale_Amount
),
12
).
toInt
());
json
.
insert
(
JSON_KEY_PARTORDERID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
Reserved1
),
64
));
int
len
=
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
item_line_qty
),
2
).
toInt
();
QJsonArray
prod
;
qDebug
()
<<
"--------"
<<
len
;
for
(
int
i
=
0
;
i
<
len
;
++
i
)
{
QJsonObject
object
;
struct
product
*
pro
=
(
struct
product
*
)
request
.
item_information
[
i
];
object
.
insert
(
JSON_KEY_PRODUCTS_CONSUMENUM
,
FMTool
::
GetString
((
const
void
*
)
&
(
pro
->
buyCount
),
4
));
object
.
insert
(
JSON_KEY_PRODUCTS_PID
,
FMTool
::
GetString
((
const
void
*
)
&
(
pro
->
productID
),
8
));
object
.
insert
(
JSON_KEY_PRODUCTS_NAME
,
FMTool
::
GetString
((
const
void
*
)
&
(
pro
->
productName
),
20
));
object
.
insert
(
JSON_KEY_PRODUCTS_SALESTYPE
,
DEFAULT_JSON_PRODUCTS_NORMAL
);
QString
typebuf
=
FMTool
::
GetString
((
const
void
*
)
&
(
pro
->
isCombo
),
1
);
if
(
typebuf
==
0
)
object
.
insert
(
JSON_KEY_PRODUCTS_SALESTYPE
,
DEFAULT_JSON_PRODUCTS_FREE
);
object
.
insert
(
JSON_KEY_PRODUCTS_PRICE
,
FMTool
::
GetString
((
const
void
*
)
&
(
pro
->
unitPrice
),
8
));
prod
.
append
(
object
);
}
json
.
insert
(
JSON_KEY_PRODUCTS
,
prod
);
return
true
;
}
static
bool
GetPayJson
(
QJsonObject
&
json
,
const
QJsonObject
&
reqJson
,
QStringList
list
)
{
if
(
list
.
size
()
!=
1
||
list
[
0
].
isEmpty
())
...
...
@@ -109,27 +61,6 @@ private:
}
//退款
static
bool
GetRefundJosn
(
QJsonObject
&
json
,
const
AlipayRequest
&
request
,
QStringList
list
)
{
if
(
list
.
size
()
!=
1
||
list
[
0
].
isEmpty
())
return
false
;
json
.
insert
(
JSON_KEY_VER
,
DEFAULT_JSON_VER_VALUE
);
json
.
insert
(
JSON_KEY_REQTYPE
,
JSON_REQTYPE_REFUND
);
json
.
insert
(
JSON_KEY_PARTNERID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
PlatNo
),
4
).
toInt
());
json
.
insert
(
JSON_KEY_STOREID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
StoreNo
),
20
));
json
.
insert
(
JSON_KEY_STATIONID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
DeviceNo
),
6
));
json
.
insert
(
JSON_KEY_OPERATORID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
CashierNo
),
6
));
json
.
insert
(
JSON_KEY_REFUNDID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
CashTraceNo
),
6
));
json
.
insert
(
JSON_KEY_BUSINESSDATE
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
BusinessDay
),
8
));
json
.
insert
(
JSON_KEY_FMID
,
list
[
0
]);
json
.
insert
(
JSON_KEY_REFUNDAMOUT
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
Amount
),
12
).
toInt
());
json
.
insert
(
JSON_KEY_PARTORDERID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
Reserved1
),
64
));
return
true
;
}
static
bool
GetRefundJosn
(
QJsonObject
&
json
,
const
QJsonObject
&
reqJson
,
QStringList
list
)
{
if
(
list
.
size
()
!=
1
||
list
[
0
].
isEmpty
())
...
...
@@ -144,21 +75,6 @@ private:
}
//日结
static
bool
GetDayEndJson
(
QJsonObject
&
json
,
const
AlipayRequest
&
request
,
QStringList
list
)
{
json
.
insert
(
JSON_KEY_VER
,
DEFAULT_JSON_VER_VALUE
);
json
.
insert
(
JSON_KEY_REQTYPE
,
JSON_REQTYPE_ENDDAY
);
json
.
insert
(
JSON_KEY_PARTNERID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
PlatNo
),
4
).
toInt
());
json
.
insert
(
JSON_KEY_STOREID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
StoreNo
),
20
));
json
.
insert
(
JSON_KEY_STATIONID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
DeviceNo
),
6
));
json
.
insert
(
JSON_KEY_ENDTIME
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
BusinessDay
),
8
).
append
(
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
TransTime
),
6
)));
json
.
insert
(
JSON_KEY_PARTORDERID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
Reserved1
),
64
));
json
.
insert
(
JSON_KEY_PRINTACTION
,
QString
(
"103"
));
return
true
;
}
static
bool
GetEnddayJson
(
QJsonObject
&
json
,
const
QJsonObject
&
request
,
QStringList
list
)
{
Q_UNUSED
(
list
)
...
...
@@ -173,22 +89,6 @@ private:
//重打小票
static
bool
GetAgainPrinteJson
(
QJsonObject
&
json
,
const
AlipayRequest
&
request
,
QStringList
list
)
{
if
(
!
list
.
isEmpty
()
&&
list
[
0
].
isEmpty
())
return
false
;
json
.
insert
(
JSON_KEY_VER
,
DEFAULT_JSON_VER_VALUE
);
json
.
insert
(
JSON_KEY_REQTYPE
,
JSON_REQTYPE_PRINTER
);
json
.
insert
(
JSON_KEY_PARTNERID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
PlatNo
),
4
).
toInt
());
json
.
insert
(
JSON_KEY_STOREID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
StoreNo
),
20
));
json
.
insert
(
JSON_KEY_STATIONID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
DeviceNo
),
6
));
json
.
insert
(
JSON_KEY_OPERATORID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
CashierNo
),
6
));
json
.
insert
(
JSON_KEY_FMID
,
list
[
0
]);
json
.
insert
(
JSON_KEY_PRINTACTION
,
QString
(
"103"
));
return
true
;
}
static
bool
GetAgainPrinteJson
(
QJsonObject
&
json
,
const
QJsonObject
&
request
,
QStringList
list
)
{
if
(
!
list
.
isEmpty
()
&&
list
[
0
].
isEmpty
())
...
...
@@ -206,36 +106,6 @@ private:
}
//查询流水
static
bool
GetFindJson
(
QJsonObject
&
json
,
const
AlipayRequest
&
request
,
QStringList
list
)
{
if
(
list
.
size
()
!=
4
||
list
[
0
].
isEmpty
()
||
list
[
1
].
isEmpty
())
return
false
;
QString
tmp0
=
list
[
0
];
QString
tmp1
=
list
[
1
];
QString
tmp2
=
list
[
2
];
QString
cur
=
QDateTime
::
currentDateTime
().
toString
(
"hh:mm:ss"
);
tmp0
.
append
(
" 00:00:00"
);
tmp1
.
append
(
QString
(
" "
)
+
cur
);
json
.
insert
(
JSON_KEY_VER
,
DEFAULT_JSON_VER_VALUE
);
json
.
insert
(
JSON_KEY_REQTYPE
,
JSON_REQTYPE_FIND
);
json
.
insert
(
JSON_KEY_PARTNERID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
PlatNo
),
4
).
toInt
());
json
.
insert
(
JSON_KEY_STOREID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
StoreNo
),
20
));
json
.
insert
(
JSON_KEY_STATIONID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
DeviceNo
),
6
));
json
.
insert
(
JSON_KEY_OPERATORID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
CashierNo
),
6
));
json
.
insert
(
JSON_KEY_BEGINTIME
,
tmp0
);
json
.
insert
(
JSON_KEY_ENDTIME
,
tmp1
);
json
.
insert
(
JSON_KEY_PAGESIZE
,
10
);
json
.
insert
(
JSON_KEY_PAGENUM
,
tmp2
.
toInt
());
json
.
insert
(
JSON_KEY_METHCODE
,
10001
);
return
true
;
}
static
bool
GetFindJson
(
QJsonObject
&
json
,
const
QJsonObject
&
request
,
QStringList
list
)
{
if
(
list
.
size
()
!=
4
||
list
[
0
].
isEmpty
()
||
list
[
1
].
isEmpty
())
...
...
sbkpay/labelstimer.h
View file @
fa1d4bd8
...
...
@@ -23,6 +23,7 @@ signals:
void
timeout
();
void
timeChanged
(
int
time
);
void
started
();
/**
* @brief finished
* 调用stop()或定时超时后触发
...
...
sbkpay/main.cpp
View file @
fa1d4bd8
...
...
@@ -11,7 +11,6 @@
#include "control.h"
#include "global.h"
#include "QsLog.h"
#include "requestmodel.h"
#include "fmtool.h"
#include "rspfactory.h"
#include "fmp_settings.h"
...
...
@@ -220,7 +219,7 @@ extern "C" __declspec(dllexport) void Start(const char *indata, char *outdata)
#include "control.h"
#include "global.h"
#include "QsLog.h"
#include "
requestmode
l.h"
#include "
globa
l.h"
#include "fmtool.h"
#include "rspfactory.h"
#include <QDir>
...
...
sbkpay/requestmodel.h
deleted
100644 → 0
View file @
e9d99937
#
ifndef
REQUESTMODEL
#define REQUESTMODEL
typedef
enum
{
SIGN
,
// 签到 - 0
MANAGE
,
// 管理 - 1
PAY
,
// 支付 - 2
REFUND
,
// 退货 - 3
FINDS
,
// 交易查询 - 4
ENDDAY
,
// 日结单打印 - 5
SHIFT
,
// 打印交接班 - 6 [已淘汰,不使用]
AGAIN_PRINT
,
// 重新打印 - 7
EC_SIGN
=
350
,
// 签到 - 350 = 350-350 = 0 对应上面 "签到"
EC_FINDS
=
354
,
// 查询 - 354 = 354-350 = 4 对应上面 "交易查询"
}
ReqType
;
struct
EFTItem
{
char
billType
[
1
];
//资金归属. 1:商户实收, 2:商户优惠
char
billId
[
8
];
//支付类型. //36464:用户支付, 36465: 微信优惠, 36466: 商家优惠
char
amount
[
12
];
//金额
char
Reserved4
[
64
];
//保留字段
char
Reserved5
[
8
];
//保留字段
char
transactionNum
[
64
];
//账单编号(非码交易序号)
};
struct
AlipayResponse
{
char
ResponseCode
[
3
];
//返回码
char
ResponseMsg
[
40
];
//返回文字信息
char
Amount
[
12
];
//订单金额(与wxpayRequest.Amount一致)
char
SettleNum
[
6
];
//
char
MerchantID
[
15
];
//商户id
char
TerminalID
[
8
];
//
char
TransDate
[
8
];
//交易日期
char
TransTime
[
6
];
//交易时间
char
CardTraceNo
[
64
];
//订单号(非码交易号)
char
NeedPrint
[
2
];
//是否打印小票. 00:表示打印小票, 01:表示不打印小票
char
EFTprintFileName
[
200
];
//打印文件路径.
char
MD5_CHECK_CODE
[
32
];
//
char
Reserved1
[
48
];
//保留
char
Reserved2
[
48
];
char
Reserved3
[
48
];
char
Reserved4
[
48
];
char
Reserved5
[
48
];
char
EFT_quantity
[
2
];
//交易流水数量[1‐10]
char
EFT_Detail_information
[
10
][
157
];
//交易流水列表。每条定义见struct EFTItem
};
struct
product
{
char
productID
[
8
];
//商品id
char
buyCount
[
4
];
//购买数量
char
unitPrice
[
8
];
//单件商品价格
char
originPrice
[
8
];
//单件商品原价
char
isCombo
[
1
];
//默认为0
char
isNonsale
[
1
];
//(废弃)
char
productName
[
20
];
//商品名字
};
struct
AlipayRequest
{
char
PlatNo
[
4
];
// *商户编号
char
TransType
[
2
];
// 交易类型
char
PayType
[
2
];
// 支付类型.
char
StoreNo
[
20
];
// 门店号.
char
BusinessDay
[
8
];
// 营业日期. ex:"20140307"
char
TransTime
[
6
];
//交易时间 时分秒(HHMMss)
char
DeviceNo
[
6
];
// *pos编号
char
CashierNo
[
6
];
// 收银员编号。 ex:"001"
char
Amount
[
12
];
// 需支付的金额(分). ex:"1000"
char
Ticket_Amount
[
12
];
//整单总金额(分). ex:"2000"
char
non_sale_Amount
[
12
];
//非卖品总金额(分)
char
CashTraceNo
[
6
];
// 流水号. ex:"080001"
char
OriginTrace
[
64
];
// 退款订单号(退款时使用)
char
Reserved1
[
48
];
// 保留字段。
char
Reserved2
[
48
];
// ""
char
Reserved3
[
48
];
// ""
char
Reserved4
[
48
];
// ""
char
Reserved5
[
48
];
// ""
char
item_line_qty
[
2
];
// item_information的数量[0‐99]
char
item_information
[
99
][
50
];
// 商品列表.最多99条商品,每条商品的格式由struct product定义
};
#endif // REQUESTMODEL
sbkpay/rspfactory.h
View file @
fa1d4bd8
#
ifndef
RSPFACTORY
#define RSPFACTORY
#include "requestmodel.h"
#include "global.h"
#include "fmtool.h"
#include "QsLog.h"
...
...
@@ -47,115 +46,18 @@ private:
return
true
;
}
static
bool
GetPayResponse
(
AlipayResponse
&
response
,
const
QJsonObject
&
json
)
{
FMTool
::
SetString
(
response
.
ResponseCode
,
3
,
QString
::
number
(
json
[
JSON_KEY_STATUSCODE
].
toInt
()));
FMTool
::
SetString
(
response
.
ResponseMsg
,
40
,
json
[
JSON_KEY_MESSAGE
].
toString
());
FMTool
::
SetString
(
response
.
CardTraceNo
,
40
,
json
[
JSON_KEY_FMID
].
toString
());
FMTool
::
SetString
(
response
.
NeedPrint
,
2
,
QString
(
"01"
));
int
transAmount
=
json
[
JSON_KEY_TRANSAMOUNT
].
toInt
();
int
merchantDiscount
=
json
[
JSON_KEY_MERDISCOUNT
].
toInt
();
int
platformDiscount
=
json
[
JSON_KEY_PLTDISCOUNT
].
toInt
();
int
userAmount
=
transAmount
-
merchantDiscount
-
platformDiscount
;
QString
number
;
{
//用户实付
struct
EFTItem
*
item
=
(
struct
EFTItem
*
)
response
.
EFT_Detail_information
[
0
];
FMTool
::
SetString
((
void
*
)
&
(
item
->
billType
),
1
,
"1"
);
FMTool
::
SetString
((
void
*
)
&
(
item
->
billId
),
8
,
QString
(
"36464"
));
FMTool
::
SetString
((
void
*
)
&
(
item
->
amount
),
12
,
QString
::
number
(
userAmount
));
FMTool
::
SetString
((
void
*
)
&
(
item
->
transactionNum
),
64
,
json
[
JSON_KEY_FMID
].
toString
());
//FMTool::SetString((void *)&(item->transactionNum), 64, "99571708191000040011");
number
=
"01"
;
}
if
(
merchantDiscount
!=
0
)
{
//商户补贴
struct
EFTItem
*
item
=
(
struct
EFTItem
*
)
response
.
EFT_Detail_information
[
1
];
FMTool
::
SetString
((
void
*
)
&
(
item
->
billType
),
1
,
"1"
);
FMTool
::
SetString
((
void
*
)
&
(
item
->
billId
),
8
,
QString
(
"36466"
));
FMTool
::
SetString
((
void
*
)
&
(
item
->
amount
),
12
,
QString
::
number
(
merchantDiscount
));
//FMTool::SetString((void *)&(item->amount), 12, QString("100"));
FMTool
::
SetString
((
void
*
)
&
(
item
->
transactionNum
),
64
,
json
[
JSON_KEY_FMID
].
toString
());
number
=
"02"
;
}
if
(
platformDiscount
!=
0
)
{
//支付宝补贴
struct
EFTItem
*
item
=
(
struct
EFTItem
*
)
response
.
EFT_Detail_information
[
2
];
FMTool
::
SetString
((
void
*
)
&
(
item
->
billType
),
1
,
"1"
);
FMTool
::
SetString
((
void
*
)
&
(
item
->
billId
),
8
,
QString
(
"10001"
));
FMTool
::
SetString
((
void
*
)
&
(
item
->
amount
),
12
,
QString
::
number
(
platformDiscount
));
FMTool
::
SetString
((
void
*
)
&
(
item
->
transactionNum
),
64
,
json
[
JSON_KEY_FMID
].
toString
());
number
=
"03"
;
}
FMTool
::
SetString
(
response
.
EFT_quantity
,
2
,
number
);
if
(
json
[
JSON_KEY_STATUSCODE
].
toInt
()
==
100
)
return
SetPinter
(
response
,
json
);
return
true
;
}
static
bool
GetPayResponse
(
QJsonObject
&
response
,
const
QJsonObject
&
json
)
{
response
=
json
;
return
true
;
}
static
bool
GetRefundResponse
(
AlipayResponse
&
response
,
const
QJsonObject
&
json
)
{
FMTool
::
SetString
(
response
.
ResponseCode
,
3
,
QString
::
number
(
json
[
JSON_KEY_STATUSCODE
].
toInt
()));
FMTool
::
SetString
(
response
.
ResponseMsg
,
40
,
json
[
JSON_KEY_MESSAGE
].
toString
());
FMTool
::
SetString
(
response
.
CardTraceNo
,
40
,
json
[
JSON_KEY_FMID
].
toString
());
FMTool
::
SetString
(
response
.
NeedPrint
,
2
,
QString
(
"01"
));
int
transAmount
=
json
[
JSON_KET_CLIENTREF
].
toString
().
toInt
();
int
merchantDiscount
=
json
[
JSON_KEY_MERDISCOUNT
].
toInt
();
int
platformDiscount
=
json
[
JSON_KEY_PLTDISCOUNT
].
toInt
();
int
userAmount
=
transAmount
-
merchantDiscount
-
platformDiscount
;
QString
number
;
if
(
json
[
JSON_KEY_STATUSCODE
].
toInt
()
==
100
)
{
struct
EFTItem
*
item
=
(
struct
EFTItem
*
)
response
.
EFT_Detail_information
[
0
];
FMTool
::
SetString
((
void
*
)
&
(
item
->
billType
),
1
,
"1"
);
FMTool
::
SetString
((
void
*
)
&
(
item
->
billId
),
8
,
QString
(
"36464"
));
FMTool
::
SetString
((
void
*
)
&
(
item
->
amount
),
12
,
QString
::
number
(
userAmount
));
FMTool
::
SetString
((
void
*
)
&
(
item
->
transactionNum
),
64
,
json
[
JSON_KEY_FMID
].
toString
());
number
=
"01"
;
}
FMTool
::
SetString
(
response
.
EFT_quantity
,
2
,
number
);
if
(
json
[
JSON_KEY_STATUSCODE
].
toInt
()
==
100
)
return
SetPinter
(
response
,
json
);
return
true
;
}
static
bool
GetRefundResponse
(
QJsonObject
&
response
,
const
QJsonObject
&
json
)
{
response
=
json
;
return
true
;
}
static
bool
GetDayEndResponse
(
AlipayResponse
&
response
,
const
QJsonObject
&
json
)
{
FMTool
::
SetString
(
response
.
ResponseCode
,
3
,
QString
::
number
(
json
[
JSON_KEY_STATUSCODE
].
toInt
()));
FMTool
::
SetString
(
response
.
ResponseMsg
,
40
,
json
[
JSON_KEY_MESSAGE
].
toString
());
FMTool
::
SetString
(
response
.
NeedPrint
,
2
,
QString
(
"01"
));
if
(
json
[
JSON_KEY_STATUSCODE
].
toInt
()
==
100
)
return
SetPinter
(
response
,
json
);
return
true
;
}
static
bool
GetEndDayResponse
(
QJsonObject
&
response
,
const
QJsonObject
&
json
)
{
...
...
@@ -168,19 +70,6 @@ private:
}
static
bool
GetAgainPrinteResponse
(
AlipayResponse
&
response
,
const
QJsonObject
&
json
)
{
FMTool
::
SetString
(
response
.
ResponseCode
,
3
,
QString
::
number
(
json
[
JSON_KEY_STATUSCODE
].
toInt
()));
FMTool
::
SetString
(
response
.
ResponseMsg
,
40
,
json
[
JSON_KEY_MESSAGE
].
toString
());
FMTool
::
SetString
(
response
.
CardTraceNo
,
40
,
json
[
JSON_KEY_FMID
].
toString
());
FMTool
::
SetString
(
response
.
NeedPrint
,
2
,
QString
(
"01"
));
if
(
json
[
JSON_KEY_STATUSCODE
].
toInt
()
==
100
)
return
SetAgainPinter
(
response
,
json
);
return
true
;
}
static
bool
GetAgainPrinteResponse
(
QJsonObject
&
response
,
const
QJsonObject
&
json
)
{
response
=
json
;
...
...
@@ -191,12 +80,6 @@ private:
return
true
;
}
static
bool
GetFindResponse
(
AlipayResponse
&
response
,
const
QJsonObject
&
json
)
{
Q_UNUSED
(
response
);
Q_UNUSED
(
json
);
return
false
;
}
static
bool
GetFindResponse
(
QJsonObject
&
response
,
const
QJsonObject
&
json
)
{
...
...
@@ -204,69 +87,6 @@ private:
return
true
;
}
static
bool
SetAgainPinter
(
AlipayResponse
&
response
,
const
QJsonObject
&
json
)
{
if
(
!
json
.
contains
(
JSON_KEY_EXT
)
||
!
json
[
JSON_KEY_EXT
].
isObject
())
return
false
;
FMTool
::
SetString
(
response
.
NeedPrint
,
2
,
QString
(
"00"
));
QJsonObject
obj
=
json
[
JSON_KEY_EXT
].
toObject
();
QString
str
;
str
.
append
(
obj
[
JSON_KEY_PRINT
].
toString
());
str
.
replace
(
"#"
,
"
\r\n
"
);
str
.
append
(
"==============================
\r\n
"
).
append
(
QChar
(
27
)).
append
(
QChar
(
'@'
)).
append
(
QChar
(
29
)).
append
(
"hP"
).
append
(
QChar
(
29
)).
append
(
QChar
(
'w'
)).
append
(
QChar
(
2
)).
append
(
QChar
(
29
)).
append
(
QChar
(
'H'
)).
append
(
QChar
(
2
));
str
.
append
(
QChar
(
27
)).
append
(
QChar
(
'a'
)).
append
(
QChar
(
1
)).
append
(
QChar
(
29
)).
append
(
"kF"
).
append
(
QChar
(
20
)).
append
(
json
[
JSON_KEY_FMID
].
toString
()).
append
(
"
\r\n
"
).
append
(
QChar
(
27
)).
append
(
'@'
).
append
(
'\r'
).
append
(
'\n'
);
qDebug
()
<<
str
;
qDebug
()
<<
json
;
QFile
file
(
qApp
->
applicationDirPath
()
+
"/"
+
PRINT_FILE_NAME
);
QString
path
=
qApp
->
applicationDirPath
()
+
"/"
+
PRINT_FILE_NAME
;
FMTool
::
SetString
(
response
.
EFTprintFileName
,
200
,
path
.
replace
(
"/"
,
"
\\
"
));
file
.
open
(
QFile
::
WriteOnly
);
if
(
!
file
.
isOpen
())
return
false
;
char
array
[
MAX_PRINT_LEN
]
=
{
0
};
FMTool
::
SetStringWith
(
array
,
str
.
toUtf8
().
length
(),
str
);
file
.
write
(
array
);
file
.
flush
();
file
.
close
();
return
true
;
}
static
bool
SetPinter
(
AlipayResponse
&
response
,
const
QJsonObject
&
json
)
{
if
(
!
json
.
contains
(
JSON_KEY_EXT
)
||
!
json
[
JSON_KEY_EXT
].
isObject
())
return
false
;
FMTool
::
SetString
(
response
.
NeedPrint
,
2
,
QString
(
"00"
));
QJsonObject
obj
=
json
[
JSON_KEY_EXT
].
toObject
();
QString
str
=
obj
[
JSON_KEY_PRINT
].
toString
();
str
.
replace
(
"#"
,
"
\r\n
"
);
str
.
append
(
"
\r\n
"
);
QFile
file
(
qApp
->
applicationDirPath
()
+
"/"
+
PRINT_FILE_NAME
);
QString
path
=
qApp
->
applicationDirPath
()
+
"/"
+
PRINT_FILE_NAME
;
FMTool
::
SetString
(
response
.
EFTprintFileName
,
200
,
path
.
replace
(
"/"
,
"
\\
"
));
file
.
open
(
QFile
::
WriteOnly
);
if
(
!
file
.
isOpen
())
return
false
;
char
array
[
MAX_PRINT_LEN
]
=
{
0
};
FMTool
::
SetStringWith
(
array
,
str
.
toUtf8
().
length
(),
str
);
file
.
write
(
array
);
file
.
flush
();
file
.
close
();
return
true
;
}
static
bool
SetPinter
(
QJsonObject
&
response
,
const
QJsonObject
&
json
,
QString
configKey
=
CONFIG_PRINT_ENDDAY_NAME
)
{
if
(
!
json
.
contains
(
JSON_KEY_EXT
)
||
!
json
[
JSON_KEY_EXT
].
isObject
())
...
...
sbkpay/sbkpay.pri
View file @
fa1d4bd8
...
...
@@ -16,7 +16,6 @@ SOURCES += $$PWD/hostwidget.cpp \
HEADERS += $$PWD/hostwidget.h \
$$PWD/fmp_window.h \
$$PWD/requestmodel.h \
$$PWD/global.h \
$$PWD/control.h \
$$PWD/fmtool.h \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment