Skip to content

Commit

Permalink
Merge pull request #41 from compropago/refactor
Browse files Browse the repository at this point in the history
Refactor
  • Loading branch information
danteay authored Apr 9, 2018
2 parents 0fdead7 + be47656 commit 48eb073
Show file tree
Hide file tree
Showing 40 changed files with 978 additions and 477 deletions.
6 changes: 6 additions & 0 deletions app/code/local/ComproPago/Base/Helper/Data.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

class ComproPago_Base_Helper_Data extends Mage_Payment_Helper_Data
{

}
36 changes: 36 additions & 0 deletions app/code/local/ComproPago/Base/Model/Observer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

class ComproPago_Cash_Model_Oberver
{
/**
* Set ComproPago retro to config panel
* @param $observer
* @throws Varien_Exception
*/
public function retro($observer)
{
$session = Mage::getSingleton('adminhtml/session');

$config = [
"mode" => Mage::getStoreConfig('payment/base/mode'),
"public_key" => Mage::getStoreConfig('payment/base/publickey'),
"private_key" => Mage::getStoreConfig('payment/base/privatekey'),
"cash_enable" => Mage::getStoreConfig('payment/cash/active')
];

try {
$this->validate($config);
} catch (\Exception $e) {
$session->addWarning($e->getMessage());
}
}

/**
* Validate configuration
* @param $config
*/
private function validate($config)
{
return;
}
}
33 changes: 33 additions & 0 deletions app/code/local/ComproPago/Base/etc/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<config>
<modules>
<ComproPago_Webhook>
<version>0.0.0.1</version>
</ComproPago_Webhook>
</modules>

<global>
<helpers>
<base>
<class>ComproPago_Base_Helper</class>
</base>
</helpers>

<models>
<base>
<class>ComproPago_Base_Model</class>
</base>
</models>

<events>
<admin_system_config_changed_section_payment>
<observers>
<cash_retro>
<class>base/observer</class>
<method>retro</method>
</cash_retro>
</observers>
</admin_system_config_changed_section_payment>
</events>
</global>
</config>
48 changes: 48 additions & 0 deletions app/code/local/ComproPago/Base/etc/system.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<config>
<sections>
<payment>
<groups>
<base translate="label" module="base">
<label>ComproPago Base Config</label>
<frontend_type>text</frontend_type>
<sort_order>100</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>

<fields>
<publickey translate="label">
<label>Llave Publica</label>
<frontend_type>text</frontend_type>
<sort_order>6</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</publickey>

<privatekey translate="label">
<label>Llave Privada</label>
<frontend_type>text</frontend_type>
<sort_order>7</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</privatekey>

<mode translate="label">
<label>Modo activo</label>
<frontend_type>select</frontend_type>
<comment>Estas generando pruebas? cambia a 'no'</comment>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>8</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</mode>
</fields>
</base>
</groups>
</payment>
</sections>
</config>
1 change: 0 additions & 1 deletion app/code/local/ComproPago/Cash/Block/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public function getMethodLabelAfterHtml()
$mark = Mage::getConfig()->getBlockClassName('core/template');
$mark = new $mark;
$mark->setTemplate('compropago/cash/mark.phtml');

return $mark->toHtml();
}
}
16 changes: 16 additions & 0 deletions app/code/local/ComproPago/Cash/Block/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,20 @@ public function __construct()
parent::__construct();
$this->setTemplate($this->template);
}

/**
* Return the payment method title
* @return string
*/
public function getTitle()
{
return Mage::getStoreConfig('payment/cash/title');
}

public function getExtraData()
{
$info = parent::getInfo();
$data = $info->getAdditionalInformation();
return $data;
}
}
5 changes: 1 addition & 4 deletions app/code/local/ComproPago/Cash/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@

class ComproPago_Cash_Helper_Data extends Mage_Payment_Helper_Data
{
protected function something()
{
// TODO: Something to do for not empty class
}

}
Loading

0 comments on commit 48eb073

Please sign in to comment.