saucal / woocommerce-gateway-amazon-pay

Amazon Pay Gateway
0 stars 1 forks source link

Round price in two decimal digits to send to the API #120

Open lauramelos opened 3 years ago

lauramelos commented 3 years ago

Describe the bug WooCommerce support more that 2 digit on their setting, this enables merchants to connect with some ERP systems that required this due to rounding issues. We need to round the values to be sent to the API so we avoid the error response:

 "InvalidParameterValue": [
            "The value '0.9000' provided for 'chargeAmount.Amount' is invalid."
        ]

Reference report: https://wordpress.org/support/topic/prices-4-digits-and-no-payment-possible/

To Reproduce Steps to reproduce the behavior:

  1. Set WooCommerce to work with more than 2 decimal digits
  2. try to perform a purchase (will be on error)
  3. Check the error log

Expected behavior Amazon pay should be able to handle payments on store that use more that 2 decimal digits on their prices.

Isolating the problem (mark completed items with an [x]):

ChristianAF commented 3 years ago

https://github.com/woocommerce/woocommerce-gateway-amazon-pay/issues/131