|
|
@@ -11,6 +11,7 @@ import org.apache.http.HttpResponse;
|
|
|
import org.apache.http.client.methods.HttpPost;
|
|
|
//import org.apache.http.impl.client.DefaultHttpClient;
|
|
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
|
import java.security.Signature;
|
|
|
import java.security.KeyFactory;
|
|
|
@@ -35,16 +36,20 @@ import java.util.*;
|
|
|
*/
|
|
|
public class KsherPaySdk {
|
|
|
|
|
|
- private String appid;
|
|
|
- private String privateKey;
|
|
|
- private String PayDomain = "https://api.mch.ksher.net/KsherPay";
|
|
|
- private String GateDomain = "https://gateway.ksher.com/api";
|
|
|
+ private String appid;
|
|
|
+ private String privateKey;
|
|
|
+ private String PayDomain = "https://api.mch.ksher.net/KsherPay";
|
|
|
+ private String GateDomain = "https://gateway.ksher.com/api";
|
|
|
//定义加密方式
|
|
|
- private final String KEY_RSA = "RSA";
|
|
|
+ private final String KEY_RSA = "RSA";
|
|
|
//定义签名算法
|
|
|
- private final String KEY_RSA_SIGNATURE = "MD5withRSA";
|
|
|
- private final java.text.SimpleDateFormat timeStampFormat = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
- private final String publicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAL7955OCuN4I8eYNL/mixZWIXIgCvIVEivlxqdpiHPcOLdQ2RPSx/pORpsUu/E9wz0mYS2PY7hNc2mBgBOQT+wUCAwEAAQ==";
|
|
|
+ private final String KEY_RSA_SIGNATURE = "MD5withRSA";
|
|
|
+ private final java.text.SimpleDateFormat timeStampFormat = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
+ private final String publicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAL7955OCuN4I8eYNL/mixZWIXIgCvIVEivlxqdpiHPcOLdQ2RPSx/pORpsUu/E9wz0mYS2PY7hNc2mBgBOQT+wUCAwEAAQ==";
|
|
|
+
|
|
|
+ //回调
|
|
|
+ @Value("${general.notify-url}")
|
|
|
+ private String notifyUrl;
|
|
|
|
|
|
public KsherPaySdk(String appid, String privateKey) {
|
|
|
this.appid = appid;
|
|
|
@@ -53,6 +58,7 @@ public class KsherPaySdk {
|
|
|
|
|
|
/**
|
|
|
* sign byte to hex
|
|
|
+ *
|
|
|
* @param bytes
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -66,6 +72,7 @@ public class KsherPaySdk {
|
|
|
|
|
|
/**
|
|
|
* hex string to byte
|
|
|
+ *
|
|
|
* @param sign
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -79,11 +86,11 @@ public class KsherPaySdk {
|
|
|
|
|
|
/**
|
|
|
* 请求参数排序
|
|
|
+ *
|
|
|
* @param params
|
|
|
* @return
|
|
|
*/
|
|
|
- public byte[] getParamsSort(Map params)
|
|
|
- {
|
|
|
+ public byte[] getParamsSort(Map params) {
|
|
|
TreeMap<String, String> sortParas = new TreeMap<String, String>();
|
|
|
sortParas.putAll(params);
|
|
|
Iterator<String> it = sortParas.keySet().iterator();
|
|
|
@@ -97,6 +104,7 @@ public class KsherPaySdk {
|
|
|
|
|
|
/**
|
|
|
* 签名
|
|
|
+ *
|
|
|
* @param params
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -119,8 +127,10 @@ public class KsherPaySdk {
|
|
|
//String sing_str = new String(Base64.encodeBase64(signature.sign()));
|
|
|
return bytesToHex(sign_byte);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 校验数字签名
|
|
|
+ *
|
|
|
* @param data
|
|
|
* @param sign
|
|
|
* @return 校验成功返回true,失败返回false
|
|
|
@@ -161,7 +171,7 @@ public class KsherPaySdk {
|
|
|
params.put("time_stamp", timeStampFormat.format(new Date()));
|
|
|
|
|
|
//回调
|
|
|
- params.put("notify_url","");
|
|
|
+ params.put("notify_url", notifyUrl);
|
|
|
|
|
|
List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
|
|
|
for (Iterator iter = params.keySet().iterator(); iter.hasNext(); ) {
|
|
|
@@ -184,21 +194,22 @@ public class KsherPaySdk {
|
|
|
|
|
|
JSONObject json = JSONObject.parseObject(result.toString());
|
|
|
boolean isVerify = KsherVerify(json.getJSONObject("data"), json.getString("sign"));
|
|
|
- if(isVerify){
|
|
|
+ if (isVerify) {
|
|
|
return result.toString();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
throw new Exception("verify signature failed");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 商户扫用户(B扫C)
|
|
|
+ *
|
|
|
* @param mchOrderNo 商户订单号
|
|
|
- * @param feeType 支付币种 'THB'泰铢 'CNY'人民币
|
|
|
- * @param authCode 支付条码
|
|
|
- * @param channel 支付通道 wechat aplipay
|
|
|
+ * @param feeType 支付币种 'THB'泰铢 'CNY'人民币
|
|
|
+ * @param authCode 支付条码
|
|
|
+ * @param channel 支付通道 wechat aplipay
|
|
|
* @param operatorId 操作员编号 可选
|
|
|
- * @param totalFee 支付金额
|
|
|
+ * @param totalFee 支付金额
|
|
|
* @return
|
|
|
*/
|
|
|
public String QuickPay(String mchOrderNo, String feeType, String authCode, String channel, String operatorId, Integer totalFee) {
|
|
|
@@ -220,18 +231,19 @@ public class KsherPaySdk {
|
|
|
/**
|
|
|
* C扫B支付
|
|
|
* 必传参数
|
|
|
- * mch_order_no
|
|
|
- * total_fee
|
|
|
- * fee_type
|
|
|
- * channel
|
|
|
+ * mch_order_no
|
|
|
+ * total_fee
|
|
|
+ * fee_type
|
|
|
+ * channel
|
|
|
* 选传参数
|
|
|
- * redirect_url
|
|
|
- * notify_url
|
|
|
- * paypage_title
|
|
|
- * operator_id
|
|
|
+ * redirect_url
|
|
|
+ * notify_url
|
|
|
+ * paypage_title
|
|
|
+ * operator_id
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
- public String JsApiPay(String mchOrderNo,String feeType,String channel,Integer totalFee){
|
|
|
+ public String JsApiPay(String mchOrderNo, String feeType, String channel, Integer totalFee) {
|
|
|
try {
|
|
|
Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("mch_order_no", mchOrderNo);
|
|
|
@@ -244,26 +256,27 @@ public class KsherPaySdk {
|
|
|
return ex.getMessage();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- 动态码支付
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- mch_order_no
|
|
|
- total_fee
|
|
|
- fee_type
|
|
|
- channel
|
|
|
- 选传参数
|
|
|
- redirect_url
|
|
|
- notify_url
|
|
|
- paypage_title
|
|
|
- product
|
|
|
- attach
|
|
|
- operator_id
|
|
|
- device_id
|
|
|
- img_type
|
|
|
- :return:
|
|
|
- **/
|
|
|
- public String NativePay(String mchOrderNo, String feeType, String channel,Integer totalFee) throws Exception {
|
|
|
+ * 动态码支付
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * mch_order_no
|
|
|
+ * total_fee
|
|
|
+ * fee_type
|
|
|
+ * channel
|
|
|
+ * 选传参数
|
|
|
+ * redirect_url
|
|
|
+ * notify_url
|
|
|
+ * paypage_title
|
|
|
+ * product
|
|
|
+ * attach
|
|
|
+ * operator_id
|
|
|
+ * device_id
|
|
|
+ * img_type
|
|
|
+ * :return:
|
|
|
+ **/
|
|
|
+ public String NativePay(String mchOrderNo, String feeType, String channel, Integer totalFee) throws Exception {
|
|
|
Map<String, String> paras = new HashMap<>();
|
|
|
paras.put("mch_order_no", mchOrderNo);
|
|
|
paras.put("total_fee", totalFee.toString());
|
|
|
@@ -271,25 +284,27 @@ public class KsherPaySdk {
|
|
|
paras.put("channel", channel);
|
|
|
return KsherPost(PayDomain + "/native_pay", paras);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- 小程序支付
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- mch_order_no
|
|
|
- total_fee
|
|
|
- fee_type
|
|
|
- channel
|
|
|
- sub_openid
|
|
|
- channel_sub_appid
|
|
|
- 选传参数
|
|
|
- redirect_url
|
|
|
- notify_url
|
|
|
- paypage_title
|
|
|
- product
|
|
|
- operator_id
|
|
|
- :return:
|
|
|
- **/
|
|
|
- public String MiniproPay(String mchOrderNo, String feeType, String channel, String subOpenid, String channelSubAppId, Integer totalFee) throws Exception{
|
|
|
+ * 小程序支付
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * mch_order_no
|
|
|
+ * total_fee
|
|
|
+ * fee_type
|
|
|
+ * channel
|
|
|
+ * sub_openid
|
|
|
+ * channel_sub_appid
|
|
|
+ * 选传参数
|
|
|
+ * redirect_url
|
|
|
+ * notify_url
|
|
|
+ * paypage_title
|
|
|
+ * product
|
|
|
+ * operator_id
|
|
|
+ * :return:
|
|
|
+ **/
|
|
|
+ public String MiniproPay(String mchOrderNo, String feeType, String channel, String subOpenid, String channelSubAppId,
|
|
|
+ Integer totalFee, String attach) throws Exception {
|
|
|
Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("mch_order_no", mchOrderNo);
|
|
|
paras.put("total_fee", totalFee.toString());
|
|
|
@@ -297,29 +312,32 @@ public class KsherPaySdk {
|
|
|
paras.put("channel", channel);
|
|
|
paras.put("sub_openid", subOpenid);
|
|
|
paras.put("channel_sub_appid", channelSubAppId);
|
|
|
+ paras.put("attach", attach);
|
|
|
return KsherPost(PayDomain + "/mini_program_pay", paras);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- app支付
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- mch_order_no
|
|
|
- total_fee
|
|
|
- fee_type
|
|
|
- channel wechat/alipay
|
|
|
- sub_openid
|
|
|
- channel_sub_appid
|
|
|
- 选传参数
|
|
|
- redirect_url
|
|
|
- notify_url
|
|
|
- paypage_title
|
|
|
- product
|
|
|
- attach
|
|
|
- operator_id
|
|
|
- refer_url 仅当channel为alipay时需要
|
|
|
- :return:
|
|
|
- **/
|
|
|
- public String AppPay(String mchOrderNo,String feeType,String channel,String subOpenid,String channelSubAppId, Integer totalFee) throws Exception {
|
|
|
+ * app支付
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * mch_order_no
|
|
|
+ * total_fee
|
|
|
+ * fee_type
|
|
|
+ * channel wechat/alipay
|
|
|
+ * sub_openid
|
|
|
+ * channel_sub_appid
|
|
|
+ * 选传参数
|
|
|
+ * redirect_url
|
|
|
+ * notify_url
|
|
|
+ * paypage_title
|
|
|
+ * product
|
|
|
+ * attach
|
|
|
+ * operator_id
|
|
|
+ * refer_url 仅当channel为alipay时需要
|
|
|
+ * :return:
|
|
|
+ **/
|
|
|
+ public String AppPay(String mchOrderNo, String feeType, String channel, String subOpenid, String channelSubAppId,
|
|
|
+ Integer totalFee, String attach) throws Exception {
|
|
|
Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("mch_order_no", mchOrderNo);
|
|
|
paras.put("total_fee", totalFee.toString());
|
|
|
@@ -327,28 +345,30 @@ public class KsherPaySdk {
|
|
|
paras.put("channel", channel);
|
|
|
paras.put("sub_openid", subOpenid);
|
|
|
paras.put("channel_sub_appid", channelSubAppId);
|
|
|
+ paras.put("attach", attach);
|
|
|
return KsherPost(PayDomain + "/app_pay", paras);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- H5支付,仅支持channel=alipay
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- mch_order_no
|
|
|
- total_fee
|
|
|
- fee_type
|
|
|
- channel
|
|
|
- 选传参数
|
|
|
- redirect_url
|
|
|
- notify_url
|
|
|
- paypage_title
|
|
|
- product
|
|
|
- attach
|
|
|
- operator_id
|
|
|
- device_id
|
|
|
- refer_url
|
|
|
- :return:
|
|
|
- **/
|
|
|
- public String WapPay(String mchOrderNo,String feeType,String channel, Integer totalFee) throws Exception {
|
|
|
+ * H5支付,仅支持channel=alipay
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * mch_order_no
|
|
|
+ * total_fee
|
|
|
+ * fee_type
|
|
|
+ * channel
|
|
|
+ * 选传参数
|
|
|
+ * redirect_url
|
|
|
+ * notify_url
|
|
|
+ * paypage_title
|
|
|
+ * product
|
|
|
+ * attach
|
|
|
+ * operator_id
|
|
|
+ * device_id
|
|
|
+ * refer_url
|
|
|
+ * :return:
|
|
|
+ **/
|
|
|
+ public String WapPay(String mchOrderNo, String feeType, String channel, Integer totalFee) throws Exception {
|
|
|
Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("mch_order_no", mchOrderNo);
|
|
|
paras.put("total_fee", totalFee.toString());
|
|
|
@@ -356,26 +376,27 @@ public class KsherPaySdk {
|
|
|
paras.put("channel", channel);
|
|
|
return KsherPost(PayDomain + "/wap_pay", paras);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- PC网站支付,仅支持channel=alipay
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- mch_order_no
|
|
|
- total_fee
|
|
|
- fee_type
|
|
|
- channel
|
|
|
- 选传参数
|
|
|
- redirect_url
|
|
|
- notify_url
|
|
|
- paypage_title
|
|
|
- product
|
|
|
- attach
|
|
|
- operator_id
|
|
|
- device_id
|
|
|
- refer_url
|
|
|
- :return:
|
|
|
- **/
|
|
|
- public String WepPay(String mchOrderNo,String feeType,String channel,Integer totalFee)throws Exception{
|
|
|
+ * PC网站支付,仅支持channel=alipay
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * mch_order_no
|
|
|
+ * total_fee
|
|
|
+ * fee_type
|
|
|
+ * channel
|
|
|
+ * 选传参数
|
|
|
+ * redirect_url
|
|
|
+ * notify_url
|
|
|
+ * paypage_title
|
|
|
+ * product
|
|
|
+ * attach
|
|
|
+ * operator_id
|
|
|
+ * device_id
|
|
|
+ * refer_url
|
|
|
+ * :return:
|
|
|
+ **/
|
|
|
+ public String WepPay(String mchOrderNo, String feeType, String channel, Integer totalFee) throws Exception {
|
|
|
Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("mch_order_no", mchOrderNo);
|
|
|
paras.put("total_fee", totalFee.toString());
|
|
|
@@ -383,60 +404,65 @@ public class KsherPaySdk {
|
|
|
paras.put("channel", channel);
|
|
|
return KsherPost(PayDomain + "/wap_pay", paras);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- 订单查询
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- mch_order_no、ksher_order_no、channel_order_no三选一
|
|
|
- :return:
|
|
|
- **/
|
|
|
- public String OrderQuery(String mchOrderNo) throws Exception{
|
|
|
+ * 订单查询
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * mch_order_no、ksher_order_no、channel_order_no三选一
|
|
|
+ * :return:
|
|
|
+ **/
|
|
|
+ public String OrderQuery(String mchOrderNo) throws Exception {
|
|
|
Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("mch_order_no", mchOrderNo);
|
|
|
return KsherPost(PayDomain + "/order_query", paras);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- 订单关闭
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- mch_order_no、ksher_order_no、channel_order_no三选一
|
|
|
- 选传参数
|
|
|
- operator_id
|
|
|
- :return:
|
|
|
- **/
|
|
|
+ * 订单关闭
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * mch_order_no、ksher_order_no、channel_order_no三选一
|
|
|
+ * 选传参数
|
|
|
+ * operator_id
|
|
|
+ * :return:
|
|
|
+ **/
|
|
|
public String OrderClose(String mchOrderNo) throws Exception {
|
|
|
Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("mch_order_no", mchOrderNo);
|
|
|
return KsherPost(PayDomain + "/order_close", paras);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- 订单撤销
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- mch_order_no、ksher_order_no、channel_order_no三选一
|
|
|
- 选传参数
|
|
|
- operator_id
|
|
|
- :return:
|
|
|
- **/
|
|
|
- public String OrderReverse(String mchOrderNo) throws Exception{
|
|
|
+ * 订单撤销
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * mch_order_no、ksher_order_no、channel_order_no三选一
|
|
|
+ * 选传参数
|
|
|
+ * operator_id
|
|
|
+ * :return:
|
|
|
+ **/
|
|
|
+ public String OrderReverse(String mchOrderNo) throws Exception {
|
|
|
Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("mch_order_no", mchOrderNo);
|
|
|
return KsherPost(PayDomain + "/order_reverse", paras);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- 订单退款
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- total_fee
|
|
|
- fee_type
|
|
|
- refund_fee
|
|
|
- mch_refund_no
|
|
|
- mch_order_no、ksher_order_no、channel_order_no三选一
|
|
|
- 选传参数
|
|
|
- operator_id
|
|
|
- :return:
|
|
|
- **/
|
|
|
- public String OrderRefund(String mchRefundNo,String feeType,String mchOrderNo,Integer refundFee,Integer totalFee) throws Exception {
|
|
|
+ * 订单退款
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * total_fee
|
|
|
+ * fee_type
|
|
|
+ * refund_fee
|
|
|
+ * mch_refund_no
|
|
|
+ * mch_order_no、ksher_order_no、channel_order_no三选一
|
|
|
+ * 选传参数
|
|
|
+ * operator_id
|
|
|
+ * :return:
|
|
|
+ **/
|
|
|
+ public String OrderRefund(String mchRefundNo, String feeType, String mchOrderNo, Integer refundFee,
|
|
|
+ Integer totalFee) throws Exception {
|
|
|
Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("mch_refund_no", mchRefundNo);
|
|
|
paras.put("fee_type", feeType);
|
|
|
@@ -445,29 +471,31 @@ public class KsherPaySdk {
|
|
|
paras.put("total_fee", totalFee.toString());
|
|
|
return KsherPost(PayDomain + "/order_refund", paras);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- 退款查询
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- mch_refund_no、ksher_refund_no、channel_refund_no三选一
|
|
|
- mch_order_no、ksher_order_no、channel_order_no三选一
|
|
|
- **/
|
|
|
- public String RefundQuery(String mchRefundNo, String mchOrderNo) throws Exception{
|
|
|
+ * 退款查询
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * mch_refund_no、ksher_refund_no、channel_refund_no三选一
|
|
|
+ * mch_order_no、ksher_order_no、channel_order_no三选一
|
|
|
+ **/
|
|
|
+ public String RefundQuery(String mchRefundNo, String mchOrderNo) throws Exception {
|
|
|
Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("mch_refund_no", mchRefundNo);
|
|
|
paras.put("mchOrderNo", mchOrderNo);
|
|
|
return KsherPost(PayDomain + "/refund_query", paras);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- 汇率查询
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- channel
|
|
|
- fee_type
|
|
|
- date
|
|
|
- :return:
|
|
|
- **/
|
|
|
- public String RateQuery(String channel, String feeType,String date) throws Exception{
|
|
|
+ * 汇率查询
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * channel
|
|
|
+ * fee_type
|
|
|
+ * date
|
|
|
+ * :return:
|
|
|
+ **/
|
|
|
+ public String RateQuery(String channel, String feeType, String date) throws Exception {
|
|
|
Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("channel", channel);
|
|
|
paras.put("fee_type", feeType);
|
|
|
@@ -476,50 +504,50 @@ public class KsherPaySdk {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- 聚合支付商户查询订单支付状态
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- mch_order_no
|
|
|
- :return:
|
|
|
- **/
|
|
|
- public String GatewayOrderQuery(String mch_order_no) throws Exception{
|
|
|
+ * 聚合支付商户查询订单支付状态
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * mch_order_no
|
|
|
+ * :return:
|
|
|
+ **/
|
|
|
+ public String GatewayOrderQuery(String mch_order_no) throws Exception {
|
|
|
Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("mch_order_no", mch_order_no);
|
|
|
return KsherPost(GateDomain + "gateway_order_query", paras);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- 聚合支付商户通过API提交数据
|
|
|
- :param kwargs:
|
|
|
- 必传参数
|
|
|
- mch_order_no: 商户订单号 str
|
|
|
- total_fee: 金额(分) int
|
|
|
- fee_type: 货币种类 str
|
|
|
- channel_list: 支付通道 str
|
|
|
- mch_code: 商户订单code str
|
|
|
- mch_redirect_url: 商户通知url str
|
|
|
- mch_redirect_url_fail: 失败回调网址 str
|
|
|
- product_name: 商品描述 str
|
|
|
- refer_url: 商家refer str
|
|
|
- device: 设备名称(PC or H5) str
|
|
|
- 选传参数
|
|
|
- color: 横幅颜色 str
|
|
|
- background: 横幅背景图片 str
|
|
|
- payment_color: 支付按钮颜色 str
|
|
|
- ksher_explain: 最下方文案 str
|
|
|
- hide_explain: 是否显示最下方文案(1显示 0不显示) int
|
|
|
- expire_time: 订单过期时间(min) int
|
|
|
- hide_exp_time: 是否显示过期时间(1显示 0不显示) int
|
|
|
- logo: 横幅logo str
|
|
|
- lang: 语言(en,cn,th) str
|
|
|
- shop_name: logo旁文案 str
|
|
|
- attach: 商户附加信息 str
|
|
|
- :return:
|
|
|
- {'pay_content': 'https://gateway.ksher.com/mindex?order_uuid=订单uuid'}
|
|
|
- **/
|
|
|
- public String GatewayPay(String mch_order_no, String fee_type, String channel_list, String mch_code, String mch_redirect_url,
|
|
|
- String mch_redirect_url_fail, String product_name, String refer_url, String device, Integer total_fee) throws Exception{
|
|
|
- Map<String, String> paras = new HashMap<String, String>();
|
|
|
+ * 聚合支付商户通过API提交数据
|
|
|
+ * :param kwargs:
|
|
|
+ * 必传参数
|
|
|
+ * mch_order_no: 商户订单号 str
|
|
|
+ * total_fee: 金额(分) int
|
|
|
+ * fee_type: 货币种类 str
|
|
|
+ * channel_list: 支付通道 str
|
|
|
+ * mch_code: 商户订单code str
|
|
|
+ * mch_redirect_url: 商户通知url str
|
|
|
+ * mch_redirect_url_fail: 失败回调网址 str
|
|
|
+ * product_name: 商品描述 str
|
|
|
+ * refer_url: 商家refer str
|
|
|
+ * device: 设备名称(PC or H5) str
|
|
|
+ * 选传参数
|
|
|
+ * color: 横幅颜色 str
|
|
|
+ * background: 横幅背景图片 str
|
|
|
+ * payment_color: 支付按钮颜色 str
|
|
|
+ * ksher_explain: 最下方文案 str
|
|
|
+ * hide_explain: 是否显示最下方文案(1显示 0不显示) int
|
|
|
+ * expire_time: 订单过期时间(min) int
|
|
|
+ * hide_exp_time: 是否显示过期时间(1显示 0不显示) int
|
|
|
+ * logo: 横幅logo str
|
|
|
+ * lang: 语言(en,cn,th) str
|
|
|
+ * shop_name: logo旁文案 str
|
|
|
+ * attach: 商户附加信息 str
|
|
|
+ * :return:
|
|
|
+ * {'pay_content': 'https://gateway.ksher.com/mindex?order_uuid=订单uuid'}
|
|
|
+ **/
|
|
|
+ public String GatewayPay(String mch_order_no, String fee_type, String channel_list, String mch_code, String mch_redirect_url,
|
|
|
+ String mch_redirect_url_fail, String product_name, String refer_url, String device, Integer total_fee, String attach) throws Exception {
|
|
|
+ Map<String, String> paras = new HashMap<String, String>();
|
|
|
paras.put("mch_order_no", mch_order_no);
|
|
|
paras.put("fee_type", fee_type);
|
|
|
paras.put("channel_list", channel_list);
|
|
|
@@ -530,6 +558,7 @@ public class KsherPaySdk {
|
|
|
paras.put("refer_url", refer_url);
|
|
|
paras.put("device", device);
|
|
|
paras.put("total_fee", total_fee.toString());
|
|
|
+ paras.put("attach", attach);
|
|
|
return KsherPost(GateDomain + "gateway_pay", paras);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|