update 汇付

This commit is contained in:
2023-04-27 09:53:25 +08:00
parent 72a856ee7b
commit 36561d6169
5 changed files with 402 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
package com.jsowell.adapay.service;
import com.google.common.collect.Maps;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.huifu.adapay.model.Payment;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class AdapayService {
/**
* 创建交易对象
*/
public void test() {
// 请求参数
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("div_members", [{"amount":"0.05", "fee_flag":"Y", "member_id":"member_id_test"}]);
// 调用创建方法,获取 Payment对象_
try {
Map<String, Object> response = Payment.create(paymentParams);
} catch (BaseAdaPayException e) {
e.printStackTrace();
}
}
}