Skip to content

Commit

Permalink
Release 2.0.41
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandrososa committed Jul 10, 2024
1 parent 376389c commit e1230a4
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Please see the [license file](https://github.com/wallee-payment/plentymarkets/blob/2.0.41/LICENSE) for more information.
2 changes: 1 addition & 1 deletion docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/wallee-payment/plentymarkets/releases/tag/2.0.40/">
<a href="https://github.com/wallee-payment/plentymarkets/releases/tag/2.0.41/">
Source
</a>
</li>
Expand Down
5 changes: 5 additions & 0 deletions meta/documents/changelog_de.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions meta/documents/changelog_en.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion resources/views/Failure.twig
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
</div>

{% if allowSwitchPaymentMethod %}
<form action="/wallee/pay-order/" method="POST">
<form action="{{ payOrderFormUrl | default('/wallee/pay-order/') }}" method="POST">
<input type="hidden" name="orderId" value="{{ orderData.order.id }}" />
<div class="card small" style="margin-top: 20px;">
<div class="card-body">
Expand Down
18 changes: 14 additions & 4 deletions src/Controllers/PaymentProcessController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down Expand Up @@ -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)
]);
}

Expand All @@ -223,16 +228,21 @@ 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']);
} elseif (isset($result['transactionId'])) {
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);
}
}

Expand Down
12 changes: 9 additions & 3 deletions src/Services/PaymentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand Down

0 comments on commit e1230a4

Please sign in to comment.