Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always use cancelSubscription form for cancelling recurring contributions #18196

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions CRM/Financial/BAO/PaymentProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,24 @@ public static function getAllPaymentProcessors($mode = 'all', $reset = FALSE, $i
}

$processors = civicrm_api3('payment_processor', 'get', $retrievalParameters);
// Add the pay-later pseudo-processor.
$processors['values'][0] = [
'id' => 0,
'payment_processor_type_id' => 0,
// This shouldn't be required but there are still some processors hacked into core with nasty 'if's.
'api.payment_processor_type.getsingle' => ['name' => 'Manual'],
'class_name' => 'Payment_Manual',
'name' => 'pay_later',
'billing_mode' => '',
'is_default' => 0,
'payment_instrument_id' => key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1')),
// Making this optionally recur would give lots of options -but it should
// be a row in the payment processor table before we do that.
'is_recur' => FALSE,
'is_test' => FALSE,
'domain_id' => CRM_Core_Config::domainID(),
'is_active' => 1,
];
foreach ($processors['values'] as $processor) {
$fieldsToProvide = [
'id',
Expand Down Expand Up @@ -334,24 +352,6 @@ public static function getAllPaymentProcessors($mode = 'all', $reset = FALSE, $i
$processors['values'][$processor['id']]['object'] = Civi\Payment\System::singleton()->getByProcessor($processors['values'][$processor['id']]);
}

// Add the pay-later pseudo-processor.
$processors['values'][0] = [
'object' => new CRM_Core_Payment_Manual(),
'id' => 0,
'payment_processor_type_id' => 0,
// This shouldn't be required but there are still some processors hacked into core with nasty 'if's.
'payment_processor_type' => 'Manual',
'class_name' => 'Payment_Manual',
'name' => 'pay_later',
'billing_mode' => '',
'is_default' => 0,
'payment_instrument_id' => key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1')),
// Making this optionally recur would give lots of options -but it should
// be a row in the payment processor table before we do that.
'is_recur' => FALSE,
'is_test' => FALSE,
];

CRM_Utils_Cache::singleton()->set($cacheKey, $processors['values']);

return $processors['values'];
Expand Down