@@ -26,9 +26,9 @@ |
||
26 | 26 | { |
27 | 27 | $originalData = $element->getOriginalData(); |
28 | 28 | $label = __($originalData['button_label']); |
29 | - $url = $this->escapeHtml($originalData['button_url']); |
|
29 | + $url = $this->escapeHtml($originalData['button_url']); |
|
30 | 30 | $labelCredentials = __($originalData['button_credentials_label']); |
31 | - $urlCredentials = $this->escapeHtml($originalData['button_credentials_url']); |
|
31 | + $urlCredentials = $this->escapeHtml($originalData['button_credentials_url']); |
|
32 | 32 | return <<<EOD |
33 | 33 | <div class="pp-buttons-container"> |
34 | 34 | <button onclick="javascript:window.open('$url')" class="scalable" type="button" id="bo_paylater"> |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | /** |
27 | 27 | * testMagentoOpen |
28 | - */ |
|
28 | + */ |
|
29 | 29 | public function testPaylaterMg21BasicTest() |
30 | 30 | { |
31 | 31 | $this->webDriver->get(self::MAGENTO_URL); |
@@ -16,7 +16,7 @@ |
||
16 | 16 | public function execute(\Magento\Framework\Event\Observer $observer) |
17 | 17 | { |
18 | 18 | try { |
19 | - if ($observer->getEvent()->getMethodInstance()->getCode()=="paylater") { |
|
19 | + if ($observer->getEvent()->getMethodInstance()->getCode() == "paylater") { |
|
20 | 20 | $checkResult = $observer->getEvent()->getResult(); |
21 | 21 | $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); |
22 | 22 | $config = $objectManager->create('DigitalOrigin\Pmt\Helper\Config')->getConfig(); |
@@ -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); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | $this->assertNotEmpty($orderUrl); |
60 | 60 | |
61 | 61 | $orderArray = explode('/', $orderUrl); |
62 | - $magentoOrderId = (int)$orderArray['8']; |
|
62 | + $magentoOrderId = (int) $orderArray['8']; |
|
63 | 63 | $this->assertNotEmpty($magentoOrderId); |
64 | 64 | $notifyUrl = self::MAGENTO_URL.self::NOTIFICATION_FOLDER.'?'.self::NOTIFICATION_PARAMETER.'='.$magentoOrderId; |
65 | 65 | $response = Request::post($notifyUrl)->expects('json')->send(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $condition = WebDriverExpectedCondition::visibilityOfElementLocated($elementSearch); |
79 | 79 | $this->webDriver->wait()->until($condition); |
80 | 80 | $otherElement = $this->findById('payment_us_other_payment_methods-head'); |
81 | - if ($otherElement->getAttribute('class')!='open') { |
|
81 | + if ($otherElement->getAttribute('class') != 'open') { |
|
82 | 82 | $otherElement->click(); |
83 | 83 | } |
84 | 84 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $this->webDriver->wait()->until($condition); |
88 | 88 | $this->assertTrue((bool) $condition, "PR4"); |
89 | 89 | $paylaterElement = $this->findById('payment_us_paylater-head'); |
90 | - if ($paylaterElement->getAttribute('class')!='open') { |
|
90 | + if ($paylaterElement->getAttribute('class') != 'open') { |
|
91 | 91 | $paylaterElement->click(); |
92 | 92 | } |
93 | 93 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $this->webDriver->get(self::MAGENTO_URL.self::CHECKOUT_FOLDER); |
289 | 289 | $condition = WebDriverExpectedCondition::titleContains(self::CHECKOUT_TITLE); |
290 | 290 | $this->webDriver->wait()->until($condition); |
291 | - $this->assertTrue((bool)$condition, self::MAGENTO_URL.self::CHECKOUT_FOLDER); |
|
291 | + $this->assertTrue((bool) $condition, self::MAGENTO_URL.self::CHECKOUT_FOLDER); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $this->webDriver->wait()->until($condition); |
302 | 302 | $this->assertTrue((bool) $condition); |
303 | 303 | $this->assertSame( |
304 | - $this->configuration['firstname'] . ' ' . $this->configuration['lastname'], |
|
304 | + $this->configuration['firstname'].' '.$this->configuration['lastname'], |
|
305 | 305 | $this->findByClass('FieldsPreview-desc')->getText() |
306 | 306 | ); |
307 | 307 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | { |
316 | 316 | $condition = WebDriverExpectedCondition::titleContains(self::PMT_TITLE); |
317 | 317 | $this->webDriver->wait(300)->until($condition, $this->webDriver->getCurrentURL()); |
318 | - $this->assertTrue((bool)$condition, "PR32"); |
|
318 | + $this->assertTrue((bool) $condition, "PR32"); |
|
319 | 319 | |
320 | 320 | SeleniumHelper::finishForm($this->webDriver); |
321 | 321 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $simulatorPrice = $simulatorElement->getAttribute('data-pmt-amount'); |
434 | 434 | $simulatorPrice = preg_replace('/[^\x{20}-\x{7F}]/u', '', $simulatorPrice); |
435 | 435 | $price = preg_replace('/[^\x{20}-\x{7F}]/u', '', $price); |
436 | - $this->assertContains($simulatorPrice, $price, json_encode(array($price,$simulatorPrice))); |
|
436 | + $this->assertContains($simulatorPrice, $price, json_encode(array($price, $simulatorPrice))); |
|
437 | 437 | |
438 | 438 | sleep(2); |
439 | 439 | $checkoutButton = WebDriverBy::cssSelector("#checkout-payment-method-load > .payment-methods > .payment-group > ._active > .payment-method-content > .actions-toolbar > .primary"); |
@@ -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 | } |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | $this->getPmtOrderIdDb(); |
231 | 231 | } catch (\Exception $e) { |
232 | 232 | $exceptionObject = new \stdClass(); |
233 | - $exceptionObject->method= __FUNCTION__; |
|
234 | - $exceptionObject->status='404'; |
|
235 | - $exceptionObject->result= self::GPOI_ERR_MSG; |
|
233 | + $exceptionObject->method = __FUNCTION__; |
|
234 | + $exceptionObject->status = '404'; |
|
235 | + $exceptionObject->result = self::GPOI_ERR_MSG; |
|
236 | 236 | $exceptionObject->result_description = $e->getMessage(); |
237 | 237 | throw new \Exception(serialize($exceptionObject)); |
238 | 238 | } |
@@ -245,9 +245,9 @@ discard block |
||
245 | 245 | $this->pmtOrder = $this->orderClient->getOrder($this->pmtOrderId); |
246 | 246 | } catch (\Exception $e) { |
247 | 247 | $exceptionObject = new \stdClass(); |
248 | - $exceptionObject->method= __FUNCTION__; |
|
249 | - $exceptionObject->status='400'; |
|
250 | - $exceptionObject->result= self::GPO_ERR_MSG; |
|
248 | + $exceptionObject->method = __FUNCTION__; |
|
249 | + $exceptionObject->status = '400'; |
|
250 | + $exceptionObject->result = self::GPO_ERR_MSG; |
|
251 | 251 | $exceptionObject->result_description = $e->getMessage(); |
252 | 252 | throw new \Exception(serialize($exceptionObject)); |
253 | 253 | } |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | } catch (\Exception $e) { |
261 | 261 | $this->getMagentoOrderId(); |
262 | 262 | $exceptionObject = new \stdClass(); |
263 | - $exceptionObject->method= __FUNCTION__; |
|
264 | - if ($this->magentoOrderId!='') { |
|
265 | - $exceptionObject->status='200'; |
|
266 | - $exceptionObject->result= self::CMOS_ALREADY_PROCESSED; |
|
263 | + $exceptionObject->method = __FUNCTION__; |
|
264 | + if ($this->magentoOrderId != '') { |
|
265 | + $exceptionObject->status = '200'; |
|
266 | + $exceptionObject->result = self::CMOS_ALREADY_PROCESSED; |
|
267 | 267 | $exceptionObject->result_description = self::CMOS_ALREADY_PROCESSED; |
268 | 268 | } else { |
269 | - $exceptionObject->status='403'; |
|
270 | - $exceptionObject->result= self::COS_ERR_MSG; |
|
269 | + $exceptionObject->status = '403'; |
|
270 | + $exceptionObject->result = self::COS_ERR_MSG; |
|
271 | 271 | $exceptionObject->result_description = $e->getMessage(); |
272 | 272 | } |
273 | 273 | throw new \Exception(serialize($exceptionObject)); |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | $this->checkCartStatus(); |
281 | 281 | } catch (\Exception $e) { |
282 | 282 | $exceptionObject = new \stdClass(); |
283 | - $exceptionObject->method= __FUNCTION__; |
|
284 | - $exceptionObject->status='409'; |
|
285 | - $exceptionObject->result= self::CMOS_ERR_MSG; |
|
283 | + $exceptionObject->method = __FUNCTION__; |
|
284 | + $exceptionObject->status = '409'; |
|
285 | + $exceptionObject->result = self::CMOS_ERR_MSG; |
|
286 | 286 | $exceptionObject->result_description = $e->getMessage(); |
287 | 287 | throw new \Exception(serialize($exceptionObject)); |
288 | 288 | } |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | $this->comparePrices(); |
295 | 295 | } catch (\Exception $e) { |
296 | 296 | $exceptionObject = new \stdClass(); |
297 | - $exceptionObject->method= __FUNCTION__; |
|
298 | - $exceptionObject->status='409'; |
|
299 | - $exceptionObject->result= self::VA_ERR_MSG; |
|
297 | + $exceptionObject->method = __FUNCTION__; |
|
298 | + $exceptionObject->status = '409'; |
|
299 | + $exceptionObject->result = self::VA_ERR_MSG; |
|
300 | 300 | $exceptionObject->result_description = $e->getMessage(); |
301 | 301 | throw new \Exception(serialize($exceptionObject)); |
302 | 302 | } |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | $this->updateBdInfo(); |
310 | 310 | } catch (\Exception $e) { |
311 | 311 | $exceptionObject = new \stdClass(); |
312 | - $exceptionObject->method= __FUNCTION__; |
|
313 | - $exceptionObject->status='500'; |
|
314 | - $exceptionObject->result= self::PMO_ERR_MSG; |
|
312 | + $exceptionObject->method = __FUNCTION__; |
|
313 | + $exceptionObject->status = '500'; |
|
314 | + $exceptionObject->result = self::PMO_ERR_MSG; |
|
315 | 315 | $exceptionObject->result_description = $e->getMessage(); |
316 | 316 | throw new \Exception(serialize($exceptionObject)); |
317 | 317 | } |
@@ -323,9 +323,9 @@ discard block |
||
323 | 323 | $this->pmtOrder = $this->orderClient->confirmOrder($this->pmtOrderId); |
324 | 324 | } catch (\Exception $e) { |
325 | 325 | $exceptionObject = new \stdClass(); |
326 | - $exceptionObject->method= __FUNCTION__; |
|
327 | - $exceptionObject->status='500'; |
|
328 | - $exceptionObject->result= self::CPO_ERR_MSG; |
|
326 | + $exceptionObject->method = __FUNCTION__; |
|
327 | + $exceptionObject->status = '500'; |
|
328 | + $exceptionObject->result = self::CPO_ERR_MSG; |
|
329 | 329 | $exceptionObject->result_description = $e->getMessage(); |
330 | 330 | throw new \Exception(serialize($exceptionObject)); |
331 | 331 | } |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $response = array(); |
334 | 334 | $response['status'] = '200'; |
335 | 335 | $response['timestamp'] = time(); |
336 | - $response['order_id']= $this->magentoOrderId; |
|
336 | + $response['order_id'] = $this->magentoOrderId; |
|
337 | 337 | $response['result'] = self::CPO_OK_MSG; |
338 | 338 | $response = json_encode($response); |
339 | 339 | return $response; |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $tableName = $this->dbObject->getTableName(self::CONCURRENCY_TABLE); |
402 | 402 | if ($mode == false) { |
403 | 403 | $dbConnection->delete($tableName, "timestamp<".(time() - 5)); |
404 | - } elseif ($this->quoteId!='') { |
|
404 | + } elseif ($this->quoteId != '') { |
|
405 | 405 | $dbConnection->delete($tableName, "id=".$this->quoteId); |
406 | 406 | } |
407 | 407 | } catch (Exception $exception) { |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | */ |
469 | 469 | private function checkCartStatus() |
470 | 470 | { |
471 | - if ($this->quote->getIsActive()=='0') { |
|
471 | + if ($this->quote->getIsActive() == '0') { |
|
472 | 472 | $this->getMagentoOrderId(); |
473 | 473 | throw new \Exception(self::CMOS_ALREADY_PROCESSED); |
474 | 474 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | private function getRedirectUrl() |
542 | 542 | { |
543 | 543 | $returnUrl = 'checkout/#payment'; |
544 | - if ($this->magentoOrderId!='') { |
|
544 | + if ($this->magentoOrderId != '') { |
|
545 | 545 | /** @var Order $this->magentoOrder */ |
546 | 546 | $this->magentoOrder = $this->orderRepositoryInterface->get($this->magentoOrderId); |
547 | 547 | if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) { |