+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
+ | Copyright CiviCRM LLC (c) 2004-2020 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC (c) 2004-2020
*/
/**
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
public function doExpressCheckout(&$params) {
- $statuses = CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id');
if (!empty($params['is_recur'])) {
return $this->createRecurringPayments($params);
}
}
/* Success */
-
$params['trxn_id'] = $result['transactionid'];
$params['gross_amount'] = $result['amt'];
$params['fee_amount'] = $result['feeamt'];
$params['pending_reason'] = $result['pendingreason'];
if (!empty($params['is_recur'])) {
// See comment block.
- $params['payment_status_id'] = array_search('Pending', $statuses);
+ $params['payment_status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending');
}
else {
- $params['payment_status_id'] = array_search('Completed', $statuses);
+ $params['payment_status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed');
}
return $params;
}
if ($outcome != 'success' && $outcome != 'successwithwarning') {
throw new PaymentProcessorException("{$result['l_shortmessage0']} {$result['l_longmessage0']}");
- $e = CRM_Core_Error::singleton();
- $e->push($result['l_errorcode0'],
- 0, NULL,
- "{$result['l_shortmessage0']} {$result['l_longmessage0']}"
- );
- return $e;
}
return $result;