|
|
@@ -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,
|