Browse Source

paymentservice 接受shippingMethod字段

fogwind 3 days ago
parent
commit
4db6e6f84f
1 changed files with 7 additions and 0 deletions
  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) {
         if ($express) {
             $this->validateExpressInitiation($cart, $input);
             $this->validateExpressInitiation($cart, $input);
         } else {
         } else {
+              if ($input->shippingMethod) {
+                if (! Cart::saveShippingMethod($input->shippingMethod)) {
+                    throw new OperationFailedException(__('bagistoapi::app.graphql.checkout.shipping-method-save-failed'));
+                }
+                }
             $this->validateStandardInitiation($cart, $input);
             $this->validateStandardInitiation($cart, $input);
             Cart::collectTotals();
             Cart::collectTotals();
         }
         }
 
 
+      
+
         if (! $input->paymentMethod && ! $cart->payment?->method) {
         if (! $input->paymentMethod && ! $cart->payment?->method) {
             throw new OperationFailedException(__('bagistoapi::app.graphql.checkout.payment-method-required'));
             throw new OperationFailedException(__('bagistoapi::app.graphql.checkout.payment-method-required'));
         }
         }