From 9e9ff8ed43998803e8b9a1964b40f78c6dbc47ea Mon Sep 17 00:00:00 2001 From: ivan-pugach-mondu <155441636+ivan-pugach-mondu@users.noreply.github.com> Date: Fri, 30 Aug 2024 15:43:28 +0300 Subject: [PATCH] PT-1842: Failed Webhook Attempts (#74) --- composer.json | 2 +- src/Components/MonduApi/Service/MonduClient.php | 4 ++-- .../PaymentMethod/PaymentHandler/MonduHandler.php | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 07bc7f4..2797798 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "mondu/shopware6-payment", "description": "Mondu payment for Shopware 6", - "version": "1.4.0", + "version": "1.4.1", "type": "shopware-platform-plugin", "license": "proprietary", "authors": [ diff --git a/src/Components/MonduApi/Service/MonduClient.php b/src/Components/MonduApi/Service/MonduClient.php index 4b19535..9f0642c 100644 --- a/src/Components/MonduApi/Service/MonduClient.php +++ b/src/Components/MonduApi/Service/MonduClient.php @@ -75,9 +75,9 @@ public function cancelOrder($orderUid): ?string return $response['order']['state'] ?? null; } - public function confirmOrder($orderUuid): ?string + public function confirmOrder($orderUuid, $data): ?string { - $response = $this->sendRequest('orders/'. $orderUuid .'/confirm', 'POST'); + $response = $this->sendRequest('orders/'. $orderUuid .'/confirm', 'POST', $data); return $response['order']['state'] ?? null; } diff --git a/src/Components/PaymentMethod/PaymentHandler/MonduHandler.php b/src/Components/PaymentMethod/PaymentHandler/MonduHandler.php index 8c3be02..e721def 100644 --- a/src/Components/PaymentMethod/PaymentHandler/MonduHandler.php +++ b/src/Components/PaymentMethod/PaymentHandler/MonduHandler.php @@ -64,7 +64,12 @@ public function finalize(AsyncPaymentTransactionStruct $transaction, Request $re if ($paymentState === self::PAYMENT_STATE_SUCCESS) { $paymentOrderUuid = $request->query->get('order_uuid'); - $confirmResponseState = $this->monduClient->setSalesChannelId($salesChannelContext->getSalesChannelId())->confirmOrder($paymentOrderUuid); + $confirmResponseState = $this->monduClient->setSalesChannelId( + $salesChannelContext->getSalesChannelId() + )->confirmOrder( + $paymentOrderUuid, + ['external_reference_id' => $transaction->getOrder()->getOrderNumber()] + ); if (!$this->isOrderConfirmed($confirmResponseState)) { throw new CustomerCanceledAsyncPaymentException(