Merge pull request #4898 from monishdeb/CRM-15619-fix
[civicrm-core.git] / CRM / Core / Payment / eWAY.php
index ceb785e7b8a040eb9bdf2e9b47483dad633b5299..71457de839318fb0df9410358449dafe609165bd 100644 (file)
 */
 
 /**
- -----------------------------------------------------------------------------------------------
- From the eWAY supplied 'Web.config' dated 25-Sep-2006 - check date and update links if required
- -----------------------------------------------------------------------------------------------
-
- LIVE gateway with CVN
- https://www.eway.com.au/gateway_cvn/xmlpayment.asp
-
- LIVE gateway without CVN
- https://www.eway.com.au/gateway/xmlpayment.asp
-
-
- Test gateway with CVN
- https://www.eway.com.au/gateway_cvn/xmltest/TestPage.asp
-
- Test gateway without CVN
- https://www.eway.com.au/gateway/xmltest/TestPage.asp
-
-
- LIVE gateway for Stored Transactions
- https://www.eway.com.au/gateway/xmlstored.asp
-
-
- -----------------------------------------------------------------------------------------------
- From the eWAY web-site - http://www.eway.com.au/Support/Developer/PaymentsRealTime.aspx
- -----------------------------------------------------------------------------------------------
- The test Customer ID is 87654321 - this is the only ID that will work on the test gateway.
- The test Credit Card number is 4444333322221111
- - this is the only credit card number that will work on the test gateway.
- The test Total Amount should end in 00 or 08 to get a successful response (e.g. $10.00 or $10.08)
- ie - all other amounts will return a failed response.
-
- -----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
From the eWAY supplied 'Web.config' dated 25-Sep-2006 - check date and update links if required
-----------------------------------------------------------------------------------------------
+ *
LIVE gateway with CVN
https://www.eway.com.au/gateway_cvn/xmlpayment.asp
+ *
LIVE gateway without CVN
https://www.eway.com.au/gateway/xmlpayment.asp
+ *
+ *
Test gateway with CVN
https://www.eway.com.au/gateway_cvn/xmltest/TestPage.asp
+ *
Test gateway without CVN
https://www.eway.com.au/gateway/xmltest/TestPage.asp
+ *
+ *
LIVE gateway for Stored Transactions
https://www.eway.com.au/gateway/xmlstored.asp
+ *
+ *
-----------------------------------------------------------------------------------------------
From the eWAY web-site - http://www.eway.com.au/Support/Developer/PaymentsRealTime.aspx
-----------------------------------------------------------------------------------------------
The test Customer ID is 87654321 - this is the only ID that will work on the test gateway.
The test Credit Card number is 4444333322221111
- this is the only credit card number that will work on the test gateway.
The test Total Amount should end in 00 or 08 to get a successful response (e.g. $10.00 or $10.08)
ie - all other amounts will return a failed response.
+ *
-----------------------------------------------------------------------------------------------
  **/
 class CRM_Core_Payment_eWAY extends CRM_Core_Payment {
   # (not used, implicit in the API, might need to convert?)
@@ -124,34 +124,6 @@ class CRM_Core_Payment_eWAY extends CRM_Core_Payment {
     $this->_processorName = ts('eWay');
   }
 
-  /**
-   * Singleton function used to manage this object
-   *
-   * @param string $mode
-   *   The mode of operation: live or test.
-   *
-   * @param object $paymentProcessor
-   * @param null $paymentForm
-   * @param bool $force
-   *
-   * @return object
-   * @static
-   */
-  public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
-    if (!empty($paymentProcessor['id'])) {
-      $cacheKey = $paymentProcessor['id'];
-    }
-    else {
-      //@todo eliminated instances of this in favour of id-specific instances.
-      $cacheKey = $mode . '_' . $paymentProcessor['name'];
-    }
-
-    if (self::$_singleton[$cacheKey] === NULL) {
-      self::$_singleton[$cacheKey] = new CRM_Core_Payment_eWAY($mode, $paymentProcessor);
-    }
-    return self::$_singleton[$cacheKey];
-  }
-
   /**********************************************************
    * This function sends request and receives response from
    * eWAY payment process
@@ -198,7 +170,7 @@ class CRM_Core_Payment_eWAY extends CRM_Core_Payment {
     // Prepare some composite data from _paymentProcessor fields
     //-------------------------------------------------------------
     $fullAddress = $params['street_address'] . ", " . $params['city'] . ", " . $params['state_province'] . ".";
-    $expireYear  = substr($params['year'], 2, 2);
+    $expireYear = substr($params['year'], 2, 2);
     $expireMonth = sprintf('%02d', (int) $params['month']);
     // CiviCRM V1.9 - Picks up reasonable description
     //$description = $params['amount_level'];
@@ -440,7 +412,8 @@ class CRM_Core_Payment_eWAY extends CRM_Core_Payment {
    * @param int $invoiceId
    *   The ID to check.
    *
-   * @return bool                 True if ID exists, else false
+   * @return bool
+   *   True if ID exists, else false
    */
   public function _checkDupe($invoiceId) {
     $contribution = new CRM_Contribute_DAO_Contribution();
@@ -566,12 +539,12 @@ The CiviCRM eWAY Payment Processor Module
     $params = array();
 
     $params['groupName'] = 'eWay Email Sender';
-    $params['from']      = $from;
-    $params['toName']    = $toName;
-    $params['toEmail']   = $toEmail;
-    $params['subject']   = $subject;
-    $params['cc']        = $cc;
-    $params['text']      = $message;
+    $params['from'] = $from;
+    $params['toName'] = $toName;
+    $params['toEmail'] = $toEmail;
+    $params['subject'] = $subject;
+    $params['cc'] = $cc;
+    $params['text'] = $message;
 
     CRM_Utils_Mail::send($params);
   }