@@ -77,19 +77,19 @@ discard block |
||
| 77 | 77 | * A list of all fields in the AIM API. |
| 78 | 78 | * Used to warn user if they try to set a field not offered in the API. |
| 79 | 79 | */ |
| 80 | - private $_all_aim_fields = array("address","allow_partial_auth","amount", |
|
| 81 | - "auth_code","authentication_indicator", "bank_aba_code","bank_acct_name", |
|
| 82 | - "bank_acct_num","bank_acct_type","bank_check_number","bank_name", |
|
| 83 | - "card_code","card_num","cardholder_authentication_value","city","company", |
|
| 84 | - "country","cust_id","customer_ip","delim_char","delim_data","description", |
|
| 85 | - "duplicate_window","duty","echeck_type","email","email_customer", |
|
| 86 | - "encap_char","exp_date","fax","first_name","footer_email_receipt", |
|
| 87 | - "freight","header_email_receipt","invoice_num","last_name","line_item", |
|
| 88 | - "login","method","phone","po_num","recurring_billing","relay_response", |
|
| 89 | - "ship_to_address","ship_to_city","ship_to_company","ship_to_country", |
|
| 90 | - "ship_to_first_name","ship_to_last_name","ship_to_state","ship_to_zip", |
|
| 91 | - "split_tender_id","state","tax","tax_exempt","test_request","tran_key", |
|
| 92 | - "trans_id","type","version","zip" |
|
| 80 | + private $_all_aim_fields = array("address", "allow_partial_auth", "amount", |
|
| 81 | + "auth_code", "authentication_indicator", "bank_aba_code", "bank_acct_name", |
|
| 82 | + "bank_acct_num", "bank_acct_type", "bank_check_number", "bank_name", |
|
| 83 | + "card_code", "card_num", "cardholder_authentication_value", "city", "company", |
|
| 84 | + "country", "cust_id", "customer_ip", "delim_char", "delim_data", "description", |
|
| 85 | + "duplicate_window", "duty", "echeck_type", "email", "email_customer", |
|
| 86 | + "encap_char", "exp_date", "fax", "first_name", "footer_email_receipt", |
|
| 87 | + "freight", "header_email_receipt", "invoice_num", "last_name", "line_item", |
|
| 88 | + "login", "method", "phone", "po_num", "recurring_billing", "relay_response", |
|
| 89 | + "ship_to_address", "ship_to_city", "ship_to_company", "ship_to_country", |
|
| 90 | + "ship_to_first_name", "ship_to_last_name", "ship_to_state", "ship_to_zip", |
|
| 91 | + "split_tender_id", "state", "tax", "tax_exempt", "test_request", "tran_key", |
|
| 92 | + "trans_id", "type", "version", "zip" |
|
| 93 | 93 | ); |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | // Split Array |
| 404 | 404 | $this->response = $response; |
| 405 | 405 | if ($encap_char) { |
| 406 | - $this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1)); |
|
| 406 | + $this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1)); |
|
| 407 | 407 | } else { |
| 408 | 408 | $this->_response_array = explode($delimiter, $response); |
| 409 | 409 | } |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | $this->duty = $this->_response_array[33]; |
| 458 | 458 | $this->freight = $this->_response_array[34]; |
| 459 | 459 | $this->tax_exempt = $this->_response_array[35]; |
| 460 | - $this->purchase_order_number= $this->_response_array[36]; |
|
| 460 | + $this->purchase_order_number = $this->_response_array[36]; |
|
| 461 | 461 | $this->md5_hash = $this->_response_array[37]; |
| 462 | 462 | $this->card_code_response = $this->_response_array[38]; |
| 463 | 463 | $this->cavv_response = $this->_response_array[39]; |
@@ -484,10 +484,10 @@ discard block |
||
| 484 | 484 | |
| 485 | 485 | if ($this->error) { |
| 486 | 486 | $this->error_message = "AuthorizeNet Error: |
| 487 | - Response Code: ".$this->response_code." |
|
| 488 | - Response Subcode: ".$this->response_subcode." |
|
| 489 | - Response Reason Code: ".$this->response_reason_code." |
|
| 490 | - Response Reason Text: ".$this->response_reason_text." |
|
| 487 | + Response Code: ".$this->response_code . " |
|
| 488 | + Response Subcode: ".$this->response_subcode . " |
|
| 489 | + Response Reason Code: ".$this->response_reason_code . " |
|
| 490 | + Response Reason Text: ".$this->response_reason_text . " |
|
| 491 | 491 | "; |
| 492 | 492 | } |
| 493 | 493 | } else { |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if (preg_match('/xml/',$post_url)) { |
|
| 99 | + if (preg_match('/xml/', $post_url)) { |
|
| 100 | 100 | curl_setopt($curl_request, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $this->xml = @simplexml_load_string($response); |
| 30 | 30 | |
| 31 | 31 | // Remove namespaces for use with XPath. |
| 32 | - $this->xpath_xml = @simplexml_load_string(preg_replace('/ xmlns:xsi[^>]+/','',$response)); |
|
| 32 | + $this->xpath_xml = @simplexml_load_string(preg_replace('/ xmlns:xsi[^>]+/', '', $response)); |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | { |
| 117 | 117 | $start = "<$elementName>"; |
| 118 | 118 | $end = "</$elementName>"; |
| 119 | - if (strpos($this->response,$start) === false || strpos($this->response,$end) === false) { |
|
| 119 | + if (strpos($this->response, $start) === false || strpos($this->response, $end) === false) { |
|
| 120 | 120 | return false; |
| 121 | 121 | } else { |
| 122 | - $start_position = strpos($this->response, $start)+strlen($start); |
|
| 122 | + $start_position = strpos($this->response, $start) + strlen($start); |
|
| 123 | 123 | $end_position = strpos($this->response, $end); |
| 124 | - return substr($this->response, $start_position, $end_position-$start_position); |
|
| 124 | + return substr($this->response, $start_position, $end_position - $start_position); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
@@ -182,7 +182,7 @@ |
||
| 182 | 182 | $string = ""; |
| 183 | 183 | foreach ($array as $key => $value) { |
| 184 | 184 | if ($value) { |
| 185 | - $string .= '<input type="hidden" name="'.$key.'" value="'.$value.'">'; |
|
| 185 | + $string .= '<input type="hidden" name="' . $key . '" value="' . $value . '">'; |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | return $string; |
@@ -116,7 +116,7 @@ |
||
| 116 | 116 | */ |
| 117 | 117 | protected function _setPostString() |
| 118 | 118 | { |
| 119 | - $this->_post_string =<<<XML |
|
| 119 | + $this->_post_string = <<<XML |
|
| 120 | 120 | <?xml version="1.0" encoding="utf-8"?> |
| 121 | 121 | <ARB{$this->_request_type} xmlns= "AnetApi/xml/v1/schema/AnetApiSchema.xsd"> |
| 122 | 122 | <merchantAuthentication> |
@@ -309,10 +309,10 @@ discard block |
||
| 309 | 309 | { |
| 310 | 310 | $this->_validationMode = $validationMode; |
| 311 | 311 | $this->_constructXml("validateCustomerPaymentProfileRequest"); |
| 312 | - $this->_xml->addChild("customerProfileId",$customerProfileId); |
|
| 313 | - $this->_xml->addChild("customerPaymentProfileId",$customerPaymentProfileId); |
|
| 314 | - $this->_xml->addChild("customerShippingAddressId",$customerShippingAddressId); |
|
| 315 | - $this->_xml->addChild("cardCode",$cardCode); |
|
| 312 | + $this->_xml->addChild("customerProfileId", $customerProfileId); |
|
| 313 | + $this->_xml->addChild("customerPaymentProfileId", $customerPaymentProfileId); |
|
| 314 | + $this->_xml->addChild("customerShippingAddressId", $customerShippingAddressId); |
|
| 315 | + $this->_xml->addChild("cardCode", $cardCode); |
|
| 316 | 316 | return $this->_sendRequest(); |
| 317 | 317 | } |
| 318 | 318 | |
@@ -341,13 +341,13 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | protected function _setPostString() |
| 343 | 343 | { |
| 344 | - ($this->_validationMode != "none" ? $this->_xml->addChild('validationMode',$this->_validationMode) : ""); |
|
| 344 | + ($this->_validationMode != "none" ? $this->_xml->addChild('validationMode', $this->_validationMode) : ""); |
|
| 345 | 345 | $this->_post_string = $this->_xml->asXML(); |
| 346 | 346 | |
| 347 | 347 | // Add extraOptions CDATA |
| 348 | 348 | if ($this->_extraOptions) { |
| 349 | 349 | $this->_xml->addChild("extraOptions"); |
| 350 | - $this->_post_string = str_replace("<extraOptions></extraOptions>",'<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions>', $this->_xml->asXML()); |
|
| 350 | + $this->_post_string = str_replace("<extraOptions></extraOptions>", '<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions>', $this->_xml->asXML()); |
|
| 351 | 351 | $this->_extraOptions = false; |
| 352 | 352 | } |
| 353 | 353 | // Blank out our validation mode, so that we don't include it in calls that |
@@ -362,12 +362,12 @@ discard block |
||
| 362 | 362 | */ |
| 363 | 363 | private function _constructXml($request_type) |
| 364 | 364 | { |
| 365 | - $string = '<?xml version="1.0" encoding="utf-8"?><'.$request_type.' xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"></'.$request_type.'>'; |
|
| 365 | + $string = '<?xml version="1.0" encoding="utf-8"?><' . $request_type . ' xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"></' . $request_type . '>'; |
|
| 366 | 366 | $this->_xml = @new SimpleXMLElement($string); |
| 367 | 367 | $merchant = $this->_xml->addChild('merchantAuthentication'); |
| 368 | - $merchant->addChild('name',$this->_api_login); |
|
| 369 | - $merchant->addChild('transactionKey',$this->_transaction_key); |
|
| 370 | - ($this->_refId ? $this->_xml->addChild('refId',$this->_refId) : ""); |
|
| 368 | + $merchant->addChild('name', $this->_api_login); |
|
| 369 | + $merchant->addChild('transactionKey', $this->_transaction_key); |
|
| 370 | + ($this->_refId ? $this->_xml->addChild('refId', $this->_refId) : ""); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | /** |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | $this->_addObject($items, $item); |
| 388 | 388 | } |
| 389 | 389 | } else { |
| 390 | - $destination->addChild($key,$value); |
|
| 390 | + $destination->addChild($key, $value); |
|
| 391 | 391 | } |
| 392 | 392 | } elseif (is_object($value) && self::_notEmpty($value)) { |
| 393 | 393 | $dest = $destination->addChild($key); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $this->xml = @simplexml_load_string($response); |
| 118 | 118 | // Set all fields |
| 119 | - $this->version = array_pop(array_slice(explode('"', $response), 1,1)); |
|
| 119 | + $this->version = array_pop(array_slice(explode('"', $response), 1, 1)); |
|
| 120 | 120 | $this->response_code = (string)$this->xml->ResponseCode; |
| 121 | 121 | |
| 122 | 122 | if ($this->response_code == 1) { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | // Split Array |
| 145 | 145 | $this->response = $response; |
| 146 | 146 | if ($encap_char) { |
| 147 | - $this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1)); |
|
| 147 | + $this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1)); |
|
| 148 | 148 | } else { |
| 149 | 149 | $this->_response_array = explode($delimiter, $response); |
| 150 | 150 | } |
@@ -190,9 +190,9 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | if ($this->error) { |
| 192 | 192 | $this->error_message = "AuthorizeNet Error: |
| 193 | - Response Code: ".$this->response_code." |
|
| 194 | - Response Reason Code: ".$this->response_reason_code." |
|
| 195 | - Response Reason Text: ".$this->response_reason_text." |
|
| 193 | + Response Code: ".$this->response_code . " |
|
| 194 | + Response Reason Code: ".$this->response_reason_code . " |
|
| 195 | + Response Reason Text: ".$this->response_reason_text . " |
|
| 196 | 196 | "; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | $month = ($month ? $month : date('m')); |
| 66 | 66 | $year = ($year ? $year : date('Y')); |
| 67 | - $firstSettlementDate = substr(date('c',mktime(0, 0, 0, $month, 1, $year)),0,-6); |
|
| 68 | - $lastSettlementDate = substr(date('c',mktime(0, 0, 0, $month+1, 0, $year)),0,-6); |
|
| 67 | + $firstSettlementDate = substr(date('c', mktime(0, 0, 0, $month, 1, $year)), 0, -6); |
|
| 68 | + $lastSettlementDate = substr(date('c', mktime(0, 0, 0, $month + 1, 0, $year)), 0, -6); |
|
| 69 | 69 | return $this->getSettledBatchList(true, $firstSettlementDate, $lastSettlementDate); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | $month = ($month ? $month : date('m')); |
| 99 | 99 | $day = ($day ? $day : date('d')); |
| 100 | 100 | $year = ($year ? $year : date('Y')); |
| 101 | - $firstSettlementDate = substr(date('c',mktime(0, 0, 0, (int)$month, (int)$day, (int)$year)),0,-6); |
|
| 102 | - $lastSettlementDate = substr(date('c',mktime(0, 0, 0, (int)$month, (int)$day, (int)$year)),0,-6); |
|
| 101 | + $firstSettlementDate = substr(date('c', mktime(0, 0, 0, (int)$month, (int)$day, (int)$year)), 0, -6); |
|
| 102 | + $lastSettlementDate = substr(date('c', mktime(0, 0, 0, (int)$month, (int)$day, (int)$year)), 0, -6); |
|
| 103 | 103 | $response = $this->getSettledBatchList(true, $firstSettlementDate, $lastSettlementDate); |
| 104 | 104 | $batches = $response->xpath("batchList/batch"); |
| 105 | 105 | foreach ($batches as $batch) { |
@@ -187,11 +187,11 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | private function _constructXml($request_type) |
| 189 | 189 | { |
| 190 | - $string = '<?xml version="1.0" encoding="utf-8"?><'.$request_type.' xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"></'.$request_type.'>'; |
|
| 190 | + $string = '<?xml version="1.0" encoding="utf-8"?><' . $request_type . ' xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"></' . $request_type . '>'; |
|
| 191 | 191 | $this->_xml = @new SimpleXMLElement($string); |
| 192 | 192 | $merchant = $this->_xml->addChild('merchantAuthentication'); |
| 193 | - $merchant->addChild('name',$this->_api_login); |
|
| 194 | - $merchant->addChild('transactionKey',$this->_transaction_key); |
|
| 193 | + $merchant->addChild('name', $this->_api_login); |
|
| 194 | + $merchant->addChild('transactionKey', $this->_transaction_key); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | } |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | $string = ""; |
| 52 | 52 | $types = $this->__getTypes(); |
| 53 | 53 | foreach ($types as $type) { |
| 54 | - if (preg_match("/struct /",$type)) { |
|
| 55 | - $type = preg_replace("/struct /","class ",$type); |
|
| 56 | - $type = preg_replace("/ (\w+) (\w+);/"," // $1\n public \$$2;",$type); |
|
| 57 | - $string .= $type ."\n"; |
|
| 54 | + if (preg_match("/struct /", $type)) { |
|
| 55 | + $type = preg_replace("/struct /", "class ", $type); |
|
| 56 | + $type = preg_replace("/ (\w+) (\w+);/", " // $1\n public \$$2;", $type); |
|
| 57 | + $string .= $type . "\n"; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | return $string; |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function saveSoapDocumentation($path) |
| 86 | 86 | { |
| 87 | - $string = "<?php\n"; |
|
| 87 | + $string = "<?php\n"; |
|
| 88 | 88 | $string .= "/**\n"; |
| 89 | 89 | $string .= " * Auto generated documentation for the AuthorizeNetSOAP API.\n"; |
| 90 | 90 | $string .= " * Generated " . date("m/d/Y") . "\n"; |
| 91 | 91 | $string .= " */\n"; |
| 92 | 92 | $string .= "class AuthorizeNetSOAP\n"; |
| 93 | - $string .= "{\n" . $this->getSoapMethods() . "\n}\n\n" . $this->getSoapTypes() ."\n\n ?>"; |
|
| 93 | + $string .= "{\n" . $this->getSoapMethods() . "\n}\n\n" . $this->getSoapTypes() . "\n\n ?>"; |
|
| 94 | 94 | return file_put_contents($path, $string); |
| 95 | 95 | } |
| 96 | 96 | |