Commit d25b1422 authored by mattwire's avatar mattwire Committed by mattwire
Browse files

Don't require total_amount for repeatContribution - it is set automatically...

Don't require total_amount for repeatContribution - it is set automatically via the recur template contribution
parent 97b5e77a
......@@ -314,7 +314,7 @@ trait CRM_Core_Payment_MJWIPNTrait {
'receive_date',
'order_reference',
'trxn_id',
'total_amount',
//'total_amount',
],
$params
);
......@@ -342,13 +342,16 @@ trait CRM_Core_Payment_MJWIPNTrait {
// We send a receipt when adding a payment, not now
$contributionParams['is_email_receipt'] = FALSE;
try {
$contribution = civicrm_api3('Contribution', 'repeattransaction', $contributionParams);
$contribution = reset(civicrm_api3('Contribution', 'repeattransaction', $contributionParams)['values']);
}
catch (Exception $e) {
\Civi::log()->error('MJWIPNTrait call to repeattransaction failed: ' . $e->getMessage() . '; params: ' . print_r($contributionParams, TRUE));
return FALSE;
}
// Get total amount from contribution returned by repeatTransaction (Which came from the recur template Contribution)
$params['total_amount'] = $params['total_amount'] ?? $contribution['total_amount'];
if ($createPayment) {
$paymentParamsKeys = [
'receive_date' => 'trxn_date',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment