This commit is contained in:
2023-05-10 08:19:44 +08:00
parent 818b9177ba
commit a045fe9315
2 changed files with 20 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ import com.google.common.collect.Maps;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.huifu.adapay.model.Payment;
import com.jsowell.JsowellApplication;
import com.jsowell.adapay.service.AdapayService;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ykc.LoginRequestData;
@@ -157,6 +158,14 @@ public class SpringBootTestController {
@Autowired
private IPileAuthCardService pileAuthCardService;
@Autowired
private AdapayService adapayService;
@Test
public void testCreateAdapay() {
adapayService.createTransactionObject();
}
/**
* 创建交易对象
*/

View File

@@ -1,5 +1,6 @@
package com.jsowell.adapay.service;
import com.alibaba.fastjson2.JSON;
import com.google.common.collect.Maps;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.huifu.adapay.model.Payment;
@@ -12,21 +13,23 @@ public class AdapayService {
/**
* 创建交易对象
* createTransactionObject
*/
public void test() {
public void createTransactionObject() {
// 请求参数
Map<String, Object> paymentParams = Maps.newHashMap();
paymentParams.put("order_no", "123456789");
paymentParams.put("pay_amt", "0.05");
paymentParams.put("app_id", "app_XXXXXXXX");
paymentParams.put("pay_channel", "alipay");
paymentParams.put("goods_title", "Your goods_title");
paymentParams.put("goods_desc", "Your goods_desc");
paymentParams.put("description", "payment Discription");
paymentParams.put("app_id", "app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa");
paymentParams.put("order_no", "2023050911410199622174123");
paymentParams.put("pay_channel", "wx_lite");
paymentParams.put("pay_amt", "0.01");
paymentParams.put("currency", "cny");
paymentParams.put("goods_title", "测试商品");
paymentParams.put("goods_desc", "用于支付流程测试的商品");
// paymentParams.put("div_members", [{"amount":"0.05", "fee_flag":"Y", "member_id":"member_id_test"}]);
// 调用创建方法,获取 Payment对象_
try {
Map<String, Object> response = Payment.create(paymentParams);
System.out.println("response:" + JSON.toJSONString(response));
} catch (BaseAdaPayException e) {
e.printStackTrace();
}