diff --git a/class-wc-settings-page-komoju.php b/class-wc-settings-page-komoju.php index 75bf211..93ef418 100644 --- a/class-wc-settings-page-komoju.php +++ b/class-wc-settings-page-komoju.php @@ -365,12 +365,23 @@ private function fetch_all_payment_methods() try { $all_payment_methods = $api->paymentMethods(); $methods_by_slug = []; + $wc_currency = get_woocommerce_currency(); foreach ($all_payment_methods as $payment_method) { - $slug = $payment_method['type_slug']; - if (isset($methods_by_slug[$slug])) { - continue; + $slug = $payment_method['type_slug']; + $pm_currency = $payment_method['currency']; + + // If $slug is not set, register + if (!isset($methods_by_slug[$slug])) { + $methods_by_slug[$slug] = $payment_method; + } else { + // If $slug is already registered and + // the payment currency matches the WooCommerce currency then override it + if ($pm_currency === $wc_currency) { + $methods_by_slug[$slug] = $payment_method; + } } + $methods_by_slug[$slug] = $payment_method; } diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index b826252..0f588b2 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -49,6 +49,7 @@ Cypress.Commands.add('installWordpress', () => { Cypress.Commands.add('signinToWordpress', () => { cy.visit('/wp-admin'); + cy.wait(1000); cy.get('body').then(($body) => { if (!$body.find('#loginform').length) { @@ -60,6 +61,7 @@ Cypress.Commands.add('signinToWordpress', () => { cy.get('#user_pass').should('be.visible').clear().type('deg1kaX7reme!'); cy.get('#wp-submit').should('be.visible').click(); }); + cy.wait(1000); }); Cypress.Commands.add('installWooCommerce', () => {