-
-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to calling Payment.create api when processing a refund from AdditionalPayment form #14317
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -362,10 +362,12 @@ public function submit($submittedValues) { | |
'id' => $this->_contributionId, | ||
]); | ||
$contributionStatusId = CRM_Utils_Array::value('contribution_status_id', $contribution); | ||
$result = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($this->_contributionId, $this->_params, $this->_paymentType, $participantId); | ||
$paymentID = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($this->_contributionId, $this->_params, $this->_paymentType, $participantId); | ||
// Fetch the contribution & do proportional line item assignment | ||
$params = ['id' => $this->_contributionId]; | ||
$contribution = CRM_Contribute_BAO_Contribution::retrieve($params, $defaults, $params); | ||
// @todo - this line needs to be moved to the Payment.create api - it's not form layer appropriate. | ||
// testing required. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree |
||
CRM_Contribute_BAO_Contribution::addPayments([$contribution], $contributionStatusId); | ||
if ($this->_contributionId && CRM_Core_Permission::access('CiviMember')) { | ||
$membershipPaymentCount = civicrm_api3('MembershipPayment', 'getCount', ['contribution_id' => $this->_contributionId]); | ||
|
@@ -382,8 +384,8 @@ public function submit($submittedValues) { | |
|
||
$statusMsg = ts('The payment record has been processed.'); | ||
// send email | ||
if (!empty($result) && !empty($this->_params['is_email_receipt'])) { | ||
$sendResult = civicrm_api3('Payment', 'sendconfirmation', ['id' => $result->id])['values'][$result->id]; | ||
if (!empty($paymentID) && !empty($this->_params['is_email_receipt'])) { | ||
$sendResult = civicrm_api3('Payment', 'sendconfirmation', ['id' => $paymentID])['values'][$paymentID]; | ||
if ($sendResult['is_sent']) { | ||
$statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.'); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,6 +102,7 @@ public static function create($params) { | |
} | ||
elseif ($params['total_amount'] < 0) { | ||
$trxn = self::recordRefundPayment($params['contribution_id'], $params, FALSE); | ||
CRM_Contribute_BAO_Contribution::recordPaymentActivity($params['contribution_id'], CRM_Utils_Array::value('participant_id', $params), $params['total_amount'], $trxn->currency, $trxn->trxn_date); | ||
} | ||
|
||
if ($isPaymentCompletesContribution) { | ||
|
@@ -319,7 +320,7 @@ public static function filterUntestedTemplateVariables($params) { | |
* | ||
* @return CRM_Financial_DAO_FinancialTrxn | ||
*/ | ||
public static function recordRefundPayment($contributionId, $trxnData, $updateStatus) { | ||
protected static function recordRefundPayment($contributionId, $trxnData, $updateStatus) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Umm you missed a spot
which expect it to be public. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @monishdeb I don't see that line.. at that line I see Are you on latest? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @eileenmcnaughton yes I am checking on the latest instance heres the line https://github.com/civicrm/civicrm-core/blob/master/CRM/Contribute/BAO/Contribution.php#L4017 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @monishdeb but isn't that line removed in this pr? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh right ... (arghhh).. sorry my bad :( |
||
list($contributionDAO, $params) = self::getContributionAndParamsInFormatForRecordFinancialTransaction($contributionId); | ||
|
||
$params['payment_instrument_id'] = CRM_Utils_Array::value('payment_instrument_id', $trxnData, CRM_Utils_Array::value('payment_instrument_id', $params)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be on the safe side if $payment NOT IN 'refund', 'owed' should we throw a exception message on
else{...}
loop?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GIven we don't throw one now I don't think we should add one in 'just in case'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok no problem