@@ -166,9 +166,9 @@ |
||
| 166 | 166 | |
| 167 | 167 | $body = array('PAGANTIS_TITLE' => 'changed'); |
| 168 | 168 | $response = Request::post($configUrl) |
| 169 | - ->body($body, Mime::FORM) |
|
| 170 | - ->expectsJSON() |
|
| 171 | - ->send(); |
|
| 169 | + ->body($body, Mime::FORM) |
|
| 170 | + ->expectsJSON() |
|
| 171 | + ->send(); |
|
| 172 | 172 | $title = $response->body->PAGANTIS_TITLE; |
| 173 | 173 | $this->assertEquals('changed', $title, "PR62=>".$configUrl." = ".$title); |
| 174 | 174 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $this->assertNotEmpty($orderUrl); |
| 84 | 84 | |
| 85 | 85 | $orderArray = explode('/', $orderUrl); |
| 86 | - $magentoOrderId = (int)$orderArray['8']; |
|
| 86 | + $magentoOrderId = (int) $orderArray['8']; |
|
| 87 | 87 | $this->assertNotEmpty($magentoOrderId); |
| 88 | 88 | $notifyFile = 'index/'; |
| 89 | 89 | $quoteId = ($magentoOrderId) - 1; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | { |
| 136 | 136 | $version = ''; |
| 137 | 137 | if (version_compare($this->version, '23') >= 0) { |
| 138 | - $version = "V2"; |
|
| 138 | + $version = "V2"; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $logUrl = sprintf( |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $condition = WebDriverExpectedCondition::visibilityOfElementLocated($elementSearch); |
| 78 | 78 | $this->webDriver->wait()->until($condition); |
| 79 | 79 | $otherElement = $this->findById('payment_us_other_payment_methods-head'); |
| 80 | - if ($otherElement->getAttribute('class')!='open') { |
|
| 80 | + if ($otherElement->getAttribute('class') != 'open') { |
|
| 81 | 81 | $otherElement->click(); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $this->webDriver->wait()->until($condition); |
| 87 | 87 | $this->assertTrue((bool) $condition, "PR4"); |
| 88 | 88 | $pagantisElement = $this->findById('payment_us_pagantis-head'); |
| 89 | - if ($pagantisElement->getAttribute('class')!='open') { |
|
| 89 | + if ($pagantisElement->getAttribute('class') != 'open') { |
|
| 90 | 90 | $pagantisElement->click(); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -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::PAGANTIS_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 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * testMagentoOpen |
| 28 | - */ |
|
| 28 | + */ |
|
| 29 | 29 | public function testpagantisMg21BasicTest() |
| 30 | 30 | { |
| 31 | 31 | $this->webDriver->get($this->configuration['magentoUrl']); |
@@ -150,16 +150,16 @@ discard block |
||
| 150 | 150 | $faker = Factory::create(); |
| 151 | 151 | $this->configuration['dni'] = $this->getDNI(); |
| 152 | 152 | $this->configuration['birthdate'] = |
| 153 | - $faker->numberBetween(1, 28) . '/' . |
|
| 154 | - $faker->numberBetween(1, 12). '/1975' |
|
| 153 | + $faker->numberBetween(1, 28).'/'. |
|
| 154 | + $faker->numberBetween(1, 12).'/1975' |
|
| 155 | 155 | ; |
| 156 | 156 | $this->configuration['firstname'] = $faker->firstName; |
| 157 | - $this->configuration['lastname'] = $faker->lastName . ' ' . $faker->lastName; |
|
| 157 | + $this->configuration['lastname'] = $faker->lastName.' '.$faker->lastName; |
|
| 158 | 158 | $this->configuration['company'] = $faker->company; |
| 159 | 159 | $this->configuration['zip'] = '28'.$faker->randomNumber(3, true); |
| 160 | 160 | $this->configuration['street'] = $faker->streetAddress; |
| 161 | - $this->configuration['phone'] = '6' . $faker->randomNumber(8); |
|
| 162 | - $this->configuration['email'] = date('ymd') . '@pagantis.com'; |
|
| 161 | + $this->configuration['phone'] = '6'.$faker->randomNumber(8); |
|
| 162 | + $this->configuration['email'] = date('ymd').'@pagantis.com'; |
|
| 163 | 163 | |
| 164 | 164 | if (!isset($_SERVER['argv']) || |
| 165 | 165 | !isset($_SERVER['argv'][4]) || |
@@ -183,12 +183,12 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | protected function getDNI() |
| 185 | 185 | { |
| 186 | - $dni = '0000' . rand(pow(10, 4-1), pow(10, 4)-1); |
|
| 186 | + $dni = '0000'.rand(pow(10, 4 - 1), pow(10, 4) - 1); |
|
| 187 | 187 | $value = (int) ($dni / 23); |
| 188 | 188 | $value *= 23; |
| 189 | - $value= $dni - $value; |
|
| 190 | - $letter= "TRWAGMYFPDXBNJZSQVHLCKEO"; |
|
| 191 | - $dniLetter= substr($letter, $value, 1); |
|
| 189 | + $value = $dni - $value; |
|
| 190 | + $letter = "TRWAGMYFPDXBNJZSQVHLCKEO"; |
|
| 191 | + $dniLetter = substr($letter, $value, 1); |
|
| 192 | 192 | return $dni.$dniLetter; |
| 193 | 193 | } |
| 194 | 194 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | public function execute(\Magento\Framework\Event\Observer $observer) |
| 17 | 17 | { |
| 18 | 18 | try { |
| 19 | - if ($observer->getEvent()->getMethodInstance()->getCode()=="pagantis") { |
|
| 19 | + if ($observer->getEvent()->getMethodInstance()->getCode() == "pagantis") { |
|
| 20 | 20 | $checkResult = $observer->getEvent()->getResult(); |
| 21 | 21 | $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); |
| 22 | 22 | $config = $objectManager->create('Pagantis\Pagantis\Helper\Config')->getConfig(); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $availableCountry = (in_array(strtolower($locale), $allowedCountries)); |
| 28 | 28 | if (!isset($config['pagantis_public_key']) || $config['pagantis_public_key'] == '' || |
| 29 | 29 | !isset($config['pagantis_private_key']) || $config['pagantis_private_key'] == '' || |
| 30 | - !$availableCountry ) { |
|
| 30 | + !$availableCountry) { |
|
| 31 | 31 | $checkResult->setData('is_available', false); |
| 32 | 32 | } else { |
| 33 | 33 | $checkResult->setData('is_available', true); |
@@ -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_pagantis"> |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | foreach ($items as $key => $item) { |
| 108 | 108 | $promotedProduct = $this->isPromoted($item); |
| 109 | 109 | if ($promotedProduct == 'true') { |
| 110 | - $promotedAmount+=$item->getPrice()*$item->getQty(); |
|
| 110 | + $promotedAmount += $item->getPrice() * $item->getQty(); |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
@@ -234,9 +234,9 @@ discard block |
||
| 234 | 234 | if ($promotedProduct == 'true') { |
| 235 | 235 | $promotedAmount+=$product->getAmount()*$item->getQty(); |
| 236 | 236 | $promotedMessage = 'Promoted Item: ' . $item->getName() . |
| 237 | - ' Price: ' . $item->getPrice() . |
|
| 238 | - ' Qty: ' . $item->getQty() . |
|
| 239 | - ' Item ID: ' . $item->getItemId(); |
|
| 237 | + ' Price: ' . $item->getPrice() . |
|
| 238 | + ' Qty: ' . $item->getQty() . |
|
| 239 | + ' Item ID: ' . $item->getItemId(); |
|
| 240 | 240 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage); |
| 241 | 241 | } |
| 242 | 242 | } |
@@ -401,9 +401,9 @@ discard block |
||
| 401 | 401 | $magentoVersion = $this->productMetadataInterface->getVersion(); |
| 402 | 402 | $moduleInfo = $this->moduleList->getOne('Pagantis_Pagantis'); |
| 403 | 403 | return array( 'magento' => $magentoVersion, |
| 404 | - 'pagantis' => $moduleInfo['setup_version'], |
|
| 405 | - 'php' => phpversion(), |
|
| 406 | - 'curl' => $curlVersion); |
|
| 404 | + 'pagantis' => $moduleInfo['setup_version'], |
|
| 405 | + 'php' => phpversion(), |
|
| 406 | + 'curl' => $curlVersion); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /** |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | $customer = $quote->getCustomer(); |
| 126 | 126 | $shippingAddress = $quote->getShippingAddress(); |
| 127 | 127 | |
| 128 | - if (isset($params['email']) && $params['email']!='') { |
|
| 128 | + if (isset($params['email']) && $params['email'] != '') { |
|
| 129 | 129 | $this->session->setEmail($params['email']); //Get guest email after refresh page |
| 130 | 130 | $customer->setEmail($params['email']); |
| 131 | 131 | $quote->setCheckoutMethod('guest'); |
| 132 | 132 | $quote->getBillingAddress()->setEmail($params['email']); |
| 133 | - } elseif ($customer->getEmail()=='') { |
|
| 133 | + } elseif ($customer->getEmail() == '') { |
|
| 134 | 134 | $customer->setEmail($this->session->getEmail()); |
| 135 | 135 | $quote->setCheckoutMethod('guest'); |
| 136 | 136 | $quote->getBillingAddress()->setEmail($this->session->getEmail()); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $currentQuote->setCustomerEmail($customer->getEmail()); |
| 142 | 142 | $this->quoteRepository->save($currentQuote); |
| 143 | 143 | |
| 144 | - $userAddress = new Address(); |
|
| 144 | + $userAddress = new Address(); |
|
| 145 | 145 | $userAddress |
| 146 | 146 | ->setZipCode($shippingAddress->getPostcode()) |
| 147 | 147 | ->setFullName($shippingAddress->getFirstname()." ".$shippingAddress->getLastname()) |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | ->setTaxId($tax_id) |
| 164 | 164 | ; |
| 165 | 165 | |
| 166 | - $orderBillingAddress = new Address(); |
|
| 166 | + $orderBillingAddress = new Address(); |
|
| 167 | 167 | $billingAddress = $quote->getBillingAddress(); |
| 168 | 168 | $orderBillingAddress |
| 169 | 169 | ->setZipCode($billingAddress->getPostcode()) |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | if ($customer->getDob()) { |
| 193 | 193 | $orderUser->setDateOfBirth($customer->getDob()); |
| 194 | 194 | } |
| 195 | - if ($customer->getTaxvat()!='') { |
|
| 195 | + if ($customer->getTaxvat() != '') { |
|
| 196 | 196 | $orderUser->setDni($customer->getTaxvat()); |
| 197 | 197 | $orderBillingAddress->setDni($customer->getTaxvat()); |
| 198 | 198 | $orderShippingAddress->setDni($customer->getTaxvat()); |
@@ -232,11 +232,11 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | $promotedProduct = $this->isPromoted($item); |
| 234 | 234 | if ($promotedProduct == 'true') { |
| 235 | - $promotedAmount+=$product->getAmount()*$item->getQty(); |
|
| 236 | - $promotedMessage = 'Promoted Item: ' . $item->getName() . |
|
| 237 | - ' Price: ' . $item->getPrice() . |
|
| 238 | - ' Qty: ' . $item->getQty() . |
|
| 239 | - ' Item ID: ' . $item->getItemId(); |
|
| 235 | + $promotedAmount += $product->getAmount() * $item->getQty(); |
|
| 236 | + $promotedMessage = 'Promoted Item: '.$item->getName(). |
|
| 237 | + ' Price: '.$item->getPrice(). |
|
| 238 | + ' Qty: '.$item->getQty(). |
|
| 239 | + ' Item ID: '.$item->getItemId(); |
|
| 240 | 240 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage); |
| 241 | 241 | } |
| 242 | 242 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | ->setType(Channel::ONLINE) |
| 274 | 274 | ; |
| 275 | 275 | |
| 276 | - $haystack = ($this->store->getLocale()!=null) ? $this->store->getLocale() : $this->getResolverCountry(); |
|
| 276 | + $haystack = ($this->store->getLocale() != null) ? $this->store->getLocale() : $this->getResolverCountry(); |
|
| 277 | 277 | $language = strstr($haystack, '_', true); |
| 278 | 278 | $orderConfiguration = new Configuration(); |
| 279 | 279 | $orderConfiguration |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | ->setUser($orderUser) |
| 292 | 292 | ; |
| 293 | 293 | |
| 294 | - if ($this->config['pagantis_public_key']=='' || $this->config['pagantis_private_key']=='') { |
|
| 294 | + if ($this->config['pagantis_public_key'] == '' || $this->config['pagantis_private_key'] == '') { |
|
| 295 | 295 | throw new \Exception('Public and Secret Key not found'); |
| 296 | 296 | } |
| 297 | 297 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | $displayMode = $this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE']; |
| 320 | - if ($displayMode==='0') { |
|
| 320 | + if ($displayMode === '0') { |
|
| 321 | 321 | echo $url; |
| 322 | 322 | exit; |
| 323 | 323 | } else { |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | private function getOrders($customerId) |
| 340 | 340 | { |
| 341 | 341 | $orderCollection = array(); |
| 342 | - if ($customerId!='') { |
|
| 342 | + if ($customerId != '') { |
|
| 343 | 343 | $this->orderCollection->addAttributeToFilter('customer_id', $customerId) |
| 344 | 344 | ->addAttributeToFilter( |
| 345 | 345 | 'status', |
| 346 | - ['in' => ['processing','pending','complete']] |
|
| 346 | + ['in' => ['processing', 'pending', 'complete']] |
|
| 347 | 347 | ) |
| 348 | 348 | ->load(); |
| 349 | 349 | $orderCollection = $this->orderCollection->getData(); |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
| 387 | 387 | return $dbConnection->insertOnDuplicate( |
| 388 | 388 | $tableName, |
| 389 | - array('id'=>$quoteId,'order_id'=>$pagantisOrderId), |
|
| 389 | + array('id'=>$quoteId, 'order_id'=>$pagantisOrderId), |
|
| 390 | 390 | array('order_id') |
| 391 | 391 | ); |
| 392 | 392 | } |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | $curlVersion = $curlInfo['version']; |
| 401 | 401 | $magentoVersion = $this->productMetadataInterface->getVersion(); |
| 402 | 402 | $moduleInfo = $this->moduleList->getOne('Pagantis_Pagantis'); |
| 403 | - return array( 'magento' => $magentoVersion, |
|
| 403 | + return array('magento' => $magentoVersion, |
|
| 404 | 404 | 'pagantis' => $moduleInfo['setup_version'], |
| 405 | 405 | 'php' => phpversion(), |
| 406 | 406 | 'curl' => $curlVersion); |
@@ -20,20 +20,20 @@ |
||
| 20 | 20 | * @var array $defaultConfigs |
| 21 | 21 | */ |
| 22 | 22 | public $defaultConfigs = array('PAGANTIS_TITLE'=>'Instant Financing', |
| 23 | - 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
| 24 | - 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
| 25 | - 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
| 26 | - 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
| 27 | - 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
| 28 | - 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
| 29 | - 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
| 30 | - 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
| 31 | - 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
| 32 | - 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
| 33 | - 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
| 34 | - 'PAGANTIS_URL_OK'=>'', |
|
| 35 | - 'PAGANTIS_URL_KO'=>'', |
|
| 36 | - 'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!' |
|
| 23 | + 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
| 24 | + 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
| 25 | + 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
| 26 | + 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
| 27 | + 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
| 28 | + 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
| 29 | + 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
| 30 | + 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
| 31 | + 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
| 32 | + 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
| 33 | + 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
| 34 | + 'PAGANTIS_URL_OK'=>'', |
|
| 35 | + 'PAGANTIS_URL_KO'=>'', |
|
| 36 | + 'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!' |
|
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -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']; |