osCommerce / oscommerce2

osCommerce Online Merchant v2.x
http://www.oscommerce.com
MIT License
281 stars 222 forks source link

PS module - OSCOM Error Total Mismatch: PayPal transaction value (xxxx) does not match order value (yyyy) #630

Open tgely opened 6 years ago

tgely commented 6 years ago

Order items value calculation rules are not in harmony with rounded values

return number_format(tep_round($total * $currency_value, $currencies->currencies[$currency_code]['decimal_places']), $currencies->currencies[$currency_code]['decimal_places'], '.', '');

Issue is found between 4 digit rounded items price table data and applied currency setup rounding rule.

Solution regardless to orders_products table column

CREATE TABLE orders_products (
.
.
.
  final_price decimal(15,4) NOT NULL,
.
.
.
return number_format(tep_round($total * $currency_value, 4), $currencies->currencies[$currency_code]['decimal_places'], '.', '');