Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Wysocki committed Dec 13, 2024
1 parent afce921 commit 90dba44
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Controller/Tpay/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Tpay\Magento2\Api\TpayInterface;
use Tpay\Magento2\Model\ApiFacade\Transaction\TransactionApiFacade;
use Tpay\Magento2\Model\ApiFacade\Transaction\TransactionOriginApi;
use Tpay\Magento2\Provider\ConfigurationProvider;
use Tpay\Magento2\Service\RedirectHandler;
use Tpay\Magento2\Service\TpayAliasServiceInterface;
use Tpay\Magento2\Service\TpayService;
Expand Down Expand Up @@ -209,6 +210,6 @@ private function handleOpenApiTrId(array &$paymentData, array $transaction)

private function buildBlikAlias(string $customerId): string
{
return sprintf('%s-%s', base64_encode('tpay-magento'), $customerId);
return sprintf('%s-%s', ConfigurationProvider::generateRandomString(10), $customerId);
}
}
13 changes: 13 additions & 0 deletions Provider/ConfigurationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,19 @@ public function isPlnPayment(): bool
return 'PLN' == $this->storeManager->getStore()->getBaseCurrencyCode() && 'PLN' == $this->storeManager->getStore()->getCurrentCurrencyCode();
}

public static function generateRandomString(int $length = 46): string
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';

for ($i = 0; $i < $length; $i++) {
$index = rand(0, strlen($characters) - 1);
$randomString .= $characters[$index];
}

return $randomString;
}

private function getTpayPluginVersion(): string
{
$dir = __DIR__.'/../.version';
Expand Down
3 changes: 2 additions & 1 deletion i18n/pl_PL.csv
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@
"By paying, you accept ","Płacąc, akceptujesz "
"regulations","regulamin"
"The personal data administrator is Krajowy Integrator Płatności S.A with its registered office in Poznań. ","Administratorem danych osobowych jest Krajowy Integrator Płatności spółka akcyjna z siedzibą w Poznaniu."
"Show full content","Zapoznaj się z pełną treścią"
"Show full content","Zapoznaj się z pełną treścią"
"I pay with BLIK from saved account", "Zapłać zapisanym aliasem BLIK"
2 changes: 1 addition & 1 deletion view/frontend/web/template/payment/tpay-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<div class="tpay-input-wrapper">
<p>
<input id="blik_alias" type="radio">
<!-- ko i18n: 'I pay with BLIK from saved account.'--><!--/ko-->
<!-- ko i18n: 'I pay with BLIK from saved account'--><!--/ko-->
</p>
</div>
</div>
Expand Down

0 comments on commit 90dba44

Please sign in to comment.