Commit 74df51c9 by 李定达

1.新增RES对接,并测试完成;2.main调用方法未编写;3本次提交exe的注意

parent 932408b6
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>
......@@ -91,11 +91,13 @@
<ClCompile Include="load.c" />
<ClCompile Include="memory.c" />
<ClCompile Include="pack_unpack.c" />
<ClCompile Include="resdata.cpp" />
<ClCompile Include="sbk_client.cpp" />
<ClCompile Include="strbuffer.c" />
<ClCompile Include="strconv.c" />
<ClCompile Include="tastdataprocess.cpp" />
<ClCompile Include="testlog.cpp" />
<ClCompile Include="testresdata.cpp" />
<ClCompile Include="testtool.cpp" />
<ClCompile Include="utf.c" />
<ClCompile Include="value.c" />
......@@ -114,10 +116,12 @@
<ClInclude Include="jansson_config.h" />
<ClInclude Include="jansson_private.h" />
<ClInclude Include="lookup3.h" />
<ClInclude Include="resdata.h" />
<ClInclude Include="sqlite3.h" />
<ClInclude Include="strbuffer.h" />
<ClInclude Include="testdataprocess.h" />
<ClInclude Include="testlog.h" />
<ClInclude Include="testresdata.h" />
<ClInclude Include="testtool.h" />
<ClInclude Include="utf.h" />
</ItemGroup>
......
......@@ -66,6 +66,12 @@
<ClCompile Include="testtool.cpp">
<Filter>Source Files\TestCase</Filter>
</ClCompile>
<ClCompile Include="resdata.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="testresdata.cpp">
<Filter>Source Files\TestCase</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="fmcrypt.h">
......@@ -125,5 +131,11 @@
<ClInclude Include="fmdatabase.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resdata.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="testresdata.h">
<Filter>Header Files\TestCase</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -10,7 +10,12 @@
#define MAX_SIGN_LEN 256
#define CFG_FILE_NAME "fmclient.cfg"
#define RBG_FILE_NAME "fmclient.rbk"
#define REQUEST_CRET "{\r\n \"ver\": 1,\r\n \"reqType\": 99,\r\n \"partnerId\":%d,\r\n \"storeId\":\"%s\",\r\n \"stationId\": \"%s\"\r\n}"
#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 \"amount\":\"%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 \"amount\":\"%d\",\r\n \"transId\":\"%s\"\r\n}"
#define DES3_KEY "ABCD@#9876DFSAAWKLDEOPDD"
#define CRET_FILE_NAME "client.p12"
#define JSON_KEY_ONLY "partnerOrderId"
......
#ifndef FM_RESDATA_H
#define FM_RESDATA_H
#include<string>
#include <jansson.h>
#include <jansson_private.h>
using std::string;
typedef struct
{
string data[6];
////1
//string reqType;
////2
//string partnerId;
////3
//string storeId;
////4
//string posNo;
////5
//string optId;
////6
//string code;
inline void init()
{
for(int i = 0; i < 6; i ++)
data[i].clear();
}
} Request_0;
typedef struct
{
string data[9];
////1
//string reqType;
////2
//string partnerId;
////3
//string storeId;
////4
//string posNo;
////5
//string optId;
////6
//string code;
////7
//string businessData;
////8
//string totalAmout;
////9
//string transId;
inline void init()
{
for(int i = 0; i < 9; i ++)
data[i].clear();
}
} Request_71_3;
typedef struct
{
string data[17];
//1返回查询结果状态码
//string statusCode;
////2状态码描述
//string statusCodeMSG;
////3券类型
//string type;
////4券码
//string code;
////5券状态
//string status;
////6券状态汉字
//string statusMSG;
////7活动编号
//string actId;
////8活动名称
//string actName;
////9支付渠道编号
//string payCode;
////10支付渠道名称
//string payCodeName;
////11授权码
//string autoCode;
////12脚本编码
//string SIMCode;
////13商品或券编号
//string counpId;
////14商品或券名称
//string counpName;
////15券使用范围
//string userRange;
////16折扣编号
//string discountNO;
////17券面值
//string counp_amout;
inline void init()
{
for(int i = 0; i < 17; i ++)
data[i].clear();
}
} Response_0;
typedef struct
{
string data[14];
//1返回查询结果状态码
//string statusCode;
////2状态码描述
//string statusCodeMSG;
////3券类型
//string type;
////4券码
//string code;
////5券状态
//string status;
////6券状态汉字
//string statusMSG;
////7活动编号
//string actId;
////8活动名称
//string actName;
////9支付渠道编号
//string payCode;
////10支付渠道名称
//string payCodeName;
////11非码交易
//string fmId;
////12脚本编码
//string SIMCode;
////13账户消费额
//string userAccount;
////14折扣账户消费金额
//string discountAccount;
inline void init()
{
for(int i = 0; i < 14; i ++)
data[i].clear();
}
} Response_71;
typedef struct
{
string data[2];
////1返回查询结果状态码
//string statusCode;
////2状态码描述
//string statusCodeMSG;
inline void init()
{
for(int i = 0; i < 2; i ++)
data[i].clear();
}
} Response_3;
extern bool JsonToRES(const string &indata, string &outdata);
extern bool RESToJson(const string &indata, string &outdata);
extern int _reqType;
#endif
\ No newline at end of file
......@@ -17,12 +17,17 @@
#include "fmtool.h"
#include "fmdatabase.h"
//#define FM_TEST
#include "resdata.h"
int _reqType = -1;
#define FM_TEST
//#define FM_TESTS
#include "testdataprocess.h"
#include "testlog.h"
#include "testtool.h"
#include "testresdata.h"
using std::cout;
using std::endl;
......@@ -1159,10 +1164,15 @@ void testCheckRollbackData()
int main()
{
_reqType = 3;
TestRESToJson();
TestJsonToRES();
char storeid[] = "12344";
char posno[] = "01";
//TestComplementJson();
//Test_RSASign();
......@@ -1188,7 +1198,7 @@ int main()
//GetRSACret(1443, storeid, posno);
//while(1)
//{
GetValue(a, b);
//GetValue(a, b);
// LOG() << b;
......
#include "testresdata.h"
#include "resdata.h"
#include <string>
#include "fmlog.h"
using std::string;
//char buf[] = "{\n \"ext\": {\n \"hint\": \"------------7310183410017522691 +++++++++\"\n },\n \"paymentMethodCode\": \"80022\",\n \"ver\": 1,\n \"paymentMethod\": \"****************\",\n \"message\": \"wdh----\",\n \"type\": 3,\n \"info\": {\n \"actId\": \"20000451\",\n \"actName\": \"zkq20000451\",\n \"authCode\": \"\",\n \"code\": \"7310183410017522691=4F28F2E86561C03F\",\n \"products\": [\n {\n \"discount\": 216,\n \"name\": \"sp85zq----\",\n \"priceAct\": 0,\n \"scope\": \"discountNo\"\n }\n ],\n \"status\": \"6\",\n \"statusDesc\": \"++++++++\"\n },\n \"statusCode\": 100\n}";
//char buf[] = "\{\"a\": 8}";
char buf[] = "{\n \"ext\": {\n \"hint\": \"shiping85zheyouhuiquan 7310183410017522691\"\n },\n \"paymentMethodCode\": \"80022\",\n \"actInfo\": {\n \"actId\": \"1402007\",\n \"actName\": \"zhekouquan20000451\",\n \"code\": \"7310183410017522691=4F28F2E86561C03F\"\n },\n \"fmId\": \"2691170714Z10000001\",\n \"ver\": 1,\n \"paymentMethod\": \"dianzhiquan-zhekoquan\",\n \"message\": \"chenggong\",\n \"type\": 3,\n \"statusCode\": 100\n}";
char ls[] = "0|1443|0001|FOE13|01|123456789987654321|END|";
char ls1[] = "3|1443|0001|FOE13|01|123456789987654321|20170714||8888|END|";
char ls2[] = "71|1443|0001|FOE13|01|123456789987654321|20170714||8888|END|";
void TestRESToJson()
{
string str(ls);
string str1(ls1);
string str2(ls2);
string out;
RESToJson(str, out);
RESToJson(str1, out);
RESToJson(str2, out);
}
void TestJsonToRES()
{
string str(buf);
string out;
JsonToRES(str, out);
LOG() << out;
}
\ No newline at end of file
#ifdef FM_TEST
void TestRESToJson();
void TestJsonToRES();
#endif
\ No newline at end of file
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