|
@@ -24,11 +24,12 @@ public class Payment extends ConfigInit {
|
|
|
//支付接口
|
|
|
Map<String, Object> paymentParams = new HashMap<>(10);
|
|
|
paymentParams.put("order_no", "jsdk_payment_" + System.currentTimeMillis());
|
|
|
- paymentParams.put("pay_channel", "wx_pub");
|
|
|
+ paymentParams.put("pay_channel", "alipay_wap");
|
|
|
paymentParams.put("pay_amt", "0.01");
|
|
|
|
|
|
paymentParams.put("goods_title", "your goods title");
|
|
|
paymentParams.put("goods_desc", "your goods desc");
|
|
|
+ paymentParams.put("notify_url", "https://wxwechat.utools.club/studentOrder/adaNotify");
|
|
|
|
|
|
|
|
|
paymentParams.put("div_members", "");
|
|
@@ -71,13 +72,11 @@ public class Payment extends ConfigInit {
|
|
|
// expendParams.put("promotion_detail", promotionDetail);
|
|
|
paymentParams.put("expend", expendParams);
|
|
|
Map<String, Object> payment = executePayment(paymentParams);
|
|
|
- payment = createReverse(merchantKey, "002112020062910440410123507019803422720", appId);
|
|
|
- payment = createConfirm(merchantKey, "002112020062910440410123507019803422720", appId);
|
|
|
System.out.println("钱包支付地址:" + payment.get("pay_url"));
|
|
|
//支付查询接口
|
|
|
- queryPayment((String) payment.get("id"));
|
|
|
+ // queryPayment((String) payment.get("id"));
|
|
|
// //关单接口
|
|
|
- closePayment((String) payment.get("id"));
|
|
|
+ // closePayment((String) payment.get("id"));
|
|
|
|
|
|
return (String) payment.get("id");
|
|
|
}
|
|
@@ -147,7 +146,6 @@ public class Payment extends ConfigInit {
|
|
|
return payment;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 查询一个支付交易
|
|
|
*
|
|
@@ -179,79 +177,6 @@ public class Payment extends ConfigInit {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 创建撤销对象
|
|
|
- *
|
|
|
- * @param paymentId 要查询的支付id
|
|
|
- * @return 查询的支付对象
|
|
|
- * @throws Exception 异常
|
|
|
- */
|
|
|
- public static Map<String, Object> createReverse(String merchantKey, String paymentId, String app_id) throws Exception {
|
|
|
- System.out.println("=======create Reverse begin=======");
|
|
|
-
|
|
|
- Map<String, Object> reverse = new HashMap<>();
|
|
|
-
|
|
|
- reverse.put("payment_id", paymentId);
|
|
|
- reverse.put("app_id", app_id);
|
|
|
- reverse.put("order_no", "jsdk_reverse_" + System.currentTimeMillis());
|
|
|
- reverse.put("app_id", app_id);
|
|
|
- reverse.put("notify_url", "");
|
|
|
- reverse.put("reverse_amt", "0.01");
|
|
|
- reverse.put("reason", "reason");
|
|
|
- reverse.put("expand", "expend");
|
|
|
- reverse.put("device_info", "device_info");
|
|
|
-
|
|
|
-
|
|
|
- try {
|
|
|
- System.out.println("创建撤销对象" + JSON.toJSONString(reverse));
|
|
|
- reverse = com.huifu.adapay.model.Payment.createReverse(reverse, merchantKey);
|
|
|
- } catch (BaseAdaPayException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
- System.out.println("创建撤销对象返回参数:" + JSON.toJSONString(reverse));
|
|
|
- String error_code = (String) reverse.get("error_code");
|
|
|
- if (null == error_code) {
|
|
|
- String error_msg = (String) reverse.get("error_msg");
|
|
|
- System.out.println("error_code:" + error_code + "............." + error_msg);
|
|
|
- }
|
|
|
- System.out.println("=======create Reverse end=======");
|
|
|
- return reverse;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 创建确认对象
|
|
|
- *
|
|
|
- * @return 查询的支付对象
|
|
|
- * @throws Exception 异常
|
|
|
- */
|
|
|
- public static Map<String, Object> createConfirm(String merchantKey, String paymentId, String app_id) throws Exception {
|
|
|
- System.out.println("=======create confirm begin=======");
|
|
|
-
|
|
|
- Map<String, Object> confirm = new HashMap<>();
|
|
|
-
|
|
|
- confirm.put("payment_id", paymentId);
|
|
|
- confirm.put("order_no", "jsdk_confirm_" + System.currentTimeMillis());
|
|
|
- confirm.put("confirm_amt", "0.01");
|
|
|
- confirm.put("description", "description");
|
|
|
- confirm.put("div_members", "");
|
|
|
-
|
|
|
- try {
|
|
|
- System.out.println("创建确认对象" + JSON.toJSONString(confirm));
|
|
|
- confirm = com.huifu.adapay.model.Payment.createConfirm(confirm, merchantKey);
|
|
|
- } catch (BaseAdaPayException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- String error_code = (String) confirm.get("error_code");
|
|
|
- if (null == error_code) {
|
|
|
- String error_msg = (String) confirm.get("error_msg");
|
|
|
- System.out.println("error_code:" + error_code + "............." + error_msg);
|
|
|
- }
|
|
|
- System.out.println("创建确认对象返回参数:" + JSON.toJSONString(confirm));
|
|
|
- System.out.println("=======create confirm end=======");
|
|
|
- return confirm;
|
|
|
- }
|
|
|
-
|
|
|
public static Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, String sellerNo, List<Map<String, Object>> tempRoutingList) throws Exception {
|
|
|
Map<String, Object> paymentParams = new HashMap<>(10);
|
|
|
paymentParams.put("appId", appId);
|