diff --git a/jsowell-admin/src/test/java/SpringBootTestController.java b/jsowell-admin/src/test/java/SpringBootTestController.java index 84e9b7b08..cf5a4bdf2 100644 --- a/jsowell-admin/src/test/java/SpringBootTestController.java +++ b/jsowell-admin/src/test/java/SpringBootTestController.java @@ -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 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 getList() { List 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 list = getList(); + for (String paymentId : list) { + Map refundParams = Maps.newHashMap(); + refundParams.put("payment_id", paymentId); + try { + Map 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 list = getList(); + for (String paymentId : list) { + try { + Map reverse = Maps.newHashMap(); + reverse.put("payment_id", paymentId); + reverse.put("app_id", wechatAppId); + Map 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"; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/orderlogic/NotDelayMerchantOrderLogic.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/orderlogic/NotDelayMerchantOrderLogic.java index bce6a1c0f..2b2047e23 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/orderlogic/NotDelayMerchantOrderLogic.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/orderlogic/NotDelayMerchantOrderLogic.java @@ -220,6 +220,7 @@ public class NotDelayMerchantOrderLogic extends AbstractOrderLogic{ * * @param dto */ + @Transactional(rollbackFor = Exception.class) public void balancePayOrder(PayOrderDTO dto) { logger.info("【{}】-余额支付订单start, param:{}", this.getClass().getSimpleName(), JSON.toJSONString(dto)); String orderCode = dto.getOrderCode(); // 订单编号