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
8d5665ff
Commit
8d5665ff
authored
Aug 30, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 从配置文件中读取OLTP的dll中的各个参数。 2. 修复签名时OLTP参数错误。 3. 使用SPCC密钥。
parent
4a97cd48
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
20 deletions
+40
-20
sbkpay/DataProcess/fmglobal.h
+1
-1
sbkpay/control.cpp
+25
-16
sbkpay/control.h
+2
-0
sbkpay/global.h
+9
-0
sbkpay/hostwidget.cpp
+1
-1
sbkpay/main.cpp
+2
-2
No files found.
sbkpay/DataProcess/fmglobal.h
View file @
8d5665ff
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#define CFG_FILE_NAME "fmclient.cfg"
#define CFG_FILE_NAME "fmclient.cfg"
#define RBG_FILE_NAME "fmclient.rbk"
#define RBG_FILE_NAME "fmclient.rbk"
#define DES3_KEY "
ABCD@#9876DFSAAWKLDEOPDD
"
#define DES3_KEY "
DDDDEEEE45LPODDCXZZLKDDO
"
#define DES3_KEY_PRT "1JG23G12Y12V123G123F1DI1"
#define DES3_KEY_PRT "1JG23G12Y12V123G123F1DI1"
#define CRET_FILE_NAME "client.p12"
#define CRET_FILE_NAME "client.p12"
#define JSON_KEY_ONLY "partnerOrderId"
#define JSON_KEY_ONLY "partnerOrderId"
...
...
sbkpay/control.cpp
View file @
8d5665ff
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
EXTERN_C
IMAGE_DOS_HEADER
__ImageBase
;
EXTERN_C
IMAGE_DOS_HEADER
__ImageBase
;
typedef
int
(
__stdcall
*
SKBAPISend
)(
const
char
*
indata
,
const
char
*
guid
,
char
*
outdata
,
char
*
errMsg
,
const
char
*
mode
);
typedef
int
(
__stdcall
*
SKBAPISend
)(
const
char
*
indata
,
const
char
*
guid
,
char
*
outdata
,
char
*
errMsg
,
const
char
*
mode
,
const
char
*
operation
);
Control
::
Control
(
QObject
*
parent
)
:
QObject
(
parent
),
_widget
(
NULL
)
Control
::
Control
(
QObject
*
parent
)
:
QObject
(
parent
),
_widget
(
NULL
)
{
{
...
@@ -309,18 +309,18 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata,
...
@@ -309,18 +309,18 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata,
QString
reqXmlStr
=
QString
::
fromLocal8Bit
(
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>"
QString
reqXmlStr
=
QString
::
fromLocal8Bit
(
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>"
"<ns0:OLTP xmlns:ns0=
\"
http://spcc.com.cn/online
\"
>"
"<ns0:OLTP xmlns:ns0=
\"
http://spcc.com.cn/online
\"
>"
"<ns0:HEADER>"
"<ns0:HEADER>"
"<ns0:VER>
01.0
1</ns0:VER>"
"<ns0:VER>
%
1</ns0:VER>"
"<ns0:FROM>
CS00000001
</ns0:FROM>"
"<ns0:FROM>
%2
</ns0:FROM>"
"<ns0:TERMINO>%
1
</ns0:TERMINO>"
"<ns0:TERMINO>%
3
</ns0:TERMINO>"
"<ns0:TO>%
2
</ns0:TO>"
"<ns0:TO>%
4
</ns0:TO>"
"<ns0:BUSINESS>
0000000
</ns0:BUSINESS>"
"<ns0:BUSINESS>
%5
</ns0:BUSINESS>"
"<ns0:DATE>%
3
</ns0:DATE>"
"<ns0:DATE>%
6
</ns0:DATE>"
"<ns0:TIME>%
4
</ns0:TIME>"
"<ns0:TIME>%
7
</ns0:TIME>"
"<ns0:STATCODE>
0000
</ns0:STATCODE>"
"<ns0:STATCODE>
%8
</ns0:STATCODE>"
"<ns0:STATDESC/>"
"<ns0:STATDESC/>"
"</ns0:HEADER>"
"</ns0:HEADER>"
"<ns0:AP>"
"<ns0:AP>"
"%
5
"
"%
9
"
"</ns0:AP>"
"</ns0:AP>"
"</ns0:OLTP>"
);
"</ns0:OLTP>"
);
QString
nsTo
=
"CS00400004"
;
QString
nsTo
=
"CS00400004"
;
...
@@ -338,16 +338,25 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata,
...
@@ -338,16 +338,25 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata,
QByteArray
jsonArray
=
QJsonDocument
(
json
).
toJson
(
QJsonDocument
::
Compact
);
QByteArray
jsonArray
=
QJsonDocument
(
json
).
toJson
(
QJsonDocument
::
Compact
);
reqXmlStr
=
reqXmlStr
.
arg
(
termino
).
arg
(
nsTo
).
arg
(
QDate
::
currentDate
().
toString
(
"yyyyMMdd"
)).
arg
(
time
).
arg
(
QString
::
fromUtf8
(
jsonArray
));
reqXmlStr
=
reqXmlStr
.
arg
(
_setting
.
GetValue
(
CONFIG_OLTP_VER
,
"01.01"
).
toString
())
.
arg
(
_setting
.
GetValue
(
CONFIG_OLTP_FROM
,
"CS00000001"
).
toString
())
.
arg
(
termino
)
.
arg
(
nsTo
)
.
arg
(
_setting
.
GetValue
(
CONFIG_OLTP_BUSINESS
,
"0000000"
).
toString
())
.
arg
(
QDate
::
currentDate
().
toString
(
"yyyyMMdd"
))
.
arg
(
time
)
.
arg
(
_setting
.
GetValue
(
CONFIG_OLTP_STATCODE
,
"0000"
).
toString
())
.
arg
(
QString
::
fromUtf8
(
jsonArray
));
char
in
[
MAX_BUF_LEN
]
=
{
0
};
char
in
[
MAX_BUF_LEN
]
=
{
0
};
char
out
[
MAX_BUF_LEN
]
=
{
0
};
char
out
[
MAX_BUF_LEN
]
=
{
0
};
char
*
guid
=
""
;
char
*
guid
=
""
;
char
errMsg
[
MAX_BUF_LEN
]
=
{
0
};
char
errMsg
[
MAX_BUF_LEN
]
=
{
0
};
char
*
mode
=
"ONLINE"
;
QByteArray
mode
=
_setting
.
GetValue
(
CONFIG_OLTP_MODE
,
"FM"
).
toByteArray
();
QByteArray
operation
=
_setting
.
GetValue
(
CONFIG_OLTP_OPERATION
,
"75000"
).
toByteArray
();
strcpy
(
in
,
reqXmlStr
.
toUtf8
().
data
());
strcpy
(
in
,
reqXmlStr
.
toUtf8
().
data
());
QLOG_INFO
()
<<
"Request StarbucksAPI XML data: "
<<
in
;
QLOG_INFO
()
<<
"Request StarbucksAPI XML data: "
<<
in
<<
"mode: "
<<
mode
<<
"Operation: "
<<
operation
;
#ifdef MOCK
#ifdef MOCK
QLOG_DEBUG
()
<<
"=========================================== Read debug data. ========================================"
;
QLOG_DEBUG
()
<<
"=========================================== Read debug data. ========================================"
;
QLOG_DEBUG
()
<<
"Test req type: "
<<
type
;
QLOG_DEBUG
()
<<
"Test req type: "
<<
type
;
...
@@ -359,7 +368,7 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata,
...
@@ -359,7 +368,7 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata,
int
result
=
0
;
int
result
=
0
;
#else
#else
int
result
=
skbSend
(
in
,
guid
,
out
,
errMsg
,
mode
);
int
result
=
skbSend
(
in
,
guid
,
out
,
errMsg
,
mode
.
data
(),
operation
.
data
()
);
#endif //! End def MOCK
#endif //! End def MOCK
QLOG_DEBUG
()
<<
"StarbucksAPI return to GBK: "
<<
QString
::
fromLocal8Bit
(
out
);
QLOG_DEBUG
()
<<
"StarbucksAPI return to GBK: "
<<
QString
::
fromLocal8Bit
(
out
);
...
@@ -430,10 +439,10 @@ bool Control::GetRSA(QString &error)
...
@@ -430,10 +439,10 @@ bool Control::GetRSA(QString &error)
QJsonObject
json
;
QJsonObject
json
;
json
.
insert
(
JSON_KEY_VER
,
1
);
json
.
insert
(
JSON_KEY_VER
,
1
);
json
.
insert
(
JSON_KEY_REQTYPE
,
99
);
json
.
insert
(
JSON_KEY_REQTYPE
,
sign
);
json
.
insert
(
JSON_KEY_STOREID
,
FMTool
::
GetJsonValue
(
_posReqJsonObj
,
JSON_KEY_STOREID
).
toString
());
json
.
insert
(
JSON_KEY_STOREID
,
FMTool
::
GetJsonValue
(
_posReqJsonObj
,
JSON_KEY_STOREID
).
toString
());
json
.
insert
(
JSON_KEY_STATIONID
,
FMTool
::
GetJsonValue
(
_posReqJsonObj
,
JSON_KEY_STATIONID
).
toString
());
json
.
insert
(
JSON_KEY_STATIONID
,
FMTool
::
GetJsonValue
(
_posReqJsonObj
,
JSON_KEY_STATIONID
).
toString
());
json
.
insert
(
JSON_KEY_PARTNERID
,
QString
::
number
(
FMTool
::
GetJsonValue
(
_posReqJsonObj
,
JSON_KEY_PARTNERID
).
toInt
()
));
json
.
insert
(
JSON_KEY_PARTNERID
,
FMTool
::
GetJsonValue
(
_posReqJsonObj
,
JSON_KEY_PARTNERID
).
toInt
(
));
CretOperate
::
GetDES3MAC
(
json
);
CretOperate
::
GetDES3MAC
(
json
);
QByteArray
array
;
QByteArray
array
;
...
...
sbkpay/control.h
View file @
8d5665ff
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#include "requestmodel.h"
#include "requestmodel.h"
#include "hostwidget.h"
#include "hostwidget.h"
#include "DataProcess/fmp_database.h"
#include "DataProcess/fmp_database.h"
#include "fmp_settings.h"
#include <QObject>
#include <QObject>
#include <QApplication>
#include <QApplication>
#include <QLibrary>
#include <QLibrary>
...
@@ -75,6 +76,7 @@ private:
...
@@ -75,6 +76,7 @@ private:
bool
_isinterrupt
;
bool
_isinterrupt
;
FMPDataBase
*
_db
;
FMPDataBase
*
_db
;
FMPSettings
_setting
;
POSType
_posType
;
POSType
_posType
;
};
};
...
...
sbkpay/global.h
View file @
8d5665ff
...
@@ -88,5 +88,14 @@
...
@@ -88,5 +88,14 @@
#define JSON_REQTYPE_PRINTER 85
#define JSON_REQTYPE_PRINTER 85
#define JSON_REQTYPE_FIND 2
#define JSON_REQTYPE_FIND 2
#define CONFIG_OLTP_PATH "OLTP/DLLPATH"
#define CONFIG_OLTP_VER "OLTP/VER"
#define CONFIG_OLTP_FROM "OLTP/FROM"
#define CONFIG_OLTP_BUSINESS "OLTP/BUSINESS"
#define CONFIG_OLTP_STATCODE "OLTP/STATCODE"
#define CONFIG_OLTP_MODE "OLTP/MODE"
#define CONFIG_OLTP_OPERATION "OLTP/OPERATION"
#endif // GLOBAL
#endif // GLOBAL
sbkpay/hostwidget.cpp
View file @
8d5665ff
...
@@ -35,7 +35,7 @@ HostWidget::HostWidget(QWidget *parent) :
...
@@ -35,7 +35,7 @@ HostWidget::HostWidget(QWidget *parent) :
connect
(
&
_intertime
,
&
QTimer
::
timeout
,
this
,
[
this
](){
connect
(
&
_intertime
,
&
QTimer
::
timeout
,
this
,
[
this
](){
if
(
!
_need_exit
)
if
(
!
_need_exit
)
{
{
ui
->
btn_pay_exitint
->
show
();
//
ui->btn_pay_exitint->show();
}
}
});
});
...
...
sbkpay/main.cpp
View file @
8d5665ff
...
@@ -31,7 +31,7 @@ static bool CopyApiDll(QString &errorString)
...
@@ -31,7 +31,7 @@ static bool CopyApiDll(QString &errorString)
QFileInfo
localFileInfo
(
localDllPath
);
QFileInfo
localFileInfo
(
localDllPath
);
FMPSettings
setting
;
FMPSettings
setting
;
QString
configDllPath
=
setting
.
GetValue
(
"STARBUCKSAPIURL"
,
".
"
).
toString
();
QString
configDllPath
=
setting
.
GetValue
(
CONFIG_OLTP_PATH
,
"C:
\\
OLTP
\\
"
).
toString
();
QFileInfo
configFileInfo
(
configDllPath
);
QFileInfo
configFileInfo
(
configDllPath
);
if
(
!
configFileInfo
.
isFile
())
{
if
(
!
configFileInfo
.
isFile
())
{
...
@@ -415,7 +415,7 @@ int main(int argc, char *argv[])
...
@@ -415,7 +415,7 @@ int main(int argc, char *argv[])
// control.Start(as, b);
// control.Start(as, b);
char
spccIn
[
MAX_BUF_LEN
]
=
"{
\"
fmId
\"
:
\"
0123456789012345678
\"
,
\"
reqType
\"
:
451
,
\"
storeId
\"
:
\"
1713
\"
,
\"
stationId
\"
:
\"
1
\"
,
\"
partnerId
\"
:1443,
\"
operatorId
\"
:
\"
sssaw
\"
,
\"
transId
\"
:
\"
52342342323806
\"
,
\"
transAmount
\"
:8000,
\"
partnerOrderId
\"
:
\"
909911039993720192019
\"
,
\"
businessDate
\"
:
\"
20170508
\"
,
\"
products
\"
:[{
\"
pid
\"
:
\"
123
\"
,
\"
name
\"
:
\"
中杯拿铁
\"
,
\"
price
\"
:321,
\"
salesType
\"
:
\"
NORMAL
\"
}]}"
;
char
spccIn
[
MAX_BUF_LEN
]
=
"{
\"
fmId
\"
:
\"
0123456789012345678
\"
,
\"
reqType
\"
:
352
,
\"
storeId
\"
:
\"
1713
\"
,
\"
stationId
\"
:
\"
1
\"
,
\"
partnerId
\"
:1443,
\"
operatorId
\"
:
\"
sssaw
\"
,
\"
transId
\"
:
\"
52342342323806
\"
,
\"
transAmount
\"
:8000,
\"
partnerOrderId
\"
:
\"
909911039993720192019
\"
,
\"
businessDate
\"
:
\"
20170508
\"
,
\"
products
\"
:[{
\"
pid
\"
:
\"
123
\"
,
\"
name
\"
:
\"
中杯拿铁
\"
,
\"
price
\"
:321,
\"
salesType
\"
:
\"
NORMAL
\"
}]}"
;
control
.
Start
(
spccIn
,
b
);
control
.
Start
(
spccIn
,
b
);
return
a
.
exec
();
return
a
.
exec
();
...
...
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