Commit 1dc7b824 by 李定达

1.RES支付宝接口支持;2.测试用例编写变成并测试

parent 8df13c56
......@@ -8,3 +8,4 @@ Debug/log/
*.user
Debug/
ipch/
*.log
No preview for this file type
......@@ -18,7 +18,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>false</UseOfMfc>
......
......@@ -15,6 +15,9 @@
#define REQUEST_0 "{\r\n \"ver\": 1,\r\n \"reqType\": %s,\r\n \"partnerId\":%d,\r\n \"storeId\":\"%s\",\r\n \"stationId\": \"%s\",\r\n \"operatorId\":\"%s\",\r\n \"code\":\"%s\"\r\n}"
#define REQUEST_3 "{\r\n \"ver\": 1,\r\n \"reqType\": %s,\r\n \"partnerId\":%d,\r\n \"storeId\":\"%s\",\r\n \"stationId\": \"%s\",\r\n \"operatorId\":\"%s\",\r\n \"code\":\"%s\",\r\n \"businessDate\":\"%s\",\r\n \"transAmount\":\"%d\",\r\n \"transId\":\"%s\"\r\n}"
#define REQUEST_71 "{\r\n \"ver\": 1,\r\n \"reqType\": %s,\r\n \"partnerId\":%d,\r\n \"storeId\":\"%s\",\r\n \"stationId\": \"%s\",\r\n \"operatorId\":\"%s\",\r\n \"code\":\"%s\",\r\n \"businessDate\":\"%s\",\r\n \"transAmount\":\"%d\",\r\n \"transId\":\"%s\"\r\n}"
#define REQUEST_72 "{\r\n \"ver\": 1,\r\n \"reqType\": %s,\r\n \"partnerId\":%d,\r\n \"storeId\":\"%s\",\r\n \"stationId\": \"%s\",\r\n \"operatorId\":\"%s\",\r\n \"code\":\"%s\",\r\n \"businessDate\":\"%s\",\r\n \"transAmount\":\"%d\",\r\n \"undiscountAmount\":\"%d\",\r\n \"promotionTag\":\"%s\",\r\n \"transId\":\"%s\"\r\n}"
#define REQUEST_62 "{\r\n \"ver\": 1,\r\n \"reqType\": %s,\r\n \"partnerId\":%d,\r\n \"storeId\":\"%s\",\r\n \"stationId\": \"%s\",\r\n \"operatorId\":\"%s\",\r\n \"code\":\"%s\",\r\n \"fmId\":\"%s\",\r\n \"transId\":\"%s\",\r\n \"businessDate\":\"%s\",\r\n \"refundAmount\":\"%d\"\r\n}"
#define DES3_KEY "ABCD@#9876DFSAAWKLDEOPDD"
#define CRET_FILE_NAME "client.p12"
......
......@@ -32,6 +32,74 @@ typedef struct
} Request_0;
typedef struct
{
string data[11];
////1
//string reqType;
////2
//string partnerId;
////3
//string storeId;
////4
//string posNo;
////5
//string optId;
////6
//string code;
////7
//string businessData;
////8
//string amount;
////9
//string unamount;
////10
//string tuiguangbh
////11
//string transid;
inline void init()
{
for(int i = 0; i < 11; i ++)
data[i].clear();
}
} Request_72;
typedef struct
{
string data[10];
////1
//string reqType;
////2
//string partnerId;
////3
//string storeId;
////4
//string posNo;
////5
//string optId;
////6
//string code;
////7
//string fmid;
////8
//string transid;
////9
//string businessdata;
////10
//string amount;
inline void init()
{
for(int i = 0; i < 10; i ++)
data[i].clear();
}
} Request_62;
typedef struct
{
string data[9];
......@@ -149,16 +217,97 @@ typedef struct
typedef struct
{
string data[2];
////1返回查询结果状态码
string data[14];
//1返回查询结果状态码
//string statusCode;
////2状态码描述
//string statusCodeMSG;
////3券类型
//string type;
////4支付账号
//string account;
////5第三方交易号
//string threadtransid;
////6非码交易号
//string fmid;
////7支付渠道号
//string payCode;
////8支付渠道名称
//string payCodeName;
////9总交易金额
//string amount;
////10积分兑换金额
//string jfdh;
////11商户补贴金额
//string shbtje;
////12平台补贴金额
//string ptbtje;
////13小票行数
//string num;
////14小票打印
//string message;
inline void init()
{
for(int i = 0; i < 14; i ++)
data[i].clear();
}
} Response_72;
typedef struct
{
string data[5];
//1返回查询结果状态码
//string statusCode;
////2状态码描述
//string statusCodeMSG;
////3非码交易号
//string fmid;
////4小票行数
//string num;
////5小票打印
//string message;
inline void init()
{
for(int i = 0; i < 5; i ++)
data[i].clear();
}
} Response_62;
typedef struct
{
string data[5];
////1商品数量
//string num;
////2商品编号
//string pid;
////3商品名称
//string prdname;
////4商品类型
//string type;
////5商品单价
//string price;
inline void init()
{
for(int i = 0; i < 5; i ++)
data[i].clear();
}
} Product;
typedef struct
{
string data[2];
inline void init()
{
for(int i = 0; i < 2; i ++)
data[i].clear();
data[i].clear();
}
} Response_3;
......
......@@ -21,7 +21,7 @@
int _reqType = -1;
//#define FM_TEST
#define FM_TEST
//#define FM_TESTS
#include "testdataprocess.h"
......@@ -1242,10 +1242,10 @@ void testCheckRollbackData()
int main()
{
_reqType = 3;
_reqType = 62;
//TestRESToJson();
//TestJsonToRES();
TestJsonToRES();
char storeid[] = "12344";
char posno[] = "01";
......@@ -1263,7 +1263,7 @@ int main()
char b[MAX_BUF_LEN];
RESGetValue(ls1, b);
//RESGetValue(ls1, b);
//char c[MAX_BUF_LEN] = { 0 };
......
......@@ -13,19 +13,25 @@ char buf[] = "{\n \"ext\": {\n \"hint\": \"shiping85zheyouhuiquan 7310183410
static char ls[] = "0|1443|0001|FOE13|01|123456789987654321|END|";
static char ls1[] = "3|1443|0001|FOE13|01|123456789987654321|20170714||8888|END|";
static char ls2[] = "71|1443|0001|FOE13|01|123456789987654321|20170714||8888|END|";
static char ls3[] = "72|1443|0001|FOE13|01|123456789987654321|20170714|300|0|0|8888|1|123|dadawan|FREE|300|1||dasawan||300|END|";
static char ls4[] = "62|1443|0001|FOE13|01|123456789987654321|fm123123123123|8888|20170714|300|END|";
void TestRESToJson()
{
string str(ls);
string str1(ls1);
string str2(ls2);
string str3(ls3);
string str4(ls4);
string out;
RESToJson(str, out);
RESToJson(str1, out);
RESToJson(str2, out);
RESToJson(str3, out);
RESToJson(str4, out);
}
......
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