/**
* Constructor
*
- * @param string $mode the mode of operation: live or test
+ * @param string $mode
+ * The mode of operation: live or test.
*
* @param $paymentProcessor
*
* @return \CRM_Core_Payment_IATS
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = ts('IATS');
}
}
- /**
- * @param string $mode
- * @param array $paymentProcessor
- *
- * @return mixed
- */
- static function &singleton($mode, &$paymentProcessor) {
- $processorName = $paymentProcessor['name'];
- if (self::$_singleton[$processorName] === NULL) {
- self::$_singleton[$processorName] = new CRM_Core_Payment_IATS($mode, $paymentProcessor);
- }
- return self::$_singleton[$processorName];
- }
-
/**
* This function collects all the information from a web/api form and invokes
* the relevant payment processor specific functions to perform the transaction
*
- * @param array $params assoc array of input parameters for this transaction
+ * @param array $params
+ * Assoc array of input parameters for this transaction.
*
- * @return array the result in an nice formatted array (or an error object)
+ * @return array
+ * the result in an nice formatted array (or an error object)
* @abstract
*/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
// $result = '';
// foreach($params as $key => $value) {
// $result .= "<strong>$key</strong>: $value<br />";
// beginning of modified sample code from IATS php api include IATS supplied api library
if ($isRecur) {
- include_once ('Services/IATS/iats_reoccur.php');
+ include_once 'Services/IATS/iats_reoccur.php';
$iatslink1 = new iatslinkReoccur;
}
else {
- include_once ('Services/IATS/iatslink.php');
+ include_once 'Services/IATS/iatslink.php';
$iatslink1 = new iatslink;
}
case 'week':
$scheduleType = 'WEEKLY';
$scheduleDate = $date['wday'] + 1;
- $endTime = $startTime + ($paymentsRecur * 7 * 24 * 60 * 60);
+ $endTime = $startTime + ($paymentsRecur * 7 * 24 * 60 * 60);
break;
case 'month':
// this just means we got some kind of answer, not necessarily approved
$result = $iatslink1->getAuthorizationResult();
//return self::error($result);
- $result = explode(':', $result, 2);
+ $result = explode(':', $result, 2);
$trxn_result = trim($result[0]);
- $trxn_id = trim($result[1]);
+ $trxn_id = trim($result[1]);
if ($trxn_result == 'OK') {
$params['trxn_id'] = $trxn_id . ':' . time();
$params['gross_amount'] = $amount;
*
* @return object
*/
- function &error($error = NULL) {
+ public function &error($error = NULL) {
$e = CRM_Core_Error::singleton();
if (is_object($error)) {
$e->push($error->getResponseCode(),
*
* @return string
*/
- function errorString($error_id) {
+ public function errorString($error_id) {
$errors = array(
1 => 'Agent Code has not been set up on the authorization system.',
2 => 'Unable to process transaction. Verify and re-enter credit card information.',
*
* @internal param string $mode the mode we are operating in (live or test)
*
- * @return string the error message if any
- * @public
+ * @return string
+ * the error message if any
*/
- function checkConfig() {
+ public function checkConfig() {
$error = array();
if (empty($this->_paymentProcessor['signature'])) {
}
}
}
-