Skip to content

Commit

Permalink
Send only issuers on allAvailable call
Browse files Browse the repository at this point in the history
remove unneeded code
  • Loading branch information
mmaymo committed Dec 19, 2023
1 parent 6b23cbe commit 6d69990
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/Shared/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ public function getPayment($payment_id, $apiKey, $use_cache = true): ?\Mollie\Ap
*/
public function getAllPaymentMethods($apiKey, $test_mode = false, $use_cache = true)
{
if (!$apiKey) {
$apiKey = $this->getApiKey($test_mode);
}
$result = $this->getRegularPaymentMethods($apiKey, $test_mode, $use_cache);
if (!is_array($result)) {
$result = unserialize($result);
Expand Down Expand Up @@ -691,23 +688,16 @@ public function isSubscription($orderId)
return apply_filters($this->pluginId . '_is_subscription_payment', $isSubscription, $orderId);
}

public function getAllAvailablePaymentMethods($use_cache = true, $filters = [])
public function getAllAvailablePaymentMethods($use_cache = true)
{

$apiKey = $this->settingsHelper->getApiKey();
$methods = false;
$locale = $this->getPaymentLocale();
$test_mode = $this->isTestModeEnabled();
$filters_key = [];
$filters_key['locale'] = $locale;
$filters_key['mode'] = ( $test_mode ? 'test' : 'live' );
$filters_key['api'] = 'methods';
$filters_key['include'] = 'issuers';
$transient_id = $this->getTransientId(md5(http_build_query($filters_key)));
$filters['include'] = 'issuers';
$filters['locale'] = $locale;
$keysAllowed = ['amount' => '', 'locale' => '', 'issuers' => ''];
$filters = array_intersect_key($filters, $keysAllowed);

try {
if ($use_cache) {
// When no cache exists $methods will be `false`
Expand All @@ -720,7 +710,7 @@ public function getAllAvailablePaymentMethods($use_cache = true, $filters = [])
if (!$apiKey) {
return [];
}
$methods = $this->api_helper->getApiClient($apiKey)->methods->allAvailable($filters);
$methods = $this->api_helper->getApiClient($apiKey)->methods->allAvailable($filters_key);
$methods_cleaned = [];

foreach ($methods as $method) {
Expand Down

0 comments on commit 6d69990

Please sign in to comment.