tangxiangan преди 4 месеца
родител
ревизия
f8816b4a5a

+ 3 - 0
pdf-office-api/pdf-office-api-payment/src/main/java/cn/kdan/cloud/pdf/office/api/payment/vo/OrdersVO.java

@@ -131,4 +131,7 @@ public class OrdersVO implements Serializable {
 
     private String simplifiedChineseName;
     private String traditionalChineseName;
+
+    private String currency;
+
 }

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

@@ -127,7 +127,7 @@ public class AppStoreServiceImpl implements AppStoreService {
             CreateOrderManualDTO orderManualDTO = CreateOrderManualDTO.builder()
                     .thirdTradeNo(originalTransactionId)
                     .thirdOrderNo(transactionId)
-                    .price(product.getPrice())
+                    .price(currency.equals("cny")?product.getCnyPrice():product.getPrice())
                     .reducedPrice(price)
                     .subscriptionId(subscriptionId)
                     .userId(equityVerificationDTO.getUserId())

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

@@ -10,6 +10,7 @@ import cn.kdan.cloud.pdf.office.payment.properties.AppStoreProperties;
 import cn.kdan.cloud.pdf.office.payment.service.*;
 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;
@@ -44,7 +45,13 @@ public class AppStoreWebhookServiceImpl implements AppStoreWebhookService {
         }
         OrdersVO ordersVONew = ordersVOS.get(0);
         ProductVO productVO = ordersService.getProduct(ordersVONew.getProductId());
-        webhookService.handleSubsequentAutomaticDeduction(productVO.getPrice(), thirdTradeNo, thirdOrderId,ordersVONew,payTime);
+        BigDecimal price;
+        if(StringUtils.isNotEmpty(ordersVONew.getCurrency())&&ordersVONew.getCurrency().equals("USD")){
+            price = productVO.getPrice();
+        }else{
+            price = productVO.getCnyPrice();
+        }
+        webhookService.handleSubsequentAutomaticDeduction(price, thirdTradeNo, thirdOrderId,ordersVONew,payTime);
     }
 
     @Override

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

@@ -303,7 +303,7 @@ public class GooglePayServiceImpl implements GooglePayService {
         }
         OrdersVO ordersVONew = orderByTradeNo.get(0);
         ProductVO productVO = orderService.getProduct(ordersVONew.getProductId());
-        //todo 价格怎么办
+
         webhookService.handleSubsequentAutomaticDeduction(productVO.getPrice(), thirdTradeNo, thirdOrderId,ordersVONew, 1);
     }
 

+ 1 - 1
pdf-office-payment/src/main/resources/mapper/OrderMapper.xml

@@ -46,7 +46,7 @@
             ,type
             ,detail_type
             ,user_id
-            ,email,discount_type,subscription_type,payment_model
+            ,email,discount_type,subscription_type,payment_model,currency
         from `order`
         where third_trade_no = #{tradeNo}
         order by created_at desc