Commit cf6083c3 authored by 周尚's avatar 周尚

remove paytype ui

parent 3c81f021
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff is collapsed.
No preview for this file type
This diff is collapsed.
No preview for this file type

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "V1_0_0", "V1_0_0.vcxproj", "{4D0804EF-455B-44D1-B0C7-74E9B14E37B0}"
EndProject
Global
......
No preview for this file type
This diff is collapsed.
No preview for this file type
......@@ -7,6 +7,7 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\ExFuncs.h" />
<ClInclude Include="include\HttpApi.h" />
<ClInclude Include="include\sslapi.h" />
<ClInclude Include="include\zx_code.h" />
......@@ -48,7 +49,7 @@
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
......@@ -110,7 +111,7 @@
<TargetMachine>MachineX86</TargetMachine>
<IgnoreSpecificDefaultLibraries>libc.lib;libcd.lib</IgnoreSpecificDefaultLibraries>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug/V1_0_0.bsc</OutputFile>
......
......@@ -47,6 +47,9 @@
<ClInclude Include="include\zx_wifi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\ExFuncs.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\main.c">
......
/* This file was automatically generated. Do not edit! */
#ifndef ZX_MD5_H
#define ZX_MD5_H
#include "zx_define.h"
void BCC_MD5_gen_encrypt(uchar *text,int text_len,uchar *key,int key_len,uchar *out_digest32);
......
......@@ -16,4 +16,6 @@ typedef struct WIFI_ST {
int zx_wifi_connect();
int zx_wifi_init();
void zx_wifi_disconnect();
int zx_wifi_check();
#endif // ZX_WIFI_H
No preview for this file type
......@@ -30,6 +30,8 @@ const APPINFO AppInfo = {
0,
""};
void zx_disp_submenu();
int event_main(ST_EVENT_MSG *msg)
{
SystemInit();
......@@ -83,15 +85,12 @@ int zx_getpayamt()
memset(buff, 0, sizeof(buff));
memset(amtStr, 0, sizeof(amtStr));
ucKey = 0x00;
for (; ucKey != KEYENTER || strlen(amtStr) == 0;) {
if (strcmp(pay_st.payWay, "1") == 0)
zx_common_disp_str((uchar *)" 微信支付 ", 0, LEFT, 0, 1);
else if (strcmp(pay_st.payWay, "2") == 0)
zx_common_disp_str((uchar *)" 支付宝支付 ", 0, LEFT, 0, 1);
zx_common_disp_str((uchar *)"请输入金额: ", 4, LEFT, 0, 0);
ucKey = getkey();
for (; ucKey != KEYENTER;) {
zx_common_disp_str((uchar *)"请输入金额: ", 0, LEFT, 0, 1);
zx_common_disp_str(amtStr, 8, LEFT, 0, 0);
ucKey = getkey();
switch (ucKey) {
case KEY0:
case KEY1:
......@@ -121,15 +120,28 @@ int zx_getpayamt()
case KEYCANCEL:
return KEYCANCEL;
default:
break;
case KEYENTER:
if (strlen(buff) == 0) {
continue;
}
zx_common_asc2amt(buff, amtStr);
zx_common_disp_str(amtStr, 8, LEFT, 0, 0);
}
strcpy(pay_st.transAmount, amtStr);
ret = zx_getqrcode();
if (ret == KEYCANCEL) {
continue;
} else if (ret > 0) {
ret = zx_trans_biz(TRANS_POSPAY);
if (strcmp(pay_st.status, "2") == 0 && strcmp(pay_st.isMember, "0") == 0) {
ret = zx_trans_biz(TRANS_GETPOINT);
}
}
break;
default:
break;
}
}
return ret;
}
......@@ -195,7 +207,7 @@ void setup()
zx_config_read_host();
RouteSetDefault(12);
/* zx_wifi_init(); */
// zx_wifi_init();
}
void zx_disp_submenu()
......@@ -251,22 +263,75 @@ end:
int main(void)
{
uchar ucKey = 0x00;
uchar buff[12] = {0};
uchar amtStr[12] = {0};
int ret = 0;
SystemInit();
setup();
while (1) {
memset(buff, 0, sizeof(buff));
memset(amtStr, 0, sizeof(amtStr));
ucKey = 0x00;
for (; ucKey != KEYENTER;) {
ScrCls();
zx_common_disp_str((uchar *)"请输入金额: ", 0, 0, 0, 1);
zx_common_asc2amt(buff, amtStr);
zx_common_disp_str(amtStr, 8, LEFT, 0, 0);
while (1) {
zx_disp_paymenu();
ucKey = getkey();
switch (ucKey) {
case KEY0:
case KEY1:
case KEY2:
case KEY3:
case KEY4:
case KEY5:
case KEY6:
case KEY7:
case KEY8:
case KEY9:
if (strlen(buff) < sizeof(buff) - 1)
sprintf(buff + strlen(buff), "%c", ucKey);
break;
// disp_mainmenu();
/* zx_getpaytype(pay_st.payWay); */
/* zx_getpayamt(amtStr); */
/* zx_getqrcode(); */
case KEYBACKSPACE:
buff[strlen(buff) - 1] = 0;
break;
case KEYCLEAR:
case KEYCANCEL:
memset(buff, 0, sizeof(buff));
break;
case KEYFN:
zx_disp_submenu();
/* zx_trans_send_pay(&pay_st, sendbuf); */
/* send_and_receive(0, sendbuf, strlen(sendbuf), recvbuf, &recvlen); */
case KEYENTER:
if (strlen(buff) == 0) {
continue;
}
break;
default:
break;
}
}
strcpy(pay_st.transAmount, amtStr);
ret = zx_getqrcode();
if (ret == KEYCANCEL) {
continue;
} else if (ret > 0) {
ret = zx_trans_biz(TRANS_POSPAY);
if (strcmp(pay_st.status, "2") == 0 && strcmp(pay_st.isMember, "0") == 0) {
ret = zx_trans_biz(TRANS_GETPOINT);
}
}
}
return 0;
}
......@@ -101,8 +101,8 @@ void zx_common_disp_str(uchar const *mess, uchar line, uchar loc, uchar inkey, u
void zx_common_print2port(const char *sendbuf)
{
return; /* log */
#if 1
int ret = 0;
char buf[20];
char portbuf[2048];
......@@ -137,4 +137,5 @@ void zx_common_print2port(const char *sendbuf)
zx_common_disp_str("PortClose", 2, 0, 0, 0);
zx_err_port(ret);
}
#endif
}
......@@ -2,6 +2,7 @@
#include <posapi.h>
#include <posapi_all.h>
#include "zx_code.h"
#include "zx_common.h"
#include "zx_config.h"
#include "zx_define.h"
......@@ -27,22 +28,18 @@ int zx_config_read_shop()
ret = seek(fd, 0, SEEK_SET);
if (ret < 0) {
zx_common_disp_str((uchar *)"seek", 4, 0, 0, 0);
zx_err_file();
// zx_err_file();
goto end;
}
ret = read(fd, (void *)buf, sizeof(SHOP_ST));
if (ret == -1) {
zx_common_disp_str((uchar *)"read", 4, 0, 0, 0);
zx_err_file();
// zx_err_file();
goto end;
} else if (ret == sizeof(SHOP_ST))
memcpy(&shop_st, buf, sizeof(SHOP_ST));
zx_common_print2port("posKey: ");
zx_common_print2port(shop_st.posKey);
zx_common_print2port("\n");
end:
if (fd > 0) {
close(fd);
......@@ -58,18 +55,14 @@ int zx_config_write_shop()
fd = open("shopData", O_CREATE | O_RDWR);
if (fd < 0) {
zx_common_disp_str((uchar *)"open", 4, 0, 0, 0);
zx_err_file();
// zx_err_file();
goto end;
}
zx_common_print2port("posKey: ");
zx_common_print2port(shop_st.posKey);
zx_common_print2port("\n");
ret = write(fd, (void *)&shop_st, sizeof(SHOP_ST));
if (ret == -1) {
zx_common_disp_str((uchar *)"write", 4, 0, 0, 0);
zx_err_file();
// zx_err_file();
goto end;
}
......@@ -144,14 +137,14 @@ int zx_config_read_wifi()
ret = seek(fd, 0, SEEK_SET);
if (ret < 0) {
zx_common_disp_str((uchar *)"seek", 4, 0, 0, 0);
zx_err_file();
// zx_err_file();
goto end;
}
ret = read(fd, (void *)buf, sizeof(WIFI_ST));
if (ret == -1) {
zx_common_disp_str((uchar *)"read", 4, 0, 0, 0);
zx_err_file();
// zx_err_file();
goto end;
} else if (ret == sizeof(WIFI_ST)) {
memcpy(&wifi_st, buf, sizeof(WIFI_ST));
......@@ -174,13 +167,13 @@ int zx_config_write_wifi()
fd = open("wifi", O_CREATE | O_RDWR);
if (fd < 0) {
zx_common_disp_str((uchar *)"open", 4, 0, 0, 0);
zx_err_file();
// zx_err_file();
goto end;
}
ret = write(fd, (void *)&wifi_st, sizeof(WIFI_ST));
if (ret == -1) {
zx_common_disp_str((uchar *)"write", 4, 0, 0, 0);
zx_err_file();
// zx_err_file();
goto end;
}
......@@ -207,14 +200,14 @@ int zx_config_read_host()
ret = seek(fd, 0, SEEK_SET);
if (ret < 0) {
zx_common_disp_str((uchar *)"seek", 4, 0, 0, 0);
zx_err_file();
// zx_err_file();
goto end;
}
ret = read(fd, (void *)buf, HOSTLEN);
if (ret == -1) {
zx_common_disp_str((uchar *)"read", 4, 0, 0, 0);
zx_err_file();
// zx_err_file();
goto end;
} else if (ret == HOSTLEN) {
strcpy(hosturl, buf);
......@@ -235,7 +228,7 @@ int zx_config_write_host()
fd = open("hosturl", O_CREATE | O_RDWR);
if (fd < 0) {
zx_common_disp_str((uchar *)"open", 4, 0, 0, 0);
zx_err_file();
// zx_err_file();
goto end;
}
......
......@@ -6,6 +6,9 @@
*************************************************************************/
#include "zx_md5.h"
#include <posapi.h>
#include <posapi_all.h>
/* #include <posapi.h> */
/* #include <posapi_all.h> */
......
......@@ -6,6 +6,7 @@
#include "zx_global.h"
#include "zx_md5.h"
// #include "ExFuncs.h"
#include "HttpApi.h"
int zx_trans_send_shop(const SHOP_ST *shop_st, uchar *out)
......@@ -24,11 +25,9 @@ int zx_trans_send_shop(const SHOP_ST *shop_st, uchar *out)
{
// ptr = shop_st->apiDistrict;
ptr = "01";
zx_common_print2port(ptr);
zx_code_urlstr_keyval_set("apiDistrict", ptr, out, &len);
ptr = shop_st->serialNo;
zx_common_print2port("serialNo");
zx_common_print2port(ptr);
zx_code_urlstr_keyval_set("serialNo", ptr, out, &len);
out[--len] = 0;
}
......@@ -54,40 +53,28 @@ int zx_trans_send_activate(const ACT_ST *act_st, uchar *out)
{
// ptr = act_st->apiDistrict;
ptr = "02";
zx_common_print2port(ptr);
ret |= zx_code_urlstr_keyval_set("apiDistrict", ptr, signbuf, &len);
ptr = shop_st.serialNo;
zx_common_print2port("serialNo");
zx_common_print2port(ptr);
ret |= zx_code_urlstr_keyval_set("serialNo", ptr, signbuf, &len);
ptr = shop_st.shopId;
zx_common_print2port("shopId");
zx_common_print2port(ptr);
ret |= zx_code_urlstr_keyval_set("shopId", ptr, signbuf, &len);
ptr = shop_st.shopName;
zx_common_print2port("shopName");
zx_common_print2port(ptr);
ret |= zx_code_urlstr_keyval_set("shopName", ptr, signbuf, &len);
strcpy((char *)out, (char *)signbuf); // apiDistrict=val1&serialNo=val2&shopId=val3&shopName=val4&
ptr = shop_st.posKey;
zx_common_print2port("posKey");
zx_common_print2port(ptr);
ret |= zx_code_urlstr_keyval_set("key", ptr, signbuf, &len);
signbuf[len - 1] = 0;
zx_common_print2port("signbuf:");
zx_common_print2port(signbuf);
}
{
BCC_MD5_gen(signbuf, md5buf);
zx_common_print2port("md5buf:");
zx_common_print2port(md5buf);
zx_code_upper_str(md5buf, strlen(md5buf));
zx_code_urlstr_keyval_set("sign", md5buf, out, &len);
out[--len] = 0;
......@@ -110,55 +97,35 @@ int zx_trans_send_pay(const PAY_ST *pay_st, uchar *out)
{
ptr = "03";
zx_common_print2port(ptr);
zx_code_urlstr_keyval_set("apiDistrict", ptr, signbuf, &len);
ptr = pay_st->authCode;
zx_common_print2port("authCode");
zx_common_print2port(ptr);
zx_code_urlstr_keyval_set("authCode", ptr, signbuf, &len);
ptr = pay_st->payWay;
zx_common_print2port("payWay");
zx_common_print2port(ptr);
zx_code_urlstr_keyval_set("payWay", ptr, signbuf, &len);
ptr = shop_st.serialNo;
zx_common_print2port("serialNo");
zx_common_print2port(ptr);
zx_code_urlstr_keyval_set("serialNo", ptr, signbuf, &len);
ptr = shop_st.shopId;
zx_common_print2port("shopId");
zx_common_print2port(ptr);
zx_code_urlstr_keyval_set("shopId", ptr, signbuf, &len);
ptr = pay_st->spbillCreateIp;
zx_common_print2port("spbillCreateIp");
zx_common_print2port(ptr);
zx_code_urlstr_keyval_set("spbillCreateIp", ptr, signbuf, &len);
ptr = pay_st->transAmount;
zx_common_print2port("transAmount");
zx_common_print2port(ptr);
zx_code_urlstr_keyval_set("transAmount", ptr, signbuf, &len);
strcpy((char *)out, (char *)signbuf);
ptr = shop_st.posKey;
zx_common_print2port("posKey");
zx_common_print2port(ptr);
zx_code_urlstr_keyval_set("key", ptr, signbuf, &len);
signbuf[len - 1] = 0;
}
{
zx_common_print2port("signbuf");
zx_common_print2port(signbuf);
BCC_MD5_gen(signbuf, md5buf);
zx_code_upper_str(md5buf, strlen(md5buf));
zx_code_urlstr_keyval_set("sign", md5buf, out, &len);
out[--len] = 0;
}
......@@ -175,55 +142,36 @@ int zx_trans_recv_pay(const uchar *in, PAY_ST *pay_st)
{
ptr = pay_st->rspCode;
ret |= zx_code_urlstr_keyval_get(in, "&", "responseCode", ptr);
zx_common_print2port("rspCode");
zx_common_print2port(ptr);
}
{
ptr = pay_st->orderId;
ret |= zx_code_urlstr_keyval_get(in, "&", "orderId", ptr);
zx_common_print2port("orderId");
zx_common_print2port(ptr);
ptr = pay_st->isMember;
ret |= zx_code_urlstr_keyval_get(in, "&", "isMember", ptr);
zx_common_print2port("isMember");
zx_common_print2port(ptr);
ptr = pay_st->transTime;
ret |= zx_code_urlstr_keyval_get(in, "&", "transTime", ptr);
zx_common_print2port("transTime");
zx_common_print2port(ptr);
ptr = pay_st->receivedPoint;
ret |= zx_code_urlstr_keyval_get(in, "&", "receivedPoint", ptr);
zx_common_print2port("receivedPoint");
zx_common_print2port(ptr);
ptr = pay_st->userId;
ret |= zx_code_urlstr_keyval_get(in, "&", "userId", ptr);
zx_common_print2port("userId");
zx_common_print2port(ptr);
ptr = userName;
ret |= zx_code_urlstr_keyval_get(in, "&", "userName", ptr);
zx_common_print2port("userName");
zx_common_print2port(ptr);
HttpEscapeEncode(userName, sizeof(userName), pay_st->userName, sizeof(pay_st->userName));
ptr = pay_st->thirdPartyUseId;
ret |= zx_code_urlstr_keyval_get(in, "&", "thirdPartyUsed", ptr);
zx_common_print2port("thirdPartyUseId");
zx_common_print2port(ptr);
ptr = pay_st->status;
ret |= zx_code_urlstr_keyval_get(in, "&", "status", ptr);
zx_common_print2port("status");
zx_common_print2port(ptr);
ptr = pay_st->getPointsUrl;
ret |= zx_code_urlstr_keyval_get(in, "&", "getPointsUrl", ptr);
zx_common_print2port("getPointsUrl");
zx_common_print2port(ptr);
}
return ret;
}
......@@ -240,31 +188,23 @@ int zx_trans_points_qrcode()
ScrCls();
memset(&tBitmap, 0, sizeof(BITMAP_T));
zx_common_print2port("=================== POINTS_QRCODE ====================");
ret = CLcdGetInfo(&stLcdInfo);
sprintf(log, "LcdInfo: %d, %d", stLcdInfo.width, stLcdInfo.height);
zx_common_print2port(log);
tBitmap.data = malloc(stLcdInfo.width * stLcdInfo.height * sizeof(int));
if (tBitmap.data == NULL ) {
zx_common_print2port("MEM FAIL");
if (tBitmap.data == NULL) {
}
tBitmap.size = stLcdInfo.width * stLcdInfo.height * sizeof(int);
zx_common_print2port(pay_st.getPointsUrl);
ret = GetQRCode(pay_st.getPointsUrl, strlen(pay_st.getPointsUrl), 4, 0, &tBitmap);
sprintf(log, "GetQRCode: %d", ret);
zx_common_print2port(log);
ret = DrawBarcode(x_res, y_res, &tBitmap);
sprintf(log, "DrawBarcode: %d", ret);
zx_common_print2port(log);
sprintf(log, "bitmap: %d, %d", tBitmap.width, tBitmap.height);
zx_common_print2port(log);
free(tBitmap.data);
......@@ -291,6 +231,11 @@ int zx_trans_biz(int trans_no)
ScrCls();
zx_common_disp_str(" 交易处理中 ", 0, LEFT, 0, 1);
ret = zx_wifi_check();
if (ret < 0) {
return ret;
}
if (!shop_st.posKey[0] && trans_no != TRANS_POSKEY) {
zx_common_disp_str("无KEY", 4, LEFT, 0, 0);
getkey();
......@@ -302,7 +247,6 @@ int zx_trans_biz(int trans_no)
getkey();
return -1;
}
zx_common_print2port(hosturl);
// send buffer
switch (trans_no) {
......@@ -322,12 +266,8 @@ int zx_trans_biz(int trans_no)
default:
return -1;
}
zx_common_print2port("tempbuf:");
zx_common_print2port(tempbuf);
// HttpEscapeEncode(tempbuf, templen, sendbuf, sendlen);
BCC_url_encode(tempbuf, templen, sendbuf, sendlen);
zx_common_print2port("sendbuf:");
zx_common_print2port(sendbuf);
s = HttpCreate();
if (s < 0) {
......@@ -355,9 +295,6 @@ int zx_trans_biz(int trans_no)
goto end;
}
zx_common_print2port("recvbuf: ");
zx_common_print2port(recvbuf);
// parse recv buffer
switch (trans_no) {
case TRANS_POSKEY:
......
......@@ -126,6 +126,19 @@ void zx_wifi_set_param(ST_WIFI_PARAM *wifi_para, ST_WIFI_AP *apNow)
return;
}
int zx_wifi_check()
{
int ret = 0;
ST_WIFI_AP checkAp;
memset(&checkAp, 0, sizeof(ST_WIFI_AP));
ret = WifiCheck(&checkAp);
if (ret < 0) {
zx_err_wifi(ret);
}
return ret;
}
int zx_wifi_connect()
{
int ret = 0;
......@@ -253,6 +266,7 @@ void zx_wifi_disconnect()
}
}
// NOT WORK as expected
int zx_wifi_init()
{
int ret = 0;
......@@ -276,6 +290,7 @@ int zx_wifi_init()
if (ret < 0) {
goto end;
}
ret = WifiCheck(&apNow);
if (ret < 0) {
goto end;
......
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