From cf7181f373fdec5fca79b3e55e1b7f7d5f0dc3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20=C5=A0mulk=C5=A1tys?= Date: Fri, 8 Dec 2023 13:53:41 +0200 Subject: [PATCH 1/2] SL-203-match-shop-language-with-iframe --- src/Service/Request/InitializeRequestObjectCreator.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Service/Request/InitializeRequestObjectCreator.php b/src/Service/Request/InitializeRequestObjectCreator.php index 805da6b2..a364df31 100755 --- a/src/Service/Request/InitializeRequestObjectCreator.php +++ b/src/Service/Request/InitializeRequestObjectCreator.php @@ -30,6 +30,7 @@ use Invertus\SaferPay\DTO\Request\RequestHeader; use Invertus\SaferPay\DTO\Request\Initialize\InitializeRequest; use Invertus\SaferPay\DTO\Request\Payer; +use PrestaShop\PrestaShop\Adapter\Shop\Context; if (!defined('_PS_VERSION_')) { exit; @@ -68,6 +69,7 @@ public function create( $totalPrice = (int) (round($totalPrice)); $payment = $this->requestObjectCreator->createPayment($cart, $totalPrice); $payer = new Payer(); + $payer->setLanguageCode($cart->getAssociatedLanguage()->iso_code); $returnUrl = $this->requestObjectCreator->createReturnUrl($returnUrl); $notification = ($isBusinessLicence && version_compare(Configuration::get(RequestHeader::SPEC_VERSION), '1.35', '<')) ? null : $this->requestObjectCreator->createNotification($customerEmail, $notifyUrl); $deliveryAddressForm = $this->requestObjectCreator->createDeliveryAddressForm(); From 2ae7b3dc0d109a8e73e512c51dba6cbd43689584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20=C5=A0mulk=C5=A1tys?= Date: Tue, 12 Dec 2023 11:43:40 +0200 Subject: [PATCH 2/2] update --- src/Service/Request/InitializeRequestObjectCreator.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Service/Request/InitializeRequestObjectCreator.php b/src/Service/Request/InitializeRequestObjectCreator.php index a364df31..b6d445d9 100755 --- a/src/Service/Request/InitializeRequestObjectCreator.php +++ b/src/Service/Request/InitializeRequestObjectCreator.php @@ -69,7 +69,12 @@ public function create( $totalPrice = (int) (round($totalPrice)); $payment = $this->requestObjectCreator->createPayment($cart, $totalPrice); $payer = new Payer(); - $payer->setLanguageCode($cart->getAssociatedLanguage()->iso_code); + + $languageCode = !empty($cart->getAssociatedLanguage()->iso_code) + ? $cart->getAssociatedLanguage()->iso_code + : 'en'; + + $payer->setLanguageCode($languageCode); $returnUrl = $this->requestObjectCreator->createReturnUrl($returnUrl); $notification = ($isBusinessLicence && version_compare(Configuration::get(RequestHeader::SPEC_VERSION), '1.35', '<')) ? null : $this->requestObjectCreator->createNotification($customerEmail, $notifyUrl); $deliveryAddressForm = $this->requestObjectCreator->createDeliveryAddressForm();