This commit is contained in:
2023-10-08 16:42:56 +08:00
parent 0a609314f1
commit e25f6b1b9a
2 changed files with 78 additions and 11 deletions

View File

@@ -13,6 +13,7 @@ import com.google.common.collect.Sets;
import com.google.common.primitives.Bytes;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.huifu.adapay.model.Payment;
import com.huifu.adapay.model.PaymentReverse;
import com.huifu.adapay.model.Refund;
import com.jsowell.JsowellApplication;
import com.jsowell.adapay.config.AbstractAdapayConfig;
@@ -655,12 +656,15 @@ public class SpringBootTestController {
System.out.println(JSON.toJSONString(paymentConfirmResponse));
}
/**
* 延迟分账未确认调撤销调撤销接口退款
*/
@Test
public void createPaymentReverseRequestTest() {
String paymentId = "002212023082411000810540619496373694464";
BigDecimal refundAmount = new BigDecimal("1.00");
String paymentId = "002212023082409392010540599165461884928";
BigDecimal refundAmount = new BigDecimal("0.09");
String wechatAppId = "wx20abc5210391649c";
String memberId = "42012388";
String memberId = null;
// 延迟分账未确认调撤销调撤销接口退款
PaymentReverseOperation operation = new PaymentReverseOperation();
@@ -676,10 +680,10 @@ public class SpringBootTestController {
@Test
public void createRefundRequestTest() {
String paymentId = "002212023091416460110548316686591795200";
BigDecimal refundAmount = new BigDecimal("1.00");
String paymentId = "002212023100711233510556570466139144192";
BigDecimal refundAmount = new BigDecimal("0.05");
String wechatAppId = "wx20abc5210391649c";
String memberId = "42012388";
String memberId = "";
// 调汇付的交易退款接口
RefundResponse response = adapayService.createRefundRequest(paymentId, refundAmount,
wechatAppId, memberId, ScenarioEnum.ORDER.getValue(), null);
@@ -703,18 +707,39 @@ public class SpringBootTestController {
if (response != null) {
List<QueryPaymentConfirmDetailResponse.PaymentConfirmInfo> confirms = response.getPaymentConfirms();
System.out.println("支付id:" + s + ", 确认信息:" + JSON.toJSONString(confirms));
if (CollectionUtils.isNotEmpty(confirms)) {
for (QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm : confirms) {
adapayService.createConfirmReverse(confirm.getId(), wechatAppId);
}
}
// if (CollectionUtils.isNotEmpty(confirms)) {
// for (QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm : confirms) {
// adapayService.createConfirmReverse(confirm.getId(), wechatAppId);
// }
// }
}
}
}
public List<String> getList() {
List<String> list = Lists.newArrayList();
list.add("002212023082215262610539961740180578304");
list.add("002212023082311373310540266527452135424");
list.add("002212023082314254110540308836529778688");
list.add("002212023082314524610540315652298944512");
list.add("002212023082314544910540316170146885632");
list.add("002212023082314574110540316892933017600");
list.add("002212023082315053010540318859374428160");
list.add("002212023082315170610540321776783896576");
list.add("002212023082317112110540350527641501696");
list.add("002212023082318144410540366481254158336");
list.add("002212023082318215210540368274134847488");
list.add("002212023082318242710540368927782121472");
list.add("002212023082408475810540586236738351104");
list.add("002212023082408563710540588415700250624");
list.add("002212023082409080510540591299769815040");
list.add("002212023082409175010540593754135060480");
list.add("002212023082409294410540596745978433536");
list.add("002212023082409370910540598613444284416");
list.add("002212023082409392010540599165461884928");
list.add("002212023082411000810540619496373694464");
list.add("002212023083113391910543196272217128960");
list.add("002212023083114021810543202055938179072");
return list;
}
@@ -1794,6 +1819,47 @@ public class SpringBootTestController {
}
}
/**
* 查询退款信息
*/
@Test
public void queryRefundTest() {
String wechatAppId = "wx20abc5210391649c";
List<String> list = getList();
for (String paymentId : list) {
Map<String, Object> refundParams = Maps.newHashMap();
refundParams.put("payment_id", paymentId);
try {
Map<String, Object> refund = Refund.query(refundParams, wechatAppId);
System.out.println("支付id:" + paymentId + ", 退款信息:" + JSON.toJSONString(refund));
System.out.println();
} catch (BaseAdaPayException e) {
throw new RuntimeException(e);
}
}
}
/**
* 查询支付撤销信息
*/
@Test
public void queryPaymentReverseTest() {
String wechatAppId = "wx20abc5210391649c";
List<String> list = getList();
for (String paymentId : list) {
try {
Map<String, Object> reverse = Maps.newHashMap();
reverse.put("payment_id", paymentId);
reverse.put("app_id", wechatAppId);
Map<String, Object> response = PaymentReverse.queryList(reverse, wechatAppId);
System.out.printf("支付id: %s, 支付撤销信息: %s%n", paymentId, JSON.toJSONString(response));
System.out.println();
} catch (BaseAdaPayException e) {
throw new RuntimeException(e);
}
}
}
@Test
public void testGenerateBillingTemplateMsgBody() {
String pileSn = "88000000000001";