校验支付确认是否撤销

This commit is contained in:
2024-01-03 17:07:01 +08:00
parent 946325120d
commit 4c21bf1f9b
6 changed files with 122 additions and 12 deletions

View File

@@ -19,14 +19,12 @@ import com.jsowell.JsowellApplication;
import com.jsowell.adapay.common.AdaPayment;
import com.jsowell.adapay.config.AbstractAdapayConfig;
import com.jsowell.adapay.dto.QueryAcctFlowDTO;
import com.jsowell.adapay.dto.QueryConfirmReverseDTO;
import com.jsowell.adapay.dto.QueryPaymentConfirmDTO;
import com.jsowell.adapay.dto.SettleAccountDTO;
import com.jsowell.adapay.factory.AdapayConfigFactory;
import com.jsowell.adapay.operation.PaymentReverseOperation;
import com.jsowell.adapay.response.PaymentConfirmResponse;
import com.jsowell.adapay.response.PaymentReverseResponse;
import com.jsowell.adapay.response.QueryPaymentConfirmDetailResponse;
import com.jsowell.adapay.response.RefundResponse;
import com.jsowell.adapay.response.*;
import com.jsowell.adapay.service.AdapayService;
import com.jsowell.adapay.vo.DrawCashDetailVO;
import com.jsowell.common.constant.CacheConstants;
@@ -667,6 +665,15 @@ public class SpringBootTestController {
orderPileOccupyService.generateOccupyPileOrder(dto);
}
@Test
public void testQueryConfirmReverse() throws BaseAdaPayException {
QueryConfirmReverseDTO dto = QueryConfirmReverseDTO.builder()
.paymentConfirmId("0022120231023104957990562360205131259904")
.wechatAppId(wechatAppId1)
.build();
adapayService.queryConfirmReverse(dto);
}
@Test
public void testStopOccupyPileOrder() {
@@ -681,7 +688,16 @@ public class SpringBootTestController {
// 需要重新分账的订单信息(针对未分账的订单)
public JSONArray getPaymentList() {
String jsonArrayString = "[" +
"{\"orderCode\":\"C69677615458\", \"settleAmount\":\"14.90\", \"paymentId\":\"002212023121114570010580179384493879296\"}" +
"{\"orderCode\":\"C23000133174\", \"settleAmount\":\"47.01\", \"paymentId\":\"002212023100819330610557056046136913920\"}" +
"{\"orderCode\":\"C21732136953\", \"settleAmount\":\"10.00\", \"paymentId\":\"002212023101121251610558171434498875392\"}" +
"{\"orderCode\":\"C21122501014\", \"settleAmount\":\"44.3\", \"paymentId\":\"002212023102217533710562104440424718336\"}" +
"{\"orderCode\":\"C40769056697\", \"settleAmount\":\"11.23\", \"paymentId\":\"002212023102316213810562443678391427072\"}" +
"{\"orderCode\":\"C23426149031\", \"settleAmount\":\"16.22\", \"paymentId\":\"002212023102520255110563229911567286272\"}" +
"{\"orderCode\":\"C63782621987\", \"settleAmount\":\"10.82\", \"paymentId\":\"002212023102523371410563278077378646016\"}" +
"{\"orderCode\":\"C40957699775\", \"settleAmount\":\"20.07\", \"paymentId\":\"002212023102608180610563409156395016192\"}" +
"{\"orderCode\":\"C40134359627\", \"settleAmount\":\"0.19\", \"paymentId\":\"002212023102613265510563486871366881280\"}" +
"{\"orderCode\":\"C29560601840\", \"settleAmount\":\"6.19\", \"paymentId\":\"002212023102812085110564192003156709376\"}" +
"{\"orderCode\":\"C21185002061\", \"settleAmount\":\"15.29\", \"paymentId\":\"002212023103121471210565424714177380352\"}" +
"]";
return JSONArray.parseArray(jsonArrayString);
}
@@ -695,7 +711,7 @@ public class SpringBootTestController {
// TODO 获取默认结算账户如需分给对应商户就填写正确的汇付会员id
// AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.getDefault();
AdapayMemberAccount adapayMemberAccount = new AdapayMemberAccount();
adapayMemberAccount.setAdapayMemberId("ACM25158725");
adapayMemberAccount.setAdapayMemberId("ACM23489463");
for (int i = 0; i < paymentList.size(); i++) {
JSONObject jsonObject = (JSONObject) paymentList.get(i);
BigDecimal confirmAmt = jsonObject.getBigDecimal("settleAmount"); // 确认金额就是结算金额
@@ -742,6 +758,10 @@ public class SpringBootTestController {
unSplitList.add(paymentId);
} else {
for (QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm : confirms) {
if (queryConfirmReverseStatus(confirm)) {
System.out.println("支付确认id:" + confirm.getId() + "撤销了。。。");
continue;
}
JSONObject jsonObject = JSON.parseObject(confirm.getDescription());
String adapayMemberId = jsonObject.getString("adapayMemberId");
BigDecimal confirmedAmt = new BigDecimal(confirm.getConfirmedAmt());
@@ -763,7 +783,20 @@ public class SpringBootTestController {
System.out.println("=================自己:" + JSON.toJSONString(selfList));
}
private boolean queryConfirmReverseStatus(QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm) throws BaseAdaPayException {
boolean result = false;
QueryConfirmReverseDTO dto = QueryConfirmReverseDTO.builder()
.paymentConfirmId(confirm.getId())
.wechatAppId(wechatAppId1)
.build();
ConfirmReverseResponse confirmReverseResponse = adapayService.queryConfirmReverse(dto);
if (confirmReverseResponse.isSuccess()) {
result = true;
}
return result;
}
/**
* 延迟分账未确认调撤销调撤销接口退款
@@ -856,10 +889,7 @@ public class SpringBootTestController {
public List<String> getPaymentIdList() {
List<String> list = Lists.newArrayList();
list.add("002212023122611111810585558404842418176");
list.add("002212023100819330610557056046136913920");
return list;
}