Commit df4c1b9e authored by mattwire's avatar mattwire
Browse files

Trap exceptions triggered when calling repeatcontribution

parent c1dbaf4d
......@@ -201,7 +201,9 @@ trait CRM_Core_Payment_MJWIPNTrait {
*
* @param array $params
*
* @return bool
* @throws \CiviCRM_API3_Exception
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
private function repeatContribution($params) {
$this->checkRequiredParams(
......@@ -240,7 +242,13 @@ trait CRM_Core_Payment_MJWIPNTrait {
$contributionParams['trxn_id'] = $params['order_reference'];
// We send a receipt when adding a payment, not now
$contributionParams['is_email_receipt'] = FALSE;
$contribution = civicrm_api3('Contribution', 'repeattransaction', $contributionParams);
try {
$contribution = civicrm_api3('Contribution', 'repeattransaction', $contributionParams);
}
catch (Exception $e) {
\Civi::log()->error('MJWIPNTrait call to repeattransaction failed: ' . $e->getMessage() . '; params: ' . print_r($contributionParams, TRUE));
return FALSE;
}
if ($createPayment) {
$paymentParamsKeys = [
......@@ -260,6 +268,7 @@ trait CRM_Core_Payment_MJWIPNTrait {
$paymentParams['skipCleanMoney'] = TRUE;
civicrm_api3('Mjwpayment', 'create_payment', $paymentParams);
}
return TRUE;
}
/**
......
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