From 6607d9b349f855f923656b65b2388e36a9738a36 Mon Sep 17 00:00:00 2001 From: Matthew Wire <mjw@mjwconsult.co.uk> Date: Mon, 13 Jul 2020 14:55:13 +0100 Subject: [PATCH] Add basic function for updating a contribution (eg. the trxn_id) without touching other things --- CRM/Core/Payment/MJWIPNTrait.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Payment/MJWIPNTrait.php b/CRM/Core/Payment/MJWIPNTrait.php index f6f5913..067d993 100644 --- a/CRM/Core/Payment/MJWIPNTrait.php +++ b/CRM/Core/Payment/MJWIPNTrait.php @@ -248,11 +248,27 @@ trait CRM_Core_Payment_MJWIPNTrait { $paymentParams['contribution_id'] = $contribution['id']; $paymentParams['is_send_contribution_notification'] = $this->getSendEmailReceipt(); $paymentParams['skipCleanMoney'] = TRUE; - - $payment = civicrm_api3('Mjwpayment', 'create_payment', $paymentParams); + civicrm_api3('Mjwpayment', 'create_payment', $paymentParams); } } + /** + * @param array $params + * + * @throws \CiviCRM_API3_Exception + * @throws \Civi\Payment\Exception\PaymentProcessorException + */ + private function updateContribution($params) { + $this->checkRequiredParams('updateContribution', ['contribution_id'], $params); + $params['id'] = $params['contribution_id']; + unset($params['contribution_id']); + $params['skipCleanMoney'] = TRUE; + $params['skipRecentView'] = TRUE; + $params['skipLineItem'] = TRUE; + $params['is_post_payment_create'] = TRUE; + civicrm_api3('Contribution', 'create', $params); + } + /** * Complete a pending contribution and update associated entities (recur/membership) * -- GitLab