Просмотр исходного кода

paymentservice 接受shippingMethod字段

fogwind 3 дней назад
Родитель
Сommit
4db6e6f84f
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      packages/Webkul/BagistoApi/src/Services/PaymentService.php

+ 7 - 0
packages/Webkul/BagistoApi/src/Services/PaymentService.php

@@ -79,10 +79,17 @@ class PaymentService
         if ($express) {
             $this->validateExpressInitiation($cart, $input);
         } else {
+              if ($input->shippingMethod) {
+                if (! Cart::saveShippingMethod($input->shippingMethod)) {
+                    throw new OperationFailedException(__('bagistoapi::app.graphql.checkout.shipping-method-save-failed'));
+                }
+                }
             $this->validateStandardInitiation($cart, $input);
             Cart::collectTotals();
         }
 
+      
+
         if (! $input->paymentMethod && ! $cart->payment?->method) {
             throw new OperationFailedException(__('bagistoapi::app.graphql.checkout.payment-method-required'));
         }