From 105a05d7538a65e7cf12b068775f5a4a5875d7f7 Mon Sep 17 00:00:00 2001 From: Daniil Tkachev Date: Fri, 8 Nov 2024 17:15:29 +0100 Subject: [PATCH] UNZER-514 Add a descriptor to the prepayment thankyou page --- src/Controller/ThankYouController.php | 13 +++++++++++++ src/Service/PrePaymentBankAccountService.php | 7 +++++++ translations/de/oscunzer_lang.php | 1 + translations/en/oscunzer_lang.php | 1 + .../blocks/page/checkout/thank_you_info.tpl | 3 +++ 5 files changed, 25 insertions(+) diff --git a/src/Controller/ThankYouController.php b/src/Controller/ThankYouController.php index 48b502e4..2eed51fc 100644 --- a/src/Controller/ThankYouController.php +++ b/src/Controller/ThankYouController.php @@ -69,6 +69,19 @@ public function getUnzerPrePaymentHolder(): ?string return $result; } + /** Template variable getter. Returns Unzer PrePayment Holder */ + public function getUnzerPrePaymentDescriptor(): ?string + { + $result = null; + $unzerOrderNumber = $this->getUnzerOrderNumberForPrePayments(); + if ($unzerOrderNumber) { + $result = $this->getPrePaymentBankAccountService()->getDescriptor( + $unzerOrderNumber + ); + } + return $result; + } + private function getPrePaymentBankAccountService(): PrePaymentBankAccountService { return $this->getServiceFromContainer(PrePaymentBankAccountService::class); diff --git a/src/Service/PrePaymentBankAccountService.php b/src/Service/PrePaymentBankAccountService.php index 7bf55d83..ef947061 100644 --- a/src/Service/PrePaymentBankAccountService.php +++ b/src/Service/PrePaymentBankAccountService.php @@ -61,6 +61,13 @@ public function getHolder(string $unzerOrderNumber): ?string ); } + public function getDescriptor(string $unzerOrderNumber): ?string + { + return $this->getStringVarFromSession( + $this->getSessionVariableName($unzerOrderNumber, 'getDescriptor') + ); + } + private function getStringVarFromSession(string $varName): string { $result = $this->session->getVariable($varName); diff --git a/translations/de/oscunzer_lang.php b/translations/de/oscunzer_lang.php index 45780451..eb4f79c2 100644 --- a/translations/de/oscunzer_lang.php +++ b/translations/de/oscunzer_lang.php @@ -134,4 +134,5 @@ 'OSCUNZER_PREPAYMENT_BANK_ACCOUNT_INFO_BANK_HOLDER' => 'Kontoinhaber', 'OSCUNZER_FIX_ROUNDING' => 'Korrektur Rundung', 'OSCUNZER_NOT_SERIALIZABLE' => 'NOT SERIALIZABLE: ', + 'OSCUNZER_PREPAYMENT_BANK_ACCOUNT_INFO_BANK_DESCRIPTOR' => 'Descriptor', ]; diff --git a/translations/en/oscunzer_lang.php b/translations/en/oscunzer_lang.php index 89ea1c45..7d7d0e8e 100644 --- a/translations/en/oscunzer_lang.php +++ b/translations/en/oscunzer_lang.php @@ -134,4 +134,5 @@ 'OSCUNZER_PREPAYMENT_BANK_ACCOUNT_INFO_BANK_HOLDER' => 'Account Holder', 'OSCUNZER_FIX_ROUNDING' => 'Fix rounding item', 'OSCUNZER_NOT_SERIALIZABLE' => 'NOT SERIALIZABLE: ', + 'OSCUNZER_PREPAYMENT_BANK_ACCOUNT_INFO_BANK_DESCRIPTOR' => 'Descriptor', ]; diff --git a/views/frontend/blocks/page/checkout/thank_you_info.tpl b/views/frontend/blocks/page/checkout/thank_you_info.tpl index 4e5c3cc0..e673a161 100644 --- a/views/frontend/blocks/page/checkout/thank_you_info.tpl +++ b/views/frontend/blocks/page/checkout/thank_you_info.tpl @@ -9,6 +9,9 @@ [{if $oView->getUnzerPrePaymentHolder()}] [{oxmultilang ident="OSCUNZER_PREPAYMENT_BANK_ACCOUNT_INFO_BANK_HOLDER"}]: [{$oView->getUnzerPrePaymentHolder()}]
[{/if}] +[{if $oView->getUnzerPrePaymentDescriptor()}] + [{oxmultilang ident="OSCUNZER_PREPAYMENT_BANK_ACCOUNT_INFO_DESCRIPTOR"}]: [{$oView->getUnzerPrePaymentDescriptor()}]
+ [{/if}] [{if $oView->getUnzerPrePaymentIban()}]
[{/if}]