Skip to content

Commit

Permalink
Merge pull request #226 from Invertus/SL-270/bo-performance
Browse files Browse the repository at this point in the history
SL-270 Performance issues in BO "Payments" tab
  • Loading branch information
MarijusCoding authored Nov 29, 2024
2 parents c5f7cd7 + bc6dd43 commit 00dddbf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions controllers/admin/AdminSaferPayOfficialPaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ protected function renderShoppingPointOptions()
$fieldsForm = [];
$fieldsForm[0]['form'] = $this->fields_form;

/** @var \Invertus\SaferPay\Service\SaferPayObtainPaymentMethods $saferPayObtainPaymentMethods */
$saferPayObtainPaymentMethods = $this->module->getService(SaferPayObtainPaymentMethods::class);

$paymentMethodsList = $saferPayObtainPaymentMethods->obtainPaymentMethods();

foreach ($paymentMethods as $paymentMethod) {
$isActive = $paymentRepository->isActiveByName($paymentMethod);
$isLogoActive = $logoRepository->isActiveByName($paymentMethod);
Expand All @@ -184,7 +189,7 @@ protected function renderShoppingPointOptions()
'paymentMethod' => $paymentMethod,
'countryOptions' => $this->getActiveCountriesList(),
'countrySelect' => $selectedCountries,
'currencyOptions' => $this->getActiveCurrenciesList($paymentMethod),
'currencyOptions' => $this->getActiveCurrenciesList($paymentMethod, $paymentMethodsList),
'currencySelect' => $selectedCurrencies,
'is_field_active' => $isFieldActive,
'supported_field_payments' => SaferPayConfig::FIELD_SUPPORTED_PAYMENT_METHODS,
Expand Down Expand Up @@ -219,13 +224,8 @@ public function getActiveCountriesList($onlyActive = true)
return $countriesWithNames;
}

public function getActiveCurrenciesList($paymentMethod)
public function getActiveCurrenciesList($paymentMethod, $paymentMethods)
{
/** @var \Invertus\SaferPay\Service\SaferPayObtainPaymentMethods $saferPayObtainPaymentMethods */
$saferPayObtainPaymentMethods = $this->module->getService(SaferPayObtainPaymentMethods::class);

$paymentMethods = $saferPayObtainPaymentMethods->obtainPaymentMethods();

$currencyOptions[0] = $this->l('All');
foreach ($paymentMethods[$paymentMethod]['currencies'] as $currencyIso) {
if (Currency::getIdByIsoCode($currencyIso)) {
Expand Down

0 comments on commit 00dddbf

Please sign in to comment.