In all the places I checked passing in this param achieved nothing. Let's start by making it optional
* @param array $ids
* @param array $objects
* @param CRM_Core_Transaction $transaction
+ * It is not recommended to pass this in. The calling function handle it's own roll back if it wants it.
* @param bool $isPostPaymentCreate
* Is this being called from the payment.create api. If so the api has taken care of financial entities.
* Note that our goal is that this would only ever be called from payment.create and never handle financials (only
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
- public static function completeOrder($input, &$ids, $objects, $transaction, $isPostPaymentCreate = FALSE) {
+ public static function completeOrder($input, &$ids, $objects, $transaction = NULL, $isPostPaymentCreate = FALSE) {
+ if (!$transaction) {
+ $transaction = new CRM_Core_Transaction();
+ }
$contribution = $objects['contribution'];
$primaryContributionID = $contribution->id ?? $objects['first_contribution']->id;
// The previous details are used when calculating line items so keep it before any code that 'does something'
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
- public function completeTransaction(&$input, &$ids, &$objects, &$transaction) {
+ public function completeTransaction(&$input, &$ids, &$objects, $transaction = NULL) {
CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects, $transaction);
}
}
$input['card_type_id'] = $params['card_type_id'] ?? NULL;
$input['pan_truncation'] = $params['pan_truncation'] ?? NULL;
- $transaction = new CRM_Core_Transaction();
- return CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects, $transaction,
- CRM_Utils_Array::value('is_post_payment_create', $params));
+ return CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects, NULL,
+ $params['is_post_payment_create'] ?? NULL);
}
/**