Skip to content

Commit

Permalink
Merge pull request #41 from pagantis/INT-942
Browse files Browse the repository at this point in the history
Int 942
  • Loading branch information
pgarcess committed Mar 19, 2020
2 parents 8b6449f + 50da114 commit 685db11
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 56 deletions.
9 changes: 0 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,6 @@ commands:
name: Buy Unregistered
command: |
vendor/bin/phpunit --group magento-buy-unregistered -d magentoVersion -d ${VERSION}
magento_register:
description: "Register Test"
steps:
- run:
name: Register Test
command: |
vendor/bin/phpunit --group magento-register -d magentoVersion -d ${VERSION}
magento_buy_registered:
description: "Buy Registered Test"
steps:
Expand All @@ -127,7 +120,6 @@ jobs:
- basic_test
- magento_install
- magento_buy_unregistered
- magento_register
- magento_buy_registered
test-magento-23:
environment:
Expand All @@ -146,7 +138,6 @@ jobs:
- basic_test
- magento_install
- magento_buy_unregistered
- magento_register
- magento_buy_registered
workflows:
version: 2
Expand Down
22 changes: 0 additions & 22 deletions Block/Product/Simulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ class Simulator extends Template
*/
protected $decimalSeparator;

/**
* @var String
*/
protected $separator;

/**
* Simulator constructor.
*
Expand Down Expand Up @@ -157,7 +152,6 @@ public function __construct(
$this->promotedMessage = $this->extraConfig['PAGANTIS_PROMOTION_EXTRA'];
$this->thousandSeparator = $this->extraConfig['PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR'];
$this->decimalSeparator = $this->extraConfig['PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR'];
$this->separator = __('ó');

$this->promoted = $this->isProductInPromotion();
}
Expand Down Expand Up @@ -439,22 +433,6 @@ public function setDecimalSeparator($decimalSeparator)
$this->decimalSeparator = $decimalSeparator;
}

/**
* @return String
*/
public function getSeparator()
{
return $this->separator;
}

/**
* @param String $separator
*/
public function setSeparator($separator)
{
$this->separator = $separator;
}

/**
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion Model/Ui/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function getConfig()
'thousandSeparator' => $this->extraConfig['PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR'],
'decimalSeparator' => $this->extraConfig['PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR'],
'quotesStart' => $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'],
'type' => $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'],
'type' => $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT'],
'skin' => $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'],
'position' => $positionSelector
],
Expand Down
3 changes: 2 additions & 1 deletion Setup/InstallData.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class InstallData implements InstallDataInterface
*/
public $defaultConfigs = array(
'PAGANTIS_TITLE'=>'Pago en cuotas',
'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'sdk.simulator.types.SELECTABLE_TEXT_CUSTOM',
'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'sdk.simulator.types.PRODUCT_PAGE',
'PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT'=>'sdk.simulator.types.CHECKOUT_PAGE',
'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'sdk.simulator.skins.BLUE',
'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons',
'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3,
Expand Down
16 changes: 16 additions & 0 deletions Setup/UpgradeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
}
}

if (version_compare($context->getVersion(), '8.3.2') < 0) {
$newConfigs = array(
/* INSERT NEW CONFIGS PARAMS HERE:'config'=>'<value>'*/
'PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT' => 'sdk.simulator.types.CHECKOUT_PAGE'
);
foreach ($newConfigs as $config => $value) {
$setup->getConnection()->insert(self::CONFIG_TABLE, array('config'=>$config, 'value'=>$value));
}
$setup->getConnection()->update(
self::CONFIG_TABLE,
array('value' => 'sdk.simulator.types.PRODUCT_PAGE'),
"config='PAGANTIS_SIMULATOR_DISPLAY_TYPE'"
);

}

$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
\Magento\Catalog\Model\Product::ENTITY,
Expand Down
Binary file modified Test.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pagantis/magento-2x",
"version": "8.3.1",
"version": "8.3.2",
"description": "Pagantis Magento 2 module",
"type": "magento2-module",
"keywords": [
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Pagantis_Pagantis" setup_version="8.3.1">
<module name="Pagantis_Pagantis" setup_version="8.3.2">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
Expand Down
15 changes: 2 additions & 13 deletions view/frontend/templates/product/simulator.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,10 @@ if($block->isEnabled()==='1' && $block->getProductSimulator()==='1' && $block->g
return simulatorLoaded;
}

function prependSeparator()
{
var node = document.querySelector(findPositionSelector());
var textnode = document.createTextNode("<?php echo $block->getSeparator();?>");
var spannode = document.createElement("span");
spannode.style.cssText = 'margin-right:5px; margin-top: 5px';
spannode.appendChild(textnode);
node.prepend(spannode);
return true;
}

function moveToPrice()
{
if (simulatorType === 'sdk.simulator.types.SELECTABLE_TEXT_CUSTOM') {
if (simulatorType === 'sdk.simulator.types.SELECTABLE_TEXT_CUSTOM' ||
simulatorType === 'sdk.simulator.types.PRODUCT_PAGE') {
var simnode = document.querySelector(findPositionSelector());

var detailnode = document.getElementsByClassName('product-add-form');
Expand Down Expand Up @@ -142,7 +132,6 @@ if($block->isEnabled()==='1' && $block->getProductSimulator()==='1' && $block->g
window.MGSimulatorId = window.sdk.simulator.init(simulator_options);
if(window.MGSimulatorId != '') {
moveToPrice();
prependSeparator();
}
return false;
}
Expand Down
7 changes: 5 additions & 2 deletions view/frontend/web/js/view/payment/method-renderer/pagantis.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define(
function ($, Component, url, customerData, errorProcessor, fullScreenLoader, quote, pgSDK, selectPaymentMethodAction, checkoutData, totals, priceUtils) {
'use strict';

window.checkoutConfig.payment.pagantis.guestEmail = quote.guestEmail;
window.checkoutConfig.payment.pagantis.fullQuote = quote;

return Component.extend({
defaults: {
Expand Down Expand Up @@ -72,7 +72,10 @@ define(

placeOrder: function () {
var paymentUrl = url.build('pagantis/Payment');
$.post(paymentUrl, { email: window.checkoutConfig.payment.pagantis.guestEmail }, 'json')

var guestEmail = window.checkoutConfig.payment.pagantis.fullQuote.guestEmail;

$.post(paymentUrl, { email: guestEmail }, 'json')
.done(function (response) {
window.location.replace(response);
})
Expand Down

0 comments on commit 685db11

Please sign in to comment.