krokedil / klarna-checkout-for-woocommerce

Klarna Checkout for WooCommerce plugin
15 stars 23 forks source link

Plugin not compatible with new Klarna credentials format #586

Closed didkan closed 2 months ago

didkan commented 2 months ago

Tested with plugin version 2.12.4

Klarna has apparently change their Key ID format from something like K529269_6e7be3f4fedf to using UUID e.g. 2faf6b4e-a7cd-4be4-8b7f-8f3013b8e805. The new UUID format is not accepted by the js validation of this plugin when trying to change Klarna credentials in the plugin settings. See error message below: image

The culprit is this line of code:

https://github.com/krokedil/klarna-checkout-for-woocommerce/blob/7e102cf20b711b3a2f0b0f5fa74c6e44670474f9/assets/js/klarna-checkout-for-woocommerce-admin.js#L57

A suggested fix is to extend the regexp to allow for UUID strings in addition to the old format:

var regex = /^([A-Za-z0-9]{1,2}[0-9]{5}|[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12})/
mntzrr commented 2 months ago

Fixed in #587.

Thank you!

didkan commented 2 months ago

@mntzrr Thanks for the quick merge! Glad to be able to help out. When can I expect this to be added to a new release?

mntzrr commented 2 months ago

Since this will affect all new merchants (or API keys), this warrant a new release sometime early next week.