From e1230a465e8b82cf6f169d27a62f7da8ea90e013 Mon Sep 17 00:00:00 2001 From: Alejandro Sosa Date: Wed, 10 Jul 2024 09:56:58 +0200 Subject: [PATCH] Release 2.0.41 --- README.md | 4 ++-- docs/en/documentation.html | 2 +- meta/documents/changelog_de.md | 5 +++++ meta/documents/changelog_en.md | 5 +++++ plugin.json | 2 +- resources/views/Failure.twig | 2 +- src/Controllers/PaymentProcessController.php | 18 ++++++++++++++---- src/Services/PaymentService.php | 12 +++++++++--- 8 files changed, 38 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6d36672..c337c9c 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ This repository contains the plentymarkets extension that enables to process pay ## Documentation -* [Documentation](https://plugin-documentation.wallee.com/wallee-payment/plentymarkets/2.0.40/docs/en/documentation.html) +* [Documentation](https://plugin-documentation.wallee.com/wallee-payment/plentymarkets/2.0.41/docs/en/documentation.html) ## License -Please see the [license file](https://github.com/wallee-payment/plentymarkets/blob/2.0.40/LICENSE) for more information. \ No newline at end of file +Please see the [license file](https://github.com/wallee-payment/plentymarkets/blob/2.0.41/LICENSE) for more information. \ No newline at end of file diff --git a/docs/en/documentation.html b/docs/en/documentation.html index d5d22e8..6ee8e36 100644 --- a/docs/en/documentation.html +++ b/docs/en/documentation.html @@ -23,7 +23,7 @@

Documentation

  • - + Source
  • diff --git a/meta/documents/changelog_de.md b/meta/documents/changelog_de.md index 4228c69..57684db 100644 --- a/meta/documents/changelog_de.md +++ b/meta/documents/changelog_de.md @@ -1,5 +1,10 @@ # Release Notes for wallee +## v2.0.41 (2024-07-10) + +## Fixed +- Die Spracheinstellungen bei der Weiterleitung wurden korrigiert, um eine korrekte Lokalisierung zu gewährleisten. + ## v2.0.38 (2023-11-28) ### Fixed diff --git a/meta/documents/changelog_en.md b/meta/documents/changelog_en.md index 80fb1d2..7e9324d 100644 --- a/meta/documents/changelog_en.md +++ b/meta/documents/changelog_en.md @@ -1,5 +1,10 @@ # Release Notes for wallee +## v2.0.41 (2024-07-10) + +## Fixed +- Corrected language settings during redirection to ensure proper localization. + ## v2.0.38 (2023-11-28) ### Fixed diff --git a/plugin.json b/plugin.json index b947197..8d3f96b 100644 --- a/plugin.json +++ b/plugin.json @@ -6,7 +6,7 @@ }, "namespace": "Wallee", "type": "payment", - "version": "2.0.40", + "version": "2.0.41", "license": " Apache License Version 2", "isClosedSource": false, "pluginIcon": "icon_plugin_md.png", diff --git a/resources/views/Failure.twig b/resources/views/Failure.twig index df3b33d..539232e 100644 --- a/resources/views/Failure.twig +++ b/resources/views/Failure.twig @@ -124,7 +124,7 @@ {% if allowSwitchPaymentMethod %} -
    +
    diff --git a/src/Controllers/PaymentProcessController.php b/src/Controllers/PaymentProcessController.php index 5c98d67..d1384d6 100644 --- a/src/Controllers/PaymentProcessController.php +++ b/src/Controllers/PaymentProcessController.php @@ -172,8 +172,12 @@ public function failTransaction(Twig $twig, int $id) $transaction = $this->sdkService->call('getTransaction', [ 'id' => $id ]); + // Get the current language from session storage + $lang = $this->sessionStorage->getLang(); + if (is_array($transaction) && isset($transaction['error'])) { - return $this->response->redirectTo('confirmation'); + $confirmUrl = sprintf('%s/confirmation', $lang); + return $this->response->redirectTo($confirmUrl); } $payments = $this->paymentRepository->getPaymentsByPropertyTypeAndValue(PaymentProperty::TYPE_TRANSACTION_ID, $transaction['id']); @@ -205,7 +209,8 @@ public function failTransaction(Twig $twig, int $id) 'totals' => pluginApp(OrderTotalsService::class)->getAllTotals($order->order), 'currentPaymentMethodId' => $paymentMethodId, 'allowSwitchPaymentMethod' => $this->allowSwitchPaymentMethod($order->order->id), - 'paymentMethodListForSwitch' => $this->getPaymentMethodListForSwitch($paymentMethodId, $order->order->id) + 'paymentMethodListForSwitch' => $this->getPaymentMethodListForSwitch($paymentMethodId, $order->order->id), + 'payOrderFormUrl' => sprintf('/%s/wallee/pay-order/', $lang) ]); } @@ -223,6 +228,8 @@ public function payOrder(Request $request) $this->switchPaymentMethodForOrder($order, $paymentMethodId); $result = $this->paymentService->executePayment($order, $this->paymentMethodService->findByPaymentMethodId($paymentMethodId)); + // Get the current language from session storage + $lang = $this->sessionStorage->getLang(); if ($result['type'] == GetPaymentMethodContent::RETURN_TYPE_REDIRECT_URL) { return $this->response->redirectTo($result['content']); @@ -230,9 +237,12 @@ public function payOrder(Request $request) if (isset($result['content'])) { $this->frontendSession->getPlugin()->setValue('walleePayErrorMessage', $result['content']); } - return $this->response->redirectTo('wallee/fail-transaction/' . $result['transactionId']); + // Construct the URL with the language + $failUrl = sprintf('%s/wallee/fail-transaction/%s', $lang, $result['transactionId']); + return $this->response->redirectTo($failUrl); } else { - return $this->response->redirectTo('confirmation'); + $confirmUrl = sprintf('%s/confirmation', $lang); + return $this->response->redirectTo($confirmUrl); } } diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index ac4be97..303ab01 100644 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -461,7 +461,9 @@ private function getBasketItemName(BasketItem $basketItem): string */ private function getSuccessUrl(): string { - return $this->webstoreHelper->getCurrentWebstoreConfiguration()->domainSsl . '/confirmation'; + $lang = $this->session->getLocaleSettings()->language; + $domain = $this->webstoreHelper->getCurrentWebstoreConfiguration()->domainSsl; + return sprintf('%s/%s/confirmation', $domain, $lang); } /** @@ -470,7 +472,9 @@ private function getSuccessUrl(): string */ private function getFailedUrl(): string { - return $this->webstoreHelper->getCurrentWebstoreConfiguration()->domainSsl . '/wallee/fail-transaction'; + $lang = $this->session->getLocaleSettings()->language; + $domain = $this->webstoreHelper->getCurrentWebstoreConfiguration()->domainSsl; + return sprintf('%s/%s/wallee/fail-transaction', $domain, $lang); } /** @@ -479,7 +483,9 @@ private function getFailedUrl(): string */ private function getCheckoutUrl(): string { - return $this->webstoreHelper->getCurrentWebstoreConfiguration()->domainSsl . '/checkout'; + $lang = $this->session->getLocaleSettings()->language; + $domain = $this->webstoreHelper->getCurrentWebstoreConfiguration()->domainSsl; + return sprintf('%s/%s/checkout', $domain, $lang); } /**