@@ -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($this->configuration['magentoUrl']); |
@@ -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 = $this->configuration['magentoUrl'].self::NOTIFICATION_FOLDER.'?'.self::NOTIFICATION_PARAMETER.'='.$magentoOrderId; |
| 65 | 65 | $response = Request::post($notifyUrl)->expects('json')->send(); |
@@ -16,20 +16,20 @@ |
||
| 16 | 16 | * @var array $defaultConfigs |
| 17 | 17 | */ |
| 18 | 18 | public $defaultConfigs = array('PMT_TITLE'=>'Instant Financing', |
| 19 | - 'PMT_SIMULATOR_DISPLAY_TYPE'=>'pmtSDK.simulator.types.SIMPLE', |
|
| 20 | - 'PMT_SIMULATOR_DISPLAY_SKIN'=>'pmtSDK.simulator.skins.BLUE', |
|
| 21 | - 'PMT_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
| 22 | - 'PMT_SIMULATOR_START_INSTALLMENTS'=>3, |
|
| 23 | - 'PMT_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
| 24 | - 'PMT_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
| 25 | - 'PMT_SIMULATOR_DISPLAY_CSS_POSITION'=>'pmtSDK.simulator.positions.INNER', |
|
| 26 | - 'PMT_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
| 27 | - 'PMT_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
| 28 | - 'PMT_FORM_DISPLAY_TYPE'=>0, |
|
| 29 | - 'PMT_DISPLAY_MIN_AMOUNT'=>1, |
|
| 30 | - 'PMT_URL_OK'=>'', |
|
| 31 | - 'PMT_URL_KO'=>'', |
|
| 32 | - 'PMT_TITLE_EXTRA' => 'Paga hasta en 12 cómodas cuotas con Paga+Tarde. Solicitud totalmente |
|
| 19 | + 'PMT_SIMULATOR_DISPLAY_TYPE'=>'pmtSDK.simulator.types.SIMPLE', |
|
| 20 | + 'PMT_SIMULATOR_DISPLAY_SKIN'=>'pmtSDK.simulator.skins.BLUE', |
|
| 21 | + 'PMT_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
| 22 | + 'PMT_SIMULATOR_START_INSTALLMENTS'=>3, |
|
| 23 | + 'PMT_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
| 24 | + 'PMT_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
| 25 | + 'PMT_SIMULATOR_DISPLAY_CSS_POSITION'=>'pmtSDK.simulator.positions.INNER', |
|
| 26 | + 'PMT_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
| 27 | + 'PMT_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
| 28 | + 'PMT_FORM_DISPLAY_TYPE'=>0, |
|
| 29 | + 'PMT_DISPLAY_MIN_AMOUNT'=>1, |
|
| 30 | + 'PMT_URL_OK'=>'', |
|
| 31 | + 'PMT_URL_KO'=>'', |
|
| 32 | + 'PMT_TITLE_EXTRA' => 'Paga hasta en 12 cómodas cuotas con Paga+Tarde. Solicitud totalmente |
|
| 33 | 33 | online y sin papeleos,¡y la respuesta es inmediata!' |
| 34 | 34 | ); |
| 35 | 35 | |
@@ -24,22 +24,22 @@ discard block |
||
| 24 | 24 | $installer->startSetup(); |
| 25 | 25 | |
| 26 | 26 | $table = $installer->getConnection() |
| 27 | - ->newTable($installer->getTable(self::CONFIG_TABLE)) |
|
| 28 | - ->addColumn( |
|
| 29 | - 'id', |
|
| 30 | - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, |
|
| 31 | - null, |
|
| 32 | - ['identity' => true, 'unsigned' => true, 'nullable' => |
|
| 33 | - false, 'primary' => true], |
|
| 34 | - 'Entity ID' |
|
| 35 | - ) |
|
| 36 | - ->addColumn( |
|
| 37 | - 'config', |
|
| 38 | - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, |
|
| 39 | - 60, |
|
| 40 | - ['nullable' => false], |
|
| 41 | - 'Config' |
|
| 42 | - ) |
|
| 27 | + ->newTable($installer->getTable(self::CONFIG_TABLE)) |
|
| 28 | + ->addColumn( |
|
| 29 | + 'id', |
|
| 30 | + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, |
|
| 31 | + null, |
|
| 32 | + ['identity' => true, 'unsigned' => true, 'nullable' => |
|
| 33 | + false, 'primary' => true], |
|
| 34 | + 'Entity ID' |
|
| 35 | + ) |
|
| 36 | + ->addColumn( |
|
| 37 | + 'config', |
|
| 38 | + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, |
|
| 39 | + 60, |
|
| 40 | + ['nullable' => false], |
|
| 41 | + 'Config' |
|
| 42 | + ) |
|
| 43 | 43 | ->addColumn( |
| 44 | 44 | 'value', |
| 45 | 45 | \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | ['nullable' => false], |
| 48 | 48 | 'Value' |
| 49 | 49 | ) |
| 50 | - ->setComment('Paga+Tarde config table'); |
|
| 50 | + ->setComment('Paga+Tarde config table'); |
|
| 51 | 51 | |
| 52 | 52 | $installer->getConnection()->createTable($table); |
| 53 | 53 | |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | Table::TYPE_TIMESTAMP, |
| 112 | 112 | null, |
| 113 | 113 | array('nullable'=>false, |
| 114 | - 'default'=>Table::TIMESTAMP_INIT) |
|
| 114 | + 'default'=>Table::TIMESTAMP_INIT) |
|
| 115 | 115 | ); |
| 116 | 116 | return $dbConnection->createTable($table); |
| 117 | 117 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | $secretKey = $this->getRequest()->getParam('secret'); |
| 45 | 45 | $privateKey = isset($this->config['pmt_private_key']) ? $this->config['pmt_private_key'] : null; |
| 46 | 46 | |
| 47 | - if ($secretKey!='' && $privateKey!='') { |
|
| 47 | + if ($secretKey != '' && $privateKey != '') { |
|
| 48 | 48 | $this->checkDbLogTable(); |
| 49 | 49 | /** @var \Magento\Framework\DB\Adapter\AdapterInterface $dbConnection */ |
| 50 | 50 | $dbConnection = $this->dbObject->getConnection(); |
@@ -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 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | $this->webDriver->get($this->configuration['magentoUrl'].self::CHECKOUT_FOLDER); |
| 279 | 279 | $condition = WebDriverExpectedCondition::titleContains(self::CHECKOUT_TITLE); |
| 280 | 280 | $this->webDriver->wait()->until($condition); |
| 281 | - $this->assertTrue((bool)$condition, $this->configuration['magentoUrl'].self::CHECKOUT_FOLDER); |
|
| 281 | + $this->assertTrue((bool) $condition, $this->configuration['magentoUrl'].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, "PR32"); |
|
| 308 | + $this->assertTrue((bool) $condition, "PR32"); |
|
| 309 | 309 | |
| 310 | 310 | SeleniumHelper::finishForm($this->webDriver); |
| 311 | 311 | } |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | $customer = $quote->getCustomer(); |
| 108 | 108 | $shippingAddress = $quote->getShippingAddress(); |
| 109 | 109 | |
| 110 | - if (isset($params['email']) && $params['email']!='') { |
|
| 110 | + if (isset($params['email']) && $params['email'] != '') { |
|
| 111 | 111 | $this->session->setEmail($params['email']); //Get guest email after refresh page |
| 112 | 112 | $customer->setEmail($params['email']); |
| 113 | 113 | $quote->setCheckoutMethod('guest'); |
| 114 | 114 | $quote->getBillingAddress()->setEmail($params['email']); |
| 115 | - } elseif ($customer->getEmail()=='') { |
|
| 115 | + } elseif ($customer->getEmail() == '') { |
|
| 116 | 116 | $customer->setEmail($this->session->getEmail()); |
| 117 | 117 | $quote->setCheckoutMethod('guest'); |
| 118 | 118 | $quote->getBillingAddress()->setEmail($this->session->getEmail()); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $currentQuote->setCustomerEmail($customer->getEmail()); |
| 124 | 124 | $this->quoteRepository->save($currentQuote); |
| 125 | 125 | |
| 126 | - $userAddress = new Address(); |
|
| 126 | + $userAddress = new Address(); |
|
| 127 | 127 | $userAddress |
| 128 | 128 | ->setZipCode($shippingAddress->getPostcode()) |
| 129 | 129 | ->setFullName($shippingAddress->getFirstname()." ".$shippingAddress->getLastname()) |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ->setMobilePhone($shippingAddress->getTelephone()) |
| 144 | 144 | ; |
| 145 | 145 | |
| 146 | - $orderBillingAddress = new Address(); |
|
| 146 | + $orderBillingAddress = new Address(); |
|
| 147 | 147 | $billingAddress = $quote->getBillingAddress(); |
| 148 | 148 | $orderBillingAddress |
| 149 | 149 | ->setZipCode($billingAddress->getPostcode()) |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | if ($customer->getDob()) { |
| 171 | 171 | $orderUser->setDateOfBirth($customer->getDob()); |
| 172 | 172 | } |
| 173 | - if ($customer->getTaxvat()!='') { |
|
| 173 | + if ($customer->getTaxvat() != '') { |
|
| 174 | 174 | $orderUser->setDni($customer->getTaxvat()); |
| 175 | 175 | $orderBillingAddress->setDni($customer->getTaxvat()); |
| 176 | 176 | $orderShippingAddress->setDni($customer->getTaxvat()); |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | ->setUser($orderUser) |
| 244 | 244 | ; |
| 245 | 245 | |
| 246 | - if ($this->config['pmt_public_key']=='' || $this->config['pmt_private_key']=='') { |
|
| 246 | + if ($this->config['pmt_public_key'] == '' || $this->config['pmt_private_key'] == '') { |
|
| 247 | 247 | throw new \Exception('Public and Secret Key not found'); |
| 248 | 248 | } |
| 249 | 249 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | $displayMode = $this->extraConfig['PMT_FORM_DISPLAY_TYPE']; |
| 272 | - if ($displayMode==='0') { |
|
| 272 | + if ($displayMode === '0') { |
|
| 273 | 273 | echo $url; |
| 274 | 274 | exit; |
| 275 | 275 | } else { |
@@ -291,11 +291,11 @@ discard block |
||
| 291 | 291 | private function getOrders($customerId) |
| 292 | 292 | { |
| 293 | 293 | $orderCollection = array(); |
| 294 | - if ($customerId!='') { |
|
| 294 | + if ($customerId != '') { |
|
| 295 | 295 | $this->orderCollection->addAttributeToFilter('customer_id', $customerId) |
| 296 | 296 | ->addAttributeToFilter( |
| 297 | 297 | 'status', |
| 298 | - ['in' => ['processing','pending','complete']] |
|
| 298 | + ['in' => ['processing', 'pending', 'complete']] |
|
| 299 | 299 | ) |
| 300 | 300 | ->load(); |
| 301 | 301 | $orderCollection = $this->orderCollection->getData(); |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
| 339 | 339 | return $dbConnection->insertOnDuplicate( |
| 340 | 340 | $tableName, |
| 341 | - array('id'=>$quoteId,'order_id'=>$pmtOrderId), |
|
| 341 | + array('id'=>$quoteId, 'order_id'=>$pmtOrderId), |
|
| 342 | 342 | array('order_id') |
| 343 | 343 | ); |
| 344 | 344 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | $curlVersion = $curlInfo['version']; |
| 353 | 353 | $magentoVersion = $this->productMetadataInterface->getVersion(); |
| 354 | 354 | $moduleInfo = $this->moduleList->getOne('DigitalOrigin_Pmt'); |
| 355 | - return array( 'magento' => $magentoVersion, |
|
| 355 | + return array('magento' => $magentoVersion, |
|
| 356 | 356 | 'pmt' => $moduleInfo['setup_version'], |
| 357 | 357 | 'php' => phpversion(), |
| 358 | 358 | 'curl' => $curlVersion); |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $this->checkPmtStatus(array('AUTHORIZED')); |
| 263 | 263 | } catch (\Exception $e) { |
| 264 | 264 | $this->getMagentoOrderId(); |
| 265 | - if ($this->magentoOrderId!='') { |
|
| 265 | + if ($this->magentoOrderId != '') { |
|
| 266 | 266 | throw new AlreadyProcessedException(); |
| 267 | 267 | } else { |
| 268 | 268 | throw new WrongStatusException($this->pmtOrder->getStatus()); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | private function checkMerchantOrderStatus() |
| 277 | 277 | { |
| 278 | - if ($this->quote->getIsActive()=='0') { |
|
| 278 | + if ($this->quote->getIsActive() == '0') { |
|
| 279 | 279 | $this->getMagentoOrderId(); |
| 280 | 280 | throw new AlreadyProcessedException(); |
| 281 | 281 | } |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | $tableName = $this->dbObject->getTableName(self::CONCURRENCY_TABLE); |
| 398 | 398 | if ($mode == false) { |
| 399 | 399 | $dbConnection->delete($tableName, "timestamp<".(time() - 5)); |
| 400 | - } elseif ($this->quoteId!='') { |
|
| 400 | + } elseif ($this->quoteId != '') { |
|
| 401 | 401 | $dbConnection->delete($tableName, "id=".$this->quoteId); |
| 402 | 402 | } |
| 403 | 403 | } catch (Exception $exception) { |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | { |
| 526 | 526 | //$returnUrl = 'checkout/#payment'; |
| 527 | 527 | $returnUrl = $this->_url->getUrl('checkout', ['_fragment' => 'payment']); |
| 528 | - if ($this->magentoOrderId!='') { |
|
| 528 | + if ($this->magentoOrderId != '') { |
|
| 529 | 529 | /** @var Order $this->magentoOrder */ |
| 530 | 530 | $this->magentoOrder = $this->orderRepositoryInterface->get($this->magentoOrderId); |
| 531 | 531 | if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) { |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | $orderStatus = strtolower($this->magentoOrder->getStatus()); |
| 543 | 543 | $acceptedStatus = array('processing', 'completed'); |
| 544 | 544 | if (in_array($orderStatus, $acceptedStatus)) { |
| 545 | - if (isset($this->extraConfig['PMT_OK_URL']) && $this->extraConfig['PMT_OK_URL']!= '') { |
|
| 545 | + if (isset($this->extraConfig['PMT_OK_URL']) && $this->extraConfig['PMT_OK_URL'] != '') { |
|
| 546 | 546 | $returnUrl = $this->extraConfig['PMT_OK_URL']; |
| 547 | 547 | } else { |
| 548 | 548 | $returnUrl = 'checkout/onepage/success'; |
@@ -18,20 +18,20 @@ |
||
| 18 | 18 | * @var array $defaultConfigs |
| 19 | 19 | */ |
| 20 | 20 | public $defaultConfigs = array('PMT_TITLE'=>'Instant Financing', |
| 21 | - 'PMT_SIMULATOR_DISPLAY_TYPE'=>'pmtSDK.simulator.types.SIMPLE', |
|
| 22 | - 'PMT_SIMULATOR_DISPLAY_SKIN'=>'pmtSDK.simulator.skins.BLUE', |
|
| 23 | - 'PMT_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
| 24 | - 'PMT_SIMULATOR_START_INSTALLMENTS'=>3, |
|
| 25 | - 'PMT_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
| 26 | - 'PMT_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
| 27 | - 'PMT_SIMULATOR_DISPLAY_CSS_POSITION'=>'pmtSDK.simulator.positions.INNER', |
|
| 28 | - 'PMT_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
| 29 | - 'PMT_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
| 30 | - 'PMT_FORM_DISPLAY_TYPE'=>0, |
|
| 31 | - 'PMT_DISPLAY_MIN_AMOUNT'=>1, |
|
| 32 | - 'PMT_URL_OK'=>'', |
|
| 33 | - 'PMT_URL_KO'=>'', |
|
| 34 | - 'PMT_TITLE_EXTRA' => 'Paga hasta en 12 cómodas cuotas con Paga+Tarde. Solicitud totalmente |
|
| 21 | + 'PMT_SIMULATOR_DISPLAY_TYPE'=>'pmtSDK.simulator.types.SIMPLE', |
|
| 22 | + 'PMT_SIMULATOR_DISPLAY_SKIN'=>'pmtSDK.simulator.skins.BLUE', |
|
| 23 | + 'PMT_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
| 24 | + 'PMT_SIMULATOR_START_INSTALLMENTS'=>3, |
|
| 25 | + 'PMT_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
| 26 | + 'PMT_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
| 27 | + 'PMT_SIMULATOR_DISPLAY_CSS_POSITION'=>'pmtSDK.simulator.positions.INNER', |
|
| 28 | + 'PMT_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
| 29 | + 'PMT_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
| 30 | + 'PMT_FORM_DISPLAY_TYPE'=>0, |
|
| 31 | + 'PMT_DISPLAY_MIN_AMOUNT'=>1, |
|
| 32 | + 'PMT_URL_OK'=>'', |
|
| 33 | + 'PMT_URL_KO'=>'', |
|
| 34 | + 'PMT_TITLE_EXTRA' => 'Paga hasta en 12 cómodas cuotas con Paga+Tarde. Solicitud totalmente |
|
| 35 | 35 | online y sin papeleos,¡y la respuesta es inmediata!' |
| 36 | 36 | ); |
| 37 | 37 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') { |
| 73 | 73 | if (count($_POST)) { |
| 74 | 74 | foreach ($_POST as $config => $value) { |
| 75 | - if (isset($this->defaultConfigs[$config]) && $response['status']==null) { |
|
| 75 | + if (isset($this->defaultConfigs[$config]) && $response['status'] == null) { |
|
| 76 | 76 | $dbConnection->update( |
| 77 | 77 | $tableName, |
| 78 | 78 | array('value' => $value), |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $formattedResult = array(); |
| 93 | - if ($response['status']==null) { |
|
| 93 | + if ($response['status'] == null) { |
|
| 94 | 94 | $dbResult = $dbConnection->fetchAll("select * from $tableName"); |
| 95 | 95 | foreach ($dbResult as $value) { |
| 96 | 96 | $formattedResult[$value['config']] = $value['value']; |