zwaldeck / mollie

Java framework to consume the Mollie API
Other
39 stars 37 forks source link

Cannot deserialize Locale en_BE #27

Closed wmadev closed 4 years ago

wmadev commented 4 years ago

I'm getting an exception when trying to get the payment from Mollie in my webhook.

com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of typebe.feelio.mollie.data.common.Localefrom String "en_BE": not one of the values accepted for Enum class: [de_CH, nl_BE, da_DK, nb_NO, sv_SE, ca_ES, de_AT, en_US, fr_BE, is_IS, it_IT, pl_PL, fr_FR, hu_HU, de_DE, fi_FI, lt_LT, lv_LV, es_ES, pt_PT, nl_NL]

zwaldeck commented 4 years ago

@wmadev I don't think that en_BE is a valid locale. Is mollie sending you this locale?

wmadev commented 4 years ago

It's in the response from Mollie when I do retrieve the payment, so yes they are sending this invalid locale.

zwaldeck commented 4 years ago

I will look into their documentation. If this value isn't supposed to come back I will contact there dev team as well

djmbritt commented 4 years ago

I also had this error but I realised I forgot to set the locale in the PaymentRequest.

import be.feelio.mollie.data.common.Locale;

PaymentRequest.builder()
.amount(Amount.builder().currency("EUR").value(valueDouble).build())
.description(description)
.redirectUrl(Optional.of(redirectUrl))
.locale(Optional.of(Locale.nl_NL))
.build();
zwaldeck commented 4 years ago

It's optional so you should not be able to set this.

It's just a weird value we get back from mollie.

I will implement a Locale.UNKNOWN for when we get an unknown locale back

paulvaneijden commented 4 years ago

@zwaldeck please review the PR I created for this issue

paulvaneijden commented 4 years ago

I also had this error but I realised I forgot to set the locale in the PaymentRequest.

Thanks for this workaround, it still would be nice to have the PR reviewed, can you please upvote it?

zwaldeck commented 4 years ago

@paulvaneijden There is one question open on the PR.

Once this is resolved, I will merge and release the new feature

paulvaneijden commented 4 years ago

Thanks @zwaldeck I pushed the required changes, including a revert of Jackson upgrade which caused your CI/CD to not compile and thus not publish 2.1.0

zwaldeck commented 4 years ago

I'll do a release this evening and close this ticket. I'll also look into the issue of the Jackson upgrade

zwaldeck commented 4 years ago

The new version is published: https://repo.maven.apache.org/maven2/be/feelio/mollie/2.2.0/