}
$this->_processors = [];
foreach ($this->_paymentProcessors as $id => $processor) {
- // @todo review this. The inclusion of this IF was to address test processors being incorrectly loaded.
- // However the function $this->getValidProcessors() is expected to only return the processors relevant
- // to the mode (using the actual id - ie. the id of the test processor for the test processor).
- // for some reason there was a need to filter here per commit history - but this indicates a problem
- // somewhere else.
- if ($processor['is_test'] == ($this->_mode == 'test')) {
- $this->_processors[$id] = $processor['name'];
- if (!empty($processor['description'])) {
- $this->_processors[$id] .= ' : ' . $processor['description'];
- }
- if ($processor['is_recur']) {
- $this->_recurPaymentProcessors[$id] = $this->_processors[$id];
- }
+ $this->_processors[$id] = $processor['name'];
+ if (!empty($processor['description'])) {
+ $this->_processors[$id] .= ' : ' . $processor['description'];
+ }
+ if ($processor['is_recur']) {
+ $this->_recurPaymentProcessors[$id] = $this->_processors[$id];
}
}
// CRM-21002: pass the default payment processor ID whose credit card type icons should be populated first
* @throws \CRM_Core_Exception
*/
protected function assignPaymentProcessor($isPayLaterEnabled) {
- $this->_paymentProcessors = CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors(
- [ucfirst($this->_mode) . 'Mode'],
- $this->_paymentProcessorIDs
- );
+ $this->_paymentProcessors = CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors([ucfirst($this->_mode) . 'Mode'], $this->_paymentProcessorIDs);
if ($isPayLaterEnabled) {
$this->_paymentProcessors[0] = CRM_Financial_BAO_PaymentProcessor::getPayment(0);
}
* @return bool
*/
protected function supportsLiveMode() {
- return TRUE;
+ return empty($this->_paymentProcessor['is_test']) ? TRUE : FALSE;
}
/**
* @return bool
*/
protected function supportsTestMode() {
- return TRUE;
+ return empty($this->_paymentProcessor['is_test']) ? FALSE : TRUE;
}
/**
return $params;
}
- /**
- * Are back office payments supported.
- *
- * E.g paypal standard won't permit you to enter a credit card associated with someone else's login.
- *
- * @return bool
- */
- protected function supportsLiveMode() {
- return TRUE;
- }
-
/**
* Does this payment processor support refund?
*
* available processors
*/
public static function getPaymentProcessors($capabilities = [], $ids = FALSE) {
- $testProcessors = in_array('TestMode', $capabilities) ? self::getAllPaymentProcessors('test') : [];
if (is_array($ids)) {
+ $testProcessors = in_array('TestMode', $capabilities) ? self::getAllPaymentProcessors('test') : [];
$processors = self::getAllPaymentProcessors('all', FALSE, FALSE);
if (in_array('TestMode', $capabilities)) {
$possibleLiveIDs = array_diff($ids, array_keys($testProcessors));