M2_AuthorizeNetSIM_Form

A helper class for using hosted order page.

Defined (1)

The class is defined in the following location(s).

/lib/authorize.net/lib/AuthorizeNetSIM.php  
  1. class M2_AuthorizeNetSIM_Form 
  2. public $x_address; 
  3. public $x_amount; 
  4. public $x_background_url; 
  5. public $x_card_num; 
  6. public $x_city; 
  7. public $x_color_background; 
  8. public $x_color_link; 
  9. public $x_color_text; 
  10. public $x_company; 
  11. public $x_country; 
  12. public $x_cust_id; 
  13. public $x_customer_ip; 
  14. public $x_description; 
  15. public $x_delim_data; 
  16. public $x_duplicate_window; 
  17. public $x_duty; 
  18. public $x_email; 
  19. public $x_email_customer; 
  20. public $x_fax; 
  21. public $x_first_name; 
  22. public $x_footer_email_receipt; 
  23. public $x_footer_html_payment_form; 
  24. public $x_footer_html_receipt; 
  25. public $x_fp_hash; 
  26. public $x_fp_sequence; 
  27. public $x_fp_timestamp; 
  28. public $x_freight; 
  29. public $x_header_email_receipt; 
  30. public $x_header_html_payment_form; 
  31. public $x_header_html_receipt; 
  32. public $x_invoice_num; 
  33. public $x_last_name; 
  34. public $x_line_item; 
  35. public $x_login; 
  36. public $x_logo_url; 
  37. public $x_method; 
  38. public $x_phone; 
  39. public $x_po_num; 
  40. public $x_receipt_link_method; 
  41. public $x_receipt_link_text; 
  42. public $x_receipt_link_url; 
  43. public $x_recurring_billing; 
  44. public $x_relay_response; 
  45. public $x_relay_url; 
  46. public $x_rename; 
  47. public $x_ship_to_address; 
  48. public $x_ship_to_company; 
  49. public $x_ship_to_country; 
  50. public $x_ship_to_city; 
  51. public $x_ship_to_first_name; 
  52. public $x_ship_to_last_name; 
  53. public $x_ship_to_state; 
  54. public $x_ship_to_zip; 
  55. public $x_show_form; 
  56. public $x_state; 
  57. public $x_tax; 
  58. public $x_tax_exempt; 
  59. public $x_test_request; 
  60. public $x_trans_id; 
  61. public $x_type; 
  62. public $x_version; 
  63. public $x_zip; 
  64.  
  65. /** 
  66. * Constructor 
  67. * @param array $fields Fields to set. 
  68. */ 
  69. public function __construct($fields = false) 
  70. // Set some best practice fields 
  71. $this->x_relay_response = "FALSE"; 
  72. $this->x_version = "3.1"; 
  73. $this->x_delim_char = ", "; 
  74. $this->x_delim_data = "TRUE"; 
  75.  
  76. if ($fields) { 
  77. foreach ($fields as $key => $value) { 
  78. $this->$key = $value; 
  79.  
  80. /** 
  81. * Get a string of HTML hidden fields for use in a form. 
  82. * @return string 
  83. */ 
  84. public function getHiddenFieldString() 
  85. $array = (array)$this; 
  86. $string = ""; 
  87. foreach ($array as $key => $value) { 
  88. if ($value) { 
  89. $string .= '<input type="hidden" name="'.$key.'" value="'.$value.'">'; 
  90. return $string; 
  91.  
  92. /** 
  93. * Generates a fingerprint needed for a hosted order form or DPM. 
  94. * @param string $api_login_id Login ID. 
  95. * @param string $transaction_key API key. 
  96. * @param string $amount Amount of transaction. 
  97. * @param string $fp_sequence An invoice number or random number. 
  98. * @param string $fp_timestamp Timestamp. 
  99. * @return string The fingerprint. 
  100. */ 
  101. public static function getFingerprint($api_login_id, $transaction_key, $amount, $fp_sequence, $fp_timestamp) 
  102. $api_login_id = ($api_login_id ? $api_login_id : (defined('AUTHORIZENET_API_LOGIN_ID') ? AUTHORIZENET_API_LOGIN_ID : "")); 
  103. $transaction_key = ($transaction_key ? $transaction_key : (defined('AUTHORIZENET_TRANSACTION_KEY') ? AUTHORIZENET_TRANSACTION_KEY : "")); 
  104. if (function_exists('hash_hmac')) { 
  105. return hash_hmac("md5", $api_login_id . "^" . $fp_sequence . "^" . $fp_timestamp . "^" . $amount . "^", $transaction_key);  
  106. return bin2hex(mhash(MHASH_MD5, $api_login_id . "^" . $fp_sequence . "^" . $fp_timestamp . "^" . $amount . "^", $transaction_key)); 
  107.