Skip to content

Commit

Permalink
Bugfix: Catch getIssuer api key errors
Browse files Browse the repository at this point in the history
  • Loading branch information
michielgerritsen committed Dec 2, 2024
1 parent 96fdc1f commit a708daf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Model/MollieConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,16 @@ public function getActiveMethods(CartInterface $cart = null): array

private function getIssuers(string $code, array $config): array
{
$mollieApi = $this->mollieApiClient->loadByStore();
$issuerListType = $this->config->getIssuerListType($code, $this->storeManager->getStore()->getId());
$config['payment']['issuersListType'][$code] = $issuerListType;
$config['payment']['issuers'][$code] = $this->getIssuers->execute($mollieApi, $code, $issuerListType);

try {
$mollieApi = $this->mollieApiClient->loadByStore();
$config['payment']['issuers'][$code] = $this->getIssuers->execute($mollieApi, $code, $issuerListType);
} catch (\Exception $exception) {
$this->config->addTolog('error', 'Unable to load issuers: ' . $exception->getMessage());
$config['payment']['issuers'][$code] = [];
}

return $config;
}
Expand Down
7 changes: 7 additions & 0 deletions Service/Mollie/Wrapper/MollieApiClientFallbackWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

namespace Mollie\Payment\Service\Mollie\Wrapper;

use Mollie\Api\Exceptions\ApiException;
use Mollie\Api\Exceptions\IncompatiblePlatform;
use Mollie\Api\MollieApiClient;

class MollieApiClientFallbackWrapper extends MollieApiClient
{
/**
* @throws ApiException If there's an API error during initialization.
* @throws IncompatiblePlatform If the platform is not compatible.
* @return void
*/
public function initializeEndpoints()
{
parent::initializeEndpoints();
Expand Down

0 comments on commit a708daf

Please sign in to comment.