@@ -16,22 +16,22 @@ |
||
16 | 16 | * @var array $defaultConfigs |
17 | 17 | */ |
18 | 18 | public $defaultConfigs = array('PAGANTIS_TITLE'=>'Instant Financing', |
19 | - 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
20 | - 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
21 | - 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
22 | - 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
23 | - 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
24 | - 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
25 | - 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
26 | - 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
27 | - 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
28 | - 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
29 | - 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
30 | - 'PAGANTIS_URL_OK'=>'', |
|
31 | - 'PAGANTIS_URL_KO'=>'', |
|
32 | - 'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!', |
|
33 | - 'PAGANTIS_ALLOWED_COUNTRIES' => 'a:2:{i:0;s:2:"es";i:1;s:2:"it";}', |
|
34 | - 'PAGANTIS_PROMOTION_EXTRA' => '<p class="promoted">Finance this product <span class="pmt-no-interest">without interest!</span></p>' |
|
19 | + 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
20 | + 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
21 | + 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
22 | + 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
23 | + 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
24 | + 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
25 | + 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
26 | + 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
27 | + 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
28 | + 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
29 | + 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
30 | + 'PAGANTIS_URL_OK'=>'', |
|
31 | + 'PAGANTIS_URL_KO'=>'', |
|
32 | + 'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!', |
|
33 | + 'PAGANTIS_ALLOWED_COUNTRIES' => 'a:2:{i:0;s:2:"es";i:1;s:2:"it";}', |
|
34 | + 'PAGANTIS_PROMOTION_EXTRA' => '<p class="promoted">Finance this product <span class="pmt-no-interest">without interest!</span></p>' |
|
35 | 35 | ); |
36 | 36 | |
37 | 37 | /** |
@@ -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(); |
|
276 | + $haystack = $this->store->getLocale(); |
|
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); |
@@ -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 |
@@ -155,16 +155,16 @@ discard block |
||
155 | 155 | $faker = Factory::create(); |
156 | 156 | $this->configuration['dni'] = $this->getDNI(); |
157 | 157 | $this->configuration['birthdate'] = |
158 | - $faker->numberBetween(1, 28) . '/' . |
|
159 | - $faker->numberBetween(1, 12). '/1975' |
|
158 | + $faker->numberBetween(1, 28).'/'. |
|
159 | + $faker->numberBetween(1, 12).'/1975' |
|
160 | 160 | ; |
161 | 161 | $this->configuration['firstname'] = $faker->firstName; |
162 | - $this->configuration['lastname'] = $faker->lastName . ' ' . $faker->lastName; |
|
162 | + $this->configuration['lastname'] = $faker->lastName.' '.$faker->lastName; |
|
163 | 163 | $this->configuration['company'] = $faker->company; |
164 | 164 | $this->configuration['zip'] = '28'.$faker->randomNumber(3, true); |
165 | 165 | $this->configuration['street'] = $faker->streetAddress; |
166 | - $this->configuration['phone'] = '6' . $faker->randomNumber(8); |
|
167 | - $this->configuration['email'] = date('ymd') . '@pagantis.com'; |
|
166 | + $this->configuration['phone'] = '6'.$faker->randomNumber(8); |
|
167 | + $this->configuration['email'] = date('ymd').'@pagantis.com'; |
|
168 | 168 | |
169 | 169 | if (!isset($_SERVER['argv']) || |
170 | 170 | !isset($_SERVER['argv'][4]) || |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | throw new \Exception("No magentoVersion param provided or not valid for phpunit testing"); |
176 | 176 | } |
177 | 177 | |
178 | - if ($_SERVER['argv'][8]!='test' && $_SERVER['argv'][8]!='dev') { |
|
178 | + if ($_SERVER['argv'][8] != 'test' && $_SERVER['argv'][8] != 'dev') { |
|
179 | 179 | throw new \Exception("No environment param provided or not valid for phpunit testing"); |
180 | 180 | } |
181 | 181 | |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | */ |
194 | 194 | protected function getDNI() |
195 | 195 | { |
196 | - $dni = '0000' . rand(pow(10, 4-1), pow(10, 4)-1); |
|
196 | + $dni = '0000'.rand(pow(10, 4 - 1), pow(10, 4) - 1); |
|
197 | 197 | $value = (int) ($dni / 23); |
198 | 198 | $value *= 23; |
199 | - $value= $dni - $value; |
|
200 | - $letter= "TRWAGMYFPDXBNJZSQVHLCKEO"; |
|
201 | - $dniLetter= substr($letter, $value, 1); |
|
199 | + $value = $dni - $value; |
|
200 | + $letter = "TRWAGMYFPDXBNJZSQVHLCKEO"; |
|
201 | + $dniLetter = substr($letter, $value, 1); |
|
202 | 202 | return $dni.$dniLetter; |
203 | 203 | } |
204 | 204 |