1.支付
This commit is contained in:
parent
028376d221
commit
78177caf37
|
@ -58,16 +58,33 @@ public class Application {
|
|||
body.put("terminalType", "1");
|
||||
body.put("shopId", "488");
|
||||
// 填充必填字段
|
||||
body.put("sn", "deviceSN123456"); // 设备编号,需替换为真实设备号
|
||||
body.put("payType", "wx_pay"); // 支付方式,可以是 wx.pay, ali.pay, union.online
|
||||
body.put("outTradeId", "tradeId123"); // 商户订单号
|
||||
body.put("body", "商品描述"); // 商品描述
|
||||
body.put("notifyUrl", "https://yourdomain.com/notify"); // 异步回调URL
|
||||
body.put("frontUrl", "https://yourdomain.com/front"); // 前端页面跳转URL
|
||||
body.put("profitSharing", "N"); // 是否分账,示例填写 N
|
||||
doPost("/open/Pay/unifiedOrder", body);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序支付
|
||||
*/
|
||||
public static void miniPay() {
|
||||
HashMap<String, String> body = new HashMap<String, String>();
|
||||
body.put("payAmount", "1");
|
||||
body.put("terminalType", "1");
|
||||
body.put("shopId", "488");
|
||||
// 填充必填字段
|
||||
body.put("payType", "wx_pay"); // 支付方式,可以是 wx.pay, ali.pay, union.online
|
||||
body.put("outTradeId", "tradeId123"); // 商户订单号
|
||||
body.put("openid", "111"); // openid
|
||||
body.put("body", "商品描述"); // 商品描述
|
||||
body.put("notifyUrl", "https://yourdomain.com/notify"); // 异步回调URL
|
||||
body.put("frontUrl", "https://yourdomain.com/front"); // 前端页面跳转URL
|
||||
doPost("/open/Pay/miniPay", body);
|
||||
}
|
||||
|
||||
private static void doPost(String url, HashMap<String, String> body) {
|
||||
body.put("developerId", "100001");
|
||||
body.put("version", "1.0");
|
||||
|
|
|
@ -65,6 +65,26 @@ public class TmPayService {
|
|||
doPost(channel.getHttpUrl() + "/open/Pay/unifiedOrder", body, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序支付
|
||||
*/
|
||||
public void miniPay(IChannelInfo channel, Payable payable) {
|
||||
HashMap<String, String> body = new HashMap<>();
|
||||
body.put("payAmount", String.valueOf(payable.getAmount()));
|
||||
body.put("terminalType", "1");
|
||||
body.put("shopId", channel.getShopId()); // 从渠道获取shopId
|
||||
body.put("sn", channel.getSn());
|
||||
body.put("payType", "wx_pay");
|
||||
body.put("outTradeId", payable.getOutTradeNo());
|
||||
body.put("body", payable.getDescription());
|
||||
body.put("notifyUrl", channel.getNotifyUrl());
|
||||
body.put("frontUrl", channel.getFrontUrl());
|
||||
|
||||
doPost(channel.getHttpUrl() + "/open/Pay/miniPay", body, channel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void doPost(String url, HashMap<String, String> body, IChannelInfo channel) {
|
||||
body.put("developerId", channel.getDeveloperId());
|
||||
body.put("version", "1.0");
|
||||
|
|
Loading…
Reference in New Issue
Block a user