Skip to content
Browse files

don't calculate currency values multiple times

  • Loading branch information...
1 parent 0ccb87d commit cb8c6082fad7dd7bb3d43859599ec4d75381a335 @haraldpdl haraldpdl committed
View
7 catalog/ext/modules/payment/paypal/express.php
@@ -665,9 +665,10 @@
$params['L_SHIPPINGOPTIONISDEFAULT' . $cheapest_counter] = 'true';
}
- $params['SHIPPINGAMT'] = $paypal_express->format_raw($cheapest_rate);
- $params['AMT'] = $paypal_express->format_raw($params['ITEMAMT'] + $params['TAXAMT'] + $params['SHIPPINGAMT']);
- $params['MAXAMT'] = $paypal_express->format_raw($params['AMT'] + $expensive_rate + 100); // safely pad higher for dynamic shipping rates (eg, USPS express)
+// don't recalculate currency values as they have already been calculated
+ $params['SHIPPINGAMT'] = $paypal_express->format_raw($cheapest_rate, '', 1);
+ $params['AMT'] = $paypal_express->format_raw($params['ITEMAMT'] + $params['TAXAMT'] + $params['SHIPPINGAMT'], '', 1);
+ $params['MAXAMT'] = $paypal_express->format_raw($params['AMT'] + $expensive_rate + 100, '', 1); // safely pad higher for dynamic shipping rates (eg, USPS express)
$response_array = $paypal_express->setExpressCheckout($params);
View
2 catalog/includes/modules/payment/paypal_express.php
@@ -308,7 +308,7 @@ function sendTransactionToGateway($url, $parameters) {
function format_raw($number, $currency_code = '', $currency_value = '') {
global $currencies, $currency;
- if (empty($currency_code) || !$this->is_set($currency_code)) {
+ if (empty($currency_code) || !$currencies->is_set($currency_code)) {
$currency_code = $currency;
}

0 comments on commit cb8c608

Please sign in to comment.
Something went wrong with that request. Please try again.