|
@@ -1,15 +1,23 @@
|
|
|
package org.jeecg.modules.pay.paytest;
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.jeecg.modules.pay.config.WechatPayV3Utils;
|
|
|
+import org.jeecg.modules.pay.config.WechatUrlConstants;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
|
|
|
+@Slf4j
|
|
|
@RestController
|
|
|
+@AllArgsConstructor
|
|
|
@RequestMapping(value = "/test")
|
|
|
public class payController {
|
|
|
|
|
|
+ private final WechatPayV3Utils wechatPayV3Utils;
|
|
|
+
|
|
|
@GetMapping(value = "/getPay")
|
|
|
public String getPay(String orderSn,int total , String description) {
|
|
|
PayMerchantUtil payMerchantUtil = new PayMerchantUtil();
|
|
@@ -19,6 +27,70 @@ public class payController {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ @GetMapping(value = "/test")
|
|
|
+ public JSONObject test() {
|
|
|
+ //通过订单ID查询流水号
|
|
|
+ String transaction_id = "88888888888888888888";
|
|
|
+ try {
|
|
|
+ JSONObject res = wechatPayV3Utils.sendGet(WechatUrlConstants.PAY_V3_QUERY_PROFIT_SHARING+"P001001001"+"?sub_mchid="+ServiceProvider.sub_mchid+"&transaction_id="+transaction_id);
|
|
|
+ log.info("wechatPay res:{}", res.toString());
|
|
|
+ return res;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+// @GetMapping(value = "/test")
|
|
|
+// public JSONObject test() {
|
|
|
+// //通过订单ID查询流水号
|
|
|
+// String transaction_id = "88888888888888888888";
|
|
|
+// try {
|
|
|
+// JSONObject res = wechatPayV3Utils.sendGet(WechatUrlConstants.PAY_V3_QUERY_PROFIT_SHARING+"P001001001"+"?sub_mchid="+ServiceProvider.sub_mchid+"&transaction_id="+transaction_id);
|
|
|
+// log.info("wechatPay res:{}", res.toString());
|
|
|
+// return res;
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+
|
|
|
+// @GetMapping(value = "/test")
|
|
|
+// public JSONObject test(String out_order_no) {
|
|
|
+// //1.参数封装
|
|
|
+// /**
|
|
|
+// * 分账接收方列表,不超过50个json对象,不能设置出资子商户作为分账接受方
|
|
|
+// 点击行前的+展开字段详情
|
|
|
+// */
|
|
|
+// List<Receiver> receivers = new ArrayList<>();
|
|
|
+// //查询当前订单的分账接收方列表
|
|
|
+// for (int i = 0; i < 1; i++) {
|
|
|
+// Receiver receiver = new Receiver();
|
|
|
+// receiver.setType("MERCHANT_ID")
|
|
|
+// .setAccount(ServiceProvider.sp_mchid)
|
|
|
+// .setAmount(1)
|
|
|
+// .setDescription("微信文档值得吐槽");
|
|
|
+// receivers.add(receiver);
|
|
|
+// }
|
|
|
+// ProfitSharingRequest profitSharingRequest = new ProfitSharingRequest();
|
|
|
+// profitSharingRequest
|
|
|
+// .setNonce_str(RandomUtil.randomString(32))
|
|
|
+// .setSign_type("HMAC-SHA256")
|
|
|
+// .setAppid(ServiceProvider.sp_appid)
|
|
|
+// .setSub_mchid(ServiceProvider.sub_mchid)
|
|
|
+// .setTransaction_id("4200001042202104228993583353")
|
|
|
+// .setOut_order_no("P001001001")
|
|
|
+// .setReceivers(receivers)
|
|
|
+// .setUnfreeze_unsplit(Boolean.TRUE);
|
|
|
+// try {
|
|
|
+// JSONObject res = wechatPayV3Utils.sendPost(WechatUrlConstants.PAY_V3_PROFIT_SHARING, JSONObject.from(profitSharingRequest));
|
|
|
+// log.info("wechatPay res:{}", res.toString());
|
|
|
+// return res;
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// return null;
|
|
|
+// }
|
|
|
}
|
|
|
|