|
|
@@ -235,6 +235,26 @@ class PaymentService
|
|
|
throw new OperationFailedException(__('bagistoapi::app.graphql.payment.not-pending', ['status' => $order->status]));
|
|
|
}
|
|
|
|
|
|
+ if ($input->paymentMethod) {
|
|
|
+ if(!$order->payment->method!=$input->paymentMethod){
|
|
|
+
|
|
|
+ $paymentMethodConfig = config('payment_methods.'.$input->paymentMethod);
|
|
|
+ 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'));
|
|
|
+ }
|
|
|
+ $order->payment->method = $input->paymentMethod;
|
|
|
+ $order->payment->method_title = core()->getConfigData('sales.payment_methods.'.$input->paymentMethod.'.title');
|
|
|
+ $order->payment->save();
|
|
|
+ $order->refresh();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
$gatewayOrderId = $this->createGatewayOrderForOrder($order);
|
|
|
|
|
|
$this->writeGatewayOrderId($order, $gatewayOrderId);
|