Ver Fonte

退款回调

qin há 8 meses atrás
pai
commit
0ae93ae3e1

+ 9 - 0
src/main/java/com/poteviohealth/ym/ipos/controller/ReceivePayAndRefundController.java

@@ -42,6 +42,15 @@ public class ReceivePayAndRefundController {
         return paymentService.payNotification(payNotification);
     }
 
+    @ApiOperation(value="退款回调")
+    @RequestMapping(value = "/payReverseNotify",method = RequestMethod.POST)
+    @ResponseBody
+    @OperationLog(type = OperateType.ADD, description = "退款回调")
+    public String payReverseNotify(@RequestBody PayNotification payNotification){
+        log.info("payReverseNotification==="+ JSONObject.toJSONString(payNotification));
+        return paymentService.payReverseNotification(payNotification);
+    }
+
 
     @ApiOperation(value="延时分账回调")
     @RequestMapping(value = "/delayConfirmNotify",method = RequestMethod.POST)

+ 1 - 1
src/main/java/com/poteviohealth/ym/ipos/model/payment/PaymentRecords.java

@@ -66,7 +66,7 @@ public class PaymentRecords extends BaseEntity {
     @ApiModelProperty(value="支付方式")
     private String payType;
 
-    @ApiModelProperty(value="交易类型,1:支付")
+    @ApiModelProperty(value="交易类型,1:支付;2.退款")
     private String transType;
 
     @ApiModelProperty(value="支付平台的订单号,仅成功时有值")

+ 1 - 1
src/main/java/com/poteviohealth/ym/ipos/model/payment/detail/PayReverseDetail.java

@@ -22,7 +22,7 @@ public class PayReverseDetail {
      * 521:聚分期
      */
     @ApiModelProperty(value = "支付类型")
-    private String pay_type ="515";
+    private String pay_type;
 
     @ApiModelProperty(value = "退款金额",required = true)
     private String tx_amt;

+ 6 - 0
src/main/java/com/poteviohealth/ym/ipos/service/IPaymentService.java

@@ -66,6 +66,12 @@ public interface IPaymentService {
      */
      String payNotification(PayNotification payNotification);
 
+    /**
+     * 支付退款结果通知
+     * @param payNotification
+     * @return
+     */
+    String payReverseNotification(PayNotification payNotification);
 
     /**
      * 扫码下单交易

+ 23 - 0
src/main/java/com/poteviohealth/ym/ipos/service/impl/PaymentServiceImpl.java

@@ -145,6 +145,7 @@ public class PaymentServiceImpl implements IPaymentService {
         detail.setPay_type(paymentRecords.getPayType());
         detail.setTx_amt(refundReceive.getPrice().toString());
         detail.setOrg_pos_seq(refundReceive.getPayId().toString());
+        detail.setNotify_url(url+"/payReverseNotify");
         payReverse.setBarcode_reverse_request(detail);
         PayReverseBack back = null;
         try {
@@ -288,6 +289,28 @@ public class PaymentServiceImpl implements IPaymentService {
             return "success";
     }
 
+    @Override
+    public String payReverseNotification(PayNotification payNotification) {
+        /*QueryWrapper<PaymentRecords> queryMapper = new QueryWrapper<>();
+        queryMapper.eq("pay_id",payNotification.getPos_seq());
+        try {
+            PaymentRecords pr = paymentRecordsService.getOne(queryMapper);
+                //支付通知
+                if(!pr.getTransType().equals("2")){
+
+                }else{
+                    log.info("重复推送支付成功消息---"+pr.getPaySn());
+                }
+
+
+        }catch (Exception e){
+            e.printStackTrace();
+            return "fail";
+        }*/
+        return "success";
+
+    }
+
     @Override
     public VaultsResponse<String> scanPayOrder(PaymentRecords records) {
         BasicConfiguration basicConfig = Basic.getSystemParameter(records.getOperatorId());