Skip to content
Snippets Groups Projects
Unverified Commit c7550c01 authored by mattwire's avatar mattwire Committed by GitHub
Browse files

Merge pull request #17607 from eileenmcnaughton/pi

Fix payment instrument bug by using correct payment instrument
parents 33da7777 eb6d5d25
No related branches found
No related tags found
No related merge requests found
...@@ -653,14 +653,15 @@ WHERE contribution_id = {$id} ...@@ -653,14 +653,15 @@ WHERE contribution_id = {$id}
/** /**
* Get the default payment instrument id. * Get the default payment instrument id.
* *
* This priortises the submitted value, if any and falls back on the processor.
*
* @return int * @return int
*
* @throws \CRM_Core_Exception
*/ */
protected function getDefaultPaymentInstrumentId() { protected function getDefaultPaymentInstrumentId() {
$paymentInstrumentID = CRM_Utils_Request::retrieve('payment_instrument_id', 'Integer'); $paymentInstrumentID = CRM_Utils_Request::retrieve('payment_instrument_id', 'Integer');
if ($paymentInstrumentID) { return (int) ($paymentInstrumentID ?? $this->_paymentProcessor['payment_instrument_id']);
return $paymentInstrumentID;
}
return key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment