update 汇付参数移动到配置文件

This commit is contained in:
2023-05-27 14:27:36 +08:00
parent a46b7c30e2
commit 5804bff3d4
4 changed files with 31 additions and 3 deletions

View File

@@ -54,6 +54,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.stereotype.Service;
@@ -93,6 +94,12 @@ public class MemberService {
@Autowired
private OrderService orderService;
@Value("${adapay.appId}")
private String ADAPAY_APP_ID;
@Value("${adapay.callback}")
private String ADAPAY_CALLBACK_URL;
/**
* 校验短信验证码
* @param dto
@@ -450,14 +457,14 @@ public class MemberService {
CreateAdaPaymentParam createAdaPaymentParam = new CreateAdaPaymentParam();
createAdaPaymentParam.setOrder_no(IdUtils.fastSimpleUUID());
createAdaPaymentParam.setPay_amt(AdapayUtil.formatAmount(dto.getAmount()));
createAdaPaymentParam.setApp_id("app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa"); // todo 后面移动到配置文件中
createAdaPaymentParam.setApp_id(ADAPAY_APP_ID); // 移动到配置文件中
createAdaPaymentParam.setPay_channel("wx_lite"); // todo 如果以后有支付宝等别的渠道,这里需要做修改,判断是什么渠道的请求
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");
createAdaPaymentParam.setNotify_url(ADAPAY_CALLBACK_URL);
Map<String, String> map = Maps.newHashMap();
map.put("type", ScenarioEnum.BALANCE.getValue());
map.put("memberId", dto.getMemberId());

View File

@@ -50,6 +50,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.stereotype.Service;
@@ -119,7 +120,14 @@ public class OrderService {
private List<String> stationIdList = Lists.newArrayList("1", "2");
private String ADAPAY_APP_ID = "app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa";
@Value("${adapay.appId}")
private String ADAPAY_APP_ID;
@Value("${adapay.callback}")
private String ADAPAY_CALLBACK_URL;
@Value("${adapay.refundCallback}")
private String adapay_refund_callback_url;
/**
* 生成订单
@@ -262,6 +270,8 @@ public class OrderService {
map.put("type", ScenarioEnum.ORDER.getValue());
map.put("orderCode", dto.getOrderCode());
createAdaPaymentParam.setDescription(JSON.toJSONString(map));
//异步通知地址url为http/https路径服务器POST回调URL 上请勿附带参数
createAdaPaymentParam.setNotify_url(ADAPAY_CALLBACK_URL);
createAdaPaymentParam.setExpend(JSONObject.toJSONString( ImmutableMap.of("open_id", openId)));
try {
log.info("创建汇付支付参数:{}", JSONObject.toJSONString(createAdaPaymentParam));

View File

@@ -151,3 +151,8 @@ wechat:
# C:/Users/autum/Desktop/work/1632405339_20221125_cert/apiclient_key.pem
# E://key/1632405339_20221125_cert/apiclient_key.pem
# 汇付支付
adapay:
appId: app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa
callback: https://api.jsowellcloud.com/uniapp/pay/adapayCallback
refundCallback: https://api.jsowellcloud.com/uniapp/pay/adapayRefundCallback

View File

@@ -149,3 +149,9 @@ wechat:
key:
path: /usr/local/1632405339_20221125_cert/apiclient_key.pem
########################微信支付参数#######################################
# 汇付支付
adapay:
appId: app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa
callback: https://api.jsowellcloud.com/uniapp/pay/adapayCallback
refundCallback: https://api.jsowellcloud.com/uniapp/pay/adapayRefundCallback