Zasilkovna / WooCommerce

This is the official plugin, that allows you to choose pickup points of Packeta and its external carriers in all of Europe, or utilize address delivery to 25 countries in the European Union, straight from the cart in your e-shop. Furthermore, you can also submit all your orders to Packeta with just one click.
https://wordpress.org/plugins/packeta/
GNU General Public License v3.0
19 stars 9 forks source link

bug: wrong currency error when selling to Poland via PL Home Delivery #179

Open fourstepper opened 2 years ago

fourstepper commented 2 years ago

Packet sending error Data: {"request":{"number":"1467","name":"<redacted>","surname":"<redacted>","email":"<redacted>","phone":"<redacted>","addressId":4162,"value":10.36,"eshop":"QWEEBS","weight":0.012,"street":"<redacted>","city":"<redacted>","zip":"<redacted>","currency":"EUR"},"errorMessage":"Failed to validate attributes. See detail., currency: Č. ob. 1467: Zadali jste nepovolenou měnu. Můžete zadat buď měnu země, do níž je zásilka směřována, nebo, pokud jste si nastavili konverzi měny při zadání zásilky (nikoliv při odeslání peněz), pak můžete zadat také měnu do níž necháváte konvertovat."}

I believe that this error comes from the package insurance, that unfortunately cannot be in EUR and only in PLN. As I sell in EUR (and many will probably sell in CZK or EUR, I can see this being a problem in the future for someone else as well)

If you need any further information, I will be happy to provide it :)

Best regards, Robin

MatyasKoval commented 2 years ago

Hello @fourstepper , thank you for the opened issue. This however is not as much of a bug, as it is a response directly from our API. In general our API accepts either the currency of the destination country or the currency you have set up in conversions in your client section (https://client.packeta.com/en/user-conversions/). If you set up conversions for Poland to be converted into EUR, then this error should stop appearing.

The same rules apply for sending parcels with COD, with the added requirement, that you need to have a Bank account in the currency you are using, associated with your billing address.

Best regards, Matyáš Kovaľ - Packeta Technical Support

fourstepper commented 2 years ago

Hi @MatyasKoval , I appreciate the thorough explanation - it makes a lot more sense now. Closing

fourstepper commented 2 years ago

Hello, I think I would like to re-open this discussion.

Does the currency have to be a required field in the API? I generally do not use COD, what other things is this currency conversion used for?

This is causing me quite a headache right now, as my shop is totally ran in EUR, therefore I cannot send the orders from Woocommerce automatically for orders for example from the Czech Republic.

All the best, Robin

MatyasKoval commented 2 years ago

Hello @fourstepper, thank you for your feedback, in short, the currency itself is not a required field in the Packetery API, but it is used for determining the value of the packet for insurance purposes.

The thing is, that if the currency parameter was not filled in, the Packeta system would assume the value to be in the currency of the destination country. This would for example in your case cause mismatch between the values of orders in your eshop administration and the values the packets made from orders would be insured for. You would have your order values in EUR and the packets would be insured on the same amount but in CZK if sent to Czech Republic- that is why we fill in the currency with the currency of the order, to prevent this mismatch.

We already plan to add an option directly to the administration, where you would be able to set up conversions for your order currencies, in one of the future versions of our plugin.

Best regards, Matyáš Kovaľ - Packeta Technical Support

fourstepper commented 2 years ago

Thanks for the feedback. I understand the situation, I suppose I just wanted to let you know that the behavior right now isn't perfect.

On a side note; maybe a simple option to turn off insurance for specific carrier in the settings would make this functional, at least in the short term?

MatyasKoval commented 2 years ago

Hello @fourstepper, I understand and am glad that you let us know about this.

The thing is that a packet is always insured for the value of the order, which is required (the value or more precisely amount the packet has to be insured for) so this function by itself can not be turned off as it is a required part of data, without which no packet could be created.

As mentioned in https://github.com/Zasilkovna/WooCommerce/issues/179#issuecomment-1109548939 , the only voluntary part is the currency itself, but disabling that would cause incorrect information being passed in the packet data.

Best regards, Matyáš Kovaľ - Packeta Technical Support

fourstepper commented 2 years ago

I suppose there are three ways to fix this:

  1. Make it possible to convert all currencies directly on the API endpoint.
    • I think this is the ideal solution, however I can understand if it's hard/undesirable to implement
  2. Convert the currencies right in the plugin, possibly calling some API and converting to the needed currency based on country chosen
    • not sure what you think about this one, it seems quite involved as well, bringing another dependency into the system
  3. Let users choose if they want to ignore the insurance being wrong/something like 0.0001 for any currency
    • simplest solution, would work for me in most cases
fourstepper commented 2 years ago

One more thing popped up in my mind: Is it really mandatory to set the value of the insurance? What would happen if I didn't want to insure my packages at all?

MatyasKoval commented 2 years ago

Hello @fourstepper , The point number 2. you mentioned in https://github.com/Zasilkovna/WooCommerce/issues/179#issuecomment-1111131167 is basically what we plan on adding into our plugin as an option during May. We plan on adding an exchange rate list, where you will be able to specify how the currency exchanges should be done.

As for the value of the parcel, yes the value is mandatory and without value, you would not be able to submit a packet to Packeta in any way (not through the API nor the client section).

Best regards, Matyáš Kovaľ - Packeta Technical Support

fourstepper commented 2 years ago

Alright, that sounds nice. You mention an exchange rate list, will this be a list where the currencies will have to be manually managed? That sounds like quite a bit of work...

MatyasKoval commented 2 years ago

Hello @fourstepper, Thank you for the feedback! As of now, we plan to add a manual option with the plan to add an automatic way (utilising conversion rates from ČNB) as well later down the line, but that will heavily depend on the feedback and usage of this feature by the users.

Best regards, Matyáš Kovaľ - Packeta Technical Support

fourstepper commented 2 years ago

Hi again,

I understand, however I would say that the feedback is not going to be very great, at least not from me. If there is an option for calculating the rates automatically from the start, why even bother with the manual rates, which will just add further overhead to an already pretty manual system.

I don't want to sound like I am complaining, I am certainly not, however I feel like leaving this functionality to the user will almost always lead to either bad UX by the shop owner or the customer

MatyasKoval commented 2 years ago

Hello @fourstepper, what you mention is valuable feedback, thank you.

the reasoning on our side for this is, that implementing the conversions with a manually set up rate can be implemented into the plugin relatively quickly. On the other hand, implementing automatic conversions will take substantialy longer.

Our plugin is meant for e-shops of all the countries, where Zásilkovna operates under the Packeta brand. So it will need not only the ČNB conversion rates, but also the getting and implementation of conversion rates from Hungarian, Polish and Romanian national banks and the European central bank. We also have to think through how all this will have to work - for example, will we implement the buying rates for the currencies, the median or will it be possible to slightly change the loaded conversion rates ? And so and so on. Implementing this feature is not going to be simple at all and we want to first think it through thoroughly.

These are the reasons we want to first get out an option to allow currency conversions on the plugin side and later we will expand upon this feature.

Best regards, Matyáš Kovaľ - Packeta Technical Support