mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
换绑银行卡接口
This commit is contained in:
@@ -164,16 +164,15 @@ public class AdapayMemberController extends BaseController {
|
||||
/**
|
||||
* 换绑银行卡
|
||||
* http://localhost:8080/adapay/member/changeBankCard
|
||||
* changeBankCard
|
||||
*/
|
||||
@PostMapping("/changeBankCard")
|
||||
public AjaxResult changeBankCard(@RequestBody UpdateAccountConfigDTO dto) {
|
||||
public AjaxResult changeBankCard(@RequestBody ChangeBankCardDTO dto) {
|
||||
AjaxResult result;
|
||||
try {
|
||||
adapayService.updateSettleAccountConfig(dto);
|
||||
adapayService.changeBankCard(dto);
|
||||
result = AjaxResult.success();
|
||||
} catch (BaseAdaPayException e) {
|
||||
logger.error("查询汇付账户余额error", e);
|
||||
logger.error("换绑银行卡error", e);
|
||||
result = AjaxResult.error();
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.jsowell.adapay.factory.AdapayConfigFactory;
|
||||
import com.jsowell.adapay.operation.PaymentReverseOperation;
|
||||
import com.jsowell.adapay.response.*;
|
||||
import com.jsowell.adapay.service.AdapayService;
|
||||
import com.jsowell.adapay.vo.AdapayCorpMemberVO;
|
||||
import com.jsowell.adapay.vo.DrawCashDetailVO;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
@@ -2346,14 +2347,17 @@ public class SpringBootTestController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询汇付会员信息
|
||||
*/
|
||||
@Test
|
||||
public void testQueryAdapayMemberInfo() {
|
||||
String adapayMemberId = "AM25703321";
|
||||
String settleAccountId = "0489089447022976";
|
||||
String adapayMemberId = "ACM82792551";
|
||||
String settleAccountId = null;
|
||||
try {
|
||||
// adapayMemberService.queryAdapayMemberInfo(adapayMemberId);
|
||||
|
||||
adapayService.queryAdapaySettleAccount(adapayMemberId, settleAccountId, "");
|
||||
AdapayCorpMemberVO adapayCorpMemberVO = adapayService.queryCorpAdapayMemberInfo(adapayMemberId, wechatAppId1);
|
||||
// AdapaySettleAccountVO vo = adapayService.queryAdapaySettleAccount(adapayMemberId, settleAccountId, wechatAppId1);
|
||||
System.out.println(JSON.toJSONString(adapayCorpMemberVO));
|
||||
} catch (BaseAdaPayException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.jsowell.adapay.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ChangeBankCardDTO {
|
||||
private String merchantId;
|
||||
// 账户类型:1-对公;2-对私
|
||||
private String bankAcctType;
|
||||
|
||||
// 银行卡号
|
||||
private String cardId;
|
||||
|
||||
// 银行卡对应的户名
|
||||
private String cardName;
|
||||
|
||||
// 银行编码
|
||||
private String bankCode;
|
||||
|
||||
// 证件号,银行账户类型为对私时,必填
|
||||
private String certId;
|
||||
|
||||
// 证件类型,仅支持:00-身份证,银行账户类型为对私时,必填
|
||||
private String certType;
|
||||
|
||||
// 手机号
|
||||
private String telNo;
|
||||
|
||||
// 省份编码
|
||||
private String provCode;
|
||||
|
||||
// 地区编码
|
||||
private String areaCode;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,4 +68,7 @@ public class AdapayCorpMemberVO {
|
||||
// 银行卡对应的户名
|
||||
private String cardName;
|
||||
|
||||
// 结算账户id
|
||||
private String settleAccountId;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user