Bladeren bron

Merge branch 'develop/v1.0' into master-test

Bob 1 week geleden
bovenliggende
commit
83d55000f2

+ 2 - 1
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/WebhookService.java

@@ -17,8 +17,9 @@ public interface WebhookService {
      * @param orderByTradeNo 订阅的前一笔订单对象(用于设置新订单的一些相同参数)
      * @param payTime
      * @param result
+     * @param oldPrice
      */
-    void handleSubsequentAutomaticDeduction(BigDecimal price, String thirdTradeNo, String thirdOrderId, OrdersVO orderByTradeNo, Integer payTime, String result);
+    void handleSubsequentAutomaticDeduction(BigDecimal price, String thirdTradeNo, String thirdOrderId, OrdersVO orderByTradeNo, Integer payTime, String result, BigDecimal oldPrice);
 
     /**
      * 查询订单详情(用于判断订阅是否已经支付完成)

+ 1 - 3
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/impl/AppStoreWebhookServiceImpl.java

@@ -2,12 +2,10 @@ package cn.kdan.cloud.pdf.office.payment.service.impl;
 
 import cn.kdan.cloud.pdf.office.api.payment.constant.OrderConstant;
 import cn.kdan.cloud.pdf.office.api.payment.vo.OrdersVO;
-import cn.kdan.cloud.pdf.office.api.product.vo.ProductVO;
 import cn.kdan.cloud.pdf.office.payment.service.*;
 import cn.kdan.cloud.pdf.office.payment.webhook.appstore.notification.JWSTransactionDecodedPayload;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -42,7 +40,7 @@ public class AppStoreWebhookServiceImpl implements AppStoreWebhookService {
         }
         OrdersVO ordersVONew = ordersVOS.get(0);
         BigDecimal price = BigDecimal.valueOf(jwsTransactionDecodedPayload.getPrice()/1000);
-        webhookService.handleSubsequentAutomaticDeduction(price, thirdTradeNo, thirdOrderId,ordersVONew,payTime, jwsTransactionDecodedPayload.toString());
+        webhookService.handleSubsequentAutomaticDeduction(price, thirdTradeNo, thirdOrderId,ordersVONew,payTime, jwsTransactionDecodedPayload.toString(),null );
     }
 
     @Override

+ 1 - 1
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/impl/GooglePayServiceImpl.java

@@ -306,7 +306,7 @@ public class GooglePayServiceImpl implements GooglePayService {
         if(orderByTradeNo.size()==1&&productVO.getCode().equals("advanced-annual-subscription-blackFive-trail")){
             price = productVO.getDisplayPrice();
         }
-        webhookService.handleSubsequentAutomaticDeduction(price, thirdTradeNo, thirdOrderId,ordersVONew, 1, subscriptionGoogleOrderV2.toString());
+        webhookService.handleSubsequentAutomaticDeduction(price, thirdTradeNo, thirdOrderId,ordersVONew, 1, subscriptionGoogleOrderV2.toString(),productVO.getPrice() );
     }
 
     @Override

+ 1 - 1
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/impl/PaddleWebhookServiceImpl.java

@@ -47,7 +47,7 @@ public class PaddleWebhookServiceImpl implements PaddleWebhookService {
             }
             //paddle第一次使用get Passthrough paddleWebhookDTO.getSubscriptionId()
             webhookService.handleSubsequentAutomaticDeduction(paddleWebhookDTO.getBalanceGross(),
-                    paddleWebhookDTO.getSubscriptionId(), paddleWebhookDTO.getOrderId(), ordersVOS.get(0), 1, null);
+                    paddleWebhookDTO.getSubscriptionId(), paddleWebhookDTO.getOrderId(), ordersVOS.get(0), 1, null,null );
         }
     }
 

+ 2 - 2
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/impl/PayCenterWebhookServiceImpl.java

@@ -351,9 +351,9 @@ public class PayCenterWebhookServiceImpl implements PayCenterWebhookService {
                         String price = ObjectUtils.isNotEmpty(ordersVO.getReducedPrice())? ordersVO.getReducedPrice().toEngineeringString() : ordersVO.getPrice().toEngineeringString();
                         String currencySign;
                         if (ordersVO.getPayment() == 1 || ordersVO.getPayment() == 2) {
-                            currencySign = "¥";
+                            currencySign = "CNY";
                         } else {
-                            currencySign = "$";
+                            currencySign = "USD";
                         }
                         contentMap.put("@payPrice@", currencySign + price);
                         contentMap.put("@renewPrice@", currencySign + price);

+ 1 - 1
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/impl/PayPalWebhookServiceImpl.java

@@ -55,7 +55,7 @@ public class PayPalWebhookServiceImpl implements PayPalWebhookService {
             }
             OrdersVO orderByTradeNo = ordersVOS.get(0);
             webhookService.handleSubsequentAutomaticDeduction(price, thirdTradeNo,
-                    thirdOrderId, orderByTradeNo, null, null);
+                    thirdOrderId, orderByTradeNo, null, null,null );
         }
     }
 

+ 6 - 2
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/impl/WebhookServiceImpl.java

@@ -99,7 +99,7 @@ public class WebhookServiceImpl implements WebhookService {
     private final PaddleClient paddleClient;
 
     @Override
-    public void handleSubsequentAutomaticDeduction(BigDecimal price, String thirdTradeNo, String thirdOrderId, OrdersVO orderByTradeNo, Integer payTime, String result) {
+    public void handleSubsequentAutomaticDeduction(BigDecimal price, String thirdTradeNo, String thirdOrderId, OrdersVO orderByTradeNo, Integer payTime, String result, BigDecimal oldPrice) {
         log.info("自动订阅业务处理开始(非首期)订单id:{}", thirdOrderId);
         String subId = CommonUtils.generateId();
         String orderId = cn.kdan.cloud.pdf.office.payment.utils.CommonUtils.generateRightsId((long) ((Math.random() * 9999 + 1) * 10000));;
@@ -108,7 +108,11 @@ public class WebhookServiceImpl implements WebhookService {
         BeanUtils.copyProperties(orderByTradeNo, createOrderManual);
         createOrderManual.setPaymentMethod(PaymentMethodEnum.fromValue(orderByTradeNo.getPayment()));
         // 设置实际扣费价格
-        createOrderManual.setPrice(price);
+        if(ObjectUtils.isNotEmpty(oldPrice)){
+            createOrderManual.setPrice(oldPrice);
+        }else {
+            createOrderManual.setPrice(price);
+        }
         createOrderManual.setReducedPrice(price);
         if(!StringUtils.isEmpty(orderByTradeNo.getCurrency())){
             createOrderManual.setCurrency(orderByTradeNo.getCurrency());