diff --git a/plugins/woocommerce-admin/TESTING-INSTRUCTIONS.md b/plugins/woocommerce-admin/TESTING-INSTRUCTIONS.md index cc9758adf39..32ba48ab1d7 100644 --- a/plugins/woocommerce-admin/TESTING-INSTRUCTIONS.md +++ b/plugins/woocommerce-admin/TESTING-INSTRUCTIONS.md @@ -4,6 +4,13 @@ ## 2.1.0 +### Correct the Klarna slug #6440 + +1. Set up a new store with a UK address so that Klarna available as a payment processor +2. Go to the "Choose payment methods" task item +3. Set up Klarna. The plugin will install. +4. Click Continue. It should take you back to the payment methods page - previously it wasn't doing anything but a console error was displayed. + ### Navigation: Reset submenu before making Flyout #6396 - Download and activate the MailChimp plugin. diff --git a/plugins/woocommerce-admin/client/task-list/tasks/payments/index.js b/plugins/woocommerce-admin/client/task-list/tasks/payments/index.js index b3c51c6f405..40962c94560 100644 --- a/plugins/woocommerce-admin/client/task-list/tasks/payments/index.js +++ b/plugins/woocommerce-admin/client/task-list/tasks/payments/index.js @@ -99,6 +99,10 @@ class Payments extends Component { const method = methods.find( ( option ) => option.key === methodName ); + if ( ! method ) { + throw `Method ${ methodName } not found in available methods list`; + } + this.setState( { enabledMethods: { ...enabledMethods, @@ -124,7 +128,15 @@ class Payments extends Component { return; } - return methods.find( ( method ) => method.key === query.method ); + const currentMethod = methods.find( + ( method ) => method.key === query.method + ); + + if ( ! currentMethod ) { + throw `Current method ${ query.method } not found in available methods list`; + } + + return currentMethod; } getInstallStep() { @@ -172,6 +184,10 @@ class Payments extends Component { const { enabledMethods } = this.state; const method = methods.find( ( option ) => option.key === key ); + if ( ! method ) { + throw `Method ${ key } not found in available methods list`; + } + enabledMethods[ key ] = ! enabledMethods[ key ]; this.setState( { enabledMethods } ); diff --git a/plugins/woocommerce-admin/client/task-list/tasks/payments/klarna.js b/plugins/woocommerce-admin/client/task-list/tasks/payments/klarna.js index cc108762fc5..99493e90895 100644 --- a/plugins/woocommerce-admin/client/task-list/tasks/payments/klarna.js +++ b/plugins/woocommerce-admin/client/task-list/tasks/payments/klarna.js @@ -18,7 +18,7 @@ class Klarna extends Component { const { markConfigured, plugin } = this.props; const slug = - plugin === 'checkout' ? 'klarna-checkout' : 'klarna-payments'; + plugin === 'checkout' ? 'klarna_checkout' : 'klarna_payments'; markConfigured( slug ); } diff --git a/plugins/woocommerce-admin/readme.txt b/plugins/woocommerce-admin/readme.txt index 988c0c19d27..0d376bea62c 100644 --- a/plugins/woocommerce-admin/readme.txt +++ b/plugins/woocommerce-admin/readme.txt @@ -122,6 +122,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt - Fix: Reset Navigation submenu before making Flyout #6396 - Dev: Add a changelog lint check to PRs. #6414 - Fix: Move the shipping input and text 1px lower. #6408 +- Fix: Correct the Klarna slug #6440 == 2.0.0 02/05/2021 ==