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
7de539ee
Commit
7de539ee
authored
Nov 03, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 放通支付宝和微信条码。
parent
83e99230
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
6 deletions
+46
-6
sbkpay/control.cpp
+15
-3
sbkpay/control.h
+2
-0
sbkpay/sbkpay.pro
+1
-1
sbkpay/version.h
+2
-2
tests/TestSimphony/tst_testsimphony.cpp
+26
-0
No files found.
sbkpay/control.cpp
View file @
7de539ee
...
@@ -584,9 +584,7 @@ void Control::Request(ReqType type, QStringList list)
...
@@ -584,9 +584,7 @@ void Control::Request(ReqType type, QStringList list)
bool
isOk
=
true
;
bool
isOk
=
true
;
if
(
type
==
pay
)
{
if
(
type
==
pay
)
{
QString
payCode
=
list
[
0
];
if
(
!
IsValidCode
(
list
[
0
]))
{
int
beginNum
=
payCode
.
mid
(
0
,
2
).
toInt
();
if
(
beginNum
<
25
||
beginNum
>
30
)
{
isOk
=
false
;
isOk
=
false
;
SetResPonseWithMessage
(
"23"
,
QString
::
fromLocal8Bit
(
"无效条码"
));
SetResPonseWithMessage
(
"23"
,
QString
::
fromLocal8Bit
(
"无效条码"
));
}
}
...
@@ -710,3 +708,17 @@ void Control::OnInterrupt()
...
@@ -710,3 +708,17 @@ void Control::OnInterrupt()
// _widget->StopPay();
// _widget->StopPay();
// }
// }
}
}
bool
Control
::
IsValidCode
(
const
QString
&
code
)
{
int
beginNum
=
code
.
mid
(
0
,
2
).
toInt
();
if
(
beginNum
>=
25
&&
beginNum
<=
30
)
{
return
true
;
}
if
(
beginNum
==
13
&&
code
.
length
()
==
18
)
{
return
true
;
}
return
false
;
}
sbkpay/control.h
View file @
7de539ee
...
@@ -63,6 +63,8 @@ private:
...
@@ -63,6 +63,8 @@ private:
void
InitPOSReqJsonObj
(
const
char
*
indata
);
void
InitPOSReqJsonObj
(
const
char
*
indata
);
static
bool
IsValidCode
(
const
QString
&
code
);
public
slots
:
public
slots
:
void
RequestWithType
(
ReqType
type
,
QStringList
list
);
void
RequestWithType
(
ReqType
type
,
QStringList
list
);
...
...
sbkpay/sbkpay.pro
View file @
7de539ee
...
@@ -14,7 +14,7 @@ include($$PWD/sbkpay.pri)
...
@@ -14,7 +14,7 @@ include($$PWD/sbkpay.pri)
SOURCES
+=
main
.
cpp
SOURCES
+=
main
.
cpp
CONFIG
+=
C
++
11
SBKDLL
1
CONFIG
+=
C
++
11
SBKDLL
#DEFINES += MOCK
#DEFINES += MOCK
...
...
sbkpay/version.h
View file @
7de539ee
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
#define VER_MAJOR 0
#define VER_MAJOR 0
#define VER_MINOR 2
#define VER_MINOR 2
#define VER_REVISION
2
#define VER_REVISION
3
#define VER_BUILD
1
#define VER_BUILD
0
//! Convert version numbers to string
//! Convert version numbers to string
#define _STR(S) #S
#define _STR(S) #S
...
...
tests/TestSimphony/tst_testsimphony.cpp
View file @
7de539ee
...
@@ -40,6 +40,9 @@ private slots:
...
@@ -40,6 +40,9 @@ private slots:
void
test_POSRequest_data
();
void
test_POSRequest_data
();
void
test_POSRequest
();
void
test_POSRequest
();
void
test_IsValidCode_data
();
void
test_IsValidCode
();
};
};
TestSimphony
::
TestSimphony
()
TestSimphony
::
TestSimphony
()
...
@@ -278,6 +281,29 @@ void TestSimphony::test_POSRequest()
...
@@ -278,6 +281,29 @@ void TestSimphony::test_POSRequest()
}
}
}
}
void
TestSimphony
::
test_IsValidCode_data
()
{
QTest
::
addColumn
<
QString
>
(
"code"
);
QTest
::
addColumn
<
bool
>
(
"isValid"
);
QTest
::
newRow
(
"Alipay code begin with: 24."
)
<<
"2412345678"
<<
false
;
QTest
::
newRow
(
"Alipay code begin with: 25."
)
<<
"251234567899999"
<<
true
;
QTest
::
newRow
(
"Alipay code begin with: 28."
)
<<
"28123456788888"
<<
true
;
QTest
::
newRow
(
"Alipay code begin with: 30."
)
<<
"3012345678"
<<
true
;
QTest
::
newRow
(
"Alipay code begin with: 31."
)
<<
"311234567812"
<<
false
;
QTest
::
newRow
(
"Wxpay code begin with: 12, Len: 18."
)
<<
"120123456789012345"
<<
false
;
QTest
::
newRow
(
"Wxpay code begin with: 13, Len: 18."
)
<<
"130123456789012345"
<<
true
;
QTest
::
newRow
(
"Wxpay code begin with: 13, Len: 17."
)
<<
"13012345678901234"
<<
false
;
}
void
TestSimphony
::
test_IsValidCode
()
{
QFETCH
(
QString
,
code
);
QFETCH
(
bool
,
isValid
);
QCOMPARE
(
Control
::
IsValidCode
(
code
),
isValid
);
}
QTEST_MAIN
(
TestSimphony
)
QTEST_MAIN
(
TestSimphony
)
#include "tst_testsimphony.moc"
#include "tst_testsimphony.moc"
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