@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param string $card_num The credit card number |
102 | 102 | * @param string $exp_date CC expiration date |
103 | 103 | * |
104 | - * @return AuthorizeNetAIM_Response |
|
104 | + * @return AuthorizeNetARB_Response |
|
105 | 105 | */ |
106 | 106 | public function authorizeAndCapture($amount = false, $card_num = false, $exp_date = false) |
107 | 107 | { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param string $trans_id Transaction id to charge |
123 | 123 | * @param string $amount Dollar amount to charge if lesser than auth |
124 | 124 | * |
125 | - * @return AuthorizeNetAIM_Response |
|
125 | + * @return AuthorizeNetARB_Response |
|
126 | 126 | */ |
127 | 127 | public function priorAuthCapture($trans_id = false, $amount = false) |
128 | 128 | { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @param string $card_num The credit card number |
142 | 142 | * @param string $exp_date CC expiration date |
143 | 143 | * |
144 | - * @return AuthorizeNetAIM_Response |
|
144 | + * @return AuthorizeNetARB_Response |
|
145 | 145 | */ |
146 | 146 | public function authorizeOnly($amount = false, $card_num = false, $exp_date = false) |
147 | 147 | { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @param string $trans_id Transaction id to void |
162 | 162 | * |
163 | - * @return AuthorizeNetAIM_Response |
|
163 | + * @return AuthorizeNetARB_Response |
|
164 | 164 | */ |
165 | 165 | public function void($trans_id = false) |
166 | 166 | { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param string $card_num The last 4 of credit card number |
180 | 180 | * @param string $exp_date CC expiration date |
181 | 181 | * |
182 | - * @return AuthorizeNetAIM_Response |
|
182 | + * @return AuthorizeNetARB_Response |
|
183 | 183 | */ |
184 | 184 | public function captureOnly($auth_code = false, $amount = false, $card_num = false, $exp_date = false) |
185 | 185 | { |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param string $amount The dollar amount to credit |
201 | 201 | * @param string $card_num The last 4 of credit card number |
202 | 202 | * |
203 | - * @return AuthorizeNetAIM_Response |
|
203 | + * @return AuthorizeNetARB_Response |
|
204 | 204 | */ |
205 | 205 | public function credit($trans_id = false, $amount = false, $card_num = false) |
206 | 206 | { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param AuthorizeNetCustomer $customerProfile |
52 | 52 | * @param string $validationMode |
53 | 53 | * |
54 | - * @return AuthorizeNetCIM_Response |
|
54 | + * @return AuthorizeNetARB_Response |
|
55 | 55 | */ |
56 | 56 | public function createCustomerProfile($customerProfile, $validationMode = "none") |
57 | 57 | { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param AuthorizeNetPaymentProfile $paymentProfile |
70 | 70 | * @param string $validationMode |
71 | 71 | * |
72 | - * @return AuthorizeNetCIM_Response |
|
72 | + * @return AuthorizeNetARB_Response |
|
73 | 73 | */ |
74 | 74 | public function createCustomerPaymentProfile($customerProfileId, $paymentProfile, $validationMode = "none") |
75 | 75 | { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param int $customerProfileId |
88 | 88 | * @param AuthorizeNetAddress $shippingAddress |
89 | 89 | * |
90 | - * @return AuthorizeNetCIM_Response |
|
90 | + * @return AuthorizeNetARB_Response |
|
91 | 91 | */ |
92 | 92 | public function createCustomerShippingAddress($customerProfileId, $shippingAddress) |
93 | 93 | { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param AuthorizeNetTransaction $transaction |
106 | 106 | * @param string $extraOptionsString |
107 | 107 | * |
108 | - * @return AuthorizeNetCIM_Response |
|
108 | + * @return AuthorizeNetARB_Response |
|
109 | 109 | */ |
110 | 110 | public function createCustomerProfileTransaction($transactionType, $transaction, $extraOptionsString = "") |
111 | 111 | { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @param int $customerProfileId |
124 | 124 | * |
125 | - * @return AuthorizeNetCIM_Response |
|
125 | + * @return AuthorizeNetARB_Response |
|
126 | 126 | */ |
127 | 127 | public function deleteCustomerProfile($customerProfileId) |
128 | 128 | { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param int $customerProfileId |
138 | 138 | * @param int $customerPaymentProfileId |
139 | 139 | * |
140 | - * @return AuthorizeNetCIM_Response |
|
140 | + * @return AuthorizeNetARB_Response |
|
141 | 141 | */ |
142 | 142 | public function deleteCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId) |
143 | 143 | { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @param int $customerProfileId |
154 | 154 | * @param int $customerAddressId |
155 | 155 | * |
156 | - * @return AuthorizeNetCIM_Response |
|
156 | + * @return AuthorizeNetARB_Response |
|
157 | 157 | */ |
158 | 158 | public function deleteCustomerShippingAddress($customerProfileId, $customerAddressId) |
159 | 159 | { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | /** |
167 | 167 | * Get all customer profile ids. |
168 | 168 | * |
169 | - * @return AuthorizeNetCIM_Response |
|
169 | + * @return AuthorizeNetARB_Response |
|
170 | 170 | */ |
171 | 171 | public function getCustomerProfileIds() |
172 | 172 | { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @param int $customerProfileId |
181 | 181 | * |
182 | - * @return AuthorizeNetCIM_Response |
|
182 | + * @return AuthorizeNetARB_Response |
|
183 | 183 | */ |
184 | 184 | public function getCustomerProfile($customerProfileId) |
185 | 185 | { |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @param int $customerProfileId |
195 | 195 | * @param int $customerPaymentProfileId |
196 | 196 | * |
197 | - * @return AuthorizeNetCIM_Response |
|
197 | + * @return AuthorizeNetARB_Response |
|
198 | 198 | */ |
199 | 199 | public function getCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId) |
200 | 200 | { |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @param int $customerProfileId |
211 | 211 | * @param int $customerAddressId |
212 | 212 | * |
213 | - * @return AuthorizeNetCIM_Response |
|
213 | + * @return AuthorizeNetARB_Response |
|
214 | 214 | */ |
215 | 215 | public function getCustomerShippingAddress($customerProfileId, $customerAddressId) |
216 | 216 | { |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @param int $customerProfileId |
227 | 227 | * @param AuthorizeNetCustomer $customerProfile |
228 | 228 | * |
229 | - * @return AuthorizeNetCIM_Response |
|
229 | + * @return AuthorizeNetARB_Response |
|
230 | 230 | */ |
231 | 231 | public function updateCustomerProfile($customerProfileId, $customerProfile) |
232 | 232 | { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @param AuthorizeNetPaymentProfile $paymentProfile |
246 | 246 | * @param string $validationMode |
247 | 247 | * |
248 | - * @return AuthorizeNetCIM_Response |
|
248 | + * @return AuthorizeNetARB_Response |
|
249 | 249 | */ |
250 | 250 | public function updateCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId, $paymentProfile, $validationMode = "none") |
251 | 251 | { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @param int $customerShippingAddressId |
266 | 266 | * @param AuthorizeNetAddress $shippingAddress |
267 | 267 | * |
268 | - * @return AuthorizeNetCIM_Response |
|
268 | + * @return AuthorizeNetARB_Response |
|
269 | 269 | */ |
270 | 270 | public function updateCustomerShippingAddress($customerProfileId, $customerShippingAddressId, $shippingAddress) |
271 | 271 | { |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * @param int $splitTenderId |
285 | 285 | * @param string $splitTenderStatus |
286 | 286 | * |
287 | - * @return AuthorizeNetCIM_Response |
|
287 | + * @return AuthorizeNetARB_Response |
|
288 | 288 | */ |
289 | 289 | public function updateSplitTenderGroup($splitTenderId, $splitTenderStatus) |
290 | 290 | { |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @param int $cardCode |
304 | 304 | * @param string $validationMode |
305 | 305 | * |
306 | - * @return AuthorizeNetCIM_Response |
|
306 | + * @return AuthorizeNetARB_Response |
|
307 | 307 | */ |
308 | 308 | public function validateCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId, $customerShippingAddressId, $cardCode, $validationMode = "testMode") |
309 | 309 | { |
@@ -316,9 +316,9 @@ |
||
316 | 316 | return $this->_sendRequest(); |
317 | 317 | } |
318 | 318 | |
319 | - /** |
|
320 | - * @return string |
|
321 | - */ |
|
319 | + /** |
|
320 | + * @return string |
|
321 | + */ |
|
322 | 322 | protected function _getPostUrl() |
323 | 323 | { |
324 | 324 | return ($this->_sandbox ? self::SANDBOX_URL : self::LIVE_URL); |
@@ -79,7 +79,7 @@ |
||
79 | 79 | * |
80 | 80 | * @param string $response |
81 | 81 | * |
82 | - * @return AuthorizeNetAIM_Response |
|
82 | + * @return AuthorizeNetCP_Response |
|
83 | 83 | */ |
84 | 84 | protected function _handleResponse($response) |
85 | 85 | { |
@@ -28,6 +28,7 @@ |
||
28 | 28 | /** |
29 | 29 | * Get the post url. We need this because until 5.3 you |
30 | 30 | * you could not access child constants in a parent class. |
31 | + * @return string|null |
|
31 | 32 | */ |
32 | 33 | abstract protected function _getPostUrl(); |
33 | 34 |
@@ -110,6 +110,7 @@ |
||
110 | 110 | * Grabs the contents of a unique element. |
111 | 111 | * |
112 | 112 | * @param string |
113 | + * @param string $elementName |
|
113 | 114 | * @return string |
114 | 115 | */ |
115 | 116 | protected function _getElementContents($elementName) |
@@ -69,6 +69,7 @@ discard block |
||
69 | 69 | * remove XML response namespaces |
70 | 70 | * without this php will spit out warinings |
71 | 71 | * @see http://community.developer.authorize.net/t5/Integration-and-Testing/ARB-with-SimpleXML-PHP-Issue/m-p/7128#M5139 |
72 | + * @return string |
|
72 | 73 | */ |
73 | 74 | private function removeResponseXMLNS($input) |
74 | 75 | { |
@@ -150,6 +151,9 @@ discard block |
||
150 | 151 | $this->process(); |
151 | 152 | } |
152 | 153 | |
154 | + /** |
|
155 | + * @param SimpleXMLElement $xml |
|
156 | + */ |
|
153 | 157 | private function setParameters($xml, $array) |
154 | 158 | { |
155 | 159 | if (is_array($array)) |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | const EXCEPTION_CURL = 10; |
41 | 41 | |
42 | 42 | private $ch; |
43 | - private $login; |
|
43 | + private $login; |
|
44 | 44 | private $response; |
45 | 45 | private $response_xml; |
46 | 46 | private $results; |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | private $url; |
49 | 49 | private $xml; |
50 | 50 | |
51 | - public function __construct($login, $transkey, $test = self::USE_PRODUCTION_SERVER) |
|
52 | - { |
|
53 | - $login = trim($login); |
|
51 | + public function __construct($login, $transkey, $test = self::USE_PRODUCTION_SERVER) |
|
52 | + { |
|
53 | + $login = trim($login); |
|
54 | 54 | $transkey = trim($transkey); |
55 | 55 | if (empty($login) || empty($transkey)) |
56 | 56 | { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | $subdomain = ($test) ? 'apitest' : 'api'; |
65 | 65 | $this->url = 'https://' . $subdomain . '.authorize.net/xml/v1/request.api'; |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * remove XML response namespaces |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | return str_replace(' xmlns:xsd="http://www.w3.org/2001/XMLSchema"','',$input); |
79 | 79 | } |
80 | 80 | |
81 | - public function __toString() |
|
82 | - { |
|
83 | - $output = ''; |
|
81 | + public function __toString() |
|
82 | + { |
|
83 | + $output = ''; |
|
84 | 84 | $output .= '<table summary="Authorize.Net Results" id="authnet">' . "\n"; |
85 | 85 | $output .= '<tr>' . "\n\t\t" . '<th colspan="2"><b>Class Parameters</b></th>' . "\n" . '</tr>' . "\n"; |
86 | 86 | $output .= '<tr>' . "\n\t\t" . '<td><b>API Login ID</b></td><td>' . $this->login . '</td>' . "\n" . '</tr>' . "\n"; |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | $output .= '</table>'; |
118 | 118 | |
119 | 119 | return $output; |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | - public function __destruct() |
|
122 | + public function __destruct() |
|
123 | 123 | { |
124 | 124 | if (isset($this->ch)) |
125 | 125 | { |
@@ -128,31 +128,31 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | public function __get($var) |
131 | - { |
|
132 | - return $this->response_xml->$var; |
|
133 | - } |
|
134 | - |
|
135 | - public function __set($key, $value) |
|
136 | - { |
|
137 | - trigger_error('You cannot set parameters directly in ' . __CLASS__ . '.', E_USER_WARNING); |
|
138 | - return false; |
|
139 | - } |
|
140 | - |
|
141 | - public function __call($api_call, $args) |
|
142 | - { |
|
143 | - $this->xml = new SimpleXMLElement('<' . $api_call . '></' . $api_call . '>'); |
|
131 | + { |
|
132 | + return $this->response_xml->$var; |
|
133 | + } |
|
134 | + |
|
135 | + public function __set($key, $value) |
|
136 | + { |
|
137 | + trigger_error('You cannot set parameters directly in ' . __CLASS__ . '.', E_USER_WARNING); |
|
138 | + return false; |
|
139 | + } |
|
140 | + |
|
141 | + public function __call($api_call, $args) |
|
142 | + { |
|
143 | + $this->xml = new SimpleXMLElement('<' . $api_call . '></' . $api_call . '>'); |
|
144 | 144 | $this->xml->addAttribute('xmlns', 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
145 | - $merch_auth = $this->xml->addChild('merchantAuthentication'); |
|
145 | + $merch_auth = $this->xml->addChild('merchantAuthentication'); |
|
146 | 146 | $merch_auth->addChild('name', $this->login); |
147 | - $merch_auth->addChild('transactionKey', $this->transkey); |
|
147 | + $merch_auth->addChild('transactionKey', $this->transkey); |
|
148 | 148 | |
149 | - $this->setParameters($this->xml, $args[0]); |
|
150 | - $this->process(); |
|
151 | - } |
|
149 | + $this->setParameters($this->xml, $args[0]); |
|
150 | + $this->process(); |
|
151 | + } |
|
152 | 152 | |
153 | - private function setParameters($xml, $array) |
|
154 | - { |
|
155 | - if (is_array($array)) |
|
153 | + private function setParameters($xml, $array) |
|
154 | + { |
|
155 | + if (is_array($array)) |
|
156 | 156 | { |
157 | 157 | $first = true; |
158 | 158 | foreach ($array as $key => $value) |
@@ -184,34 +184,34 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | - private function process() |
|
190 | - { |
|
191 | - $this->xml = $this->xml->asXML(); |
|
189 | + private function process() |
|
190 | + { |
|
191 | + $this->xml = $this->xml->asXML(); |
|
192 | 192 | |
193 | - $this->ch = curl_init(); |
|
193 | + $this->ch = curl_init(); |
|
194 | 194 | curl_setopt($this->ch, CURLOPT_URL, $this->url); |
195 | - curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1); |
|
196 | - curl_setopt($this->ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); |
|
197 | - curl_setopt($this->ch, CURLOPT_HEADER, 0); |
|
198 | - curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->xml); |
|
199 | - curl_setopt($this->ch, CURLOPT_POST, 1); |
|
200 | - curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 2); |
|
201 | - curl_setopt($this->ch, CURLOPT_CAINFO, dirname(__FILE__) . '/ssl/cert.pem'); |
|
195 | + curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1); |
|
196 | + curl_setopt($this->ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); |
|
197 | + curl_setopt($this->ch, CURLOPT_HEADER, 0); |
|
198 | + curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->xml); |
|
199 | + curl_setopt($this->ch, CURLOPT_POST, 1); |
|
200 | + curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 2); |
|
201 | + curl_setopt($this->ch, CURLOPT_CAINFO, dirname(__FILE__) . '/ssl/cert.pem'); |
|
202 | 202 | |
203 | 203 | if(($this->response = curl_exec($this->ch)) !== false) |
204 | 204 | { |
205 | 205 | $this->response_xml = @new SimpleXMLElement($this->response); |
206 | 206 | |
207 | - curl_close($this->ch); |
|
207 | + curl_close($this->ch); |
|
208 | 208 | unset($this->ch); |
209 | 209 | return; |
210 | - } |
|
210 | + } |
|
211 | 211 | throw new AuthnetXMLException('Connection error: ' . curl_error($this->ch) . ' (' . curl_errno($this->ch) . ')', self::EXCEPTION_CURL); |
212 | - } |
|
212 | + } |
|
213 | 213 | |
214 | - public function isSuccessful() |
|
214 | + public function isSuccessful() |
|
215 | 215 | { |
216 | 216 | return $this->response_xml->messages->resultCode == 'Ok'; |
217 | 217 | } |
@@ -189,6 +189,11 @@ |
||
189 | 189 | return $this->responseFor('insights', 'Insights', $ipAddress); |
190 | 190 | } |
191 | 191 | |
192 | + /** |
|
193 | + * @param string $endpoint |
|
194 | + * @param string $class |
|
195 | + * @param string $ipAddress |
|
196 | + */ |
|
192 | 197 | private function responseFor($endpoint, $class, $ipAddress) |
193 | 198 | { |
194 | 199 | $path = implode('/', array(self::$basePath, $endpoint, $ipAddress)); |
@@ -115,6 +115,9 @@ discard block |
||
115 | 115 | return $this->resolveDataPointer($pointer); |
116 | 116 | } |
117 | 117 | |
118 | + /** |
|
119 | + * @param string $ipAddress |
|
120 | + */ |
|
118 | 121 | private function findAddressInTree($ipAddress) |
119 | 122 | { |
120 | 123 | // XXX - could simplify. Done as a byte array to ease porting |
@@ -146,6 +149,9 @@ discard block |
||
146 | 149 | } |
147 | 150 | |
148 | 151 | |
152 | + /** |
|
153 | + * @param integer $length |
|
154 | + */ |
|
149 | 155 | private function startNode($length) |
150 | 156 | { |
151 | 157 | // Check if we are looking up an IPv4 address in an IPv6 tree. If this |
@@ -178,6 +184,9 @@ discard block |
||
178 | 184 | return $node; |
179 | 185 | } |
180 | 186 | |
187 | + /** |
|
188 | + * @param integer $index |
|
189 | + */ |
|
181 | 190 | private function readNode($nodeNumber, $index) |
182 | 191 | { |
183 | 192 | $baseOffset = $nodeNumber * $this->metadata->nodeByteSize; |
@@ -230,6 +239,10 @@ discard block |
||
230 | 239 | * are much faster algorithms (e.g., Boyer-Moore) for this if speed is ever |
231 | 240 | * an issue, but I suspect it won't be. |
232 | 241 | */ |
242 | + |
|
243 | + /** |
|
244 | + * @param string $filename |
|
245 | + */ |
|
233 | 246 | private function findMetadataStart($filename) |
234 | 247 | { |
235 | 248 | $handle = $this->fileHandle; |
@@ -407,6 +407,10 @@ discard block |
||
407 | 407 | exit; |
408 | 408 | } |
409 | 409 | |
410 | + /** |
|
411 | + * @param string $source_url |
|
412 | + * @param string $destination_file |
|
413 | + */ |
|
410 | 414 | public static function geoip2_download_file( $source_url, $destination_file ) { |
411 | 415 | $success = false; |
412 | 416 | $message = ''; |
@@ -1192,6 +1196,9 @@ discard block |
||
1192 | 1196 | return apply_filters( 'wpinv_response_euvatrates', $response, $group ); |
1193 | 1197 | } |
1194 | 1198 | |
1199 | + /** |
|
1200 | + * @param boolean $is_digital |
|
1201 | + */ |
|
1195 | 1202 | public static function requires_vat( $requires_vat = false, $user_id = 0, $is_digital = null ) { |
1196 | 1203 | global $wpi_item_id, $wpi_country; |
1197 | 1204 | |
@@ -1412,6 +1419,9 @@ discard block |
||
1412 | 1419 | return apply_filters( 'wpinv_item_is_taxable', $is_taxable, $item_id, $country , $state ); |
1413 | 1420 | } |
1414 | 1421 | |
1422 | + /** |
|
1423 | + * @param string|null $state |
|
1424 | + */ |
|
1415 | 1425 | public static function find_rate( $country, $state, $rate, $class ) { |
1416 | 1426 | global $wpi_zero_tax; |
1417 | 1427 |