Prechádzať zdrojové kódy

添加成功失败地址

llp 2 dní pred
rodič
commit
8ddc4d76b4

+ 4 - 4
packages/Longyi/Pay/AwxAfterpay/src/Http/Controllers/AfterpayController.php

@@ -88,11 +88,11 @@ class AfterpayController extends Controller
         $awxReturnResult = request()->input('awx_return_result');
         $orderId = request()->input('orderId');
         if ($awxReturnResult == 'success') {
-            session()->flash('order_id', $orderId);
-            return redirect()->route('shop.checkout.onepage.success');
+            return redirect()->to('/paymentresult/success?orderId=' . $orderId);
+        } else if ($awxReturnResult == 'cancel') {
+            return redirect()->to('/paymentresult/cancel?orderId=' . $orderId);
         } else {
-            session()->flash('error', 'klarna cancel');
-            return redirect()->route('shop.checkout.cart.index');
+            return redirect()->to('/paymentresult/failure?orderId=' . $orderId);
         }
     }
 

+ 1 - 0
packages/Longyi/Pay/AwxAfterpay/src/Payment/AwxAfterpay.php

@@ -55,6 +55,7 @@ class AwxAfterpay extends Payment
         $this->currentOrder = $order;
         return $this;
     }
+
     public function getOrder()
     {
         return $this->currentOrder;

+ 9 - 6
packages/Webkul/BagistoApi/src/Services/PaymentService.php

@@ -80,7 +80,7 @@ class PaymentService
             $this->validateExpressInitiation($cart, $input);
         } else {
             if(!$cart->shipping_method){
-                
+
                 if ($input->shippingMethod) {
 
                     if (! \Webkul\Shipping\Facades\Shipping::isMethodCodeExists($input->shippingMethod)) {
@@ -98,7 +98,7 @@ class PaymentService
             $cart = Cart::getCart();
         }
 
-      
+
 
         if (! $input->paymentMethod && ! $cart->payment?->method) {
             throw new OperationFailedException(__('bagistoapi::app.graphql.checkout.payment-method-required'));
@@ -242,7 +242,7 @@ class PaymentService
                 if (! $paymentMethodConfig || ! isset($paymentMethodConfig['class'])) {
                     throw new OperationFailedException(__('bagistoapi::app.graphql.checkout.invalid-payment-method'));
                 }
-    
+
                 if (! $order->payment) {
                     throw new OperationFailedException(__('bagistoapi::app.graphql.checkout.payment-method-required'));
                 }
@@ -252,7 +252,7 @@ class PaymentService
                 $order->refresh();
 
             }
-           
+
         }
 
         $gatewayOrderId = $this->createGatewayOrderForOrder($order);
@@ -409,7 +409,7 @@ class PaymentService
     protected function createGatewayOrder($cart, $order, PaymentInitiateInput $input, bool $express): ?string
     {
         $method = $cart->payment?->method ?? $order->payment?->method;
-        $gatewayHandler = $this->resolveGatewayHandler($method, $order);
+        $gatewayHandler = $this->resolveGatewayHandler($method, $order, $input);
         if ($gatewayHandler) {
            return $gatewayHandler->createGatewayOrder();
         } else {
@@ -479,7 +479,7 @@ class PaymentService
             return (string) $gatewayOrderId;
         }
     }
-    protected function resolveGatewayHandler(string $method, $order = null): ?object
+    protected function resolveGatewayHandler(string $method, $order = null, PaymentInitiateInput $input = null): ?object
     {
         $config = config("payment_methods.{$method}");
 
@@ -491,6 +491,9 @@ class PaymentService
             if (method_exists($handler, 'setOrder')) {
                 $handler->setOrder($order);
             }
+            if (method_exists($handler, 'setInput')) {
+                $handler->setInput($input);
+            }
             if (! method_exists($handler, 'createGatewayOrder')) {
                 Log::warning('Payment handler does not implement createGatewayOrder', [
                     'method' => $method,