Page 1 of 1

Mollie error 422 The Locale is invalid

Posted: Mon Aug 19, 2019 2:53 pm
by opentoshopping
Hi All,

Since upgrade to mollie 9.1 (download latest files, and just overwrite/upload to ftp) I got following error 422 with locale invalid.

The way how we solved it now is to go back to 8.4.

Is there anything you guys know about that could be causing this? We're on 2.3.x with journal 2 theme.

2019-08-18 17:48:23 - Error setting up transaction with Mollie: Error executing API call (422: Unprocessable Entity): The locale is invalid. Field: locale. Documentation: https://docs.mollie.com/guides/handling-errors.

Re: Mollie error 422 The Locale is invalid

Posted: Mon Aug 19, 2019 3:33 pm
by burrito
Just a quick reply here as I cannot get into my Github account...
What language setting are you using?

Re: Mollie error 422 The Locale is invalid

Posted: Mon Aug 19, 2019 5:34 pm
by opentoshopping
What do you mean with language settings?

We want to use up to 8 languages. Right now those are: English and German.
See screenshots of the settings. Default admin and web is English.
Rest of the languages are disabled.

Re: Mollie error 422 The Locale is invalid

Posted: Mon Aug 19, 2019 5:49 pm
by burrito
Can you try to open the mollie payment module and saving it? There is a new default setting that needs to be saved

Re: Mollie error 422 The Locale is invalid

Posted: Mon Aug 19, 2019 6:03 pm
by opentoshopping
I think that worked, I don't get that error anymore.
However, I'm getting payment in Mollie in the currency of the webshop now. This used to be always EUR. How can I make it that it's always EUR?

Re: Mollie error 422 The Locale is invalid

Posted: Mon Aug 19, 2019 6:10 pm
by burrito
it will use the currency used in the store if Mollie supports it. We do not have a setting currently to force EUR always. We're discussing now if this should be added in a next release.

Re: Mollie error 422 The Locale is invalid

Posted: Mon Aug 19, 2019 7:04 pm
by opentoshopping
That's not completely correct, in the older mollie plugin, I really did get the payments within mollie as EUR. But on the website customers could select a different currency from the theme. We entered the conversion rates manually and even never updated them.
So I guess after checkout page when handover to mollie payment, somewhere conversion happened that the currency sent to mollie was EUR.

This is easier processing since within mollie the EUR payments directly switch to PAID (other currencies are in afwachting).
Also we don't have to pay for conversion costs or other issues.

Do you have a location in the plugin files where I can manually change some piece of code?

Re: Mollie error 422 The Locale is invalid

Posted: Mon Aug 19, 2019 7:07 pm
by opentoshopping
Also, I see that when payments don't succeed, the orders are tagged as missing orders. Know how to solve this?

Re: Mollie error 422 The Locale is invalid

Posted: Mon Aug 19, 2019 7:41 pm
by burrito
in the older versions, multi-currency wasn't supported at all, this is why it would always be processed in Euro. Since 9.x, multi-currency got introduced.
for the missing orders, this can happen in some cases, but it should generally be updated to either failed or expired.

Re: Mollie error 422 The Locale is invalid

Posted: Mon Aug 19, 2019 7:46 pm
by opentoshopping
Although it sounds unlogically, we want to disable multicurrency :) So we want everything to go back to being sent in eur.

I found this code in mollie base.php

protected function convertCurrency($amount) {
$currency = '$this->session->data['currency']';
$configCurrency = $this->config->get("config_currency");
return $this->currency->convert($amount, $configCurrency, $currency);
}

and changed to
protected function convertCurrency($amount) {
$currency = 'EUR';
$configCurrency = $this->config->get("config_currency");
return $this->currency->convert($amount, $configCurrency, $currency);
}

will that work?

Re: Mollie error 422 The Locale is invalid

Posted: Mon Aug 19, 2019 8:17 pm
by opentoshopping
I've also changed

// Load essentials
Util::load()->language("payment/mollie");

$model = $this->getModuleModel();
$order_id = $this->getOrderID();
$order = $this->getOpenCartOrder($order_id);

$currency = $this->session->data['currency'];
to
$currency = "EUR";

That seesm to work. The convert currency thing seems to be ok for now.

Re: Mollie error 422 The Locale is invalid

Posted: Wed Aug 21, 2019 8:13 pm
by opentoshopping
Hey man, could you reply if the code I added is good?

Re: Mollie error 422 The Locale is invalid

Posted: Sat Aug 24, 2019 1:03 am
by OSWorX
opentoshopping wrote:
Wed Aug 21, 2019 8:13 pm
Hey man, could you reply if the code I added is good?
Yes, the code is okay.
But - more for the developer himself! - this should be an option in the backend if the shopowner wants only 1 currency!