mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
余额支付订单 进行分账处理
This commit is contained in:
@@ -6,10 +6,12 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.huifu.adapay.model.*;
|
||||
import com.jsowell.adapay.common.DivMember;
|
||||
import com.jsowell.adapay.dto.SettleAccountDTO;
|
||||
import com.jsowell.adapay.dto.UpdateAccountConfigDTO;
|
||||
import com.jsowell.adapay.dto.WithdrawDTO;
|
||||
import com.jsowell.adapay.response.BalancePaymentResponse;
|
||||
import com.jsowell.adapay.response.PaymentConfirmResponse;
|
||||
import com.jsowell.adapay.response.QueryCorpMemberResponse;
|
||||
import com.jsowell.adapay.response.QueryMemberResponse;
|
||||
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
|
||||
@@ -544,6 +546,46 @@ public class AdapayMemberService {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建交易确认请求/创建分账请求
|
||||
* 这个方法只适用于给一个用户分账
|
||||
* @param paymentId 支付对象id
|
||||
* @param adapayMemberAccount 收到该张的汇付会员信息
|
||||
* @param confirmAmt 确认的金额
|
||||
* @param orderCode 订单编号
|
||||
*/
|
||||
public PaymentConfirmResponse createPaymentConfirmRequest(String paymentId, AdapayMemberAccount adapayMemberAccount, BigDecimal confirmAmt, String orderCode) {
|
||||
// 调汇付的分账接口 确认交易
|
||||
Map<String, Object> confirmParams = Maps.newHashMap();
|
||||
// Adapay生成的支付对象id
|
||||
confirmParams.put("payment_id", paymentId);
|
||||
// 请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
|
||||
confirmParams.put("order_no", "PC" + System.currentTimeMillis());
|
||||
// 确认金额,必须大于0,保留两位小数点,如0.10、100.05等。必须小于等于原支付金额-已确认金额-已撤销金额。
|
||||
confirmParams.put("confirm_amt", AdapayUtil.formatAmount(confirmAmt));
|
||||
// 附加说明
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("orderCode", orderCode);
|
||||
jsonObject.put("adapayMemberId", adapayMemberAccount.getAdapayMemberId());
|
||||
confirmParams.put("description", jsonObject.toJSONString());
|
||||
// 分账对象信息 一次最多7个
|
||||
DivMember divMember = new DivMember();
|
||||
divMember.setMember_id(adapayMemberAccount.getAdapayMemberId());
|
||||
divMember.setAmount(AdapayUtil.formatAmount(confirmAmt));
|
||||
divMember.setFee_flag(Constants.Y);
|
||||
confirmParams.put("div_members", Lists.newArrayList(divMember));
|
||||
Map<String, Object> paymentConfirm = null;
|
||||
try {
|
||||
paymentConfirm = PaymentConfirm.create(confirmParams);
|
||||
} catch (BaseAdaPayException e) {
|
||||
log.error("创建交易确认请求error", e);
|
||||
}
|
||||
String jsonString = JSON.toJSONString(paymentConfirm);
|
||||
log.info("调分账接口param:{}, result:{}", JSON.toJSONString(confirmParams), jsonString);
|
||||
return JSONObject.parseObject(jsonString, PaymentConfirmResponse.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建余额支付请求
|
||||
* @param outMemberId 出账用户的member_id, 若为商户本身时,请传入0
|
||||
@@ -552,7 +594,7 @@ public class AdapayMemberService {
|
||||
* @param title 标题
|
||||
* @param desc 描述信息
|
||||
*/
|
||||
public BalancePaymentResponse createBalancePaymentRequest(String outMemberId, String inMemberId, String transAmt, String title, String desc) throws BaseAdaPayException {
|
||||
public BalancePaymentResponse createBalancePaymentRequest(String outMemberId, String inMemberId, String transAmt, String title, String desc){
|
||||
Map<String, Object> balanceParam = Maps.newHashMap();
|
||||
balanceParam.put("app_id", ADAPAY_APP_ID);
|
||||
balanceParam.put("adapay_func_code", "settle_accounts.balancePay");
|
||||
@@ -562,9 +604,15 @@ public class AdapayMemberService {
|
||||
balanceParam.put("trans_amt", AdapayUtil.formatAmount(transAmt));
|
||||
balanceParam.put("goods_title", title);
|
||||
balanceParam.put("goods_desc", desc);
|
||||
Map<String, Object> paymentResult = AdapayCommon.requestAdapay(balanceParam);
|
||||
log.info("创建余额支付param:{}, result:{}", JSON.toJSONString(balanceParam), JSON.toJSONString(paymentResult));
|
||||
return JSONObject.parseObject(JSON.toJSONString(paymentResult), BalancePaymentResponse.class);
|
||||
Map<String, Object> paymentResult = null;
|
||||
try {
|
||||
paymentResult = AdapayCommon.requestAdapay(balanceParam);
|
||||
} catch (BaseAdaPayException e) {
|
||||
log.error("创建余额支付请求error", e);
|
||||
}
|
||||
String jsonString = JSON.toJSONString(paymentResult);
|
||||
log.info("创建余额支付param:{}, result:{}", JSON.toJSONString(balanceParam), jsonString);
|
||||
return JSONObject.parseObject(jsonString, BalancePaymentResponse.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -579,4 +627,5 @@ public class AdapayMemberService {
|
||||
Map<String, Object> confirmReverseResult = AdapayCommon.requestAdapay(confirmReverseParams);
|
||||
log.info("创建支付确认撤销param:{}, result:{}", JSON.toJSONString(confirmReverseParams), JSON.toJSONString(confirmReverseResult));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,5 +24,5 @@ public class OrderSettleResult {
|
||||
/**
|
||||
* 附加说明
|
||||
*/
|
||||
private String description;
|
||||
// private String description;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user