Commit b83725b2 authored by mattwire's avatar mattwire
Browse files

Fix #2 Don't update receive_date when marking a contribution as failed

parent 4b1d1fd2
......@@ -321,18 +321,19 @@ trait CRM_Core_Payment_MJWIPNTrait {
/**
* Update a contribution to failed
*
* @param array $params ['id', 'receive_date', 'trxn_id', {, cancel_date, cancel_reason}]
* @param array $params ['contribution_id', 'order_reference'{, cancel_date, cancel_reason}]
*
* @throws \CiviCRM_API3_Exception
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
private function updateContributionFailed($params) {
$this->checkRequiredParams('updateContributionFailed', ['contribution_id', 'trxn_date', 'order_reference'], $params);
$this->checkRequiredParams('updateContributionFailed', ['contribution_id', 'order_reference'], $params);
civicrm_api3('Contribution', 'create', [
'id' => $params['contribution_id'],
'contribution_status_id' => 'Failed',
'receive_date' => $params['trxn_date'],
'id' => $params['contribution_id'],
'trxn_id' => $params['order_reference'],
'cancel_date' => $params['cancel_date'] ?? NULL,
'cancel_reason' => $params['cancel_reason'] ?? NULL,
]);
// No financial_trxn is created so we don't need to update that.
}
......
Supports Markdown
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