Commit 346c02a0 authored by 周尚's avatar 周尚

init

parents
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/libjsonpay.iml" filepath="$PROJECT_DIR$/libjsonpay.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK
include_directories(src/main/include)
add_library( # Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/jni/native-lib.cpp
src/main/jni/bcccode.c
src/main/jni/bccmd5.c
src/main/jni/cJSON.c
src/main/jni/do_log.c
src/main/jni/do_trans.c
src/main/jni/do_trans_pax.c
src/main/jni/http.c
)
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
native-lib
# Links the target library to the log library
# included in the NDK.
${log-lib} )
\ No newline at end of file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
defaultConfig {
ndk {
moduleName "jsonpay"
}
applicationId "com.xingdata.zxpay"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-frtti -fexceptions"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package com.xingdata.zxpay;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.xingdata.zxpay", appContext.getPackageName());
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xingdata.zxpay">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme" />
</manifest>
insprint:
| 字段名称 | 字段Key | 格式 | 必填 | 备注 |
|------------------+-------------------+--------------+------+----------------------------------------------------------- |
| 商户交易类型 | OrderType | String(1,40) | Y | 01 普通消费 02 查询交易 03 撤销交易 04 退货交易 05 异步通知 |
| 用户所选渠道类型 | PayChannelType | String(2) | Y | "1 现金 2 微信 3 支付宝 4 银行卡 5 银联二维码 8 会员卡 |
| 设备类型 | DeviceType | String(4) | Y | "01 刷卡支付 :通过扫描枪扫用户的二维码或者一维码 |
| | | | | 02 扫码支付 :用户扫描商户展示在各种场景的二维码进行支付 |
| | | | | 03 公众号支付:用户扫描商户展示在各种场景的二维码进行支付 |
| 商户号 | Mch_id | String(15) | Y | 终端上送 |
| 终端号 | Ter_id | String(8) | Y | 终端上送 |
| 商户订单交易时间 | OrderDateTime | String(14) | Y | yyyyMMddHHmmss |
| 商户订单币种类型 | CurrencyType | String(3) | Y | 156 人民币 |
| 商户订单交易金额 | OrderAmt | Number(22) | Y | 单位(人民币):分 整数,无小数点 |
| 商户商品名称 | OrderName | String(1,40) | Y | 终端上送 |
| 商户订单号 | OrderNo | String(1,40) | Y | 终端上送 |
| 原交易商户订单号 | OldOrderNo | String(1,40) | N | 终端上送 |
| 支付授权码 | ChannelAuthCode | String(1,64) | N | 非二维码支付没有的话填NULL |
eg:
{"OrderType":"01","PayChannelType":"12","DeviceType":"02","Mch_id":"100000000000001","Ter_id":"10000001","OrderDateTime":"20170612101520","CurrencyType":"156","OrderAmt":"000000000012","OrderName":"商品名称/商户名称+门店消费","OrderNo":"00000000000000000001","OldOrderNo":"00000000000000000001","ChannelAuthCode":"扫码得到的授权码/NULL"}
outsprint:
| 字段名称 | 字段Key | 格式 | 必填 | 备注 |
|-------------------+--------------+---------------+------+------------------------------------------|
| 响应码 | ResponseCode | String(4) | Y | 成功 0000 |
| 响应信息 | ResponseMsg | String(1,100) | Y | 交易成功 |
| 交易状态 | TradeStatus | String(6) | Y | 正常 000000 |
| 商户号 | Mch_id | String(15) | Y | 商户号 |
| 终端号 | Ter_id | String(8) | Y | 终端号 |
| 商户订单号 | OrderNo | String(1,40) | Y | 没有就填空 |
| 原交易商户订单号 | OldOrderNo | String(1,40) | Y | 没有就填空 |
| 商户退款/撤销单号 | RefundNo | String(1,40) | Y | 没有就填空 |
| 商户退款/撤销金额 | amount | Number(12) | Y | "单位(人民币):分 |
| | | | | 整数,无小数点" |
| 支付调起凭证 | tn | String(1,1000)| Y | 二维码 url 地址;没有则会返回空 |
eg:
{"ResponseCode":"0000","ResponseMsg":"交易成功","TradeStatus":"000000","Mch_id":"100000000000001","Ter_id":"10000001","OrderNo":"00000000000000000001","OldOrderNo":"00000000000000000001","RefundNo":"00000000000000000001","amount":"000000000012","tn":""}
ResponseCode意义:
"ResponseCode":"0000","ResponseMsg":"交易成功"
"ResponseCode":"0003","ResponseMsg":"无效商户"
"ResponseCode":"0005","ResponseMsg":"身份认证失败"
"ResponseCode":"0013","ResponseMsg":"无效金额"
"ResponseCode":"0014","ResponseMsg":"无效卡号"
"ResponseCode":"0025","ResponseMsg":"找不到原始交易"
"ResponseCode":"0030","ResponseMsg":"报文格式错误"
"ResponseCode":"0038","ResponseMsg":"密码错误超限"
"ResponseCode":"0040","ResponseMsg":"请求的功能尚不支持"
"ResponseCode":"0051","ResponseMsg":"金额不足"
"ResponseCode":"0055","ResponseMsg":"密码错误"
"ResponseCode":"0057","ResponseMsg":"不允许该卡进行此交易"
"ResponseCode":"0058","ResponseMsg":"不允许该终端进行此交易"
"ResponseCode":"0061","ResponseMsg":"超出金额限制"
"ResponseCode":"0064","ResponseMsg":"原始金额错误"
"ResponseCode":"0090","ResponseMsg":"系统正在进行日终处理"
"ResponseCode":"0092","ResponseMsg":"发卡方线路异常请稍后重试"
"ResponseCode":"0094","ResponseMsg":"重复交易"
"ResponseCode":"0096","ResponseMsg":"交易失败"
"ResponseCode":"0097","ResponseMsg":"终端未登记"
"ResponseCode":"0098","ResponseMsg":"交易正在处理中"
insprint:
| 字段名称 | 字段Key | 格式 | 必填 | 备注 |
|------------------+-------------------+--------------+------+----------------------------------------------------------- |
| 商户号 | Mch_id | String(15) | Y | 终端上送 |
| 商户全称 | Shop_Name | String(90) | Y | 终端上送 |
| 商户简称 | Shop_NameB | String(60) | Y | 终端上送 |
| 终端号 | Ter_id | String(8) | Y | 终端上送 |
| 终端SN号 | Ter_Sn | String(20) | Y | 终端上送 |
| 标记 | flag | String(1) | Y | 1:新建商户; |
| | | | | 2:在现有商户上增加终端; |
| | | | | 3:修改商户和终端; |
| | | | | 4:注销商户; |
| | | | | 5:注销终端 |
eg:
{"Mch_id":"100000000000001","Shop_Name":"浙星信息技术有限公司","Shop_NameB":"浙星","Ter_id":"10000001","Ter_Sn":"ZX000000000000000001","flag":"1"}
outsprint:
| 字段名称 | 字段Key | 格式 | 必填 | 备注 |
|-------------------+--------------+---------------+------+------------------------------------------|
| 响应码 | ResponseCode | String(4) | Y | 成功 0000 |
| 响应信息 | ResponseMsg | String(1,100) | Y | 交易成功 |
| 交易状态 | TradeStatus | String(6) | Y | 正常 000000 |
| 商户号 | Mch_id | String(15) | Y | 商户号 |
| 终端号 | Ter_id | String(8) | Y | 终端号 |
| 终端SN号 | Ter_Sn | String(20) | Y | 终端SN号 |
eg:
{"ResponseCode":"0000","ResponseMsg":"交易成功","TradeStatus":"000000","Mch_id":"100000000000001","Ter_id":"10000001","Ter_Sn":"00000000000000000001"}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
#ifndef _TWY_INI_H_
#define _TWY_INI_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define COMMENT '#'
#define INI_ERROR -1
struct record {
char comments[255];
char key[255];
char value[255];
struct record *next;
};
struct section {
struct record * data_first;
struct record * data_last;
unsigned int data_size;
char comments[255];
char name[255];
struct section *next;
};
typedef struct
{
unsigned int section_size;
struct section *first;
struct section *last;
} content;
typedef enum {
REPLACE = 1,
NON_REPLACE = 0
} REPLACE_FLAG;
class TwyINI
{
public:
TwyINI(void);
~TwyINI(void);
private:
content *ini_content;
char szIniFileName[255];
char error_msg[256];
int w_flag;
private:
bool load(const char *filename);
void init_content();
void clear();
void add_section(const char *sec, const char *comment);
void _append(const char *sec, const char *key, const char *value, const char *comment);
int content_size();
int section_size(char *sec);
struct section *get_section(const char *sec);
struct record * get_record(struct section *sec, const char *key);
void trim(char *buffer);
void _print_allrecord(struct record *sec);
public:
bool Open(const char *filename);
char *get_value(const char *sec, const char *key);
void Close();
void print_content();
void print_allrecord(char *sec);
char *get_last_error();
};
#endif
#ifndef _TWY_TRACE_H_
#define _TWY_TRACE_H_
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
// 显示十六进制数据时 每一行打印16个字节的数据
#define TRACE_HEX_COLS 16
class TwyTRACE
{
public:
TwyTRACE();
~TwyTRACE();
public:
void SetTraceLevel(int iLevel);
void SetFileName(char *szFileName);
bool WriteTxtTrace(int iLevel, const char *msg, ...);
bool WriteHexTrace(int iLevel, unsigned char *msg, int iLength);
private:
char *GetCurrentDate();
char *GetCurrentTime();
bool Lock();
bool UnLock();
private:
char szFileName[255];
int iMaxLevel;
char szTimeString[32];
char szDateString[32];
};
#endif
#ifndef BCCCODE_H
#define BCCCODE_H
#include "cJSON.h"
#include "common.h"
int BCC_str_set_val_raw(const char *key, const char *val, char *out, int *len);
int BCC_str_set_val_url(const char *key, const char *val, char *out, int *len);
int BCC_json_set_val(const char *key, const char *val, char *out, int *len);
int BCC_json_get_val(const cJSON *pJson, const char *key, char *out, size_t len);
int BCC_url_decode(const char *str, const int strSize, char *result, int resultSize);
int BCC_url_encode(const char *str, const int strSize, char *result, const int resultSize);
int BCC_code_upper_str(char *str, int len);
#endif /* BCCCODE_H */
/* This file was automatically generated. Do not edit! */
#ifndef BCCMD5_H
#define BCCMD5_H
#include "common.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void BCC_MD5_gen(unsigned char *in, unsigned char *out);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif /* BCCMD5_H */
This diff is collapsed.
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_xingdata_zzdpos_zxpay */
#ifndef _Included_com_xingdata_zzdpos_zxpay
#define _Included_com_xingdata_zzdpos_zxpay
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_xingdata_zzdpos_zxpay
* Method: jsonpay
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_xingdata_zzdpos_zxpay_jsonpay(JNIEnv *, jclass, jstring);
#ifdef __cplusplus
}
#endif
#endif
#ifndef COMMON_H
#define COMMON_H
#include <ctype.h>
#include <errno.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdarg.h>
#include <time.h>
#endif /* COMMON_H */
This diff is collapsed.
#ifndef __CURL_CURLVER_H
#define __CURL_CURLVER_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/* This header file contains nothing but libcurl version info, generated by
a script at release-time. This was made its own header file in 7.11.2 */
/* This is the global package copyright */
#define LIBCURL_COPYRIGHT "1996 - 2017 Daniel Stenberg, <daniel@haxx.se>."
/* This is the version number of the libcurl package from which this header
file origins: */
#define LIBCURL_VERSION "7.57.0"
/* The numeric version number is also available "in parts" by using these
defines: */
#define LIBCURL_VERSION_MAJOR 7
#define LIBCURL_VERSION_MINOR 57
#define LIBCURL_VERSION_PATCH 0
/* This is the numeric version of the libcurl version number, meant for easier
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
always follow this syntax:
0xXXYYZZ
Where XX, YY and ZZ are the main version, release and patch numbers in
hexadecimal (using 8 bits each). All three numbers are always represented
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
appears as "0x090b07".
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
and it is always a greater number in a more recent release. It makes
comparisons with greater than and less than work.
Note: This define is the full hex number and _does not_ use the
CURL_VERSION_BITS() macro since curl's own configure script greps for it
and needs it to contain the full number.
*/
#define LIBCURL_VERSION_NUM 0x073900
/*
* This is the date and time when the full source package was created. The
* timestamp is not stored in git, as the timestamp is properly set in the
* tarballs by the maketgz script.
*
* The format of the date follows this template:
*
* "2007-11-23"
*/
#define LIBCURL_TIMESTAMP "2017-11-29"
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
#define CURL_AT_LEAST_VERSION(x,y,z) \
(LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
#endif /* __CURL_CURLVER_H */
#ifndef __CURL_EASY_H
#define __CURL_EASY_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
CURL_EXTERN CURL *curl_easy_init(void);
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
CURL_EXTERN void curl_easy_cleanup(CURL *curl);
/*
* NAME curl_easy_getinfo()
*
* DESCRIPTION
*
* Request internal information from the curl session with this function. The
* third argument MUST be a pointer to a long, a pointer to a char * or a
* pointer to a double (as the documentation describes elsewhere). The data
* pointed to will be filled in accordingly and can be relied upon only if the
* function returns CURLE_OK. This function is intended to get used *AFTER* a
* performed transfer, all results from this function are undefined until the
* transfer is completed.
*/
CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
/*
* NAME curl_easy_duphandle()
*
* DESCRIPTION
*
* Creates a new curl session handle with the same options set for the handle
* passed in. Duplicating a handle could only be a matter of cloning data and
* options, internal state info and things like persistent connections cannot
* be transferred. It is useful in multithreaded applications when you can run
* curl_easy_duphandle() for each new thread to avoid a series of identical
* curl_easy_setopt() invokes in every thread.
*/
CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl);
/*
* NAME curl_easy_reset()
*
* DESCRIPTION
*
* Re-initializes a CURL handle to the default values. This puts back the
* handle to the same state as it was in when it was just created.
*
* It does keep: live connections, the Session ID cache, the DNS cache and the
* cookies.
*/
CURL_EXTERN void curl_easy_reset(CURL *curl);
/*
* NAME curl_easy_recv()
*
* DESCRIPTION
*
* Receives data from the connected socket. Use after successful
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
*/
CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,
size_t *n);
/*
* NAME curl_easy_send()
*
* DESCRIPTION
*
* Sends data over the connected socket. Use after successful
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
*/
CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
size_t buflen, size_t *n);
#ifdef __cplusplus
}
#endif
#endif
#ifndef __CURL_MPRINTF_H
#define __CURL_MPRINTF_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include <stdarg.h>
#include <stdio.h> /* needed for FILE */
#include "curl.h" /* for CURL_EXTERN */
#ifdef __cplusplus
extern "C" {
#endif
CURL_EXTERN int curl_mprintf(const char *format, ...);
CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
const char *format, ...);
CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
const char *format, va_list args);
CURL_EXTERN char *curl_maprintf(const char *format, ...);
CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
#ifdef __cplusplus
}
#endif
#endif /* __CURL_MPRINTF_H */
This diff is collapsed.
#ifndef __STDC_HEADERS_H
#define __STDC_HEADERS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include <sys/types.h>
size_t fread(void *, size_t, size_t, FILE *);
size_t fwrite(const void *, size_t, size_t, FILE *);
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);
#endif /* __STDC_HEADERS_H */
This diff is collapsed.
This diff is collapsed.
#ifndef DO_CLIENT_H
#define DO_CLIENT_H
#include <netinet/in.h>
#include <sys/socket.h>
typedef struct _tuobao_tcpclient{
int socket;
int remote_port;
char remote_ip[16];
struct sockaddr_in _addr;
int connected;
} tuobao_tcpclient;
int tuobao_tcpclient_create(tuobao_tcpclient *,const char *host, int port);
int tuobao_tcpclient_conn(tuobao_tcpclient *);
int tuobao_tcpclient_recv(tuobao_tcpclient *,char **lpbuff,int size);
int tuobao_tcpclient_send(tuobao_tcpclient *,char *buff,int size);
int tuobao_tcpclient_close(tuobao_tcpclient *);
#endif
#ifndef DO_LOG_H
#define DO_LOG_H
#include "common.h"
#ifndef LINE_MAX
#define LINE_MAX 1024
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define DEBUGLOG "debug"
#define ERRORLOG "error"
void __debuglog(const char *fmt, ...);
void __errorlog(const char *fmt, ...);
#define debuglog(fmt, ...) \
__debuglog("[%s] %s:%d :", __TIME__, __FILE__, __LINE__); \
__debuglog(fmt, __VA_ARGS__);
#define errorlog(fmt, ...) \
__errorlog("[%s] %s:%d :", __TIME__, __FILE__, __LINE__); \
__errorlog(fmt, __VA_ARGS__);
#ifdef __cplusplus
}
#endif
#endif // DO_LOG_H
#ifndef DO_TRANS_H
#define DO_TRANS_H
#include "cJSON.h"
#include "common.h"
#ifdef __cplusplus
extern "C" {
#endif
// data structure (see JSON.txt)
typedef struct {
char OrderType[2 + 1];
char PayChannelType[2 + 1];
char DeviceType[2 + 1];
char Mch_id[15 + 1];
char Ter_id[8 + 1];
char OrderDateTime[14 + 1];
char CurrencyType[3 + 1];
char OrderAmt[12 + 1];
char OrderName[40 + 1];
char ChannelAuthCode[64 + 1];
char ResponseCode[16 + 1];
char ResponseMsg[128 + 1];
char TradeStatus[6 + 1];
char OldOrderNo[40 + 1];
char RefundNo[40 + 1];
char Amount[12 + 1];
char tn[999 + 1];
char appId[100 + 1];
char timeStamp[100 + 1];
char nonceStr[100 + 1];
char package[100 + 1];
char signType[100 + 1];
char paySign[255 + 1];
char key[32 + 1];
char Agent_id[64 + 1];
char method[16 + 1];
char notifyUrl[255 + 1];
char pos_trace[6 + 1];
char OrderNo[40 + 1];
char host_order_no[128 + 1];
char plat_order_no[128 + 1];
char js_info[255 + 1];
char trade_type[64 + 1];
char payTime[14 + 1];
} trans_json_t;
// functions
int do_biz(const trans_json_t *json_in, cJSON *pSend, char *out);
int do_trans_biz_pax(trans_json_t *json_in, trans_json_t *json_out);
int do_trans_biz_comm(cJSON *pSend, char *out);
int do_trans(const char *in, char *out, size_t *len);
#ifdef __cplusplus
}
#endif
#endif /* DO_TRANS_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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