@@ -24,21 +24,21 @@ |
||
24 | 24 | * @var array $defaultConfigs |
25 | 25 | */ |
26 | 26 | public $defaultConfigs = array('PAGANTIS_TITLE'=>'Paga en cuotas', |
27 | - 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
28 | - 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
29 | - 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
30 | - 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
31 | - 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
32 | - 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
33 | - 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
34 | - 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
35 | - 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
36 | - 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
37 | - 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
38 | - 'PAGANTIS_DISPLAY_MAX_AMOUNT'=>0, |
|
39 | - 'PAGANTIS_URL_OK'=>'', |
|
40 | - 'PAGANTIS_URL_KO'=>'', |
|
41 | - 'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!' |
|
27 | + 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
28 | + 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
29 | + 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
30 | + 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
31 | + 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
32 | + 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
33 | + 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
34 | + 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
35 | + 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
36 | + 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
37 | + 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
38 | + 'PAGANTIS_DISPLAY_MAX_AMOUNT'=>0, |
|
39 | + 'PAGANTIS_URL_OK'=>'', |
|
40 | + 'PAGANTIS_URL_KO'=>'', |
|
41 | + 'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!' |
|
42 | 42 | ); |
43 | 43 | |
44 | 44 | /** |
@@ -16,26 +16,26 @@ |
||
16 | 16 | * @var array $defaultConfigs |
17 | 17 | */ |
18 | 18 | public $defaultConfigs = array( |
19 | - 'PAGANTIS_TITLE'=>'Pago en cuotas', |
|
20 | - 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'sdk.simulator.types.SELECTABLE_TEXT_CUSTOM', |
|
21 | - 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'sdk.simulator.skins.BLUE', |
|
22 | - 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
23 | - 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
24 | - 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
25 | - 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
26 | - 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'sdk.simulator.positions.INNER', |
|
27 | - 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
28 | - 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
29 | - 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
30 | - 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
31 | - 'PAGANTIS_DISPLAY_MAX_AMOUNT'=>0, |
|
32 | - 'PAGANTIS_URL_OK'=>'', |
|
33 | - 'PAGANTIS_URL_KO'=>'', |
|
34 | - 'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!', |
|
35 | - 'PAGANTIS_ALLOWED_COUNTRIES' => 'a:3:{i:0;s:2:"es";i:1;s:2:"it";i:2;s:2:"fr";}', |
|
36 | - 'PAGANTIS_PROMOTION_EXTRA' => '<p class="promoted">Finance this product <span class="pg-no-interest">without interest!</span></p>', |
|
37 | - 'PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR' => '.', |
|
38 | - 'PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR' => ',' |
|
19 | + 'PAGANTIS_TITLE'=>'Pago en cuotas', |
|
20 | + 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'sdk.simulator.types.SELECTABLE_TEXT_CUSTOM', |
|
21 | + 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'sdk.simulator.skins.BLUE', |
|
22 | + 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
23 | + 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
24 | + 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
25 | + 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
26 | + 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'sdk.simulator.positions.INNER', |
|
27 | + 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
28 | + 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
29 | + 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
30 | + 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
31 | + 'PAGANTIS_DISPLAY_MAX_AMOUNT'=>0, |
|
32 | + 'PAGANTIS_URL_OK'=>'', |
|
33 | + 'PAGANTIS_URL_KO'=>'', |
|
34 | + 'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!', |
|
35 | + 'PAGANTIS_ALLOWED_COUNTRIES' => 'a:3:{i:0;s:2:"es";i:1;s:2:"it";i:2;s:2:"fr";}', |
|
36 | + 'PAGANTIS_PROMOTION_EXTRA' => '<p class="promoted">Finance this product <span class="pg-no-interest">without interest!</span></p>', |
|
37 | + 'PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR' => '.', |
|
38 | + 'PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR' => ',' |
|
39 | 39 | ); |
40 | 40 | |
41 | 41 | /** |
@@ -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 | $totalPrice = (string) floor($observer->getEvent()->getQuote()->getGrandTotal()); |
22 | 22 | $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $availableCountry = (in_array(strtolower($locale), $allowedCountries)); |
29 | 29 | $maxAmount = $extraConfig['PAGANTIS_DISPLAY_MAX_AMOUNT']; |
30 | 30 | $minAmount = $extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT']; |
31 | - $validAmount = ($totalPrice>=$minAmount && ($totalPrice<=$maxAmount||$maxAmount=='0')); |
|
31 | + $validAmount = ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount == '0')); |
|
32 | 32 | if (!isset($config['pagantis_public_key']) || $config['pagantis_public_key'] == '' || |
33 | 33 | !isset($config['pagantis_private_key']) || $config['pagantis_private_key'] == '' || |
34 | 34 | !$availableCountry || !$validAmount) { |
@@ -24,21 +24,21 @@ |
||
24 | 24 | * @var array $defaultConfigs |
25 | 25 | */ |
26 | 26 | public $defaultConfigs = array('PAGANTIS_TITLE'=>'Paga en cuotas', |
27 | - 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
28 | - 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
29 | - 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
30 | - 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
31 | - 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
32 | - 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
33 | - 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
34 | - 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
35 | - 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
36 | - 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
37 | - 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
38 | - 'PAGANTIS_DISPLAY_MAX_AMOUNT'=>0, |
|
39 | - 'PAGANTIS_URL_OK'=>'', |
|
40 | - 'PAGANTIS_URL_KO'=>'', |
|
41 | - 'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!' |
|
27 | + 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
28 | + 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
29 | + 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
30 | + 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
31 | + 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
32 | + 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
33 | + 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
34 | + 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
35 | + 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
36 | + 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
37 | + 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
38 | + 'PAGANTIS_DISPLAY_MAX_AMOUNT'=>0, |
|
39 | + 'PAGANTIS_URL_OK'=>'', |
|
40 | + 'PAGANTIS_URL_KO'=>'', |
|
41 | + 'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!' |
|
42 | 42 | ); |
43 | 43 | |
44 | 44 | /** |
@@ -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 | } |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | $okUrlRoute = 'pagantis/notify/indexV2'; |
262 | 262 | } |
263 | 263 | |
264 | - $okUrlUser = $this->_url->getUrl($okUrlRoute, ['_query' => ['quoteId'=>$quoteId,'origin'=>'redirect']]); |
|
265 | - $okUrlNot = $this->_url->getUrl($okUrlRoute, ['_query' => ['quoteId'=>$quoteId,'origin'=>'notification']]); |
|
264 | + $okUrlUser = $this->_url->getUrl($okUrlRoute, ['_query' => ['quoteId'=>$quoteId, 'origin'=>'redirect']]); |
|
265 | + $okUrlNot = $this->_url->getUrl($okUrlRoute, ['_query' => ['quoteId'=>$quoteId, 'origin'=>'notification']]); |
|
266 | 266 | |
267 | 267 | $orderConfigurationUrls |
268 | 268 | ->setCancel($cancelUrl) |
@@ -277,15 +277,12 @@ discard block |
||
277 | 277 | ->setType(Channel::ONLINE) |
278 | 278 | ; |
279 | 279 | |
280 | - $haystack = ($this->store->getLocale()!=null) ? $this->store->getLocale() : $this->getResolverCountry(); |
|
280 | + $haystack = ($this->store->getLocale() != null) ? $this->store->getLocale() : $this->getResolverCountry(); |
|
281 | 281 | $langCountry = strtolower(strstr($haystack, '_', true)); |
282 | 282 | $allowedCountries = unserialize($this->extraConfig['PAGANTIS_ALLOWED_COUNTRIES']); |
283 | 283 | |
284 | 284 | $purchaseCountry = |
285 | - in_array($langCountry, $allowedCountries) ? $langCountry : |
|
286 | - in_array(strtolower($shippingAddress->getCountry()), $allowedCountries)? $shippingAddress->getCountry(): |
|
287 | - in_array(strtolower($billingAddress->getCountry()), $allowedCountries)? $billingAddress->getCountry() : |
|
288 | - null; |
|
285 | + in_array($langCountry, $allowedCountries) ? $langCountry : in_array(strtolower($shippingAddress->getCountry()), $allowedCountries) ? $shippingAddress->getCountry() : in_array(strtolower($billingAddress->getCountry()), $allowedCountries) ? $billingAddress->getCountry() : null; |
|
289 | 286 | |
290 | 287 | $orderConfiguration = new Configuration(); |
291 | 288 | $orderConfiguration |
@@ -303,7 +300,7 @@ discard block |
||
303 | 300 | ->setUser($orderUser) |
304 | 301 | ; |
305 | 302 | |
306 | - if ($this->config['pagantis_public_key']=='' || $this->config['pagantis_private_key']=='') { |
|
303 | + if ($this->config['pagantis_public_key'] == '' || $this->config['pagantis_private_key'] == '') { |
|
307 | 304 | throw new \Exception('Public and Secret Key not found'); |
308 | 305 | } |
309 | 306 | |
@@ -329,7 +326,7 @@ discard block |
||
329 | 326 | } |
330 | 327 | |
331 | 328 | $displayMode = $this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE']; |
332 | - if ($displayMode==='0') { |
|
329 | + if ($displayMode === '0') { |
|
333 | 330 | echo $url; |
334 | 331 | exit; |
335 | 332 | } else { |
@@ -351,11 +348,11 @@ discard block |
||
351 | 348 | private function getOrders($customerId) |
352 | 349 | { |
353 | 350 | $orderCollection = array(); |
354 | - if ($customerId!='') { |
|
351 | + if ($customerId != '') { |
|
355 | 352 | $this->orderCollection->addAttributeToFilter('customer_id', $customerId) |
356 | 353 | ->addAttributeToFilter( |
357 | 354 | 'status', |
358 | - ['in' => ['processing','pending','complete']] |
|
355 | + ['in' => ['processing', 'pending', 'complete']] |
|
359 | 356 | ) |
360 | 357 | ->load(); |
361 | 358 | $orderCollection = $this->orderCollection->getData(); |
@@ -398,7 +395,7 @@ discard block |
||
398 | 395 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
399 | 396 | return $dbConnection->insertOnDuplicate( |
400 | 397 | $tableName, |
401 | - array('id'=>$quoteId,'order_id'=>$pagantisOrderId), |
|
398 | + array('id'=>$quoteId, 'order_id'=>$pagantisOrderId), |
|
402 | 399 | array('order_id') |
403 | 400 | ); |
404 | 401 | } |
@@ -412,7 +409,7 @@ discard block |
||
412 | 409 | $curlVersion = $curlInfo['version']; |
413 | 410 | $magentoVersion = $this->productMetadataInterface->getVersion(); |
414 | 411 | $moduleInfo = $this->moduleList->getOne('Pagantis_Pagantis'); |
415 | - return array( 'magento' => $magentoVersion, |
|
412 | + return array('magento' => $magentoVersion, |
|
416 | 413 | 'pagantis' => $moduleInfo['setup_version'], |
417 | 414 | 'php' => phpversion(), |
418 | 415 | 'curl' => $curlVersion); |
@@ -464,6 +464,6 @@ |
||
464 | 464 | $minAmount = $this->getMinAmount(); |
465 | 465 | $totalPrice = (string) floor($this->getFinalPrice()); |
466 | 466 | |
467 | - return ($totalPrice>=$minAmount && ($totalPrice<=$maxAmount||$maxAmount=='0')); |
|
467 | + return ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount == '0')); |
|
468 | 468 | } |
469 | 469 | } |