Files
jsowell-charger-web/jsowell-pile/src/main/java/com/jsowell/adapay/service/AdapayService.java

35 lines
1.0 KiB
Java
Raw Normal View History

2023-04-27 09:53:25 +08:00
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();
}
}
}