Open hefan opened 1 year ago
Hey @hefan! Reading the code I think you can do:
klarna_config = Klarna::Configuration.new
klarna_config.zone = :europe
and this line will pick up the right endpoint.
Let me know if that's correct, please!
BTW, I think it's a good idea to make it configurable, so if you want to contribute for that, I guess it's a good change.
Also, reading this other piece, you can probably add to an initializer:
Klarna.configuration do |config|
config.zone = :europe
end
cc @vassalloandrea (pinging you because you are among the authors of that extension)
Hello @kennyadsl
Adding
Klarna.configure do |config|
config.zone = :europe
end
to an initializer went well in my case, thank you!
However, for being able to configure it, zone needs to be added at least to https://github.com/solidusio-contrib/solidus_klarna_payments/blob/master/lib/active_merchant/billing/klarna_gateway.rb#L13 and https://github.com/solidusio-contrib/solidus_klarna_payments/blob/master/app/services/solidus_klarna_payments/validate_klarna_credentials_service.rb#L7
The Zone should be added as a dropdown for the three zones in the payment method settings, i suppose. Maybe it could also be a good idea to leave it as an initializer and tell about zones in the Readme.
If you tell me what is the way you would prefer, i am happy to open a pull request theses days.
I think the initializer is the best trade-off for now, and we can fix it immediately. If you have extra time for proposing to change it with something in the Admin UI, it would be great as well, but could come later. 🙏
so it would be best to mention in Readme, no?
Yes!
ok. i will open a respective pull request later or tomorrow..
At the moment the extension seems to always connect with the default endpoint from klarna_proxy https://api-na.klarna.com (production) https://api-na.playground.klarna.com (test) see here https://github.com/nebulab/klarna_proxy/blob/main/lib/klarna/configuration.rb#L9
Is there a possibility to add a zone parameter or something similar to be able to send to the europe or oceania servers?