@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | const CC_ERR_MSG = 'Unable to block resource'; |
41 | 41 | const CC_NO_QUOTE = 'QuoteId not found'; |
42 | - const CC_NO_VALIDATE ='Validation in progress, try again later'; |
|
42 | + const CC_NO_VALIDATE = 'Validation in progress, try again later'; |
|
43 | 43 | const GMO_ERR_MSG = 'Merchant Order Not Found'; |
44 | 44 | const GPOI_ERR_MSG = 'Pmt Order Not Found'; |
45 | 45 | const GPOI_NO_ORDERID = 'We can not get the PagaMasTarde identification in database.'; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $status = $exception->status; |
153 | 153 | $response = array(); |
154 | 154 | $response['timestamp'] = time(); |
155 | - $response['order_id']= $this->magentoOrderId; |
|
155 | + $response['order_id'] = $this->magentoOrderId; |
|
156 | 156 | $response['result'] = $exception->result; |
157 | 157 | $response['result_description'] = $exception->result_description; |
158 | 158 | $response = json_encode($response); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $status = $exception->status; |
170 | 170 | $response = array(); |
171 | 171 | $response['timestamp'] = time(); |
172 | - $response['order_id']= $this->magentoOrderId; |
|
172 | + $response['order_id'] = $this->magentoOrderId; |
|
173 | 173 | $response['result'] = self::CPO_ERR_MSG; |
174 | 174 | $response['result_description'] = $exception->result_description; |
175 | 175 | $response = json_encode($response); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
181 | 181 | header("HTTP/1.1 $status", true, $status); |
182 | 182 | header('Content-Type: application/json', true); |
183 | - header('Content-Length: ' . strlen($response)); |
|
183 | + header('Content-Length: '.strlen($response)); |
|
184 | 184 | echo ($response); |
185 | 185 | exit(); |
186 | 186 | } else { |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | $this->blockConcurrency(); |
203 | 203 | } catch (\Exception $e) { |
204 | 204 | $exceptionObject = new \stdClass(); |
205 | - $exceptionObject->method= __FUNCTION__; |
|
206 | - $exceptionObject->status='429'; |
|
207 | - $exceptionObject->result= self::CC_ERR_MSG; |
|
205 | + $exceptionObject->method = __FUNCTION__; |
|
206 | + $exceptionObject->status = '429'; |
|
207 | + $exceptionObject->result = self::CC_ERR_MSG; |
|
208 | 208 | $exceptionObject->result_description = $e->getMessage(); |
209 | 209 | throw new \Exception(serialize($exceptionObject)); |
210 | 210 | } |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | $this->quote = $this->quoteRepository->get($this->quoteId); |
217 | 217 | } catch (\Exception $e) { |
218 | 218 | $exceptionObject = new \stdClass(); |
219 | - $exceptionObject->method= __FUNCTION__; |
|
220 | - $exceptionObject->status='404'; |
|
221 | - $exceptionObject->result= self::GMO_ERR_MSG; |
|
219 | + $exceptionObject->method = __FUNCTION__; |
|
220 | + $exceptionObject->status = '404'; |
|
221 | + $exceptionObject->result = self::GMO_ERR_MSG; |
|
222 | 222 | $exceptionObject->result_description = $e->getMessage(); |
223 | 223 | throw new \Exception(serialize($exceptionObject)); |
224 | 224 | } |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | $this->getMagentoOrderId(); |
232 | 232 | } catch (\Exception $e) { |
233 | 233 | $exceptionObject = new \stdClass(); |
234 | - $exceptionObject->method= __FUNCTION__; |
|
235 | - $exceptionObject->status='404'; |
|
236 | - $exceptionObject->result= self::GPOI_ERR_MSG; |
|
234 | + $exceptionObject->method = __FUNCTION__; |
|
235 | + $exceptionObject->status = '404'; |
|
236 | + $exceptionObject->result = self::GPOI_ERR_MSG; |
|
237 | 237 | $exceptionObject->result_description = $e->getMessage(); |
238 | 238 | throw new \Exception(serialize($exceptionObject)); |
239 | 239 | } |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | $this->pmtOrder = $this->orderClient->getOrder($this->pmtOrderId); |
247 | 247 | } catch (\Exception $e) { |
248 | 248 | $exceptionObject = new \stdClass(); |
249 | - $exceptionObject->method= __FUNCTION__; |
|
250 | - $exceptionObject->status='400'; |
|
251 | - $exceptionObject->result= self::GPO_ERR_MSG; |
|
249 | + $exceptionObject->method = __FUNCTION__; |
|
250 | + $exceptionObject->status = '400'; |
|
251 | + $exceptionObject->result = self::GPO_ERR_MSG; |
|
252 | 252 | $exceptionObject->result_description = $e->getMessage(); |
253 | 253 | throw new \Exception(serialize($exceptionObject)); |
254 | 254 | } |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | $this->checkPmtStatus(array('AUTHORIZED')); |
261 | 261 | } catch (\Exception $e) { |
262 | 262 | $exceptionObject = new \stdClass(); |
263 | - $exceptionObject->method= __FUNCTION__; |
|
264 | - $exceptionObject->status='403'; |
|
265 | - $exceptionObject->result= self::COS_ERR_MSG; |
|
263 | + $exceptionObject->method = __FUNCTION__; |
|
264 | + $exceptionObject->status = '403'; |
|
265 | + $exceptionObject->result = self::COS_ERR_MSG; |
|
266 | 266 | $exceptionObject->result_description = $e->getMessage(); |
267 | 267 | throw new \Exception(serialize($exceptionObject)); |
268 | 268 | } |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | $this->checkCartStatus(); |
275 | 275 | } catch (\Exception $e) { |
276 | 276 | $exceptionObject = new \stdClass(); |
277 | - $exceptionObject->method= __FUNCTION__; |
|
278 | - $exceptionObject->status='409'; |
|
279 | - $exceptionObject->result= self::CMOS_ERR_MSG; |
|
277 | + $exceptionObject->method = __FUNCTION__; |
|
278 | + $exceptionObject->status = '409'; |
|
279 | + $exceptionObject->result = self::CMOS_ERR_MSG; |
|
280 | 280 | $exceptionObject->result_description = $e->getMessage(); |
281 | 281 | throw new \Exception(serialize($exceptionObject)); |
282 | 282 | } |
@@ -288,9 +288,9 @@ discard block |
||
288 | 288 | $this->comparePrices(); |
289 | 289 | } catch (\Exception $e) { |
290 | 290 | $exceptionObject = new \stdClass(); |
291 | - $exceptionObject->method= __FUNCTION__; |
|
292 | - $exceptionObject->status='409'; |
|
293 | - $exceptionObject->result= self::VA_ERR_MSG; |
|
291 | + $exceptionObject->method = __FUNCTION__; |
|
292 | + $exceptionObject->status = '409'; |
|
293 | + $exceptionObject->result = self::VA_ERR_MSG; |
|
294 | 294 | $exceptionObject->result_description = $e->getMessage(); |
295 | 295 | throw new \Exception(serialize($exceptionObject)); |
296 | 296 | } |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | $this->updateBdInfo(); |
304 | 304 | } catch (\Exception $e) { |
305 | 305 | $exceptionObject = new \stdClass(); |
306 | - $exceptionObject->method= __FUNCTION__; |
|
307 | - $exceptionObject->status='500'; |
|
308 | - $exceptionObject->result= self::PMO_ERR_MSG; |
|
306 | + $exceptionObject->method = __FUNCTION__; |
|
307 | + $exceptionObject->status = '500'; |
|
308 | + $exceptionObject->result = self::PMO_ERR_MSG; |
|
309 | 309 | $exceptionObject->result_description = $e->getMessage(); |
310 | 310 | throw new \Exception(serialize($exceptionObject)); |
311 | 311 | } |
@@ -317,9 +317,9 @@ discard block |
||
317 | 317 | $this->pmtOrder = $this->orderClient->confirmOrder($this->pmtOrderId); |
318 | 318 | } catch (\Exception $e) { |
319 | 319 | $exceptionObject = new \stdClass(); |
320 | - $exceptionObject->method= __FUNCTION__; |
|
321 | - $exceptionObject->status='500'; |
|
322 | - $exceptionObject->result= self::CPO_ERR_MSG; |
|
320 | + $exceptionObject->method = __FUNCTION__; |
|
321 | + $exceptionObject->status = '500'; |
|
322 | + $exceptionObject->result = self::CPO_ERR_MSG; |
|
323 | 323 | $exceptionObject->result_description = $e->getMessage(); |
324 | 324 | throw new \Exception(serialize($exceptionObject)); |
325 | 325 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $response = array(); |
328 | 328 | $response['status'] = '200'; |
329 | 329 | $response['timestamp'] = time(); |
330 | - $response['order_id']= $this->magentoOrderId; |
|
330 | + $response['order_id'] = $this->magentoOrderId; |
|
331 | 331 | $response['result'] = self::CPO_OK_MSG; |
332 | 332 | $response = json_encode($response); |
333 | 333 | return $response; |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $tableName = $this->dbObject->getTableName(self::CONCURRENCY_TABLE); |
396 | 396 | if ($mode == false) { |
397 | 397 | $dbConnection->delete($tableName, "timestamp<".(time() - 5)); |
398 | - } elseif ($this->quoteId!='') { |
|
398 | + } elseif ($this->quoteId != '') { |
|
399 | 399 | $dbConnection->delete($tableName, "id=".$this->quoteId); |
400 | 400 | } |
401 | 401 | } catch (Exception $exception) { |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | */ |
463 | 463 | private function checkCartStatus() |
464 | 464 | { |
465 | - if ($this->quote->getIsActive()=='0') { |
|
465 | + if ($this->quote->getIsActive() == '0') { |
|
466 | 466 | $this->getMagentoOrderId(); |
467 | 467 | throw new \Exception(self::CMOS_ALREADY_PROCESSED); |
468 | 468 | } |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | private function getRedirectUrl() |
536 | 536 | { |
537 | 537 | $returnUrl = 'checkout/#payment'; |
538 | - if ($this->magentoOrderId!='') { |
|
538 | + if ($this->magentoOrderId != '') { |
|
539 | 539 | /** @var Order $this->magentoOrder */ |
540 | 540 | $this->magentoOrder = $this->orderRepositoryInterface->get($this->magentoOrderId); |
541 | 541 | if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) { |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $secretKey = $this->getRequest()->getParam('secret'); |
44 | 44 | $privateKey = isset($this->config['secret_key']) ? $this->config['secret_key'] : null; |
45 | 45 | |
46 | - if ($secretKey!='' && $privateKey!='') { |
|
46 | + if ($secretKey != '' && $privateKey != '') { |
|
47 | 47 | $this->checkDbLogTable(); |
48 | 48 | /** @var \Magento\Framework\DB\Adapter\AdapterInterface $dbConnection */ |
49 | 49 | $dbConnection = $this->dbObject->getConnection(); |
@@ -346,9 +346,9 @@ |
||
346 | 346 | $magentoVersion = $this->productMetadataInterface->getVersion(); |
347 | 347 | $moduleInfo = $this->moduleList->getOne('DigitalOrigin_Pmt'); |
348 | 348 | return array( 'magento' => $magentoVersion, |
349 | - 'pmt' => $moduleInfo['setup_version'], |
|
350 | - 'php' => phpversion(), |
|
351 | - 'curl' => $curlVersion); |
|
349 | + 'pmt' => $moduleInfo['setup_version'], |
|
350 | + 'php' => phpversion(), |
|
351 | + 'curl' => $curlVersion); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | /** |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | $customer = $quote->getCustomer(); |
102 | 102 | $shippingAddress = $quote->getShippingAddress(); |
103 | 103 | |
104 | - if (isset($params['email']) && $params['email']!='') { |
|
104 | + if (isset($params['email']) && $params['email'] != '') { |
|
105 | 105 | $this->session->setEmail($params['email']); //Get guest email after refresh page |
106 | 106 | $customer->setEmail($params['email']); |
107 | 107 | $quote->setCheckoutMethod('guest'); |
108 | 108 | $quote->getBillingAddress()->setEmail($params['email']); |
109 | - } elseif ($customer->getEmail()=='') { |
|
109 | + } elseif ($customer->getEmail() == '') { |
|
110 | 110 | $customer->setEmail($this->session->getEmail()); |
111 | 111 | $quote->setCheckoutMethod('guest'); |
112 | 112 | $quote->getBillingAddress()->setEmail($this->session->getEmail()); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $currentQuote->setCustomerEmail($customer->getEmail()); |
118 | 118 | $this->quoteRepository->save($currentQuote); |
119 | 119 | |
120 | - $userAddress = new Address(); |
|
120 | + $userAddress = new Address(); |
|
121 | 121 | $userAddress |
122 | 122 | ->setZipCode($shippingAddress->getPostcode()) |
123 | 123 | ->setFullName($shippingAddress->getFirstname()." ".$shippingAddress->getLastname()) |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | ->setMobilePhone($shippingAddress->getTelephone()) |
138 | 138 | ; |
139 | 139 | |
140 | - $orderBillingAddress = new Address(); |
|
140 | + $orderBillingAddress = new Address(); |
|
141 | 141 | $billingAddress = $quote->getBillingAddress(); |
142 | 142 | $orderBillingAddress |
143 | 143 | ->setZipCode($billingAddress->getPostcode()) |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | if ($customer->getDob()) { |
165 | 165 | $orderUser->setDateOfBirth($customer->getDob()); |
166 | 166 | } |
167 | - if ($customer->getTaxvat()!='') { |
|
167 | + if ($customer->getTaxvat() != '') { |
|
168 | 168 | $orderUser->setDni($customer->getTaxvat()); |
169 | 169 | $orderBillingAddress->setDni($customer->getTaxvat()); |
170 | 170 | $orderShippingAddress->setDni($customer->getTaxvat()); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | ->setUser($orderUser) |
237 | 237 | ; |
238 | 238 | |
239 | - if ($this->config['public_key']=='' || $this->config['secret_key']=='') { |
|
239 | + if ($this->config['public_key'] == '' || $this->config['secret_key'] == '') { |
|
240 | 240 | throw new \Exception('Public and Secret Key not found'); |
241 | 241 | } |
242 | 242 | |
@@ -284,11 +284,11 @@ discard block |
||
284 | 284 | private function getOrders($customerId) |
285 | 285 | { |
286 | 286 | $orderCollection = array(); |
287 | - if ($customerId!='') { |
|
287 | + if ($customerId != '') { |
|
288 | 288 | $this->orderCollection->addAttributeToFilter('customer_id', $customerId) |
289 | 289 | ->addAttributeToFilter( |
290 | 290 | 'status', |
291 | - ['in' => ['processing','pending','complete']] |
|
291 | + ['in' => ['processing', 'pending', 'complete']] |
|
292 | 292 | ) |
293 | 293 | ->load(); |
294 | 294 | $orderCollection = $this->orderCollection->getData(); |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
332 | 332 | return $dbConnection->insertOnDuplicate( |
333 | 333 | $tableName, |
334 | - array('id'=>$quoteId,'order_id'=>$pmtOrderId), |
|
334 | + array('id'=>$quoteId, 'order_id'=>$pmtOrderId), |
|
335 | 335 | array('order_id') |
336 | 336 | ); |
337 | 337 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | $curlVersion = $curlInfo['version']; |
346 | 346 | $magentoVersion = $this->productMetadataInterface->getVersion(); |
347 | 347 | $moduleInfo = $this->moduleList->getOne('DigitalOrigin_Pmt'); |
348 | - return array( 'magento' => $magentoVersion, |
|
348 | + return array('magento' => $magentoVersion, |
|
349 | 349 | 'pmt' => $moduleInfo['setup_version'], |
350 | 350 | 'php' => phpversion(), |
351 | 351 | 'curl' => $curlVersion); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $condition = WebDriverExpectedCondition::visibilityOfElementLocated($elementSearch); |
73 | 73 | $this->webDriver->wait()->until($condition); |
74 | 74 | $otherElement = $this->findById('payment_us_other_payment_methods-head'); |
75 | - if ($otherElement->getAttribute('class')!='open') { |
|
75 | + if ($otherElement->getAttribute('class') != 'open') { |
|
76 | 76 | $otherElement->click(); |
77 | 77 | } |
78 | 78 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $this->webDriver->wait()->until($condition); |
82 | 82 | $this->assertTrue((bool) $condition, "PR4"); |
83 | 83 | $paylaterElement = $this->findById('payment_us_paylater-head'); |
84 | - if ($paylaterElement->getAttribute('class')!='open') { |
|
84 | + if ($paylaterElement->getAttribute('class') != 'open') { |
|
85 | 85 | $paylaterElement->click(); |
86 | 86 | } |
87 | 87 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $this->webDriver->get(self::MAGENTO_URL.self::CHECKOUT_FOLDER); |
279 | 279 | $condition = WebDriverExpectedCondition::titleContains(self::CHECKOUT_TITLE); |
280 | 280 | $this->webDriver->wait()->until($condition); |
281 | - $this->assertTrue((bool)$condition, self::MAGENTO_URL.self::CHECKOUT_FOLDER); |
|
281 | + $this->assertTrue((bool) $condition, self::MAGENTO_URL.self::CHECKOUT_FOLDER); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $this->webDriver->wait()->until($condition); |
292 | 292 | $this->assertTrue((bool) $condition); |
293 | 293 | $this->assertSame( |
294 | - $this->configuration['firstname'] . ' ' . $this->configuration['lastname'], |
|
294 | + $this->configuration['firstname'].' '.$this->configuration['lastname'], |
|
295 | 295 | $this->findByClass('FieldsPreview-desc')->getText() |
296 | 296 | ); |
297 | 297 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | { |
306 | 306 | $condition = WebDriverExpectedCondition::titleContains(self::PMT_TITLE); |
307 | 307 | $this->webDriver->wait(300)->until($condition, $this->webDriver->getCurrentURL()); |
308 | - $this->assertTrue((bool)$condition, $this->webDriver->getCurrentURL()); |
|
308 | + $this->assertTrue((bool) $condition, $this->webDriver->getCurrentURL()); |
|
309 | 309 | |
310 | 310 | SeleniumHelper::finishForm($this->webDriver); |
311 | 311 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | $simulatorPrice = $simulatorElement->getAttribute('data-pmt-amount'); |
430 | 430 | $simulatorPrice = preg_replace('/[^\x{20}-\x{7F}]/u', '', $simulatorPrice); |
431 | 431 | $price = preg_replace('/[^\x{20}-\x{7F}]/u', '', $price); |
432 | - $this->assertContains($simulatorPrice, $price, json_encode(array($price,$simulatorPrice))); |
|
432 | + $this->assertContains($simulatorPrice, $price, json_encode(array($price, $simulatorPrice))); |
|
433 | 433 | |
434 | 434 | sleep(2); |
435 | 435 | $checkoutButton = WebDriverBy::cssSelector("#checkout-payment-method-load > .payment-methods > .payment-group > ._active > .payment-method-content > .actions-toolbar > .primary"); |