Skip to content

Commit

Permalink
v0.3.0 - Update commit
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipeMata committed Aug 30, 2017
1 parent 8179a21 commit 97bdf3d
Show file tree
Hide file tree
Showing 30 changed files with 702 additions and 59 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v0.3.0
- Add: Metodo de pagamento por boleto no painel administrativo.

# v0.2.6
- Fix: Converte preço de produto para Real brasileiro caso o preço base não esteja configurado com moeda BRL.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Módulo Oficial da Gerencianet para o Magento - Versão 0.2.6
# Módulo Oficial da Gerencianet para o Magento - Versão 0.3.0

**Em caso de dúvidas, você pode verificar a [Documentação](https://docs.gerencianet.com.br) da API na Gerencianet e, necessitando de mais detalhes ou informações, entre em contato com nossa consultoria técnica, via nossos [Canais de Comunicação](https://gerencianet.com.br/central-de-ajuda).**

Expand Down
6 changes: 4 additions & 2 deletions app/code/local/Gerencianet/Transparent/Block/Billet/Form.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class Gerencianet_Transparent_Block_Billet_Form extends Mage_Payment_Block_Form
*/
protected function _construct() {
parent::_construct();
$order = Mage::getModel('checkout/session')->getQuote();
$sessionInstance = Mage::getModel("core/session")->getSessionQuote();
$order = Mage::getModel($sessionInstance)->getQuote();
$address = $order->getBillingAddress();
$order_total = $order->getGrandTotal();

Expand Down Expand Up @@ -124,7 +125,8 @@ public function getOrder() {
if (!$this->_order) {
$this->_order = Mage::registry('current_order');
if (!$this->_order) {
$this->_order = Mage::getModel('checkout/session')->getQuote();
$sessionInstance = Mage::getModel("core/session")->getSessionQuote();
$this->_order = Mage::getModel($sessionInstance)->getQuote();
if (!$this->_order) {
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion app/code/local/Gerencianet/Transparent/Block/Card/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class Gerencianet_Transparent_Block_Card_Form extends Mage_Payment_Block_Form_Cc
protected function _construct() {
parent::_construct();

$order = Mage::getModel('checkout/session')->getQuote();
$sessionInstance = Mage::getModel("core/session")->getSessionQuote();
$order = Mage::getModel($sessionInstance)->getQuote();
$address = $order->getBillingAddress();
$order_total = $order->getGrandTotal();

Expand Down
6 changes: 4 additions & 2 deletions app/code/local/Gerencianet/Transparent/Model/Billet.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class Gerencianet_Transparent_Model_Billet extends Gerencianet_Transparent_Model
*/
public function assignData($data) {
$info = $this->getInfoInstance();
$quote = Mage::getModel('checkout/session')->getQuote();
$sessionInstance = Mage::getModel("core/session")->getSessionQuote();
$quote = Mage::getModel($sessionInstance)->getQuote();
$expires = Mage::getStoreConfig('payment/gerencianet_billet/duedate');
$fine = floatval(Mage::getStoreConfig('payment/gerencianet_billet/fine'));
if ($fine>0 && $fine<=10) {
Expand Down Expand Up @@ -76,7 +77,8 @@ public function assignData($data) {
*/
public function authorize(Varien_Object $payment, $amount)
{
$quote = Mage::getModel('checkout/session')->getQuote();
$sessionInstance = Mage::getModel("core/session")->getSessionQuote();
$quote = Mage::getModel($sessionInstance)->getQuote();
$order_total = $quote->getGrandTotal();
if ($order_total<5) {
Mage::throwException($this->_getHelper()->__("O valor mínimo para pagar com a Gerencianet é R$5,00."));
Expand Down
11 changes: 5 additions & 6 deletions app/code/local/Gerencianet/Transparent/Model/Card.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Gerencianet_Transparent_Model_Card extends Gerencianet_Transparent_Model_S
protected $_canCapturePartial = false;
protected $_canRefund = false;
protected $_canVoid = true;
protected $_canUseInternal = true;
protected $_canUseInternal = false;
protected $_canUseCheckout = true;
protected $_canUseForMultishipping = true;

Expand All @@ -41,12 +41,10 @@ class Gerencianet_Transparent_Model_Card extends Gerencianet_Transparent_Model_S
*/
public function assignData($data) {
$info = $this->getInfoInstance();
$quote = Mage::getModel('checkout/session')->getQuote();
$sessionInstance = Mage::getModel("core/session")->getSessionQuote();
$quote = Mage::getModel($sessionInstance)->getQuote();
$additionaldata['card']['cc_token'] = $data->getCcToken();
$additionaldata['card']['cc_installments'] = $data->getCcInstallments();
//$additionaldata['juridical']['data_pay_card_as_juridical'] = $data->getDataPayCardAsJuridical();
//$additionaldata['juridical']['cc_data_corporate_name'] = $data->getCcDataCorporateName();
//$additionaldata['juridical']['cc_data_cnpj'] = $data->getCcDataCnpj();
$additionaldata['customer']['cc_data_name_corporate'] = $data->getCcDataNameCorporate();
$additionaldata['customer']['cc_data_cpf_cnpj'] = $data->getCcDataCpfCnpj();
$additionaldata['customer']['cc_data_email'] = $data->getCcDataEmail();
Expand Down Expand Up @@ -81,7 +79,8 @@ public function assignData($data) {
*/
public function authorize(Varien_Object $payment, $amount)
{
$quote = Mage::getModel('checkout/session')->getQuote();
$sessionInstance = Mage::getModel("core/session")->getSessionQuote();
$quote = Mage::getModel($sessionInstance)->getQuote();
$order_total = $quote->getGrandTotal();
if ($order_total<5) {
Mage::throwException($this->_getHelper()->__("O valor mínimo para pagar com a Gerencianet é R$5,00."));
Expand Down
34 changes: 34 additions & 0 deletions app/code/local/Gerencianet/Transparent/Model/Observer.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,38 @@ public function setNew($event) {
}
}

public function adminPrepareLayoutBefore()
{
$this->_prepareLayoutBefore('admin');
}

public function frontendPrepareLayoutBefore()
{
$this->_prepareLayoutBefore('frontend');
}

protected function _prepareLayoutBefore($area)
{
switch($area){
case 'admin':
Mage::getModel('core/session')->setSessionQuote('adminhtml/session_quote');
break;

case 'frontend':
Mage::getModel('core/session')->setSessionQuote('checkout/session');
break;
}
}

public function prepareLayoutBefore(Varien_Event_Observer $observer)
{
$block = $observer->getEvent()->getBlock();
if ("head" == $block->getNameInLayout()) {
$block->addJs('gerencianet/jquery-1.12.3.min.js');
$block->addJs('gerencianet/jquery.maskedinput.js');
$block->addJs('gerencianet/jquery.noconflict.js');
}

return this;
}
}
6 changes: 4 additions & 2 deletions app/code/local/Gerencianet/Transparent/Model/Standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public function isAvailable($quote = null)

$order = Mage::registry('current_order');
if (!$order) {
$order = Mage::getModel('checkout/session')->getQuote();
$sessionInstance = Mage::getModel("core/session")->getSessionQuote();
$order = Mage::getModel($sessionInstance)->getQuote();
}
/*if ($order->getGrandTotal()<5) {
return false;
Expand Down Expand Up @@ -470,7 +471,8 @@ public function getOrder() {
if (!$this->_order) {
$this->_order = Mage::registry('current_order');
if (!$this->_order) {
$this->_order = Mage::getModel('checkout/session')->getQuote();
$sessionInstance = Mage::getModel("core/session")->getSessionQuote();
$this->_order = Mage::getModel($sessionInstance)->getQuote();
if (!$this->_order) {
return false;
}
Expand Down
6 changes: 4 additions & 2 deletions app/code/local/Gerencianet/Transparent/controllers/PaymentController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class Gerencianet_Transparent_PaymentController extends Mage_Core_Controller_Fro
*
*/
protected function _expireAjax() {
if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
$sessionInstance = Mage::getModel("core/session")->getSessionQuote();
if (!Mage::getSingleton($sessionInstance)->getQuote()->hasItems()) {
$this->getResponse()->setHeader('HTTP/1.1', '403 Session Expired');
exit;
}
Expand Down Expand Up @@ -80,7 +81,8 @@ public function notificationsbAction(){
public function installmentsAction() {
$brand = $this->getRequest()->getParam('brand');
$api = $this->getStandard()->getApi();
$quote = Mage::getModel('checkout/session')->getQuote();
$sessionInstance = Mage::getModel("core/session")->getSessionQuote();
$quote = Mage::getModel($sessionInstance)->getQuote();
$params = array(
'total' => number_format($quote->getGrandTotal(),2,'',''),
'brand' => $brand
Expand Down
140 changes: 103 additions & 37 deletions app/code/local/Gerencianet/Transparent/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<config>
<modules>
<Gerencianet_Transparent>
<version>0.2.6</version>
<version>0.3.0</version>
</Gerencianet_Transparent>
</modules>

Expand Down Expand Up @@ -101,43 +101,109 @@
</default>

<frontend>
<events>
<sales_order_place_after>
<observers>
<gerencianet_transparent_updatecharge>
<type>model</type>
<class>gerencianet_transparent/observer</class>
<method>updatecharge</method>
</gerencianet_transparent_updatecharge>
</observers>
</sales_order_place_after>
<sales_order_payment_place_end>
<observers>
<gerencianet_transparent_updatecharge>
<type>model</type>
<class>gerencianet_transparent/observer</class>
<method>setNew</method>
</gerencianet_transparent_updatecharge>
</observers>
</sales_order_payment_place_end>
</events>
<routers>
<gerencianet_transparent>
<use>standard</use>
<args>
<module>Gerencianet_Transparent</module>
<frontName>gerencianet</frontName>
</args>
</gerencianet_transparent>
</routers>
<layout>
<updates>
<gerencianet_transparent>
<file>gerencianet_transparent.xml</file>
</gerencianet_transparent>
</updates>
</layout>
<events>
<core_block_abstract_prepare_layout_after>
<observers>
<gerencianet_transparent_updatecharge>
<type>model</type>
<class>gerencianet_transparent/observer</class>
<method>frontendPrepareLayoutBefore</method>
</gerencianet_transparent_updatecharge>
</observers>
</core_block_abstract_prepare_layout_after>
<sales_order_place_after>
<observers>
<gerencianet_transparent_updatecharge>
<type>model</type>
<class>gerencianet_transparent/observer</class>
<method>updatecharge</method>
</gerencianet_transparent_updatecharge>
</observers>
</sales_order_place_after>
<sales_order_payment_place_end>
<observers>
<gerencianet_transparent_updatecharge>
<type>model</type>
<class>gerencianet_transparent/observer</class>
<method>setNew</method>
</gerencianet_transparent_updatecharge>
</observers>
</sales_order_payment_place_end>
</events>
<routers>
<gerencianet_transparent>
<use>standard</use>
<args>
<module>Gerencianet_Transparent</module>
<frontName>gerencianet</frontName>
</args>
</gerencianet_transparent>
</routers>
<layout>
<updates>
<gerencianet_transparent>
<file>gerencianet_transparent.xml</file>
</gerencianet_transparent>
</updates>
</layout>
</frontend>

<adminhtml>
<events>
<core_block_abstract_prepare_layout_before>
<observers>
<gerencianet_transparent_updatecharge>
<type>model</type>
<class>gerencianet_transparent/observer</class>
<method>prepareLayoutBefore</method>
</gerencianet_transparent_updatecharge>
</observers>
</core_block_abstract_prepare_layout_before>
<core_block_abstract_prepare_layout_after>
<observers>
<gerencianet_transparent_updatecharge>
<type>model</type>
<class>gerencianet_transparent/observer</class>
<method>adminPrepareLayoutBefore</method>
</gerencianet_transparent_updatecharge>
</observers>
</core_block_abstract_prepare_layout_after>
<sales_order_place_after>
<observers>
<gerencianet_transparent_updatecharge>
<type>model</type>
<class>gerencianet_transparent/observer</class>
<method>updatecharge</method>
</gerencianet_transparent_updatecharge>
</observers>
</sales_order_place_after>
<sales_order_payment_place_end>
<observers>
<gerencianet_transparent_updatecharge>
<type>model</type>
<class>gerencianet_transparent/observer</class>
<method>setNew</method>
</gerencianet_transparent_updatecharge>
</observers>
</sales_order_payment_place_end>
</events>
<routers>
<gerencianet_transparent>
<use>standard</use>
<args>
<module>Gerencianet_Transparent</module>
<frontName>gerencianet</frontName>
</args>
</gerencianet_transparent>
</routers>
<layout>
<updates>
<gerencianet_transparent>
<file>gerencianet_transparent.xml</file>
</gerencianet_transparent>
</updates>
</layout>
</adminhtml>

<crontab>
<jobs>
Expand Down
2 changes: 1 addition & 1 deletion app/code/local/Gerencianet/Transparent/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<show_in_store>1</show_in_store>
<fields>
<title_page translate="label">
<label>Versão do Módulo: v0.2.6</label>
<label>Versão do Módulo: v0.3.0</label>
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
Expand Down
Loading

0 comments on commit 97bdf3d

Please sign in to comment.