diff --git a/src/PaymentMethods/Twint.php b/src/PaymentMethods/Twint.php index 0d77d320..eeaa9b02 100644 --- a/src/PaymentMethods/Twint.php +++ b/src/PaymentMethods/Twint.php @@ -21,7 +21,7 @@ protected function getConfig(): array ], 'filtersOnBuild' => false, 'confirmationDelayed' => false, - 'SEPA' => false + 'SEPA' => false, ]; } diff --git a/src/Shared/Data.php b/src/Shared/Data.php index 49fdb2d9..9f84082d 100644 --- a/src/Shared/Data.php +++ b/src/Shared/Data.php @@ -199,7 +199,7 @@ public function getPayment($payment_id, $apiKey, $use_cache = true): ?\Mollie\Ap */ public function getAllPaymentMethods($apiKey, $test_mode = false, $use_cache = true) { - if(!$apiKey) { + if (!$apiKey) { $apiKey = $this->getApiKey($test_mode); } $result = $this->getRegularPaymentMethods($apiKey, $test_mode, $use_cache); @@ -693,6 +693,7 @@ public function isSubscription($orderId) public function getAllAvailablePaymentMethods($use_cache = true, $filters = []) { + $apiKey = $this->settingsHelper->getApiKey(); $methods = false; $locale = $this->getPaymentLocale(); @@ -714,7 +715,6 @@ public function getAllAvailablePaymentMethods($use_cache = true, $filters = []) } else { delete_transient($transient_id); } - // No cache exists, call the API and cache the result if ($methods === false) { if (!$apiKey) { diff --git a/tests/php/Functional/Payment/PaymentServiceTest.php b/tests/php/Functional/Payment/PaymentServiceTest.php index 3ef13e93..4aef1f34 100644 --- a/tests/php/Functional/Payment/PaymentServiceTest.php +++ b/tests/php/Functional/Payment/PaymentServiceTest.php @@ -112,7 +112,7 @@ public function processPayment_Order_success(){ expect('get_option') ->with('mollie-payments-for-woocommerce_api_switch') ->andReturn(false); - expect('get_transient')->andReturn(['ideal'=>['id'=>'ideal']]); + expect('get_transient')->andReturn(['ideal'=>['id'=>'ideal', 'status'=>'activated']]); $wcOrder->expects($this->any()) ->method('get_billing_company') ->willReturn('');