mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 19:45:09 +08:00
update 汇付支付回调
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package com.jsowell.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.huifu.adapay.model.Payment;
|
||||
import com.jsowell.adapay.common.CreateAdaPaymentParam;
|
||||
@@ -437,6 +439,12 @@ public class MemberService {
|
||||
return orderService.weixinPayV3(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用汇付支付充值余额
|
||||
* @param dto
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, Object> rechargeBalanceWithAdapay(WeixinPayDTO dto) throws Exception {
|
||||
// 封装对象
|
||||
CreateAdaPaymentParam createAdaPaymentParam = new CreateAdaPaymentParam();
|
||||
@@ -444,12 +452,16 @@ public class MemberService {
|
||||
createAdaPaymentParam.setPay_amt(AdapayUtil.formatAmount(dto.getAmount()));
|
||||
createAdaPaymentParam.setApp_id("app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa"); // todo 后面移动到配置文件中
|
||||
createAdaPaymentParam.setPay_channel("wx_lite"); // todo 如果以后有支付宝等别的渠道,这里需要做修改,判断是什么渠道的请求
|
||||
createAdaPaymentParam.setGoods_title("充电费用1");
|
||||
createAdaPaymentParam.setGoods_desc("充电费用2");
|
||||
createAdaPaymentParam.setDescription("充电费用3");
|
||||
createAdaPaymentParam.setGoods_title("余额");
|
||||
createAdaPaymentParam.setGoods_desc("会员充值余额");
|
||||
// createAdaPaymentParam.setDescription("充电费用3");
|
||||
createAdaPaymentParam.setExpend(JSONObject.toJSONString( ImmutableMap.of("open_id", dto.getOpenId())));
|
||||
//异步通知地址,url为http/https路径,服务器POST回调,URL 上请勿附带参数
|
||||
createAdaPaymentParam.setNotify_url("https://api.jsowellcloud.com/uniapp/pay/adapayCallback");
|
||||
Map<String, String> map = Maps.newHashMap();
|
||||
map.put("type", ScenarioEnum.BALANCE.getValue());
|
||||
map.put("memberId", dto.getMemberId());
|
||||
createAdaPaymentParam.setDescription(JSON.toJSONString(map));
|
||||
try {
|
||||
log.info("创建汇付支付参数:{}", JSONObject.toJSONString(createAdaPaymentParam));
|
||||
Map<String, Object> response = Payment.create(BeanMap.create(createAdaPaymentParam));
|
||||
|
||||
Reference in New Issue
Block a user