diff --git a/Model/PaymentMethods/AbstractMethod.php b/Model/PaymentMethods/AbstractMethod.php index fd7961f..5433d7c 100644 --- a/Model/PaymentMethods/AbstractMethod.php +++ b/Model/PaymentMethods/AbstractMethod.php @@ -303,6 +303,13 @@ public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount) $mageOrder = $payment->getOrder(); $quote = $this->quoteRepository->get($mageOrder->getQuoteId()); $worldPayPayment = $this->worldpaypaymentmodel->loadByPaymentId($quote->getReservedOrderId()); + $orderId = ''; + if($quote->getReservedOrderId()){ + $orderId = $quote->getReservedOrderId(); + }else{ + $orderId = $mageOrder->getIncrementId(); + } + $worldPayPayment = $this->worldpaypaymentmodel->loadByPaymentId($orderId); $paymenttype = $worldPayPayment->getPaymentType(); if ($this->paymentutils->CheckCaptureRequest($payment->getMethod(), $paymenttype)) { $this->paymentservicerequest->capture( diff --git a/Plugin/PaymentInformationManagement.php b/Plugin/PaymentInformationManagement.php index 1b2e58c..d17f512 100644 --- a/Plugin/PaymentInformationManagement.php +++ b/Plugin/PaymentInformationManagement.php @@ -74,7 +74,8 @@ public function aroundSavePaymentInformationAndPlaceOrder( $orderId = $this->cartManagement->placeOrder($cartId); } catch (LocalizedException $exception) { $this->logger->error($exception->getMessage()); - throw new CouldNotSaveException(__($exception->getMessage())); + //throw new CouldNotSaveException(__($exception->getMessage())); + throw new CouldNotSaveException(__('Mentioned card details are already saved, try with other card!'),$exception); } catch (\Exception $exception) { $this->logger->error($exception->getMessage()); throw new CouldNotSaveException( diff --git a/Worldpay User Document.pdf b/Worldpay User Document.pdf index f048339..fc8d552 100644 Binary files a/Worldpay User Document.pdf and b/Worldpay User Document.pdf differ diff --git a/view/frontend/web/js/view/payment/method-renderer/cc-method.js b/view/frontend/web/js/view/payment/method-renderer/cc-method.js index e3e0ce4..2fb1cd6 100644 --- a/view/frontend/web/js/view/payment/method-renderer/cc-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/cc-method.js @@ -122,6 +122,7 @@ define( function (apiresponse) { var response = JSON.parse(apiresponse); if(response.length){ + if(savedcardlists.length > 0){ for (var key in savedcardlists) { var method = savedcardlists[key]['method']; var found = false; @@ -136,6 +137,7 @@ define( filtercards.push(savedcardlists[key]); } } + } for (var responsekey in response) { var found = false;