Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class authnet extends obj

Helix obj authnet
Hide Inherited MembersE-Commerce
Description
No description.
 
Constants
No constants.
 
Properties
protected_dirty[ obj ]
publicfields[ authnet ]
protected_gateway_url[ authnet ]
publicproperty_objects_array[ obj ]
publicresponse[ authnet ]
 
Methods
public__construct ( )[ authnet ]
Parameters
No parameters for this method
Code
008  public function __construct()
009  {
010      $this->_gateway_url = "https://secure.authorize.net/gateway/transact.dll";
011     
012      $this->fields["x_login"] = new authnet_field("x_login",null,true,20);
013      $this->fields["x_tran_key"] = new authnet_field("x_tran_key",null,true,16);
014      $this->fields["x_version"] = new authnet_field("x_version","3.1",false,3);
015      $this->fields["x_test_request"] = new authnet_field("x_test_request","TRUE",false,5);
016      $this->fields["x_delim_data"] = new authnet_field("x_delim_data","TRUE",false,5);
017      $this->fields["x_delim_char"] = new authnet_field("x_delim_char",null,false,1);
018      $this->fields["x_encap_char"] = new authnet_field("x_encap_char",null,false,1);
019      $this->fields["x_relay_response"] = new authnet_field("x_relay_response","FALSE",false,null);
020      $this->fields["x_duplicate_window"] = new authnet_field("x_duplicate_window",null,false,5);
021      $this->fields["x_first_name"] = new authnet_field("x_first_name",null,false,50);
022      $this->fields["x_last_name"] = new authnet_field("x_last_name",null,false,50);
023      $this->fields["x_company"] = new authnet_field("x_company",null,false,50);
024      $this->fields["x_address"] = new authnet_field("x_address",null,false,60);
025      $this->fields["x_city"] = new authnet_field("x_city",null,false,40);
026      $this->fields["x_state"] = new authnet_field("x_state",null,false,40);
027      $this->fields["x_zip"] = new authnet_field("x_zip",null,false,20);
028      $this->fields["x_country"] = new authnet_field("x_country",null,false,60);
029      $this->fields["x_phone"] = new authnet_field("x_phone",null,false,25);
030      $this->fields["x_fax"] = new authnet_field("x_fax",null,false,25);
031      $this->fields["x_cust_id"] = new authnet_field("x_cust_id",null,false,20);
032      $this->fields["x_customer_ip"] = new authnet_field("x_customer_ip",null,false,15);
033      $this->fields["x_customer_tax_id"] = new authnet_field("x_customer_tax_id",null,false,9);
034      $this->fields["x_email"] = new authnet_field("x_email",null,false,255);
035      $this->fields["x_email_customer"] = new authnet_field("x_email_customer","FALSE",false,5);
036      $this->fields["x_merchant_email"] = new authnet_field("x_merchant_email",null,false,255);
037      $this->fields["x_invoice_num"] = new authnet_field("x_invoice_num",null,false,20);
038      $this->fields["x_description"] = new authnet_field("x_description",null,false,255);
039      $this->fields["x_line_item"] = new authnet_field("x_line_item",null,false,null);
040      $this->fields["x_ship_to_first_name"] = new authnet_field("x_ship_to_first_name",null,false,50);
041      $this->fields["x_ship_to_last_name"] = new authnet_field("x_ship_to_last_name",null,false,50);
042      $this->fields["x_ship_to_company"] = new authnet_field("x_ship_to_company",null,false,50);
043      $this->fields["x_ship_to_address"] = new authnet_field("x_ship_to_address",null,false,60);
044      $this->fields["x_ship_to_city"] = new authnet_field("x_ship_to_city",null,false,40);
045      $this->fields["x_ship_to_state"] = new authnet_field("x_ship_to_state",null,false,40);
046      $this->fields["x_ship_to_zip"] = new authnet_field("x_ship_to_zip",null,false,20);
047      $this->fields["x_ship_to_country"] = new authnet_field("x_ship_to_country",null,false,60);
048      $this->fields["x_amount"] = new authnet_field("x_amount",null,true,15);
049      $this->fields["x_currency_code"] = new authnet_field("x_currency_code",null,false,3);
050      $this->fields["x_method"] = new authnet_field("x_method","CC",true,null);
051      $this->fields["x_type"] = new authnet_field("x_type",null,true,null);
052      $this->fields["x_recurring_billing"] = new authnet_field("x_recurring_billing",null,false,3);
053      $this->fields["x_bank_aba_code"] = new authnet_field("x_bank_aba_code",null,false,9);
054      $this->fields["x_bank_acct_num"] = new authnet_field("x_bank_acct_num",null,false,20);
055      $this->fields["x_bank_acct_type"] = new authnet_field("x_bank_acct_type",null,false,null);
056      $this->fields["x_bank_name"] = new authnet_field("x_bank_name",null,false,50);
057      $this->fields["x_bank_acct_name"] = new authnet_field("x_bank_acct_name",null,false,null);
058      $this->fields["x_echeck_type"] = new authnet_field("x_echeck_type",null,false,null);
059      $this->fields["x_card_num"] = new authnet_field("x_card_num",null,false,22);
060      $this->fields["x_exp_date"] = new authnet_field("x_exp_date",null,false,null);
061      $this->fields["x_card_code"] = new authnet_field("x_card_code",null,false,4);
062      $this->fields["x_trans_id"] = new authnet_field("x_trans_id",null,false,10);
063      $this->fields["x_auth_code"] = new authnet_field("x_auth_code",null,false,6);
064      $this->fields["x_authentication_indicator"] = new authnet_field("x_authentication_indicator",null,false,null);
065      $this->fields["x_cardholder_authentication_value"] = new authnet_field("x_cardholder_authentication_value",null,false,null);
066      $this->fields["x_po_num"] = new authnet_field("x_po_num",null,false,25);
067      $this->fields["x_tax"] = new authnet_field("x_tax",null,false,null);
068      $this->fields["x_tax_exempt"] = new authnet_field("x_tax_exempt",null,false,5);
069      $this->fields["x_freight"] = new authnet_field("x_freight",null,false,null);
070      $this->fields["x_duty"] = new authnet_field("x_duty",null,false,null);
071      $this->fields["x_customer_organization_type"] = new authnet_field("x_customer_organization_type",null,false,null);
072      $this->fields["x_drivers_license_nuk"] = new authnet_field("x_drivers_license_nuk",null,false,50);
073      $this->fields["x_drivers_license_state"] = new authnet_field("x_drivers_license_state",null,false,2);
074      $this->fields["x_drivers_license_dob"] = new authnet_field("x_drivers_license_dob",null,false,null);
075  }
public__get ( p )[ obj ]
Parameters
requiredp
Code
007  public function __get($p)
008  {
009      $methods = get_class_methods($this);
010      $properties = get_object_vars($this);
011      if (in_array("get_$p",$methods))
012      {
013          return $this->{"get_$p"}();
014      }
015      else if (array_key_exists("_$p",$properties))
016      {
017          return $this->{"_$p"};
018      }
019      else if (in_array("get_" . substr($p,strpos($p,"_")+1), $methods))
020      {
021          return $this->{"get_" . substr($p,strpos($p,"_")+1)}(substr($p,0,strpos($p,"_")));
022      }
023      else
024      {
025          trigger_error("This object [" . get_class($this) . ":$this->id] has no private property '_$p' for the requested public property '$p'",E_USER_WARNING);
026          return null;
027      }
028  }
publicget_array ( )[ obj ]
Parameters
No parameters for this method
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicget_classname ( )[ obj ]
Parameters
No parameters for this method
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publicget_dirty ( )[ obj ]
Parameters
No parameters for this method
Code
063  public function get_dirty()
064  {
065      if ($this->id === 0)
066      {
067          $this->_dirty = true;
068      }
069      else
070      {
071          foreach (get_object_vars($this) as $k=>$v)
072          {
073              if ($this->_dirty)
074              {
075                  break;
076              }
077              if (preg_match('/_dirty$/',$k))
078              {
079                  $this->_dirty = $this->_dirty || $v;
080              }
081          }
082      }
083      return $this->_dirty;
084  }
publicget_json ( )[ obj ]
Parameters
No parameters for this method
Code
101  public function get_json()
102  {
103      $class = new ReflectionClass($this->classname);
104      $methods = $class->getMethods();
105      usort($methods,"sort_reflection_objects");
106      $accessors = array();
107      foreach ($methods as $index=>$method)
108      {
109          $declarer = $method->getDeclaringClass()->name;
110          if (preg_match('/^(get|set|)_(.+)$/',$method->name,$matches))
111          {
112              $accessor = $matches[2];
113              $getset = $matches[1];
114              eval("\$accessors[\$accessor] = \$this->".$accessor.";");
115          }
116      }
117      //return json_encode($this->get_array());
118      return json_encode($accessors);
119  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
protectedget_string ( )[ obj ]
Parameters
No parameters for this method
Code
091  protected function get_string()
092  {
093      return method_exists($this,"__toString") ? $this->__toString() : null;
094  }
publicprocess ( )[ authnet ]
Parameters
No parameters for this method
Code
077  public function process()
078  {
079      debug("process",__FILE__,__LINE__);
080      $this->fields["x_test_request"]->value = ($this->fields["x_test_request"]->value == "FALSE") ? "FALSE" : "TRUE";
081      $fields = array();
082      foreach ($this->fields as $k=>$v)
083      {
084          if (!is_null($v->value))
085          {
086              $fields[] = $k . "=" . rawurlencode($v->value);
087          }
088          else if ($v->required)
089          {
090              error("Authnet Required Field Missing", "'$k' is a required field.");
091          }
092      }
093      $postfields = implode("&",$fields);
094      debug("postfields : $postfields",__FILE__,__LINE__);
095      $ch = curl_init();
096      curl_setopt($ch, CURLOPT_URL, $this->_gateway_url);
097      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
098      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
099      curl_setopt($ch, CURLOPT_POST, true);
100      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
101      curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
102      $response = curl_exec($ch);
103      debug("response : $response",__FILE__,__LINE__);
104      $curl_info = curl_getinfo($ch);
105      debug("curl error info : [ " . curl_errno($ch) . " ] " . curl_error($ch),__FILE__,__LINE__);
106      curl_close($ch);
107     
108      $this->response = new authnet_response($response);
109      foreach ($this->response->data as $k=>$v)
110      {
111          debug($k . " = " . $v,__FILE__,__LINE__);
112      }
113      return timestamp() . " : " . $this->response->status;
114  }
public__set ( p , v )[ obj ]
Parameters
requiredp
requiredv
Code
030  public function __set($p,$v)
031  {
032      $methods = get_class_methods($this);
033      $properties = get_object_vars($this);
034      if (in_array("set_$p",$methods))
035      {
036          $this->{"set_$p"}($v);
037      }
038      else if (array_key_exists("_$p",$properties))
039      {
040          if (!preg_match('/_dirty$/',$p) && property_exists($this,"_{$p}_dirty"))
041          {
042              if (is_object($this->{"_$p"}))
043              {
044                  $this->{"_$p"}->dirty = true;
045              }
046              else
047              {
048                  $this->{"_{$p}_dirty"} = $this->{$p}==$v ? false : true;
049              }
050          }
051          $this->{"_$p"} = $v;
052      }
053      else if (in_array("set_" . substr($p,strpos($p,"_")+1), $methods))
054      {
055          $this->{"set_" . substr($p,strpos($p,"_")+1)}($v,substr($p,0,strpos($p,"_")));
056      }
057      else
058      {
059          trigger_error("This object [" . get_class($this) . ":$this->id] has no private property '_$p' for the requested public property '$p'",E_USER_WARNING);
060      }
061  }
 
Accessors
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicclassname[ obj ]
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publicdirty[ obj ]
Code
063  public function get_dirty()
064  {
065      if ($this->id === 0)
066      {
067          $this->_dirty = true;
068      }
069      else
070      {
071          foreach (get_object_vars($this) as $k=>$v)
072          {
073              if ($this->_dirty)
074              {
075                  break;
076              }
077              if (preg_match('/_dirty$/',$k))
078              {
079                  $this->_dirty = $this->_dirty || $v;
080              }
081          }
082      }
083      return $this->_dirty;
084  }
publicjson[ obj ]
Code
101  public function get_json()
102  {
103      $class = new ReflectionClass($this->classname);
104      $methods = $class->getMethods();
105      usort($methods,"sort_reflection_objects");
106      $accessors = array();
107      foreach ($methods as $index=>$method)
108      {
109          $declarer = $method->getDeclaringClass()->name;
110          if (preg_match('/^(get|set|)_(.+)$/',$method->name,$matches))
111          {
112              $accessor = $matches[2];
113              $getset = $matches[1];
114              eval("\$accessors[\$accessor] = \$this->".$accessor.";");
115          }
116      }
117      //return json_encode($this->get_array());
118      return json_encode($accessors);
119  }
publicproperties[ obj ]
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicstring[ obj ]
Code
091  protected function get_string()
092  {
093      return method_exists($this,"__toString") ? $this->__toString() : null;
094  }
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads