Development

Changeset 6997

You must first sign up to be able to contribute.

Changeset 6997

Show
Ignore:
Timestamp:
01/09/08 04:45:19 (11 months ago)
Author:
Stephen.Ostrow
Message:
  • Updated the class to allow the use of api login id and api transaction key
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfAuthorizeNetPlugin/lib/sfAuthorizeNet.class.php

    r2641 r6997  
    2222   */ 
    2323  private $authorize_password; 
     24   
     25  /** 
     26   * Method to use to authenticate with Authorize.net gatway. Default is password.  Recommended to be set to x_tran_key 
     27   * 
     28   * @var string 
     29   */ 
     30  private $authentication_method = "x_password"; 
    2431   
    2532  /** 
     
    8895   * - url     - The absolute URL to the Authorize.net gateway 
    8996   * - test    - Boolean value, enable or disable test mode 
    90    * @param string $username - Authorize.net gateway username 
    91    * @param string $password (optional) - Authorize.net gateway password 
     97   * - authentication_method - String of either x_password or x_tran_key 
     98   * @param string $username - Authorize.net gateway username or API login id 
     99   * @param string $password (optional) - Authorize.net gateway password or API transaction key depending on $authorize_authentication_method 
    92100   * @param array  $options (optional)  
    93101   */ 
     
    103111    if (isset($options['url'])) $this->setAuthorizeUrl($options['url']); 
    104112    if (isset($options['test'])) $this->setAuthorizeTestMode($options['test']); 
     113    if (isset($options['authentication_method'])) $this->setAuthenticationMethod($options['authentication_method']); 
    105114  } 
    106115     
     
    154163  { 
    155164    $this->authorize_hash = $hash; 
     165  } 
     166   
     167  /** 
     168   * Sets the authentication method for the authorize.net gateway 
     169   * 
     170   * @param string $authentication_method Should be either x_password or x_tran_key 
     171   */ 
     172  public function setAuthenticationMethod($authentication_method) 
     173  { 
     174    $this->authentication_method = $authentication_method; 
     175  } 
     176 
     177  /** 
     178   * Returns the Authentication method for authorize.net gateway 
     179   * 
     180   * @return string 
     181   */ 
     182  public function getAuthenticationMethod() 
     183  { 
     184    return $this->authentication_method; 
    156185  } 
    157186   
     
    865894    $this->addQueryParameter('x_delim_data', 'TRUE'); 
    866895    $this->addQueryParameter('x_login', $this->getAuthorizeUsername()); 
    867     $this->addQueryParameter('x_password', $this->getAuthorizePassword()); 
     896    $this->addQueryParameter($this->getAuthenticationMethod(), $this->getAuthorizePassword()); 
    868897    $this->addQueryParameter('x_version', $this->getAuthorizeVersion()); 
    869898    $this->addQueryParameter('x_type', $this->getAuthorizeType()); 
     
    10041033      curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string); 
    10051034      curl_setopt($ch, CURLOPT_REFERER, ""); 
     1035      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true); 
     1036      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
    10061037      $response = curl_exec($ch); 
    10071038      curl_close($ch);