From 669414e2c973ce95bdaa4a7aceda8b0d2f1648d1 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 1 Jul 2014 10:55:55 +1200 Subject: [PATCH] CRM-14930 fix net_amount on authorize.net --- CRM/Core/Payment/AuthorizeNetIPN.php | 1 - CRM/Core/Payment/BaseIPN.php | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CRM/Core/Payment/AuthorizeNetIPN.php b/CRM/Core/Payment/AuthorizeNetIPN.php index fbcf06929d..72c0b24d96 100644 --- a/CRM/Core/Payment/AuthorizeNetIPN.php +++ b/CRM/Core/Payment/AuthorizeNetIPN.php @@ -206,7 +206,6 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN { $input['response_code'] = self::retrieve('x_response_code', 'Integer'); $input['MD5_Hash'] = self::retrieve('x_MD5_Hash', 'String', FALSE, ''); $input['fee_amount'] = self::retrieve('x_fee_amount', 'Money', FALSE, '0.00'); - $input['net_amount'] = self::retrieve('x_net_amount', 'Money', FALSE, '0.00'); $input['response_reason_code'] = self::retrieve('x_response_reason_code', 'String', FALSE); $input['response_reason_text'] = self::retrieve('x_response_reason_text', 'String', FALSE); $input['subscription_paynum'] = self::retrieve('x_subscription_paynum', 'Integer', FALSE, 0); diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index 3976560052..cbf900da98 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -87,6 +87,10 @@ class CRM_Core_Payment_BaseIPN { return FALSE; } + if (!isset($input['net_amount']) && !empty($input['total_amount'])) { + $input['net_amount'] = (float) $input['total_amount'] - (float) CRM_Utils_Array::value('fee_amount', $input); + } + // make sure contribution exists and is valid $contribution = new CRM_Contribute_BAO_Contribution(); $contribution->id = $ids['contribution']; -- 2.25.1