From 40f3bf09d2c43a5d076e7996bbda96f1cc123b84 Mon Sep 17 00:00:00 2001 From: Andrii Onufriichuk Date: Mon, 20 May 2024 10:42:32 +0300 Subject: [PATCH 1/8] Added payment void on order placement failure --- Gateway/Command/VoidPayment.php | 2 +- Model/SdkProxy.php | 4 ++-- Plugin/PaymentVoid.php | 2 +- Service/Capture.php | 11 +++++++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Gateway/Command/VoidPayment.php b/Gateway/Command/VoidPayment.php index e1e612a1..b55ca4af 100644 --- a/Gateway/Command/VoidPayment.php +++ b/Gateway/Command/VoidPayment.php @@ -83,7 +83,7 @@ public function execute(array $commandSubject) list($rvvupOrderId, $paymentId) = $this->getRvvupData($payment); if ($paymentId) { - $this->sdkProxy->voidPayment($rvvupOrderId, $paymentId); + $this->sdkProxy->voidPayment($rvvupOrderId, $paymentId, 'MERCHANT_REQUEST'); } $orderState = $order->getState(); diff --git a/Model/SdkProxy.php b/Model/SdkProxy.php index 0f66fad1..7b6e2792 100644 --- a/Model/SdkProxy.php +++ b/Model/SdkProxy.php @@ -167,9 +167,9 @@ public function isOrderVoidable($orderId) /** * {@inheritdoc} */ - public function voidPayment($orderId, $paymentId) + public function voidPayment(string $orderId, string $paymentId, string $reason = null) { - return $this->getSubject()->voidPayment($orderId, $paymentId); + return $this->getSubject()->voidPayment($orderId, $paymentId, $reason); } /** diff --git a/Plugin/PaymentVoid.php b/Plugin/PaymentVoid.php index b146fce2..16c0c72a 100644 --- a/Plugin/PaymentVoid.php +++ b/Plugin/PaymentVoid.php @@ -48,7 +48,7 @@ public function aroundVoid(Payment $subject, callable $proceed, DataObject $docu $method = $subject->getMethodInstance(); $method->setStore($order->getStoreId()); $method->void($subject); - $message = __('Voided authorization for Rvvup Payment link'); + $message = __('Voided authorization for ' . $subject->getMethodInstance()->getTitle()); $order->addCommentToStatusHistory($message); $this->eventManager->dispatch('sales_order_payment_void', ['payment' => $this, 'invoice' => $document]); return $subject; diff --git a/Service/Capture.php b/Service/Capture.php index 732e9097..cc056837 100644 --- a/Service/Capture.php +++ b/Service/Capture.php @@ -255,6 +255,17 @@ public function createOrder(string $rvvupId, Quote $quote, string $origin): Vali $quote->getReservedOrderId(), $origin ); + + if ($this->sdkProxy->isOrderVoidable($rvvupId)) { + $rvvupPaymentId = $payment->getAdditionalInformation(Method::PAYMENT_ID); + $reason = 'INVALID_DATA'; + if ($e->getMessage() == 'Some of the products are out of stock.') { + $reason = 'STOCK_ISSUES'; + } + + $this->sdkProxy->voidPayment($rvvupId, $rvvupPaymentId, $reason); + } + return $this->validationInterfaceFactory->create( [ 'data' => [ From a6522b1c921dd528de1ae026a1eb47d2009b45a9 Mon Sep 17 00:00:00 2001 From: Andrii Onufriichuk Date: Tue, 21 May 2024 11:41:10 +0300 Subject: [PATCH 2/8] Added card fields to order grid for rvvup pbc orders --- Observer/Model/ProcessOrder/CardsMetadata.php | 39 +++++++---- Ui/Component/Listing/Column/Data.php | 64 +++++++++++++++++++ .../ui_component/sales_order_grid.xml | 34 ++++++++++ 3 files changed, 124 insertions(+), 13 deletions(-) create mode 100644 Ui/Component/Listing/Column/Data.php create mode 100644 view/adminhtml/ui_component/sales_order_grid.xml diff --git a/Observer/Model/ProcessOrder/CardsMetadata.php b/Observer/Model/ProcessOrder/CardsMetadata.php index 6da14ef6..687f3547 100644 --- a/Observer/Model/ProcessOrder/CardsMetadata.php +++ b/Observer/Model/ProcessOrder/CardsMetadata.php @@ -6,9 +6,12 @@ use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; +use Magento\Framework\Exception\LocalizedException; use Magento\Sales\Api\Data\OrderStatusHistoryInterfaceFactory; use Magento\Sales\Api\OrderManagementInterface; use Magento\Sales\Api\OrderRepositoryInterface; +use Magento\Sales\Model\Order\Payment; +use Magento\Sales\Model\ResourceModel\Order\Payment as PaymentResource; use Psr\Log\LoggerInterface; class CardsMetadata implements ObserverInterface @@ -25,21 +28,27 @@ class CardsMetadata implements ObserverInterface /** @var OrderManagementInterface $orderManagement */ private $orderManagement; + /** @var PaymentResource */ + private $paymentResource; + /** - * @param OrderRepositoryInterface $orderRepository + * @param OrderRepositoryInterface $orderRepository * @param OrderStatusHistoryInterfaceFactory $orderStatusHistoryFactory - * @param OrderManagementInterface $orderManagement - * @param LoggerInterface $logger + * @param OrderManagementInterface $orderManagement + * @param PaymentResource $paymentResource + * @param LoggerInterface $logger */ public function __construct( - OrderRepositoryInterface $orderRepository, - OrderStatusHistoryInterfaceFactory $orderStatusHistoryFactory, - OrderManagementInterface $orderManagement, - LoggerInterface $logger + OrderRepositoryInterface $orderRepository, + OrderStatusHistoryInterfaceFactory $orderStatusHistoryFactory, + OrderManagementInterface $orderManagement, + PaymentResource $paymentResource, + LoggerInterface $logger ) { $this->orderRepository = $orderRepository; $this->orderStatusHistoryFactory = $orderStatusHistoryFactory; $this->orderManagement = $orderManagement; + $this->paymentResource = $paymentResource; $this->logger = $logger; } @@ -53,7 +62,7 @@ public function execute(Observer $observer) { $orderId = $observer->getData('order_id'); $rvvupData = $observer->getData('rvvup_data'); - $payment = $rvvupData['payments'][0]; + $paymentData = $rvvupData['payments'][0]; $order = $this->orderRepository->get($orderId); if ($order->getPayment()->getMethod() == 'rvvup_CARD') { $data = []; @@ -67,9 +76,11 @@ public function execute(Observer $observer) 'acquirerResponseMessage' ]; + $payment = $order->getPayment(); foreach ($keys as $key) { - $this->populateCardData($data, $payment, $key); + $this->populateCardData($data, $paymentData, $key, $payment); } + $this->paymentResource->save($payment); if (!empty($data)) { try { @@ -91,14 +102,16 @@ public function execute(Observer $observer) /** * @param array $data - * @param array $payment + * @param array $paymentData * @param string $key * @return void + * @throws LocalizedException */ - private function populateCardData(array &$data, array $payment, string $key): void + private function populateCardData(array &$data, array $paymentData, string $key, Payment $payment): void { - if (isset($payment[$key])) { - $value = $this->mapCardValue($payment[$key]); + if (isset($paymentData[$key])) { + $value = $this->mapCardValue($paymentData[$key]); + $payment->setAdditionalInformation('rvvup_' . $key, $value); $data[$key] = $key . ': ' . $value; } } diff --git a/Ui/Component/Listing/Column/Data.php b/Ui/Component/Listing/Column/Data.php new file mode 100644 index 00000000..dde1b545 --- /dev/null +++ b/Ui/Component/Listing/Column/Data.php @@ -0,0 +1,64 @@ +orderRepository = $orderRepository; + $this->cache = $cache; + parent::__construct($context, $uiComponentFactory, $components, $data); + } + + public function prepareDataSource(array $dataSource) + { + if (isset($dataSource['data']['items'])) { + foreach ($dataSource['data']['items'] as & $item) { + if (isset($item['payment_method'])) { + $id = $item["entity_id"] . '_' . $this->getData('name'); + + if ($this->cache->load($id) != null) { + $item[$this->getData('name')] = $this->cache->load($id); + continue; + } + + if (strpos($item['payment_method'], 'rvvup_YAPILY') == 0) { + $order = $this->orderRepository->get($item["entity_id"]); + $payment = $order->getPayment(); + $value = $payment->getAdditionalInformation($this->getData('name')) ?? ''; + $item[$this->getData('name')] = $value; + $this->cache->save($value, $id); + } else { + $this->cache->save('', $id); + } + } + } + } + return $dataSource; + } +} diff --git a/view/adminhtml/ui_component/sales_order_grid.xml b/view/adminhtml/ui_component/sales_order_grid.xml new file mode 100644 index 00000000..d0141b52 --- /dev/null +++ b/view/adminhtml/ui_component/sales_order_grid.xml @@ -0,0 +1,34 @@ + ++ + + + + ui/grid/cells/html + false + + + + + + ui/grid/cells/html + false + + + + + + ui/grid/cells/html + false + + + + + + ui/grid/cells/html + false + + + + From 2a30b6ace7cd2a5a75f12b342224def2251a8f63 Mon Sep 17 00:00:00 2001 From: Andrii Onufriichuk Date: Tue, 21 May 2024 11:46:05 +0300 Subject: [PATCH 3/8] PHPCs fix --- Observer/Model/ProcessOrder/CardsMetadata.php | 1 + Ui/Component/Listing/Column/Data.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Observer/Model/ProcessOrder/CardsMetadata.php b/Observer/Model/ProcessOrder/CardsMetadata.php index 687f3547..d52fe46d 100644 --- a/Observer/Model/ProcessOrder/CardsMetadata.php +++ b/Observer/Model/ProcessOrder/CardsMetadata.php @@ -104,6 +104,7 @@ public function execute(Observer $observer) * @param array $data * @param array $paymentData * @param string $key + * @param Payment $payment * @return void * @throws LocalizedException */ diff --git a/Ui/Component/Listing/Column/Data.php b/Ui/Component/Listing/Column/Data.php index dde1b545..ecf095f5 100644 --- a/Ui/Component/Listing/Column/Data.php +++ b/Ui/Component/Listing/Column/Data.php @@ -14,6 +14,9 @@ class Data extends Column /** @var OrderRepositoryInterface */ private $orderRepository; + /** @var CacheInterface */ + private $cache; + /** * @param ContextInterface $context * @param UiComponentFactory $uiComponentFactory From b3c6125e06e8caf9fbc320454372b05f79a8bc82 Mon Sep 17 00:00:00 2001 From: Andrii Onufriichuk Date: Tue, 21 May 2024 11:48:49 +0300 Subject: [PATCH 4/8] PHPCs fix --- Ui/Component/Listing/Column/Data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ui/Component/Listing/Column/Data.php b/Ui/Component/Listing/Column/Data.php index ecf095f5..24b3677f 100644 --- a/Ui/Component/Listing/Column/Data.php +++ b/Ui/Component/Listing/Column/Data.php @@ -50,7 +50,7 @@ public function prepareDataSource(array $dataSource) continue; } - if (strpos($item['payment_method'], 'rvvup_YAPILY') == 0) { + if (strpos($item['payment_method'], 'rvvup_YAPILY') === 0) { $order = $this->orderRepository->get($item["entity_id"]); $payment = $order->getPayment(); $value = $payment->getAdditionalInformation($this->getData('name')) ?? ''; From fbdd612e160345b58f96588b6b1c3b5de46fd683 Mon Sep 17 00:00:00 2001 From: Andrii Onufriichuk Date: Tue, 21 May 2024 12:29:12 +0300 Subject: [PATCH 5/8] Fix using wrong payment method name --- Ui/Component/Listing/Column/Data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ui/Component/Listing/Column/Data.php b/Ui/Component/Listing/Column/Data.php index 24b3677f..6aa03fd3 100644 --- a/Ui/Component/Listing/Column/Data.php +++ b/Ui/Component/Listing/Column/Data.php @@ -50,7 +50,7 @@ public function prepareDataSource(array $dataSource) continue; } - if (strpos($item['payment_method'], 'rvvup_YAPILY') === 0) { + if (strpos($item['payment_method'], 'rvvup_CARD') === 0) { $order = $this->orderRepository->get($item["entity_id"]); $payment = $order->getPayment(); $value = $payment->getAdditionalInformation($this->getData('name')) ?? ''; From e87d002d2c2dc69d9ad25757caa2b46a11f5c0ad Mon Sep 17 00:00:00 2001 From: Andrii Onufriichuk Date: Mon, 27 May 2024 14:46:23 +0300 Subject: [PATCH 6/8] Added images to Rvvup Card payments --- Observer/Model/ProcessOrder/CardsMetadata.php | 2 +- Ui/Component/Listing/Column/Data.php | 73 +++++++++++++++++-- .../ui_component/sales_order_grid.xml | 28 +++++-- view/adminhtml/web/images/green.svg | 4 + view/adminhtml/web/images/grey.svg | 6 ++ view/adminhtml/web/images/red.svg | 12 +++ 6 files changed, 111 insertions(+), 14 deletions(-) create mode 100644 view/adminhtml/web/images/green.svg create mode 100644 view/adminhtml/web/images/grey.svg create mode 100644 view/adminhtml/web/images/red.svg diff --git a/Observer/Model/ProcessOrder/CardsMetadata.php b/Observer/Model/ProcessOrder/CardsMetadata.php index d52fe46d..610a72e0 100644 --- a/Observer/Model/ProcessOrder/CardsMetadata.php +++ b/Observer/Model/ProcessOrder/CardsMetadata.php @@ -112,7 +112,7 @@ private function populateCardData(array &$data, array $paymentData, string $key, { if (isset($paymentData[$key])) { $value = $this->mapCardValue($paymentData[$key]); - $payment->setAdditionalInformation('rvvup_' . $key, $value); + $payment->setAdditionalInformation('rvvup_' . $key, $paymentData[$key]); $data[$key] = $key . ': ' . $value; } } diff --git a/Ui/Component/Listing/Column/Data.php b/Ui/Component/Listing/Column/Data.php index 6aa03fd3..3e689b97 100644 --- a/Ui/Component/Listing/Column/Data.php +++ b/Ui/Component/Listing/Column/Data.php @@ -4,6 +4,8 @@ namespace Rvvup\Payments\Ui\Component\Listing\Column; use Magento\Framework\App\CacheInterface; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\View\Asset\Repository; use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Framework\View\Element\UiComponent\ContextInterface; use Magento\Framework\View\Element\UiComponentFactory; @@ -11,17 +13,31 @@ class Data extends Column { + private const RVVUP_PAYMENTS_IMAGES_GREEN_SVG = 'Rvvup_Payments::images/green.svg'; + private const RVVUP_PAYMENTS_IMAGES_GREY_SVG = 'Rvvup_Payments::images/grey.svg'; + private const RVVUP_PAYMENTS_IMAGES_RED_SVG = 'Rvvup_Payments::images/red.svg'; + /** @var OrderRepositoryInterface */ private $orderRepository; /** @var CacheInterface */ private $cache; + /** @var Repository */ + private $assetRepo; + + /** + * @var RequestInterface + */ + protected $request; + /** * @param ContextInterface $context * @param UiComponentFactory $uiComponentFactory * @param OrderRepositoryInterface $orderRepository * @param CacheInterface $cache + * @param Repository $assetRepo + * @param RequestInterface $request * @param array $components * @param array $data */ @@ -30,31 +46,38 @@ public function __construct( UiComponentFactory $uiComponentFactory, OrderRepositoryInterface $orderRepository, CacheInterface $cache, + Repository $assetRepo, + RequestInterface $request, array $components = [], array $data = [] ) { $this->orderRepository = $orderRepository; $this->cache = $cache; + $this->assetRepo = $assetRepo; + $this->request = $request; parent::__construct($context, $uiComponentFactory, $components, $data); } - public function prepareDataSource(array $dataSource) + public function prepareDataSource(array $dataSource): array { if (isset($dataSource['data']['items'])) { foreach ($dataSource['data']['items'] as & $item) { if (isset($item['payment_method'])) { - $id = $item["entity_id"] . '_' . $this->getData('name'); + $field = $this->getData('name'); + $id = $item["entity_id"] . '_' . $field; if ($this->cache->load($id) != null) { - $item[$this->getData('name')] = $this->cache->load($id); + $value = $this->cache->load($id); + $item[$field . '_src'] = $value; continue; } if (strpos($item['payment_method'], 'rvvup_CARD') === 0) { $order = $this->orderRepository->get($item["entity_id"]); $payment = $order->getPayment(); - $value = $payment->getAdditionalInformation($this->getData('name')) ?? ''; - $item[$this->getData('name')] = $value; + $value = $payment->getAdditionalInformation($field) ?? ''; + $value = $this->getImagePath($field, $value); + $item[$field . '_src'] = $value; $this->cache->save($value, $id); } else { $this->cache->save('', $id); @@ -64,4 +87,44 @@ public function prepareDataSource(array $dataSource) } return $dataSource; } + + /** + * @param string $field + * @param string $value + * @return string + */ + private function getImagePath(string $field, string $value): string + { + if ($field === 'rvvup_eci') { + if ($value == '05' || $value == '02') { + $value = $this->getViewFileUrl(self::RVVUP_PAYMENTS_IMAGES_GREEN_SVG); + } else { + $value = $this->getViewFileUrl(self::RVVUP_PAYMENTS_IMAGES_GREY_SVG); + } + } else { + switch ($value) { + case 2: + $value = $this->getViewFileUrl(self::RVVUP_PAYMENTS_IMAGES_GREEN_SVG); + break; + case 4: + $value = $this->getViewFileUrl(self::RVVUP_PAYMENTS_IMAGES_RED_SVG); + break; + case 0: + case 1: + default: + $value = $this->getViewFileUrl(self::RVVUP_PAYMENTS_IMAGES_GREY_SVG); + } + } + return $value; + } + + /** + * @param string $fileId + * @return string + */ + public function getViewFileUrl(string $fileId): string + { + $params = array_merge(['_secure' => $this->request->isSecure()], []); + return $this->assetRepo->getUrlWithParams($fileId, $params); + } } diff --git a/view/adminhtml/ui_component/sales_order_grid.xml b/view/adminhtml/ui_component/sales_order_grid.xml index d0141b52..c0e24499 100644 --- a/view/adminhtml/ui_component/sales_order_grid.xml +++ b/view/adminhtml/ui_component/sales_order_grid.xml @@ -2,32 +2,44 @@ - + - ui/grid/cells/html + 1 false + false - + - ui/grid/cells/html + 1 false + false - + - ui/grid/cells/html + 1 false + false - + - ui/grid/cells/html + 1 false + false diff --git a/view/adminhtml/web/images/green.svg b/view/adminhtml/web/images/green.svg new file mode 100644 index 00000000..46f75d76 --- /dev/null +++ b/view/adminhtml/web/images/green.svg @@ -0,0 +1,4 @@ + + + + diff --git a/view/adminhtml/web/images/grey.svg b/view/adminhtml/web/images/grey.svg new file mode 100644 index 00000000..f6ee0beb --- /dev/null +++ b/view/adminhtml/web/images/grey.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/view/adminhtml/web/images/red.svg b/view/adminhtml/web/images/red.svg new file mode 100644 index 00000000..79a45c3c --- /dev/null +++ b/view/adminhtml/web/images/red.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + From 851dc616c7420c3e79994ca726c6b0e0c5e0feb9 Mon Sep 17 00:00:00 2001 From: Andrii Onufriichuk Date: Tue, 28 May 2024 11:46:02 +0300 Subject: [PATCH 7/8] Revert "Change 'cancel payment links' behavior (#127)" This reverts commit 6f0916fe61ae8bdd29ab89f20e9e414d1a798848. --- Gateway/Command/Cancel.php | 2 +- Service/VirtualCheckout.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Gateway/Command/Cancel.php b/Gateway/Command/Cancel.php index 84b8ae25..24978b2d 100644 --- a/Gateway/Command/Cancel.php +++ b/Gateway/Command/Cancel.php @@ -61,7 +61,7 @@ public function execute(array $commandSubject) $paymentLinkId = $payment->getAdditionalInformation(Method::PAYMENT_LINK_ID); $storeId = $commandSubject['payment']->getOrder()->getStoreId(); - $this->paymentLinkService->cancelPaymentLink((string)$storeId, $paymentLinkId); + $this->paymentLinkService->cancelPaymentLink($storeId, $paymentLinkId); $message = __('Canceled Rvvup Payment Link online'); $orderPayment->getOrder()->addCommentToStatusHistory($message, false, false); diff --git a/Service/VirtualCheckout.php b/Service/VirtualCheckout.php index 8a271247..cb5c58d8 100644 --- a/Service/VirtualCheckout.php +++ b/Service/VirtualCheckout.php @@ -223,6 +223,16 @@ private function processResponse(string $orderId, array $body): void $order = $this->orderRepository->get($orderId); $payment = $this->paymentLinkService->getQuotePaymentByOrder($order); $payment->setAdditionalInformation(Method::MOTO_ID, $motoId); + + if ($payment->getAdditionalInformation(Method::PAYMENT_LINK_ID)) { + $paymentLinkId = $payment->getAdditionalInformation(Method::PAYMENT_LINK_ID); + } elseif ($order->getPayment()->getAdditionalInformation(Method::PAYMENT_LINK_ID)) { + $paymentLinkId = $order->getPayment()->getAdditionalInformation(Method::PAYMENT_LINK_ID); + } + if (isset($paymentLinkId)) { + $this->paymentLinkService->cancelPaymentLink((string)$order->getStoreId(), $paymentLinkId); + } + $this->paymentResource->save($payment); } catch (\Exception $e) { $this->logger->error( From a45fc02524202b2068a5b01b0271ab0f4c09ca43 Mon Sep 17 00:00:00 2001 From: Andrii Onufriichuk Date: Tue, 28 May 2024 11:47:07 +0300 Subject: [PATCH 8/8] Revert "Added payment void on order placement failure" This reverts commit 40f3bf09d2c43a5d076e7996bbda96f1cc123b84. --- Gateway/Command/VoidPayment.php | 2 +- Model/SdkProxy.php | 4 ++-- Plugin/PaymentVoid.php | 2 +- Service/Capture.php | 11 ----------- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Gateway/Command/VoidPayment.php b/Gateway/Command/VoidPayment.php index b55ca4af..e1e612a1 100644 --- a/Gateway/Command/VoidPayment.php +++ b/Gateway/Command/VoidPayment.php @@ -83,7 +83,7 @@ public function execute(array $commandSubject) list($rvvupOrderId, $paymentId) = $this->getRvvupData($payment); if ($paymentId) { - $this->sdkProxy->voidPayment($rvvupOrderId, $paymentId, 'MERCHANT_REQUEST'); + $this->sdkProxy->voidPayment($rvvupOrderId, $paymentId); } $orderState = $order->getState(); diff --git a/Model/SdkProxy.php b/Model/SdkProxy.php index 7b6e2792..0f66fad1 100644 --- a/Model/SdkProxy.php +++ b/Model/SdkProxy.php @@ -167,9 +167,9 @@ public function isOrderVoidable($orderId) /** * {@inheritdoc} */ - public function voidPayment(string $orderId, string $paymentId, string $reason = null) + public function voidPayment($orderId, $paymentId) { - return $this->getSubject()->voidPayment($orderId, $paymentId, $reason); + return $this->getSubject()->voidPayment($orderId, $paymentId); } /** diff --git a/Plugin/PaymentVoid.php b/Plugin/PaymentVoid.php index 16c0c72a..b146fce2 100644 --- a/Plugin/PaymentVoid.php +++ b/Plugin/PaymentVoid.php @@ -48,7 +48,7 @@ public function aroundVoid(Payment $subject, callable $proceed, DataObject $docu $method = $subject->getMethodInstance(); $method->setStore($order->getStoreId()); $method->void($subject); - $message = __('Voided authorization for ' . $subject->getMethodInstance()->getTitle()); + $message = __('Voided authorization for Rvvup Payment link'); $order->addCommentToStatusHistory($message); $this->eventManager->dispatch('sales_order_payment_void', ['payment' => $this, 'invoice' => $document]); return $subject; diff --git a/Service/Capture.php b/Service/Capture.php index cc056837..732e9097 100644 --- a/Service/Capture.php +++ b/Service/Capture.php @@ -255,17 +255,6 @@ public function createOrder(string $rvvupId, Quote $quote, string $origin): Vali $quote->getReservedOrderId(), $origin ); - - if ($this->sdkProxy->isOrderVoidable($rvvupId)) { - $rvvupPaymentId = $payment->getAdditionalInformation(Method::PAYMENT_ID); - $reason = 'INVALID_DATA'; - if ($e->getMessage() == 'Some of the products are out of stock.') { - $reason = 'STOCK_ISSUES'; - } - - $this->sdkProxy->voidPayment($rvvupId, $rvvupPaymentId, $reason); - } - return $this->validationInterfaceFactory->create( [ 'data' => [