fixed number format problem with PayPal fee calculation
authorsystopia <endres@systopia.de>
Mon, 14 Sep 2015 12:40:40 +0000 (14:40 +0200)
committersystopia <endres@systopia.de>
Mon, 14 Sep 2015 12:40:40 +0000 (14:40 +0200)
CRM/Core/Payment/PayPalImpl.php

index e513bace19376ec2ec0350cca74a26455d4de2a2..6a6607fac1343606c1fbd0690c12638c157a4e7b 100644 (file)
@@ -316,7 +316,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     $params['fee_amount'] = $result['feeamt'];
     $params['net_amount'] = CRM_Utils_Array::value('settleamt', $result);
     if ($params['net_amount'] == 0 && $params['fee_amount'] != 0) {
-      $params['net_amount'] = $params['gross_amount'] - $params['fee_amount'];
+      $params['net_amount'] = number_format(($params['gross_amount'] - $params['fee_amount']), 2);
     }
     $params['payment_status'] = $result['paymentstatus'];
     $params['pending_reason'] = $result['pendingreason'];
@@ -382,7 +382,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     $params['fee_amount'] = $result['feeamt'];
     $params['net_amount'] = $result['settleamt'];
     if ($params['net_amount'] == 0 && $params['fee_amount'] != 0) {
-      $params['net_amount'] = $params['gross_amount'] - $params['fee_amount'];
+      $params['net_amount'] = number_format(($params['gross_amount'] - $params['fee_amount']), 2);
     }
     $params['payment_status'] = $result['paymentstatus'];
     $params['pending_reason'] = $result['pendingreason'];