多商户配置

This commit is contained in:
2023-08-15 15:42:39 +08:00
parent 32156a0ad4
commit 935f45938c
4 changed files with 23 additions and 3 deletions

View File

@@ -11,6 +11,8 @@ 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;
import com.jsowell.adapay.config.AbstractAdapayConfig;
import com.jsowell.adapay.factory.AdapayConfigFactory;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.page.PageResponse;
@@ -598,11 +600,19 @@ public class MemberService {
* @throws Exception
*/
public Map<String, Object> rechargeBalanceWithAdapay(WeixinPayDTO dto) throws Exception {
// 获取支付信息
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(dto.getAppId());
if (config == null) {
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CONFIG_IS_NULL_ERROR);
}
log.info("使用汇付支付充值余额 支付配置参数:{}", JSON.toJSONString(config));
// 封装对象
CreateAdaPaymentParam createAdaPaymentParam = new CreateAdaPaymentParam();
createAdaPaymentParam.setOrder_no(SnowflakeIdWorker.getSnowflakeId());
createAdaPaymentParam.setPay_amt(AdapayUtil.formatAmount(dto.getAmount()));
createAdaPaymentParam.setApp_id(ADAPAY_APP_ID); // 移动到配置文件中
// createAdaPaymentParam.setApp_id(ADAPAY_APP_ID); // 移动到配置文件中
createAdaPaymentParam.setApp_id(config.getAdapayAppId()); // 移动到配置文件中
createAdaPaymentParam.setPay_channel("wx_lite"); // todo 如果以后有支付宝等别的渠道,这里需要做修改,判断是什么渠道的请求
createAdaPaymentParam.setGoods_title("充值余额");
createAdaPaymentParam.setGoods_desc("会员充值余额");