Skip to content
Snippets Groups Projects
Commit b87dd88b authored by Eileen McNaughton's avatar Eileen McNaughton
Browse files

Handle participant payment create in line item

Remove participant payment create from order api

This is now done in the line item create & we went through to 'prove' that it works with
extra validation
parent 04468647
Branches
Tags
No related merge requests found
......@@ -72,6 +72,15 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem {
civicrm_api3('MembershipPayment', 'create', $membershipPaymentParams);
}
}
if ($lineItemBAO->entity_table === 'civicrm_participant' && $lineItemBAO->contribution_id && $lineItemBAO->entity_id) {
$participantPaymentParams = [
'participant_id' => $lineItemBAO->entity_id,
'contribution_id' => $lineItemBAO->contribution_id,
];
if (!civicrm_api3('ParticipantPayment', 'getcount', $participantPaymentParams)) {
civicrm_api3('ParticipantPayment', 'create', $participantPaymentParams);
}
}
if ($id) {
// CRM-21281: Restore entity reference in case the post hook needs it
......
......@@ -160,10 +160,6 @@ function civicrm_api3_order_create(array $params): array {
CRM_Core_Error::deprecatedWarning('This should be unreachable & tests show it is never tested.');
civicrm_api3('PledgePayment', 'create', $paymentParams);
}
if ($entity === 'participant') {
civicrm_api3('ParticipantPayment', 'create', $paymentParams);
}
}
}
return civicrm_api3_create_success($contribution['values'] ?? [], $params, 'Order', 'create');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment