换绑银行卡接口

This commit is contained in:
2024-01-19 16:59:54 +08:00
parent d4867ed570
commit 5b63bf7f93
5 changed files with 89 additions and 14 deletions

View File

@@ -392,20 +392,21 @@ public class AdapayService {
.email(response.getEmail())
.socialCreditCode(response.getSocial_credit_code())
.socialCreditCodeExpires(response.getSocial_credit_code_expires())
// .bankCode(response.getBank_code())
// .cardName(response.getCard_name())
// .cardNo(response.getCard_no())
.build();
if (StringUtils.isNotBlank(response.getSettle_accounts())) {
JSONObject jsonObject = JSON.parseObject(response.getSettle_accounts());
JSONObject recipient = jsonObject.getJSONObject("recipient");
if (recipient != null) {
corpMemberVO.setCardName(recipient.getString("cardName"));
corpMemberVO.setCardNo(recipient.getString("cardNo"));
}
String settleAccountId = jsonObject.getString("id");
if (StringUtils.isNotEmpty(settleAccountId)) {
corpMemberVO.setSettleAccountId(settleAccountId);
AdapaySettleAccountVO adapaySettleAccountVO = queryAdapaySettleAccount(adapayMemberId, settleAccountId, config.getWechatAppId());
if (adapaySettleAccountVO != null) {
corpMemberVO.setBankCode(adapaySettleAccountVO.getBankCode());
corpMemberVO.setCardName(adapaySettleAccountVO.getCardName());
corpMemberVO.setCardNo(adapaySettleAccountVO.getCardId());
}
}
}
@@ -1249,4 +1250,36 @@ public class AdapayService {
log.info("confirmReverseQueryResult:{}", JSON.toJSONString(confirmReverseResponse));
return confirmReverseResponse;
}
/**
* 换绑银行卡
* 用户需要换绑银行卡 1-删除结算账户信息2-使用新账户信息创建结算账户】
*/
public void changeBankCard(ChangeBankCardDTO dto) throws BaseAdaPayException {
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
// 获取汇付支会员信息
AdapayMemberAccount account = adapayMemberAccountService.selectByMerchantId(dto.getMerchantId());
if (account == null) {
return;
}
// 1-删除结算账户信息
String adapayMemberId = account.getAdapayMemberId();
String settleAccountId = null;
AdapayCorpMemberVO adapayCorpMemberVO = this.queryCorpAdapayMemberInfo(adapayMemberId, wechatAppId);
if (adapayCorpMemberVO != null) {
settleAccountId = adapayCorpMemberVO.getSettleAccountId();
}
this.createDeleteSettleAccountRequest(adapayMemberId, settleAccountId, wechatAppId);
// 2-使用新账户信息创建结算账户
SettleAccountDTO settleAccountDTO = new SettleAccountDTO();
settleAccountDTO.setCardId(dto.getCardId());
settleAccountDTO.setCardName(dto.getCardName());
settleAccountDTO.setTelNo(dto.getTelNo());
settleAccountDTO.setBankCode(dto.getBankCode());
settleAccountDTO.setBankAcctType(dto.getBankAcctType());
settleAccountDTO.setProvCode(dto.getProvCode());
settleAccountDTO.setAreaCode(dto.getAreaCode());
this.createSettleAccountRequest(settleAccountDTO, adapayMemberId, wechatAppId);
}
}