From 500d35ecbfacf2c512bd730a1bf37c88e5fdac93 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 12 Feb 2015 18:40:26 +1300 Subject: [PATCH] CRM-15960 fix for net_amount being wiped: --- CRM/Core/Payment/BaseIPN.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index f8b2839fd1..d21bcc9d4f 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -580,10 +580,21 @@ LIMIT 1;"; 'labelColumn' => 'name', 'flip' => 1, )); + + // @todo this section should call the api in order to have hooks called & + // because all this 'messiness' setting variables could be avoided + // by letting the api resolve pseudoconstants & copy set values and format dates. $contribution->contribution_status_id = $contributionStatuses['Completed']; $contribution->is_test = $input['is_test']; - $contribution->fee_amount = CRM_Utils_Array::value('fee_amount', $input, 0); - $contribution->net_amount = CRM_Utils_Array::value('net_amount', $input, 0); + + // CRM-15960 If we don't have a value we 'want' for the amounts, leave it to the BAO to sort out. + if (isset($input['net_amount'])) { + $contribution->fee_amount = CRM_Utils_Array::value('fee_amount', $input, 0); + } + if (isset($input['net_amount'])) { + $contribution->net_amount = $input['net_amount']; + } + $contribution->trxn_id = $input['trxn_id']; $contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date); $contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date); -- 2.25.1