* $Id: Dummy.php 45429 2013-02-06 22:11:18Z lobo $
*/
+use Civi\Payment\Exception\PaymentProcessorException;
+
/**
* Dummy payment processor
*/
*
* @return array
* the result in a nice formatted array (or an error object)
+ * @throws \Civi\Payment\Exception\PaymentProcessorException
*/
public function doDirectPayment(&$params) {
// Invoke hook_civicrm_paymentProcessor
//end of hook invocation
if (!empty($this->_doDirectPaymentResult)) {
$result = $this->_doDirectPaymentResult;
+ if (CRM_Utils_Array::value('payment_status_id', $result) === 'failed') {
+ throw new PaymentProcessorException($result['message'] ?? 'failed');
+ }
$result['trxn_id'] = array_shift($this->_doDirectPaymentResult['trxn_id']);
return $result;
}
if ($this->_mode == 'test') {
$query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id LIKE 'test\\_%'";
$p = [];
- $trxn_id = strval(CRM_Core_Dao::singleValueQuery($query, $p));
+ $trxn_id = strval(CRM_Core_DAO::singleValueQuery($query, $p));
$trxn_id = str_replace('test_', '', $trxn_id);
$trxn_id = intval($trxn_id) + 1;
$params['trxn_id'] = 'test_' . $trxn_id . '_' . uniqid();
else {
$query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id LIKE 'live_%'";
$p = [];
- $trxn_id = strval(CRM_Core_Dao::singleValueQuery($query, $p));
+ $trxn_id = strval(CRM_Core_DAO::singleValueQuery($query, $p));
$trxn_id = str_replace('live_', '', $trxn_id);
$trxn_id = intval($trxn_id) + 1;
$params['trxn_id'] = 'live_' . $trxn_id . '_' . uniqid();
return TRUE;
}
+ /**
+ * Supports altering future start dates
+ * @return bool
+ */
+ public function supportsFutureRecurStartDate() {
+ return TRUE;
+ }
+
/**
* Submit a refund payment
*