Version Notes
- Update old orders
Download this release
Release Info
Developer | Bcash |
Extension | Bcash_Pagamento |
Version | 1.2.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.3 to 1.2.2
- app/code/community/Bcash/Pagamento/Block/Adminhtml/Sales/Order/Grid.php +1 -1
- app/code/community/Bcash/Pagamento/Block/Adminhtml/Sales/Order/View.php +4 -3
- app/code/community/Bcash/Pagamento/Block/Form/Bankslip.php +144 -0
- app/code/community/Bcash/Pagamento/Block/Form/{Payment.php → Creditcard.php} +24 -31
- app/code/community/Bcash/Pagamento/Block/Form/Onlinetransfer.php +138 -0
- app/code/community/Bcash/Pagamento/Block/Info/{Payment.php → Bankslip.php} +14 -2
- app/code/community/Bcash/Pagamento/Block/Info/Creditcard.php +44 -0
- app/code/community/Bcash/Pagamento/Block/Info/Onlinetransfer.php +44 -0
- app/code/community/Bcash/Pagamento/Helper/Data.php +32 -22
- app/code/community/Bcash/Pagamento/Helper/PaymentMethod.php +58 -30
- app/code/community/Bcash/Pagamento/Helper/Transaction.php +64 -91
- app/code/community/Bcash/Pagamento/Model/Bankslip.php +152 -0
- app/code/community/Bcash/Pagamento/Model/{PaymentMethod.php → Creditcard.php} +12 -89
- app/code/community/Bcash/Pagamento/Model/Observer.php +11 -50
- app/code/community/Bcash/Pagamento/Model/Onlinetransfer.php +153 -0
- app/code/community/Bcash/Pagamento/Model/Order.php +24 -10
- app/code/community/Bcash/Pagamento/controllers/Admin/Sales/OrderController.php +5 -4
- app/code/community/Bcash/Pagamento/controllers/NotificationController.php +13 -15
- app/code/community/Bcash/Pagamento/controllers/PaymentController.php +3 -3
- app/code/community/Bcash/Pagamento/etc/config.xml +105 -52
- app/code/community/Bcash/Pagamento/etc/system.xml +147 -72
- app/code/community/Bcash/Pagamento/sql/pagamento_setup/mysql4-install-0.1.0.php +1 -3
- app/code/community/Bcash/Pagamento/sql/pagamento_setup/mysql4-upgrade-0.1.0-1.2.2.php +67 -0
- app/design/adminhtml/default/default/template/bcash/pagamento/info.phtml +24 -0
- app/design/frontend/base/default/layout/bcash/pagamento/layout.xml +2 -2
- app/design/frontend/base/default/template/bcash/pagamento/checkout/success.phtml +24 -0
- app/design/frontend/base/default/template/bcash/pagamento/form/bankslip.phtml +208 -0
- app/design/frontend/base/default/template/{pagamento/form/payment.phtml → bcash/pagamento/form/creditcard.phtml} +205 -186
- app/design/frontend/base/default/template/bcash/pagamento/form/onlinetransfer.phtml +207 -0
- app/design/frontend/base/default/template/bcash/pagamento/info.phtml +31 -0
- app/design/frontend/base/default/template/{pagamento → bcash/pagamento}/sales/order/info/buttons/payment.phtml +0 -3
- app/design/frontend/base/default/template/pagamento/checkout/success.phtml +0 -24
- lib/{BcashApi/src → Bcash}/AutoLoader.php +13 -0
- lib/{BcashApi/src → Bcash}/Config/Config.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/Address.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/CreditCard.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/CurrencyEnum.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/Customer.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/DependentTransaction.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/GenderEnum.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/Model.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/NotificationContent.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/NotificationStatusEnum.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/PaymentMethod.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/PaymentMethodEnum.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/Product.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/ShippingTypeEnum.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/StateEnum.php +0 -0
- lib/{BcashApi/src → Bcash}/Domain/TransactionRequest.php +0 -0
- lib/{BcashApi/src → Bcash}/Exception/BaseException.php +0 -0
- lib/{BcashApi/src → Bcash}/Exception/ConnectionException.php +0 -0
- lib/{BcashApi/src → Bcash}/Exception/ValidationException.php +0 -0
- lib/{BcashApi/src → Bcash}/Helper/HttpHelper.php +0 -0
- lib/{BcashApi/src → Bcash}/Http/Authentication/Basic.php +0 -0
- lib/{BcashApi/src → Bcash}/Http/Authentication/OAuth.php +0 -0
- lib/{BcashApi/src → Bcash}/Http/Connection.php +0 -0
- lib/{BcashApi/src → Bcash}/Http/GetRequest.php +0 -0
- lib/{BcashApi/src → Bcash}/Http/PostRequest.php +0 -0
- lib/{BcashApi/src → Bcash}/Http/PutRequest.php +0 -0
- lib/{BcashApi/src → Bcash}/Http/Response.php +0 -0
- lib/{BcashApi/src → Bcash}/Service/Account.php +0 -0
- lib/{BcashApi/src → Bcash}/Service/Cancellation.php +0 -0
- lib/{BcashApi/src → Bcash}/Service/Consultation.php +0 -0
- lib/{BcashApi/src → Bcash}/Service/IEnvironmentManager.php +0 -0
- lib/{BcashApi/src → Bcash}/Service/Installments.php +0 -0
- lib/{BcashApi/src → Bcash}/Service/Notification.php +0 -0
- lib/{BcashApi/src → Bcash}/Service/Payment.php +0 -0
- lib/{BcashApi/src → Bcash}/Test/NotificationSimulator.php +0 -0
- lib/BcashApi/autoloader.php +0 -4
- package.xml +7 -7
- skin/frontend/base/default/bcash/pagamento/css/application.css +28 -2
app/code/community/Bcash/Pagamento/Block/Adminhtml/Sales/Order/Grid.php
CHANGED
@@ -12,7 +12,7 @@ class Bcash_Pagamento_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Bl
|
|
12 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
|
13 |
$this->getMassactionBlock()->addItem('cancel_order_with_bcash', array(
|
14 |
'label' => $this->__('Cancelar com Bcash'),
|
15 |
-
'url' => $this->getUrl('
|
16 |
));
|
17 |
}
|
18 |
}
|
12 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
|
13 |
$this->getMassactionBlock()->addItem('cancel_order_with_bcash', array(
|
14 |
'label' => $this->__('Cancelar com Bcash'),
|
15 |
+
'url' => $this->getUrl('bcash/admin_sales_order/masscanceltransaction/')
|
16 |
));
|
17 |
}
|
18 |
}
|
app/code/community/Bcash/Pagamento/Block/Adminhtml/Sales/Order/View.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
require_once(Mage::getBaseDir("lib") . "/
|
|
|
4 |
|
5 |
use Bcash\Domain\NotificationStatusEnum;
|
6 |
|
@@ -20,7 +21,7 @@ class Bcash_Pagamento_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Bl
|
|
20 |
$quoteId = $order->getQuoteId();
|
21 |
$quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteId);
|
22 |
$transactionIdBcash = $quote->getTransactionIdBcash();
|
23 |
-
$transactionInfo = Mage::helper('
|
24 |
|
25 |
// Checa se o status da transaçao Bcash permite cancelamento
|
26 |
if($transactionInfo->transacao->cod_status == NotificationStatusEnum::IN_PROGRESS || $transactionInfo->transacao->cod_status == NotificationStatusEnum::APPROVED) {
|
@@ -30,7 +31,7 @@ class Bcash_Pagamento_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Bl
|
|
30 |
);
|
31 |
$this->_addButton('button_cancel_with_bcash', array(
|
32 |
'label' => 'Cancelar com Bcash',
|
33 |
-
'onclick' => 'deleteConfirm(\'' . $confirmationMessage . '\', \'' . $this->getUrl('
|
34 |
), 0, 100, 'header', 'header');
|
35 |
}
|
36 |
}
|
1 |
<?php
|
2 |
|
3 |
+
require_once(Mage::getBaseDir("lib") . "/Bcash/AutoLoader.php");
|
4 |
+
Bcash\AutoLoader::register();
|
5 |
|
6 |
use Bcash\Domain\NotificationStatusEnum;
|
7 |
|
21 |
$quoteId = $order->getQuoteId();
|
22 |
$quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteId);
|
23 |
$transactionIdBcash = $quote->getTransactionIdBcash();
|
24 |
+
$transactionInfo = Mage::helper('bcash')->getTransaction($transactionIdBcash);
|
25 |
|
26 |
// Checa se o status da transaçao Bcash permite cancelamento
|
27 |
if($transactionInfo->transacao->cod_status == NotificationStatusEnum::IN_PROGRESS || $transactionInfo->transacao->cod_status == NotificationStatusEnum::APPROVED) {
|
31 |
);
|
32 |
$this->_addButton('button_cancel_with_bcash', array(
|
33 |
'label' => 'Cancelar com Bcash',
|
34 |
+
'onclick' => 'deleteConfirm(\'' . $confirmationMessage . '\', \'' . $this->getUrl('bcash/admin_sales_order/canceltransaction/') . '\')',
|
35 |
), 0, 100, 'header', 'header');
|
36 |
}
|
37 |
}
|
app/code/community/Bcash/Pagamento/Block/Form/Bankslip.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once(Mage::getBaseDir("lib") . "/Bcash/AutoLoader.php");
|
4 |
+
Bcash\AutoLoader::register();
|
5 |
+
|
6 |
+
use Bcash\Service\Installments;
|
7 |
+
use Bcash\Exception\ValidationException;
|
8 |
+
use Bcash\Exception\ConnectionException;
|
9 |
+
use Bcash\Domain\PaymentMethodEnum;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Bcash_Pagamento_Block_Form_BankSlip
|
13 |
+
*/
|
14 |
+
class Bcash_Pagamento_Block_Form_Bankslip extends Mage_Payment_Block_Form
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
+
protected $_code = 'bcash_bankslip';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var Mage_Core_Model_Abstract
|
23 |
+
*/
|
24 |
+
private $obj;
|
25 |
+
/**
|
26 |
+
* @var
|
27 |
+
*/
|
28 |
+
private $email;
|
29 |
+
/**
|
30 |
+
* @var
|
31 |
+
*/
|
32 |
+
private $token;
|
33 |
+
/**
|
34 |
+
* @var
|
35 |
+
*/
|
36 |
+
private $sandbox;
|
37 |
+
/**
|
38 |
+
* @var
|
39 |
+
*/
|
40 |
+
private $max_installments;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @var
|
44 |
+
*/
|
45 |
+
private $cards;
|
46 |
+
/**
|
47 |
+
* @var
|
48 |
+
*/
|
49 |
+
private $boleto;
|
50 |
+
/**
|
51 |
+
* @var
|
52 |
+
*/
|
53 |
+
private $tefs;
|
54 |
+
/**
|
55 |
+
* @var
|
56 |
+
*/
|
57 |
+
private $desconto_credito_1x;
|
58 |
+
/**
|
59 |
+
* @var
|
60 |
+
*/
|
61 |
+
private $quote;
|
62 |
+
/**
|
63 |
+
* @var
|
64 |
+
*/
|
65 |
+
private $cpf;
|
66 |
+
/**
|
67 |
+
* @var
|
68 |
+
*/
|
69 |
+
private $phone;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Instancia o template referente ao método de pagamento
|
73 |
+
*/
|
74 |
+
public function __construct()
|
75 |
+
{
|
76 |
+
parent::__construct();
|
77 |
+
$this->setTemplate('bcash/pagamento/form/bankslip.phtml');
|
78 |
+
$this->email = Mage::getStoreConfig('payment/bcash/email');
|
79 |
+
$this->token = Mage::getStoreConfig('payment/bcash/token');
|
80 |
+
$this->sandbox = Mage::getStoreConfig('payment/bcash/sandbox');
|
81 |
+
$this->max_installments = Mage::getStoreConfig('payment/bcash_creditcard/max_installments');
|
82 |
+
$this->cpf = Mage::getStoreConfig('payment/bcash/cpf');
|
83 |
+
$this->phone = Mage::getStoreConfig('payment/bcash/phone');
|
84 |
+
$this->desconto_credito_1x = 0;
|
85 |
+
$this->cards = array(PaymentMethodEnum::VISA, PaymentMethodEnum::MASTERCARD, PaymentMethodEnum::AMERICAN_EXPRESS, PaymentMethodEnum::AURA, PaymentMethodEnum::DINERS, PaymentMethodEnum::HIPERCARD, PaymentMethodEnum::ELO);
|
86 |
+
$this->boleto = PaymentMethodEnum::BANK_SLIP;
|
87 |
+
$this->tefs = array(PaymentMethodEnum::BB_ONLINE_TRANSFER, PaymentMethodEnum::BRADESCO_ONLINE_TRANSFER, PaymentMethodEnum::ITAU_ONLINE_TRANSFER, PaymentMethodEnum::BANRISUL_ONLINE_TRANSFER, PaymentMethodEnum::HSBC_ONLINE_TRANSFER);
|
88 |
+
}
|
89 |
+
|
90 |
+
public function getCpf()
|
91 |
+
{
|
92 |
+
return $this->cpf;
|
93 |
+
}
|
94 |
+
|
95 |
+
public function getPhone()
|
96 |
+
{
|
97 |
+
return $this->phone;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Retorna os meios de pagamento disponíveis no módulo Bcash.
|
102 |
+
* @return mixed
|
103 |
+
*/
|
104 |
+
public function getPaymentMethods()
|
105 |
+
{
|
106 |
+
//Mage::helper("bcash")->saveLog("Bcash_Pagamento_Block_Form_Bankslip called getPaymentMethods OK");
|
107 |
+
// Find allowed payment methods
|
108 |
+
$listAllowed = $this->getAllowedPaymentMethods();
|
109 |
+
|
110 |
+
return Mage::helper('bcash/paymentMethod')->getPaymentMethods($listAllowed, "bankslip");
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Método para buscar métodos de pagamentos permitidos pela API
|
115 |
+
*
|
116 |
+
* @return array
|
117 |
+
*/
|
118 |
+
private function getAllowedPaymentMethods()
|
119 |
+
{
|
120 |
+
$methods = array();
|
121 |
+
$installments = new Installments($this->email, $this->token);
|
122 |
+
try {
|
123 |
+
$installments->enableSandBox($this->sandbox);
|
124 |
+
// Any param value just for check
|
125 |
+
$response = $installments->calculate(100.00, 1, false);
|
126 |
+
// list methods
|
127 |
+
foreach($response->paymentTypes as $types) {
|
128 |
+
if($types->name == 'boleto') {
|
129 |
+
foreach ($types->paymentMethods as $method) {
|
130 |
+
$methods[] = $method->id;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
}
|
134 |
+
} catch (ValidationException $e) {
|
135 |
+
Mage::helper("bcash")->saveLog("Form_Bankslip::getAllowedPaymentMethods ValidationException: " . $e->getMessage(), $e->getErrors());
|
136 |
+
} catch (ConnectionException $e) {
|
137 |
+
Mage::helper("bcash")->saveLog("Form_Bankslip::getAllowedPaymentMethods ConnectionException:" . $e->getMessage(), $e->getErrors());
|
138 |
+
}
|
139 |
+
|
140 |
+
return $methods;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
|
app/code/community/Bcash/Pagamento/Block/Form/{Payment.php → Creditcard.php}
RENAMED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
require_once(Mage::getBaseDir("lib") . "/
|
|
|
4 |
|
5 |
use Bcash\Service\Installments;
|
6 |
use Bcash\Exception\ValidationException;
|
@@ -8,16 +9,14 @@ use Bcash\Exception\ConnectionException;
|
|
8 |
use Bcash\Domain\PaymentMethodEnum;
|
9 |
|
10 |
/**
|
11 |
-
* Class
|
12 |
*/
|
13 |
-
class
|
14 |
{
|
15 |
-
protected $_code = 'pagamento';
|
16 |
-
|
17 |
/**
|
18 |
-
* @var
|
19 |
*/
|
20 |
-
|
21 |
/**
|
22 |
* @var
|
23 |
*/
|
@@ -70,15 +69,14 @@ class Bcash_Pagamento_Block_Form_Payment extends Mage_Payment_Block_Form
|
|
70 |
public function __construct()
|
71 |
{
|
72 |
parent::__construct();
|
73 |
-
$this->setTemplate('pagamento/form/
|
74 |
-
$this->
|
75 |
-
$this->
|
76 |
-
$this->
|
77 |
-
$this->
|
78 |
-
$this->
|
79 |
-
$this->
|
80 |
-
$this->
|
81 |
-
$this->desconto_credito_1x = $this->obj->getConfigData('desconto_credito_1x');
|
82 |
$this->cards = array(PaymentMethodEnum::VISA, PaymentMethodEnum::MASTERCARD, PaymentMethodEnum::AMERICAN_EXPRESS, PaymentMethodEnum::AURA, PaymentMethodEnum::DINERS, PaymentMethodEnum::HIPERCARD, PaymentMethodEnum::ELO);
|
83 |
$this->boleto = PaymentMethodEnum::BANK_SLIP;
|
84 |
$this->tefs = array(PaymentMethodEnum::BB_ONLINE_TRANSFER, PaymentMethodEnum::BRADESCO_ONLINE_TRANSFER, PaymentMethodEnum::ITAU_ONLINE_TRANSFER, PaymentMethodEnum::BANRISUL_ONLINE_TRANSFER, PaymentMethodEnum::HSBC_ONLINE_TRANSFER);
|
@@ -100,11 +98,11 @@ class Bcash_Pagamento_Block_Form_Payment extends Mage_Payment_Block_Form
|
|
100 |
*/
|
101 |
public function getPaymentMethods()
|
102 |
{
|
103 |
-
Mage::
|
104 |
// Find allowed payment methods
|
105 |
$listAllowed = $this->getAllowedPaymentMethods();
|
106 |
|
107 |
-
return Mage::helper('
|
108 |
}
|
109 |
|
110 |
/**
|
@@ -126,12 +124,10 @@ class Bcash_Pagamento_Block_Form_Payment extends Mage_Payment_Block_Form
|
|
126 |
$response = $installments->calculate($grandTotal, $this->max_installments, $ignoreScheduledDiscount);
|
127 |
return array("ok" => true, "installments" => array(0 => $this->prepareInstallmentsCards($response)));
|
128 |
} catch (ValidationException $e) {
|
129 |
-
Mage::
|
130 |
-
Mage::log($e->getErrors());
|
131 |
return array("ok" => false, "installments" => array("1" => $grandTotal));
|
132 |
} catch (ConnectionException $e) {
|
133 |
-
Mage::
|
134 |
-
Mage::log($e->getErrors());
|
135 |
return array("ok" => false, "installments" => array("1" => $grandTotal));
|
136 |
}
|
137 |
}
|
@@ -172,23 +168,20 @@ class Bcash_Pagamento_Block_Form_Payment extends Mage_Payment_Block_Form
|
|
172 |
$response = $installments->calculate(100.00, 1, false);
|
173 |
// list methods
|
174 |
foreach($response->paymentTypes as $types) {
|
175 |
-
|
176 |
-
$
|
|
|
|
|
177 |
}
|
178 |
}
|
179 |
} catch (ValidationException $e) {
|
180 |
-
Mage::
|
181 |
-
Mage::log($e->getErrors());
|
182 |
} catch (ConnectionException $e) {
|
183 |
-
Mage::
|
184 |
-
Mage::log($e->getErrors());
|
185 |
}
|
186 |
|
187 |
return $methods;
|
188 |
}
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
}
|
193 |
|
194 |
|
1 |
<?php
|
2 |
|
3 |
+
require_once(Mage::getBaseDir("lib") . "/Bcash/AutoLoader.php");
|
4 |
+
Bcash\AutoLoader::register();
|
5 |
|
6 |
use Bcash\Service\Installments;
|
7 |
use Bcash\Exception\ValidationException;
|
9 |
use Bcash\Domain\PaymentMethodEnum;
|
10 |
|
11 |
/**
|
12 |
+
* Class Bcash_Pagamento_Block_Form_Creditcard
|
13 |
*/
|
14 |
+
class Bcash_Pagamento_Block_Form_Creditcard extends Mage_Payment_Block_Form
|
15 |
{
|
|
|
|
|
16 |
/**
|
17 |
+
* @var string
|
18 |
*/
|
19 |
+
protected $_code = 'bcash_creditcard';
|
20 |
/**
|
21 |
* @var
|
22 |
*/
|
69 |
public function __construct()
|
70 |
{
|
71 |
parent::__construct();
|
72 |
+
$this->setTemplate('bcash/pagamento/form/creditcard.phtml');
|
73 |
+
$this->email = Mage::getStoreConfig('payment/bcash/email');
|
74 |
+
$this->token = Mage::getStoreConfig('payment/bcash/token');
|
75 |
+
$this->sandbox = Mage::getStoreConfig('payment/bcash/sandbox');
|
76 |
+
$this->max_installments = Mage::getStoreConfig('payment/bcash_creditcard/max_installments');
|
77 |
+
$this->cpf = Mage::getStoreConfig('payment/bcash/cpf');
|
78 |
+
$this->phone = Mage::getStoreConfig('payment/bcash/phone');
|
79 |
+
$this->desconto_credito_1x = 0;
|
|
|
80 |
$this->cards = array(PaymentMethodEnum::VISA, PaymentMethodEnum::MASTERCARD, PaymentMethodEnum::AMERICAN_EXPRESS, PaymentMethodEnum::AURA, PaymentMethodEnum::DINERS, PaymentMethodEnum::HIPERCARD, PaymentMethodEnum::ELO);
|
81 |
$this->boleto = PaymentMethodEnum::BANK_SLIP;
|
82 |
$this->tefs = array(PaymentMethodEnum::BB_ONLINE_TRANSFER, PaymentMethodEnum::BRADESCO_ONLINE_TRANSFER, PaymentMethodEnum::ITAU_ONLINE_TRANSFER, PaymentMethodEnum::BANRISUL_ONLINE_TRANSFER, PaymentMethodEnum::HSBC_ONLINE_TRANSFER);
|
98 |
*/
|
99 |
public function getPaymentMethods()
|
100 |
{
|
101 |
+
//Mage::helper("bcash")->saveLog("Bcash_Pagamento_Block_Form_Creditcard called getPaymentMethods OK");
|
102 |
// Find allowed payment methods
|
103 |
$listAllowed = $this->getAllowedPaymentMethods();
|
104 |
|
105 |
+
return Mage::helper('bcash/paymentMethod')->getPaymentMethods($listAllowed, "creditcard");
|
106 |
}
|
107 |
|
108 |
/**
|
124 |
$response = $installments->calculate($grandTotal, $this->max_installments, $ignoreScheduledDiscount);
|
125 |
return array("ok" => true, "installments" => array(0 => $this->prepareInstallmentsCards($response)));
|
126 |
} catch (ValidationException $e) {
|
127 |
+
Mage::helper("bcash")->saveLog("ValidationException - Form_Creditcard::getInstallments:" . $e->getMessage(), $e->getErrors());
|
|
|
128 |
return array("ok" => false, "installments" => array("1" => $grandTotal));
|
129 |
} catch (ConnectionException $e) {
|
130 |
+
Mage::helper("bcash")->saveLog("ConnectionException - Form_Creditcard::getInstallments:" . $e->getMessage(), $e->getErrors());
|
|
|
131 |
return array("ok" => false, "installments" => array("1" => $grandTotal));
|
132 |
}
|
133 |
}
|
168 |
$response = $installments->calculate(100.00, 1, false);
|
169 |
// list methods
|
170 |
foreach($response->paymentTypes as $types) {
|
171 |
+
if($types->name == 'card') {
|
172 |
+
foreach($types->paymentMethods as $method) {
|
173 |
+
$methods[] = $method->id;
|
174 |
+
}
|
175 |
}
|
176 |
}
|
177 |
} catch (ValidationException $e) {
|
178 |
+
Mage::helper("bcash")->saveLog("ValidationException - Form_Creditcard::getAllowedPaymentMethods:" . $e->getMessage(), $e->getErrors());
|
|
|
179 |
} catch (ConnectionException $e) {
|
180 |
+
Mage::helper("bcash")->saveLog("ConnectionException - Form_Creditcard::getAllowedPaymentMethods:" . $e->getMessage(), $e->getErrors());
|
|
|
181 |
}
|
182 |
|
183 |
return $methods;
|
184 |
}
|
|
|
|
|
|
|
185 |
}
|
186 |
|
187 |
|
app/code/community/Bcash/Pagamento/Block/Form/Onlinetransfer.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once(Mage::getBaseDir("lib") . "/Bcash/AutoLoader.php");
|
4 |
+
Bcash\AutoLoader::register();
|
5 |
+
|
6 |
+
use Bcash\Service\Installments;
|
7 |
+
use Bcash\Exception\ValidationException;
|
8 |
+
use Bcash\Exception\ConnectionException;
|
9 |
+
use Bcash\Domain\PaymentMethodEnum;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Bcash_Pagamento_Block_Form_OnlineTransfer
|
13 |
+
*/
|
14 |
+
class Bcash_Pagamento_Block_Form_Onlinetransfer extends Mage_Payment_Block_Form
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
+
protected $_code = 'bcash_onlinetransfer';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var
|
23 |
+
*/
|
24 |
+
private $email;
|
25 |
+
/**
|
26 |
+
* @var
|
27 |
+
*/
|
28 |
+
private $token;
|
29 |
+
/**
|
30 |
+
* @var
|
31 |
+
*/
|
32 |
+
private $sandbox;
|
33 |
+
/**
|
34 |
+
* @var
|
35 |
+
*/
|
36 |
+
private $max_installments;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var
|
40 |
+
*/
|
41 |
+
private $cards;
|
42 |
+
/**
|
43 |
+
* @var
|
44 |
+
*/
|
45 |
+
private $boleto;
|
46 |
+
/**
|
47 |
+
* @var
|
48 |
+
*/
|
49 |
+
private $tefs;
|
50 |
+
/**
|
51 |
+
* @var
|
52 |
+
*/
|
53 |
+
private $desconto_credito_1x;
|
54 |
+
/**
|
55 |
+
* @var
|
56 |
+
*/
|
57 |
+
private $quote;
|
58 |
+
/**
|
59 |
+
* @var
|
60 |
+
*/
|
61 |
+
private $cpf;
|
62 |
+
/**
|
63 |
+
* @var
|
64 |
+
*/
|
65 |
+
private $phone;
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Instancia o template referente ao método de pagamento
|
69 |
+
*/
|
70 |
+
public function __construct()
|
71 |
+
{
|
72 |
+
parent::__construct();
|
73 |
+
$this->setTemplate('bcash/pagamento/form/onlinetransfer.phtml');
|
74 |
+
$this->email = Mage::getStoreConfig('payment/bcash/email');
|
75 |
+
$this->token = Mage::getStoreConfig('payment/bcash/token');
|
76 |
+
$this->sandbox = Mage::getStoreConfig('payment/bcash/sandbox');
|
77 |
+
$this->max_installments = Mage::getStoreConfig('payment/bcash_creditcard/max_installments');
|
78 |
+
$this->cpf = Mage::getStoreConfig('payment/bcash/cpf');
|
79 |
+
$this->phone = Mage::getStoreConfig('payment/bcash/phone');
|
80 |
+
$this->desconto_credito_1x = 0;
|
81 |
+
$this->cards = array(PaymentMethodEnum::VISA, PaymentMethodEnum::MASTERCARD, PaymentMethodEnum::AMERICAN_EXPRESS, PaymentMethodEnum::AURA, PaymentMethodEnum::DINERS, PaymentMethodEnum::HIPERCARD, PaymentMethodEnum::ELO);
|
82 |
+
$this->boleto = PaymentMethodEnum::BANK_SLIP;
|
83 |
+
$this->tefs = array(PaymentMethodEnum::BB_ONLINE_TRANSFER, PaymentMethodEnum::BRADESCO_ONLINE_TRANSFER, PaymentMethodEnum::ITAU_ONLINE_TRANSFER, PaymentMethodEnum::BANRISUL_ONLINE_TRANSFER, PaymentMethodEnum::HSBC_ONLINE_TRANSFER);
|
84 |
+
}
|
85 |
+
|
86 |
+
public function getCpf()
|
87 |
+
{
|
88 |
+
return $this->cpf;
|
89 |
+
}
|
90 |
+
|
91 |
+
public function getPhone()
|
92 |
+
{
|
93 |
+
return $this->phone;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Retorna os meios de pagamento disponíveis no módulo Bcash.
|
98 |
+
* @return mixed
|
99 |
+
*/
|
100 |
+
public function getPaymentMethods()
|
101 |
+
{
|
102 |
+
//Mage::helper("bcash")->saveLog("Bcash_Pagamento_Block_Form_Onlinetransfer called getPaymentMethods OK");
|
103 |
+
// Find allowed payment methods
|
104 |
+
$listAllowed = $this->getAllowedPaymentMethods();
|
105 |
+
|
106 |
+
return Mage::helper('bcash/paymentMethod')->getPaymentMethods($listAllowed, "onlinetransfer");
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Método para buscar métodos de pagamentos permitidos pela API
|
111 |
+
*
|
112 |
+
* @return array
|
113 |
+
*/
|
114 |
+
private function getAllowedPaymentMethods()
|
115 |
+
{
|
116 |
+
$methods = array();
|
117 |
+
$installments = new Installments($this->email, $this->token);
|
118 |
+
try {
|
119 |
+
$installments->enableSandBox($this->sandbox);
|
120 |
+
// Any param value just for check
|
121 |
+
$response = $installments->calculate(100.00, 1, false);
|
122 |
+
// list methods
|
123 |
+
foreach($response->paymentTypes as $types) {
|
124 |
+
foreach($types->paymentMethods as $method) {
|
125 |
+
$methods[] = $method->id;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
} catch (ValidationException $e) {
|
129 |
+
Mage::helper("bcash")->saveLog("ValidationException - Form_Onlinetransfer->getAllowedPaymentMethods: " . $e->getMessage(), $e->getErrors());
|
130 |
+
} catch (ConnectionException $e) {
|
131 |
+
Mage::helper("bcash")->saveLog("ConnectionException - Form_Onlinetransfer->getAllowedPaymentMethods: " . $e->getMessage(), $e->getErrors());
|
132 |
+
}
|
133 |
+
|
134 |
+
return $methods;
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
|
app/code/community/Bcash/Pagamento/Block/Info/{Payment.php → Bankslip.php}
RENAMED
@@ -1,10 +1,22 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* Class
|
5 |
*/
|
6 |
-
class
|
7 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
/**
|
10 |
* @param null $transport
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* Class Bcash_Pagamento_Block_Info_Bankslip
|
5 |
*/
|
6 |
+
class Bcash_Pagamento_Block_Info_Bankslip extends Mage_Payment_Block_Info
|
7 |
{
|
8 |
+
protected function _construct(){
|
9 |
+
parent::_construct();
|
10 |
+
$this->setTemplate('bcash/pagamento/info.phtml');
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getInfoPayment(){
|
14 |
+
|
15 |
+
$order_id = $this->getInfo()->getOrder()->getIncrementId();
|
16 |
+
$info_payments = Mage::getModel('bcash/order')->getBcashInfoPayment($order_id);
|
17 |
+
|
18 |
+
return $info_payments;
|
19 |
+
}
|
20 |
|
21 |
/**
|
22 |
* @param null $transport
|
app/code/community/Bcash/Pagamento/Block/Info/Creditcard.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Bcash_Pagamento_Block_Info_Creditcard
|
5 |
+
*/
|
6 |
+
class Bcash_Pagamento_Block_Info_Creditcard extends Mage_Payment_Block_Info
|
7 |
+
{
|
8 |
+
protected function _construct(){
|
9 |
+
parent::_construct();
|
10 |
+
$this->setTemplate('bcash/pagamento/info.phtml');
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getInfoPayment(){
|
14 |
+
|
15 |
+
$order_id = $this->getInfo()->getOrder()->getIncrementId();
|
16 |
+
$info_payments = Mage::getModel('bcash/order')->getBcashInfoPayment($order_id);
|
17 |
+
|
18 |
+
return $info_payments;
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param null $transport
|
23 |
+
* @return Varien_Object
|
24 |
+
*/
|
25 |
+
protected function _prepareSpecificInformation($transport = null)
|
26 |
+
{
|
27 |
+
if (null !== $this->_paymentSpecificInformation) {
|
28 |
+
return $this->_paymentSpecificInformation;
|
29 |
+
}
|
30 |
+
|
31 |
+
$data = array();
|
32 |
+
if ($this->getInfo()->getCustomFieldOne()) {
|
33 |
+
$data[Mage::helper('payment')->__('Custom Field One')] = $this->getInfo()->getCustomFieldOne();
|
34 |
+
}
|
35 |
+
|
36 |
+
if ($this->getInfo()->getCustomFieldTwo()) {
|
37 |
+
$data[Mage::helper('payment')->__('Custom Field Two')] = $this->getInfo()->getCustomFieldTwo();
|
38 |
+
}
|
39 |
+
|
40 |
+
$transport = parent::_prepareSpecificInformation($transport);
|
41 |
+
|
42 |
+
return $transport->setData(array_merge($data, $transport->getData()));
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Bcash/Pagamento/Block/Info/Onlinetransfer.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Bcash_Pagamento_Block_Info_Onlinetransfer
|
5 |
+
*/
|
6 |
+
class Bcash_Pagamento_Block_Info_Onlinetransfer extends Mage_Payment_Block_Info
|
7 |
+
{
|
8 |
+
protected function _construct(){
|
9 |
+
parent::_construct();
|
10 |
+
$this->setTemplate('bcash/pagamento/info.phtml');
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getInfoPayment(){
|
14 |
+
|
15 |
+
$order_id = $this->getInfo()->getOrder()->getIncrementId();
|
16 |
+
$info_payments = Mage::getModel('bcash/order')->getBcashInfoPayment($order_id);
|
17 |
+
|
18 |
+
return $info_payments;
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param null $transport
|
23 |
+
* @return Varien_Object
|
24 |
+
*/
|
25 |
+
protected function _prepareSpecificInformation($transport = null)
|
26 |
+
{
|
27 |
+
if (null !== $this->_paymentSpecificInformation) {
|
28 |
+
return $this->_paymentSpecificInformation;
|
29 |
+
}
|
30 |
+
|
31 |
+
$data = array();
|
32 |
+
if ($this->getInfo()->getCustomFieldOne()) {
|
33 |
+
$data[Mage::helper('payment')->__('Custom Field One')] = $this->getInfo()->getCustomFieldOne();
|
34 |
+
}
|
35 |
+
|
36 |
+
if ($this->getInfo()->getCustomFieldTwo()) {
|
37 |
+
$data[Mage::helper('payment')->__('Custom Field Two')] = $this->getInfo()->getCustomFieldTwo();
|
38 |
+
}
|
39 |
+
|
40 |
+
$transport = parent::_prepareSpecificInformation($transport);
|
41 |
+
|
42 |
+
return $transport->setData(array_merge($data, $transport->getData()));
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Bcash/Pagamento/Helper/Data.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
require_once(Mage::getBaseDir("lib") . "/
|
|
|
4 |
|
5 |
use Bcash\Service\Consultation;
|
6 |
use Bcash\Exception\ValidationException;
|
@@ -12,19 +13,17 @@ class Bcash_Pagamento_Helper_Data extends Mage_Payment_Helper_Data
|
|
12 |
|
13 |
private $email;
|
14 |
private $token;
|
15 |
-
private $obj;
|
16 |
private $sandbox;
|
17 |
private $quote;
|
18 |
private $max_installments;
|
19 |
|
20 |
public function __construct()
|
21 |
{
|
22 |
-
$this->
|
23 |
-
$this->
|
24 |
-
$this->
|
25 |
-
$this->
|
26 |
-
$this->
|
27 |
-
$this->desconto_credito_1x = $this->obj->getConfigData('desconto_credito_1x');
|
28 |
}
|
29 |
|
30 |
public function getTransaction($transactionId = null, $orderId = null)
|
@@ -44,11 +43,11 @@ class Bcash_Pagamento_Helper_Data extends Mage_Payment_Helper_Data
|
|
44 |
|
45 |
} catch (ValidationException $e) {
|
46 |
Mage::getSingleton('adminhtml/session')->addError('Error:' . $e->getMessage());
|
47 |
-
Mage::
|
48 |
|
49 |
} catch (ConnectionException $e) {
|
50 |
Mage::getSingleton('adminhtml/session')->addError('Error:' . $e->getMessage());
|
51 |
-
Mage::
|
52 |
}
|
53 |
|
54 |
return $response;
|
@@ -73,24 +72,14 @@ class Bcash_Pagamento_Helper_Data extends Mage_Payment_Helper_Data
|
|
73 |
$response = $installments->calculate($grandTotal, $this->max_installments, $ignoreScheduledDiscount);
|
74 |
return array("ok" => true, "installments" => array(0 => $this->prepareInstallmentsCards($response)));
|
75 |
} catch (ValidationException $e) {
|
76 |
-
Mage::
|
77 |
-
Mage::log($e->getErrors());
|
78 |
return array("ok" => false, "installments" => array("1" => $grandTotal));
|
79 |
} catch (ConnectionException $e) {
|
80 |
-
Mage::
|
81 |
-
Mage::log($e->getErrors());
|
82 |
return array("ok" => false, "installments" => array("1" => $grandTotal));
|
83 |
}
|
84 |
}
|
85 |
|
86 |
-
public function setTransaction()
|
87 |
-
{
|
88 |
-
//Create Transaction with Bcash
|
89 |
-
|
90 |
-
die('setTransaction');
|
91 |
-
|
92 |
-
}
|
93 |
-
|
94 |
/**
|
95 |
* Sincronização de informações da transação Bcash entre Quote e Order
|
96 |
*
|
@@ -112,6 +101,27 @@ class Bcash_Pagamento_Helper_Data extends Mage_Payment_Helper_Data
|
|
112 |
$order->save();
|
113 |
}
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
private function prepareInstallmentsCards($installments)
|
116 |
{
|
117 |
foreach ($installments->paymentTypes as $obj) {
|
1 |
<?php
|
2 |
|
3 |
+
require_once(Mage::getBaseDir("lib") . "/Bcash/AutoLoader.php");
|
4 |
+
Bcash\AutoLoader::register();
|
5 |
|
6 |
use Bcash\Service\Consultation;
|
7 |
use Bcash\Exception\ValidationException;
|
13 |
|
14 |
private $email;
|
15 |
private $token;
|
|
|
16 |
private $sandbox;
|
17 |
private $quote;
|
18 |
private $max_installments;
|
19 |
|
20 |
public function __construct()
|
21 |
{
|
22 |
+
$this->email = Mage::getStoreConfig('payment/bcash/email');
|
23 |
+
$this->token = Mage::getStoreConfig('payment/bcash/token');
|
24 |
+
$this->sandbox = Mage::getStoreConfig('payment/bcash/sandbox');
|
25 |
+
$this->max_installments = Mage::getStoreConfig('payment/bcash_creditcard/max_installments');
|
26 |
+
$this->desconto_credito_1x = 0;
|
|
|
27 |
}
|
28 |
|
29 |
public function getTransaction($transactionId = null, $orderId = null)
|
43 |
|
44 |
} catch (ValidationException $e) {
|
45 |
Mage::getSingleton('adminhtml/session')->addError('Error:' . $e->getMessage());
|
46 |
+
Mage::helper("bcash")->saveLog($e->getMessage(), $e->getErrors());
|
47 |
|
48 |
} catch (ConnectionException $e) {
|
49 |
Mage::getSingleton('adminhtml/session')->addError('Error:' . $e->getMessage());
|
50 |
+
Mage::helper("bcash")->saveLog($e->getMessage(), $e->getErrors());
|
51 |
}
|
52 |
|
53 |
return $response;
|
72 |
$response = $installments->calculate($grandTotal, $this->max_installments, $ignoreScheduledDiscount);
|
73 |
return array("ok" => true, "installments" => array(0 => $this->prepareInstallmentsCards($response)));
|
74 |
} catch (ValidationException $e) {
|
75 |
+
Mage::helper("bcash")->saveLog("ValidationException - Helper_Data->getInstallments:" . $e->getMessage(), $e->getErrors());
|
|
|
76 |
return array("ok" => false, "installments" => array("1" => $grandTotal));
|
77 |
} catch (ConnectionException $e) {
|
78 |
+
Mage::helper("bcash")->saveLog("ConnectionException - Helper_Data->getInstallments:" . $e->getMessage(), $e->getErrors());
|
|
|
79 |
return array("ok" => false, "installments" => array("1" => $grandTotal));
|
80 |
}
|
81 |
}
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
/**
|
84 |
* Sincronização de informações da transação Bcash entre Quote e Order
|
85 |
*
|
101 |
$order->save();
|
102 |
}
|
103 |
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Método para registrar logs
|
107 |
+
*
|
108 |
+
* @param $text
|
109 |
+
* @param null $array
|
110 |
+
*/
|
111 |
+
public function saveLog($text, $array = null){
|
112 |
+
if(!is_null($array)) {
|
113 |
+
$text .= " - Detalhes: " . json_encode($array);
|
114 |
+
}
|
115 |
+
|
116 |
+
$logAtivo = Mage::getStoreConfig('payment/bcash/logfile');
|
117 |
+
|
118 |
+
if($logAtivo) {
|
119 |
+
$urlCurrent = Mage::helper('core/url')->getCurrentUrl();
|
120 |
+
//Mage::log("Local loja: " . $urlCurrent, null, "bcash-magento.log");
|
121 |
+
Mage::log($text, null, "bcash-magento.log");
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
private function prepareInstallmentsCards($installments)
|
126 |
{
|
127 |
foreach ($installments->paymentTypes as $obj) {
|
app/code/community/Bcash/Pagamento/Helper/PaymentMethod.php
CHANGED
@@ -2,15 +2,14 @@
|
|
2 |
|
3 |
class Bcash_Pagamento_Helper_PaymentMethod
|
4 |
{
|
5 |
-
|
6 |
const CARD_TYPE = "CARD";
|
7 |
const BANKSLIP_TYPE = "BANKSLIP";
|
8 |
const ONLINE_TRANSFER_TYPE = "ONLINE_TRANSFER";
|
9 |
-
|
10 |
private static $cards;
|
11 |
private static $onlineTransfer;
|
12 |
private static $bankSlip;
|
13 |
-
|
14 |
public function __construct()
|
15 |
{
|
16 |
self::$cards = array();
|
@@ -29,13 +28,39 @@ class Bcash_Pagamento_Helper_PaymentMethod
|
|
29 |
return $payment;
|
30 |
}
|
31 |
|
32 |
-
public function getPaymentMethods($allowedMethods = null)
|
33 |
{
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
return array(
|
@@ -45,11 +70,12 @@ class Bcash_Pagamento_Helper_PaymentMethod
|
|
45 |
);
|
46 |
}
|
47 |
|
48 |
-
public function getPaymentMethod($payment_method)
|
|
|
49 |
$methods = $this->getPaymentMethods();
|
50 |
foreach ($methods as $type => $methodsType) {
|
51 |
foreach ($methodsType as $PaymentObject) {
|
52 |
-
if($payment_method == $PaymentObject->id){
|
53 |
return $PaymentObject;
|
54 |
}
|
55 |
}
|
@@ -57,67 +83,69 @@ class Bcash_Pagamento_Helper_PaymentMethod
|
|
57 |
return null;
|
58 |
}
|
59 |
|
60 |
-
private function createAllowedPaymentMethods($listAllowed)
|
|
|
61 |
// Card: Visa
|
62 |
-
if(in_array(1, $listAllowed)) {
|
63 |
-
self::$cards[] = $this->createPayment(1,
|
64 |
}
|
65 |
// Card: Master
|
66 |
-
if(in_array(2, $listAllowed)) {
|
67 |
-
self::$cards[] = $this->createPayment(2,
|
68 |
}
|
69 |
// Card: American Express
|
70 |
-
if(in_array(37, $listAllowed)) {
|
71 |
self::$cards[] = $this->createPayment(37, 'American Express', self::CARD_TYPE, 1.0, 12);
|
72 |
}
|
73 |
// Card: Aura
|
74 |
-
if(in_array(45, $listAllowed)) {
|
75 |
self::$cards[] = $this->createPayment(45, 'Aura', self::CARD_TYPE, 1.0, 24);
|
76 |
}
|
77 |
// Card: Diners
|
78 |
-
if(in_array(55, $listAllowed)) {
|
79 |
self::$cards[] = $this->createPayment(55, 'Diners', self::CARD_TYPE, 1.0, 12);
|
80 |
}
|
81 |
// Card: Hipercard
|
82 |
-
if(in_array(56, $listAllowed)) {
|
83 |
self::$cards[] = $this->createPayment(56, 'HiperCard', self::CARD_TYPE, 1.0, 12);
|
84 |
}
|
85 |
// Card: Elo
|
86 |
-
if(in_array(63, $listAllowed)) {
|
87 |
self::$cards[] = $this->createPayment(63, 'Elo', self::CARD_TYPE, 1.0, 12);
|
88 |
}
|
89 |
|
90 |
// Boleto
|
91 |
-
if(in_array(10, $listAllowed)) {
|
92 |
self::$bankSlip[] = $this->createPayment(10, 'Boleto Bancário', self::BANKSLIP_TYPE, 0.01, 1);
|
93 |
}
|
94 |
|
95 |
// OnlineTransfer : BB
|
96 |
-
if(in_array(58, $listAllowed)) {
|
97 |
self::$onlineTransfer[] = $this->createPayment(58, 'BB', self::ONLINE_TRANSFER_TYPE, 0.01, 1);
|
98 |
}
|
99 |
// OnlineTransfer : Bradesco
|
100 |
-
if(in_array(59, $listAllowed)) {
|
101 |
self::$onlineTransfer[] = $this->createPayment(59, 'Bradesco', self::ONLINE_TRANSFER_TYPE, 0.01, 1);
|
102 |
}
|
103 |
// OnlineTransfer : Itaú
|
104 |
-
if(in_array(60, $listAllowed)) {
|
105 |
self::$onlineTransfer[] = $this->createPayment(60, 'Itaú', self::ONLINE_TRANSFER_TYPE, 0.01, 1);
|
106 |
}
|
107 |
// OnlineTransfer : Banrisul
|
108 |
-
if(in_array(61, $listAllowed)) {
|
109 |
self::$onlineTransfer[] = $this->createPayment(61, 'Banrisul', self::ONLINE_TRANSFER_TYPE, 0.01, 1);
|
110 |
}
|
111 |
// OnlineTransfer : HSBC
|
112 |
-
if(in_array(62, $listAllowed)) {
|
113 |
self::$onlineTransfer[] = $this->createPayment(62, 'HSBC', self::ONLINE_TRANSFER_TYPE, 0.01, 1);
|
114 |
}
|
115 |
}
|
116 |
|
117 |
-
private function createAllPaymentMethods()
|
|
|
118 |
self::$cards = array(
|
119 |
-
$this->createPayment(1,
|
120 |
-
$this->createPayment(2,
|
121 |
$this->createPayment(37, 'American Express', self::CARD_TYPE, 1.0, 12),
|
122 |
$this->createPayment(45, 'Aura', self::CARD_TYPE, 1.0, 24),
|
123 |
$this->createPayment(55, 'Diners', self::CARD_TYPE, 1.0, 12),
|
2 |
|
3 |
class Bcash_Pagamento_Helper_PaymentMethod
|
4 |
{
|
|
|
5 |
const CARD_TYPE = "CARD";
|
6 |
const BANKSLIP_TYPE = "BANKSLIP";
|
7 |
const ONLINE_TRANSFER_TYPE = "ONLINE_TRANSFER";
|
8 |
+
|
9 |
private static $cards;
|
10 |
private static $onlineTransfer;
|
11 |
private static $bankSlip;
|
12 |
+
|
13 |
public function __construct()
|
14 |
{
|
15 |
self::$cards = array();
|
28 |
return $payment;
|
29 |
}
|
30 |
|
31 |
+
public function getPaymentMethods($allowedMethods = null, $paymentChosen = "")
|
32 |
{
|
33 |
+
try {
|
34 |
+
if (!is_null($allowedMethods)) {
|
35 |
+
$this->createAllowedPaymentMethods($allowedMethods);
|
36 |
+
} else {
|
37 |
+
$this->createAllPaymentMethods();
|
38 |
+
}
|
39 |
+
|
40 |
+
if ($paymentChosen == "creditcard") {
|
41 |
+
$returnArray = self::$cards;
|
42 |
+
self::$cards = array();
|
43 |
+
return array(
|
44 |
+
self::CARD_TYPE => $returnArray
|
45 |
+
);
|
46 |
+
}
|
47 |
+
if ($paymentChosen == "bankslip") {
|
48 |
+
$returnArray = self::$bankSlip;
|
49 |
+
self::$bankSlip = array();
|
50 |
+
return array(
|
51 |
+
self::BANKSLIP_TYPE => $returnArray
|
52 |
+
);
|
53 |
+
}
|
54 |
+
if ($paymentChosen == "onlinetransfer") {
|
55 |
+
$returnArray = self::$onlineTransfer;
|
56 |
+
self::$onlineTransfer = array();
|
57 |
+
return array(
|
58 |
+
self::ONLINE_TRANSFER_TYPE => $returnArray
|
59 |
+
);
|
60 |
+
}
|
61 |
+
|
62 |
+
} catch (Exception $e) {
|
63 |
+
Mage::helper("bcash")->saveLog($e->getMessage());
|
64 |
}
|
65 |
|
66 |
return array(
|
70 |
);
|
71 |
}
|
72 |
|
73 |
+
public function getPaymentMethod($payment_method)
|
74 |
+
{
|
75 |
$methods = $this->getPaymentMethods();
|
76 |
foreach ($methods as $type => $methodsType) {
|
77 |
foreach ($methodsType as $PaymentObject) {
|
78 |
+
if ($payment_method == $PaymentObject->id) {
|
79 |
return $PaymentObject;
|
80 |
}
|
81 |
}
|
83 |
return null;
|
84 |
}
|
85 |
|
86 |
+
private function createAllowedPaymentMethods($listAllowed)
|
87 |
+
{
|
88 |
// Card: Visa
|
89 |
+
if (in_array(1, $listAllowed)) {
|
90 |
+
self::$cards[] = $this->createPayment(1, 'Visa', self::CARD_TYPE, 1.0, 12);
|
91 |
}
|
92 |
// Card: Master
|
93 |
+
if (in_array(2, $listAllowed)) {
|
94 |
+
self::$cards[] = $this->createPayment(2, 'Master', self::CARD_TYPE, 1.0, 12);
|
95 |
}
|
96 |
// Card: American Express
|
97 |
+
if (in_array(37, $listAllowed)) {
|
98 |
self::$cards[] = $this->createPayment(37, 'American Express', self::CARD_TYPE, 1.0, 12);
|
99 |
}
|
100 |
// Card: Aura
|
101 |
+
if (in_array(45, $listAllowed)) {
|
102 |
self::$cards[] = $this->createPayment(45, 'Aura', self::CARD_TYPE, 1.0, 24);
|
103 |
}
|
104 |
// Card: Diners
|
105 |
+
if (in_array(55, $listAllowed)) {
|
106 |
self::$cards[] = $this->createPayment(55, 'Diners', self::CARD_TYPE, 1.0, 12);
|
107 |
}
|
108 |
// Card: Hipercard
|
109 |
+
if (in_array(56, $listAllowed)) {
|
110 |
self::$cards[] = $this->createPayment(56, 'HiperCard', self::CARD_TYPE, 1.0, 12);
|
111 |
}
|
112 |
// Card: Elo
|
113 |
+
if (in_array(63, $listAllowed)) {
|
114 |
self::$cards[] = $this->createPayment(63, 'Elo', self::CARD_TYPE, 1.0, 12);
|
115 |
}
|
116 |
|
117 |
// Boleto
|
118 |
+
if (in_array(10, $listAllowed)) {
|
119 |
self::$bankSlip[] = $this->createPayment(10, 'Boleto Bancário', self::BANKSLIP_TYPE, 0.01, 1);
|
120 |
}
|
121 |
|
122 |
// OnlineTransfer : BB
|
123 |
+
if (in_array(58, $listAllowed)) {
|
124 |
self::$onlineTransfer[] = $this->createPayment(58, 'BB', self::ONLINE_TRANSFER_TYPE, 0.01, 1);
|
125 |
}
|
126 |
// OnlineTransfer : Bradesco
|
127 |
+
if (in_array(59, $listAllowed)) {
|
128 |
self::$onlineTransfer[] = $this->createPayment(59, 'Bradesco', self::ONLINE_TRANSFER_TYPE, 0.01, 1);
|
129 |
}
|
130 |
// OnlineTransfer : Itaú
|
131 |
+
if (in_array(60, $listAllowed)) {
|
132 |
self::$onlineTransfer[] = $this->createPayment(60, 'Itaú', self::ONLINE_TRANSFER_TYPE, 0.01, 1);
|
133 |
}
|
134 |
// OnlineTransfer : Banrisul
|
135 |
+
if (in_array(61, $listAllowed)) {
|
136 |
self::$onlineTransfer[] = $this->createPayment(61, 'Banrisul', self::ONLINE_TRANSFER_TYPE, 0.01, 1);
|
137 |
}
|
138 |
// OnlineTransfer : HSBC
|
139 |
+
if (in_array(62, $listAllowed)) {
|
140 |
self::$onlineTransfer[] = $this->createPayment(62, 'HSBC', self::ONLINE_TRANSFER_TYPE, 0.01, 1);
|
141 |
}
|
142 |
}
|
143 |
|
144 |
+
private function createAllPaymentMethods()
|
145 |
+
{
|
146 |
self::$cards = array(
|
147 |
+
$this->createPayment(1, 'Visa', self::CARD_TYPE, 1.0, 12),
|
148 |
+
$this->createPayment(2, 'Master', self::CARD_TYPE, 1.0, 12),
|
149 |
$this->createPayment(37, 'American Express', self::CARD_TYPE, 1.0, 12),
|
150 |
$this->createPayment(45, 'Aura', self::CARD_TYPE, 1.0, 24),
|
151 |
$this->createPayment(55, 'Diners', self::CARD_TYPE, 1.0, 12),
|
app/code/community/Bcash/Pagamento/Helper/Transaction.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
require_once(Mage::getBaseDir("lib") . "/
|
|
|
4 |
|
5 |
use Bcash\Domain\PaymentMethodEnum;
|
6 |
use Bcash\Domain\CurrencyEnum;
|
@@ -31,10 +32,6 @@ class Bcash_Pagamento_Helper_Transaction extends Mage_Payment_Helper_Data
|
|
31 |
* @var
|
32 |
*/
|
33 |
private $token;
|
34 |
-
/**
|
35 |
-
* @var Mage_Core_Model_Abstract
|
36 |
-
*/
|
37 |
-
private $obj;
|
38 |
/**
|
39 |
* @var
|
40 |
*/
|
@@ -125,14 +122,14 @@ class Bcash_Pagamento_Helper_Transaction extends Mage_Payment_Helper_Data
|
|
125 |
|
126 |
public function __construct()
|
127 |
{
|
128 |
-
$this->
|
129 |
-
$this->
|
130 |
-
$this->
|
131 |
-
$this->
|
132 |
-
$this->
|
133 |
-
$this->
|
134 |
-
$this->
|
135 |
-
|
136 |
$sessionCheckout = Mage::getSingleton('checkout/session');
|
137 |
$quoteId = $sessionCheckout->getQuoteId();
|
138 |
$sessionCheckout->setData('QuoteIdBcash', $quoteId);
|
@@ -143,10 +140,10 @@ class Bcash_Pagamento_Helper_Transaction extends Mage_Payment_Helper_Data
|
|
143 |
$this->billingDataBcash = $this->quoteBcash->getBillingAddress()->getData();
|
144 |
$this->quoteIdTransaction = (str_pad($quoteId, 9, 0, STR_PAD_LEFT));
|
145 |
$this->itemsBcash = $this->quoteBcash->getItemsCollection()->getItems();
|
146 |
-
$this->cards
|
147 |
$this->boleto = PaymentMethodEnum::BANK_SLIP;
|
148 |
-
$this->tefs
|
149 |
-
$this->payment_method = Mage::app()->getRequest()->getPost('payment-method');
|
150 |
$this->installments = Mage::app()->getRequest()->getPost('installments_bcash', 1);
|
151 |
|
152 |
}
|
@@ -175,29 +172,29 @@ class Bcash_Pagamento_Helper_Transaction extends Mage_Payment_Helper_Data
|
|
175 |
'deps' => $this->deps,
|
176 |
'installments' => $this->installments
|
177 |
);
|
178 |
-
if(isset($response->cancellationCode) && $response->cancellationCode){
|
179 |
-
if($response->cancellationCode == "700001"){
|
180 |
Mage::throwException("A transação não pode ser processada utilizando este cartão. Por favor, selecione outro meio de pagamento.");
|
181 |
-
}else{
|
182 |
-
Mage::throwException(
|
183 |
}
|
184 |
-
}else{
|
185 |
return $arRet;
|
186 |
}
|
187 |
} catch (ValidationException $e) {
|
188 |
-
Mage::
|
189 |
$errorsArr = $e->getErrors();
|
190 |
$errorsList = $errorsArr->list;
|
191 |
-
$messages
|
192 |
foreach ($errorsList as $err) {
|
193 |
$messages .= "\n- " . urldecode($err->description) . " (" . $err->code . ")";
|
194 |
}
|
195 |
Mage::throwException($messages);
|
196 |
} catch (ConnectionException $e) {
|
197 |
-
Mage::
|
198 |
$errorsArr = $e->getErrors();
|
199 |
$errorsList = $errorsArr->list;
|
200 |
-
$messages
|
201 |
foreach ($errorsList as $err) {
|
202 |
$messages .= "\n- " . urldecode($err->description) . " (" . $err->code . ")";
|
203 |
}
|
@@ -211,8 +208,8 @@ class Bcash_Pagamento_Helper_Transaction extends Mage_Payment_Helper_Data
|
|
211 |
*/
|
212 |
public function createTransactionRequestBcash()
|
213 |
{
|
214 |
-
|
215 |
-
|
216 |
$transactionRequest = new TransactionRequest();
|
217 |
$transactionRequest->setSellerMail($this->email);
|
218 |
$transactionRequest->setOrderId($this->quoteBcash->getReservedOrderId());
|
@@ -223,6 +220,7 @@ class Bcash_Pagamento_Helper_Transaction extends Mage_Payment_Helper_Data
|
|
223 |
$transactionRequest->setViewedContract("S");
|
224 |
$transactionRequest->setDependentTransactions($this->createDependentTransactionsBcash());
|
225 |
$transactionRequest->setPlatformId(565);
|
|
|
226 |
return $transactionRequest;
|
227 |
}
|
228 |
|
@@ -236,49 +234,20 @@ class Bcash_Pagamento_Helper_Transaction extends Mage_Payment_Helper_Data
|
|
236 |
$this->transactionRequest->setCreditCard($this->createCreditCardBcash());
|
237 |
$this->transactionRequest->setInstallments($this->installments);
|
238 |
}
|
239 |
-
|
240 |
-
/*if ($this->installments == 1) {
|
241 |
-
$discount = $this->calculateDiscount($this->payment_method);
|
242 |
-
$this->setDiscountBcash($discount);
|
243 |
-
}*/
|
244 |
-
|
245 |
$this->setDiscountBcash();
|
246 |
}
|
247 |
|
248 |
-
/**
|
249 |
-
* @param $payment_method
|
250 |
-
* @return float|int
|
251 |
-
*/
|
252 |
-
public function calculateDiscount($payment_method)
|
253 |
-
{
|
254 |
-
$discount = 0;
|
255 |
-
if (in_array($payment_method, $this->cards)) {
|
256 |
-
$percent = $this->obj->getConfigData('desconto_credito_1x');
|
257 |
-
} elseif (in_array($payment_method, $this->tefs)) {
|
258 |
-
$percent = $this->obj->getConfigData('desconto_tef');
|
259 |
-
} else {
|
260 |
-
$percent = $this->obj->getConfigData('desconto_boleto');
|
261 |
-
}
|
262 |
-
if ($percent) {
|
263 |
-
$discount = floatval(number_format(($this->subTotalBcash / 100) * $percent, 2, '.', ''));
|
264 |
-
$this->discountPercentBcash = $percent;
|
265 |
-
$this->discountBcash = $discount;
|
266 |
-
}
|
267 |
-
return $discount;
|
268 |
-
}
|
269 |
-
|
270 |
-
|
271 |
/**
|
272 |
* Adiciona o endereço a transação atual.
|
273 |
* @return Address
|
274 |
*/
|
275 |
public function createAddressBcash()
|
276 |
{
|
277 |
-
$address
|
278 |
-
$street
|
279 |
-
$numero
|
280 |
$complemento = $address->getStreet(3);
|
281 |
-
$bairro
|
282 |
$addressObj = new Address();
|
283 |
$addressObj->setAddress($street);
|
284 |
$addressObj->setNumber($numero ? $numero : 'SN');
|
@@ -301,16 +270,16 @@ class Bcash_Pagamento_Helper_Transaction extends Mage_Payment_Helper_Data
|
|
301 |
$prefix = "";
|
302 |
|
303 |
$customer_id = $this->quoteBcash->getCustomerId();
|
304 |
-
if(!is_null($customer_id)) {
|
305 |
$customer = Mage::getModel('customer/customer')->load($customer_id);
|
306 |
$customerData = $customer->getData();
|
307 |
-
}else {
|
308 |
$customerData = $this->quoteBcash->getData();
|
309 |
$prefix = "customer_";
|
310 |
}
|
311 |
|
312 |
-
if(!is_null($customerData)) {
|
313 |
-
$cpf_cnpj_bcash = isset($customerData[$prefix."taxvat"]) ? $customerData[$prefix."taxvat"] : null;
|
314 |
$cpf_cnpj_bcash = preg_replace('/[^0-9]+/', '', $cpf_cnpj_bcash);
|
315 |
|
316 |
if ($this->cpf) {
|
@@ -319,15 +288,17 @@ class Bcash_Pagamento_Helper_Transaction extends Mage_Payment_Helper_Data
|
|
319 |
}
|
320 |
|
321 |
|
322 |
-
$buyer->setMail($customerData[$prefix.'email']);
|
323 |
-
$name
|
324 |
-
$name .= isset($customerData[$prefix.'middlename']) ? ' ' . $customerData[$prefix.'middlename'] : '';
|
325 |
-
$name .= isset($customerData[$prefix.'lastname'])
|
326 |
$buyer->setName($name);
|
327 |
-
if(strlen($cpf_cnpj_bcash) > 11) {
|
328 |
$buyer->setCnpj($cpf_cnpj_bcash);
|
329 |
$buyer->setCompanyName($name);
|
330 |
-
}else {
|
|
|
|
|
331 |
$buyer->setPhone($this->completePhoneBcash('telephone'));
|
332 |
$buyer->setCellPhone($this->completePhoneBcash('fax'));
|
333 |
$buyer->setAddress($this->createAddressBcash());
|
@@ -347,7 +318,7 @@ class Bcash_Pagamento_Helper_Transaction extends Mage_Payment_Helper_Data
|
|
347 |
$phone = preg_replace('/[^0-9]+/', '', $phone);
|
348 |
return $this->parsePhone($phone);
|
349 |
}
|
350 |
-
$address
|
351 |
if (!is_null($attr)) {
|
352 |
$phone = $this->parsePhone($address[$attr]);
|
353 |
return $phone;
|
@@ -408,10 +379,12 @@ class Bcash_Pagamento_Helper_Transaction extends Mage_Payment_Helper_Data
|
|
408 |
* @param null $addition
|
409 |
* @param null $discount
|
410 |
*/
|
411 |
-
public function setDiscountBcash(
|
412 |
{
|
413 |
$discount = $this->quoteBcash->getShippingAddress()->getDiscountAmount();
|
414 |
-
if($discount < 0) {
|
|
|
|
|
415 |
$discount = floatval(number_format($discount, 2, '.', ''));
|
416 |
$this->discountBcash = $discount;
|
417 |
$this->transactionRequest->setDiscount($discount);
|
@@ -476,24 +449,24 @@ class Bcash_Pagamento_Helper_Transaction extends Mage_Payment_Helper_Data
|
|
476 |
public static function normalizeChars($s)
|
477 |
{
|
478 |
$replace = array(
|
479 |
-
'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'Ae', 'Å'=>'A', 'Æ'=>'A', 'Ă'=>'A',
|
480 |
-
'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'ae', 'å'=>'a', 'ă'=>'a', 'æ'=>'ae',
|
481 |
-
'þ'=>'b', 'Þ'=>'B',
|
482 |
-
'Ç'=>'C', 'ç'=>'c',
|
483 |
-
'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E',
|
484 |
-
'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e',
|
485 |
-
'Ğ'=>'G', 'ğ'=>'g',
|
486 |
-
'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'İ'=>'I', 'ı'=>'i', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i',
|
487 |
-
'Ñ'=>'N',
|
488 |
-
'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'Oe', 'Ø'=>'O', 'ö'=>'oe', 'ø'=>'o',
|
489 |
-
'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o',
|
490 |
-
'Š'=>'S', 'š'=>'s', 'Ş'=>'S', 'ș'=>'s', 'Ș'=>'S', 'ş'=>'s', 'ß'=>'ss',
|
491 |
-
'ț'=>'t', 'Ț'=>'T',
|
492 |
-
'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'Ue',
|
493 |
-
'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ü'=>'ue',
|
494 |
-
'Ý'=>'Y',
|
495 |
-
'ý'=>'y', 'ý'=>'y', 'ÿ'=>'y',
|
496 |
-
'Ž'=>'Z', 'ž'=>'z'
|
497 |
);
|
498 |
return strtr($s, $replace);
|
499 |
}
|
1 |
<?php
|
2 |
|
3 |
+
require_once(Mage::getBaseDir("lib") . "/Bcash/AutoLoader.php");
|
4 |
+
Bcash\AutoLoader::register();
|
5 |
|
6 |
use Bcash\Domain\PaymentMethodEnum;
|
7 |
use Bcash\Domain\CurrencyEnum;
|
32 |
* @var
|
33 |
*/
|
34 |
private $token;
|
|
|
|
|
|
|
|
|
35 |
/**
|
36 |
* @var
|
37 |
*/
|
122 |
|
123 |
public function __construct()
|
124 |
{
|
125 |
+
$this->email = Mage::getStoreConfig('payment/bcash/email');
|
126 |
+
$this->token = Mage::getStoreConfig('payment/bcash/token');
|
127 |
+
$this->sandbox = Mage::getStoreConfig('payment/bcash/sandbox');
|
128 |
+
$this->consumer_key = Mage::getStoreConfig('payment/bcash/consumer_key');
|
129 |
+
$this->dependents = Mage::getStoreConfig('payment/bcash/transacao_dependente');
|
130 |
+
$this->cpf = Mage::getStoreConfig('payment/bcash/cpf');
|
131 |
+
$this->phone = Mage::getStoreConfig('payment/bcash/phone');
|
132 |
+
|
133 |
$sessionCheckout = Mage::getSingleton('checkout/session');
|
134 |
$quoteId = $sessionCheckout->getQuoteId();
|
135 |
$sessionCheckout->setData('QuoteIdBcash', $quoteId);
|
140 |
$this->billingDataBcash = $this->quoteBcash->getBillingAddress()->getData();
|
141 |
$this->quoteIdTransaction = (str_pad($quoteId, 9, 0, STR_PAD_LEFT));
|
142 |
$this->itemsBcash = $this->quoteBcash->getItemsCollection()->getItems();
|
143 |
+
$this->cards = array(PaymentMethodEnum::VISA, PaymentMethodEnum::MASTERCARD, PaymentMethodEnum::AMERICAN_EXPRESS, PaymentMethodEnum::AURA, PaymentMethodEnum::DINERS, PaymentMethodEnum::HIPERCARD, PaymentMethodEnum::ELO);
|
144 |
$this->boleto = PaymentMethodEnum::BANK_SLIP;
|
145 |
+
$this->tefs = array(PaymentMethodEnum::BB_ONLINE_TRANSFER, PaymentMethodEnum::BRADESCO_ONLINE_TRANSFER, PaymentMethodEnum::ITAU_ONLINE_TRANSFER, PaymentMethodEnum::BANRISUL_ONLINE_TRANSFER, PaymentMethodEnum::HSBC_ONLINE_TRANSFER);
|
146 |
+
$this->payment_method = Mage::app()->getRequest()->getPost('bcash-payment-method');
|
147 |
$this->installments = Mage::app()->getRequest()->getPost('installments_bcash', 1);
|
148 |
|
149 |
}
|
172 |
'deps' => $this->deps,
|
173 |
'installments' => $this->installments
|
174 |
);
|
175 |
+
if (isset($response->cancellationCode) && $response->cancellationCode) {
|
176 |
+
if ($response->cancellationCode == "700001") {
|
177 |
Mage::throwException("A transação não pode ser processada utilizando este cartão. Por favor, selecione outro meio de pagamento.");
|
178 |
+
} else {
|
179 |
+
Mage::throwException(Mage::helper('sales')->__(urldecode($arRet['response']->message)));
|
180 |
}
|
181 |
+
} else {
|
182 |
return $arRet;
|
183 |
}
|
184 |
} catch (ValidationException $e) {
|
185 |
+
Mage::helper("bcash")->saveLog("ValidationException - Helper_Transaction->startTransaction: " . $e->getMessage(), $e->getErrors());
|
186 |
$errorsArr = $e->getErrors();
|
187 |
$errorsList = $errorsArr->list;
|
188 |
+
$messages = $e->getMessage() . "\n";
|
189 |
foreach ($errorsList as $err) {
|
190 |
$messages .= "\n- " . urldecode($err->description) . " (" . $err->code . ")";
|
191 |
}
|
192 |
Mage::throwException($messages);
|
193 |
} catch (ConnectionException $e) {
|
194 |
+
Mage::helper("bcash")->saveLog("ConnectionException - Helper_Transaction->startTransaction: " . $e->getMessage(), $e->getErrors());
|
195 |
$errorsArr = $e->getErrors();
|
196 |
$errorsList = $errorsArr->list;
|
197 |
+
$messages = $e->getMessage() . "\n";
|
198 |
foreach ($errorsList as $err) {
|
199 |
$messages .= "\n- " . urldecode($err->description) . " (" . $err->code . ")";
|
200 |
}
|
208 |
*/
|
209 |
public function createTransactionRequestBcash()
|
210 |
{
|
211 |
+
$url = Mage::getUrl('bcash/notification/request', array('_secure' => true));
|
212 |
+
|
213 |
$transactionRequest = new TransactionRequest();
|
214 |
$transactionRequest->setSellerMail($this->email);
|
215 |
$transactionRequest->setOrderId($this->quoteBcash->getReservedOrderId());
|
220 |
$transactionRequest->setViewedContract("S");
|
221 |
$transactionRequest->setDependentTransactions($this->createDependentTransactionsBcash());
|
222 |
$transactionRequest->setPlatformId(565);
|
223 |
+
|
224 |
return $transactionRequest;
|
225 |
}
|
226 |
|
234 |
$this->transactionRequest->setCreditCard($this->createCreditCardBcash());
|
235 |
$this->transactionRequest->setInstallments($this->installments);
|
236 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
$this->setDiscountBcash();
|
238 |
}
|
239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
/**
|
241 |
* Adiciona o endereço a transação atual.
|
242 |
* @return Address
|
243 |
*/
|
244 |
public function createAddressBcash()
|
245 |
{
|
246 |
+
$address = $this->quoteBcash->getShippingAddress();
|
247 |
+
$street = $address->getStreet(1);
|
248 |
+
$numero = $address->getStreet(2);
|
249 |
$complemento = $address->getStreet(3);
|
250 |
+
$bairro = $address->getStreet(4);
|
251 |
$addressObj = new Address();
|
252 |
$addressObj->setAddress($street);
|
253 |
$addressObj->setNumber($numero ? $numero : 'SN');
|
270 |
$prefix = "";
|
271 |
|
272 |
$customer_id = $this->quoteBcash->getCustomerId();
|
273 |
+
if (!is_null($customer_id)) {
|
274 |
$customer = Mage::getModel('customer/customer')->load($customer_id);
|
275 |
$customerData = $customer->getData();
|
276 |
+
} else {
|
277 |
$customerData = $this->quoteBcash->getData();
|
278 |
$prefix = "customer_";
|
279 |
}
|
280 |
|
281 |
+
if (!is_null($customerData)) {
|
282 |
+
$cpf_cnpj_bcash = isset($customerData[$prefix . "taxvat"]) ? $customerData[$prefix . "taxvat"] : null;
|
283 |
$cpf_cnpj_bcash = preg_replace('/[^0-9]+/', '', $cpf_cnpj_bcash);
|
284 |
|
285 |
if ($this->cpf) {
|
288 |
}
|
289 |
|
290 |
|
291 |
+
$buyer->setMail($customerData[$prefix . 'email']);
|
292 |
+
$name = ($customerData[$prefix . 'firstname']);
|
293 |
+
$name .= isset($customerData[$prefix . 'middlename']) ? ' ' . $customerData[$prefix . 'middlename'] : '';
|
294 |
+
$name .= isset($customerData[$prefix . 'lastname']) ? ' ' . $customerData[$prefix . 'lastname'] : '';
|
295 |
$buyer->setName($name);
|
296 |
+
if (strlen($cpf_cnpj_bcash) > 11) {
|
297 |
$buyer->setCnpj($cpf_cnpj_bcash);
|
298 |
$buyer->setCompanyName($name);
|
299 |
+
} else {
|
300 |
+
$buyer->setCpf($cpf_cnpj_bcash);
|
301 |
+
}
|
302 |
$buyer->setPhone($this->completePhoneBcash('telephone'));
|
303 |
$buyer->setCellPhone($this->completePhoneBcash('fax'));
|
304 |
$buyer->setAddress($this->createAddressBcash());
|
318 |
$phone = preg_replace('/[^0-9]+/', '', $phone);
|
319 |
return $this->parsePhone($phone);
|
320 |
}
|
321 |
+
$address = $this->quoteBcash->getBillingAddress()->getData();
|
322 |
if (!is_null($attr)) {
|
323 |
$phone = $this->parsePhone($address[$attr]);
|
324 |
return $phone;
|
379 |
* @param null $addition
|
380 |
* @param null $discount
|
381 |
*/
|
382 |
+
public function setDiscountBcash()
|
383 |
{
|
384 |
$discount = $this->quoteBcash->getShippingAddress()->getDiscountAmount();
|
385 |
+
if ($discount < 0) {
|
386 |
+
$discount = ((-1) * $discount);
|
387 |
+
}
|
388 |
$discount = floatval(number_format($discount, 2, '.', ''));
|
389 |
$this->discountBcash = $discount;
|
390 |
$this->transactionRequest->setDiscount($discount);
|
449 |
public static function normalizeChars($s)
|
450 |
{
|
451 |
$replace = array(
|
452 |
+
'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'Ae', 'Å' => 'A', 'Æ' => 'A', 'Ă' => 'A',
|
453 |
+
'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'ae', 'å' => 'a', 'ă' => 'a', 'æ' => 'ae',
|
454 |
+
'þ' => 'b', 'Þ' => 'B',
|
455 |
+
'Ç' => 'C', 'ç' => 'c',
|
456 |
+
'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E',
|
457 |
+
'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e',
|
458 |
+
'Ğ' => 'G', 'ğ' => 'g',
|
459 |
+
'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'İ' => 'I', 'ı' => 'i', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i',
|
460 |
+
'Ñ' => 'N',
|
461 |
+
'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'Oe', 'Ø' => 'O', 'ö' => 'oe', 'ø' => 'o',
|
462 |
+
'ð' => 'o', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o',
|
463 |
+
'Š' => 'S', 'š' => 's', 'Ş' => 'S', 'ș' => 's', 'Ș' => 'S', 'ş' => 's', 'ß' => 'ss',
|
464 |
+
'ț' => 't', 'Ț' => 'T',
|
465 |
+
'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'Ue',
|
466 |
+
'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'ue',
|
467 |
+
'Ý' => 'Y',
|
468 |
+
'ý' => 'y', 'ý' => 'y', 'ÿ' => 'y',
|
469 |
+
'Ž' => 'Z', 'ž' => 'z'
|
470 |
);
|
471 |
return strtr($s, $replace);
|
472 |
}
|
app/code/community/Bcash/Pagamento/Model/Bankslip.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Bcash_Pagamento_Model_Bankslip
|
5 |
+
*/
|
6 |
+
class Bcash_Pagamento_Model_Bankslip extends Mage_Payment_Model_Method_Abstract
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* @var string
|
10 |
+
*/
|
11 |
+
protected $_code = 'bcash_bankslip';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var string
|
15 |
+
*/
|
16 |
+
protected $_formBlockType = 'bcash/form_bankslip';
|
17 |
+
protected $_infoBlockType = 'bcash/info_bankslip';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Flag executa o método initalize() com o checkout completo.
|
21 |
+
* @var bool
|
22 |
+
*/
|
23 |
+
protected $_isInitializeNeeded = true;
|
24 |
+
|
25 |
+
protected $_isGateway = true;
|
26 |
+
protected $_canAuthorize = true;
|
27 |
+
protected $_canUseCheckout = true;
|
28 |
+
protected $_canUseForMultishipping = false;
|
29 |
+
|
30 |
+
protected $transaction;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Inicializa o método de pagamento. Chamado quando a compra é completa.
|
34 |
+
* Objeto Order será criado após a chamada deste método.
|
35 |
+
*
|
36 |
+
* @param string $paymentAction
|
37 |
+
* @param Varien_Object $stateObject
|
38 |
+
* @return Mage_Payment_Model_Abstract
|
39 |
+
* @throws Mage_Payment_Model_Info_Exception
|
40 |
+
*/
|
41 |
+
public function initialize($paymentAction, $stateObject)
|
42 |
+
{
|
43 |
+
//Mage::helper("bcash")->saveLog('Called ' . __METHOD__ . ' with payment ' . $paymentAction);
|
44 |
+
//Mage::helper("bcash")->saveLog('Payment Bankslip visitor: ' . Mage::helper('core/http')->getRemoteAddr());
|
45 |
+
parent::initialize($paymentAction, $stateObject);
|
46 |
+
|
47 |
+
if ($paymentAction != 'sale') {
|
48 |
+
return $this;
|
49 |
+
}
|
50 |
+
|
51 |
+
$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
52 |
+
$stateObject->setState($state);
|
53 |
+
$stateObject->setStatus(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
|
54 |
+
$stateObject->setIsNotified(false);
|
55 |
+
|
56 |
+
try {
|
57 |
+
$result = $this->_customBeginPayment();
|
58 |
+
$response = $result['response'];
|
59 |
+
$payment_method = $result['payment_method'];
|
60 |
+
$installments = 1;
|
61 |
+
|
62 |
+
/*
|
63 |
+
1 – Em andamento
|
64 |
+
3 – Aprovada
|
65 |
+
4 – Concluída
|
66 |
+
5 – Disputa
|
67 |
+
6 – Devolvida
|
68 |
+
7 – Cancelada
|
69 |
+
8 – Chargeback
|
70 |
+
*/
|
71 |
+
|
72 |
+
// Salvar o PEDIDO em caso de SUCESSO e adicionar os dados da Transação
|
73 |
+
if ($response->status != 1 && $response->status != 2) {
|
74 |
+
|
75 |
+
$setIsNotified = false;
|
76 |
+
switch ($response->status) {
|
77 |
+
case 3: //3 – Aprovada
|
78 |
+
case 4: //4 – Concluída
|
79 |
+
$state = Mage_Sales_Model_Order::STATE_PROCESSING;
|
80 |
+
$setIsNotified = true;
|
81 |
+
break;
|
82 |
+
case 6://6 – Devolvida
|
83 |
+
$state = Mage_Sales_Model_Order::STATE_HOLDED;
|
84 |
+
break;
|
85 |
+
case 7://7 – Cancelada
|
86 |
+
case 8://8 – Chargeback
|
87 |
+
$state = Mage_Sales_Model_Order::STATE_CANCELED;
|
88 |
+
break;
|
89 |
+
default:
|
90 |
+
$state = null;
|
91 |
+
break;
|
92 |
+
}
|
93 |
+
|
94 |
+
if (!is_null($state)) {
|
95 |
+
$stateObject->setState($state);
|
96 |
+
$stateObject->setStatus($state);
|
97 |
+
$stateObject->setIsNotified($setIsNotified);
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
Mage::getSingleton('core/session')->setTransactionIdBcash($response->transactionId);
|
102 |
+
Mage::getSingleton('core/session')->setStatusBcash($response->status);
|
103 |
+
Mage::getSingleton('core/session')->setDescriptionStatusBcash(urldecode($response->descriptionStatus));
|
104 |
+
Mage::getSingleton('core/session')->setPaymentLinkBcash(isset($response->paymentLink) ? urldecode($response->paymentLink) : null);
|
105 |
+
Mage::getSingleton('core/session')->setPaymentMethodBcash($payment_method);
|
106 |
+
Mage::getSingleton('core/session')->setInstallmentsBcash($installments);
|
107 |
+
|
108 |
+
$cart = Mage::getSingleton('checkout/cart')->getQuote();
|
109 |
+
$cart->setTransactionIdBcash($response->transactionId)
|
110 |
+
->setStatusBcash($response->status)
|
111 |
+
->setDescriptionStatusBcash(urldecode($response->descriptionStatus))
|
112 |
+
->setPaymentLinkBcash(isset($response->paymentLink) ? urldecode($response->paymentLink) : null)
|
113 |
+
->setPaymentMethodBcash($payment_method)
|
114 |
+
->setInstallmentsBcash($installments);
|
115 |
+
$cart->save();
|
116 |
+
|
117 |
+
} catch (Exception $e) {
|
118 |
+
Mage::helper("bcash")->saveLog($e->getMessage());
|
119 |
+
throw new Mage_Payment_Model_Info_Exception($e->getMessage());
|
120 |
+
}
|
121 |
+
|
122 |
+
return $this;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Inicializa a transação atual via SDK Api Bcash.
|
127 |
+
* Respond with token
|
128 |
+
* @throws SoapFault
|
129 |
+
* @throws Mage_Exception
|
130 |
+
* @throws Exception
|
131 |
+
*/
|
132 |
+
protected function _customBeginPayment()
|
133 |
+
{
|
134 |
+
$this->transaction = new Bcash_Pagamento_Helper_Transaction();
|
135 |
+
return $this->transaction->startTransaction();
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Assign data to info model instance
|
140 |
+
* @param mixed $data
|
141 |
+
* @return Mage_Payment_Model_Info
|
142 |
+
*/
|
143 |
+
public function assignData($data)
|
144 |
+
{
|
145 |
+
//Mage::helper("bcash")->saveLog('Bankslip :: Assign Data with Bcash');
|
146 |
+
$result = parent::assignData($data);
|
147 |
+
$params = Mage::app()->getFrontController()->getRequest()->getParams();
|
148 |
+
$params['installments_bcash'] = 1;
|
149 |
+
|
150 |
+
return $result;
|
151 |
+
}
|
152 |
+
}
|
app/code/community/Bcash/Pagamento/Model/{PaymentMethod.php → Creditcard.php}
RENAMED
@@ -1,22 +1,23 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
/**
|
5 |
-
* Class
|
6 |
*/
|
7 |
-
class
|
8 |
{
|
9 |
/**
|
10 |
* @var string
|
11 |
*/
|
12 |
-
protected $_code = '
|
13 |
|
14 |
/**
|
15 |
* @var string
|
16 |
*/
|
17 |
-
protected $_formBlockType = '
|
|
|
18 |
|
19 |
-
/**
|
|
|
20 |
* @var bool
|
21 |
*/
|
22 |
protected $_isInitializeNeeded = true;
|
@@ -24,12 +25,10 @@ class Bcash_Pagamento_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
|
|
24 |
protected $_isGateway = true;
|
25 |
protected $_canAuthorize = true;
|
26 |
protected $_canUseCheckout = true;
|
27 |
-
//Disable multi-shipping for this payment module.
|
28 |
protected $_canUseForMultishipping = false;
|
29 |
|
30 |
protected $transaction;
|
31 |
|
32 |
-
|
33 |
/**
|
34 |
* Inicializa o método de pagamento. Chamado quando a compra é completa.
|
35 |
* Objeto Order será criado após a chamada deste método.
|
@@ -41,8 +40,8 @@ class Bcash_Pagamento_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
|
|
41 |
*/
|
42 |
public function initialize($paymentAction, $stateObject)
|
43 |
{
|
44 |
-
Mage::
|
45 |
-
Mage::
|
46 |
parent::initialize($paymentAction, $stateObject);
|
47 |
|
48 |
if ($paymentAction != 'sale') {
|
@@ -56,7 +55,6 @@ class Bcash_Pagamento_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
|
|
56 |
|
57 |
try {
|
58 |
$result = $this->_customBeginPayment();
|
59 |
-
//Mage::log(print_r($result, true));
|
60 |
$response = $result['response'];
|
61 |
$payment_method = $result['payment_method'];
|
62 |
$installments = $result['installments'];
|
@@ -118,7 +116,7 @@ class Bcash_Pagamento_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
|
|
118 |
$cart->save();
|
119 |
|
120 |
} catch (Exception $e) {
|
121 |
-
Mage::
|
122 |
throw new Mage_Payment_Model_Info_Exception($e->getMessage());
|
123 |
}
|
124 |
|
@@ -145,86 +143,11 @@ class Bcash_Pagamento_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
|
|
145 |
*/
|
146 |
public function assignData($data)
|
147 |
{
|
148 |
-
Mage::
|
149 |
$result = parent::assignData($data);
|
150 |
$params = Mage::app()->getFrontController()->getRequest()->getParams();
|
151 |
-
$params['installments_bcash'] = isset($params['installments_bcash'])
|
152 |
-
|
153 |
-
//Adiciona Desconto ao Pedido caso 1x Credito, Boleto ou TEF (configurados no Backend)
|
154 |
-
if(isset($params['payment-method'])) {
|
155 |
-
$discount = 0;
|
156 |
-
if ($params['installments_bcash'] == 1) {
|
157 |
-
$discount = $this->calculateDiscount($params['payment-method']);
|
158 |
-
}
|
159 |
-
if(!empty($params['payment-method'])) {
|
160 |
-
$this->addDiscountToQuote($discount);
|
161 |
-
}
|
162 |
-
}
|
163 |
|
164 |
return $result;
|
165 |
}
|
166 |
-
|
167 |
-
public function calculateDiscount($payment_method)
|
168 |
-
{
|
169 |
-
$transaction = new Bcash_Pagamento_Helper_Transaction();
|
170 |
-
return $transaction->calculateDiscount($payment_method);
|
171 |
-
}
|
172 |
-
|
173 |
-
public function addDiscountToQuote($discountAmount = 0)
|
174 |
-
{
|
175 |
-
$cart = Mage::getSingleton('checkout/cart');
|
176 |
-
$objShippingAddress = $cart->getQuote()->getShippingAddress();
|
177 |
-
|
178 |
-
|
179 |
-
//Mage::log($objShippingAddress);
|
180 |
-
|
181 |
-
if($discountAmount > 0) {
|
182 |
-
// Update quote
|
183 |
-
Mage::dispatchEvent(
|
184 |
-
'sales_quote_payment_import_data_before',
|
185 |
-
array(
|
186 |
-
'quote' => $cart->getQuote()
|
187 |
-
)
|
188 |
-
);
|
189 |
-
$discountDescription = $objShippingAddress->getDiscountDescription();
|
190 |
-
if(!empty($discountDescription)) { $discountDescription .= " + "; }
|
191 |
-
|
192 |
-
$objShippingAddress->setDiscountDescription($discountDescription . 'Meio de pagamento');
|
193 |
-
|
194 |
-
|
195 |
-
$grandTotal = $objShippingAddress->getGrandTotal();
|
196 |
-
$subTotalWithDiscount = $objShippingAddress->getSubtotalWithDiscount();
|
197 |
-
$baseGrandTotal = $objShippingAddress->getBaseGrandTotal();
|
198 |
-
$baseSubTotalWithDiscount = $objShippingAddress->getBaseSubtotalWithDiscount();
|
199 |
-
|
200 |
-
// Outros descontos aplicados
|
201 |
-
$objDiscountAmount = $objShippingAddress->getDiscountAmount();
|
202 |
-
if ($objDiscountAmount <> 0) {
|
203 |
-
$discountAmount = (-1 * ((-$discountAmount) + $objDiscountAmount));
|
204 |
-
$grandTotal = $grandTotal + (-1 * $objDiscountAmount);
|
205 |
-
$subTotalWithDiscount = $subTotalWithDiscount + (-1 * $objDiscountAmount);
|
206 |
-
$baseGrandTotal = $baseGrandTotal + (-1 * $objDiscountAmount);
|
207 |
-
$baseSubTotalWithDiscount = $baseSubTotalWithDiscount + (-1 * $objDiscountAmount);
|
208 |
-
}
|
209 |
-
|
210 |
-
$objShippingAddress->addTotal(array(
|
211 |
-
'code' => 'discount',
|
212 |
-
'title' => "Desconto",
|
213 |
-
'value' => -$discountAmount,
|
214 |
-
));
|
215 |
-
|
216 |
-
$totalDiscountAmount = $discountAmount;
|
217 |
-
$subtotalWithDiscount = $subTotalWithDiscount - $discountAmount;
|
218 |
-
$baseTotalDiscountAmount = $discountAmount;
|
219 |
-
$baseSubtotalWithDiscount = $baseSubTotalWithDiscount - $discountAmount;
|
220 |
-
|
221 |
-
$objShippingAddress->setDiscountAmount(-$totalDiscountAmount);
|
222 |
-
$objShippingAddress->setSubtotalWithDiscount($subtotalWithDiscount);
|
223 |
-
$objShippingAddress->setBaseDiscountAmount($baseTotalDiscountAmount);
|
224 |
-
$objShippingAddress->setBaseSubtotalWithDiscount($baseSubtotalWithDiscount);
|
225 |
-
$objShippingAddress->setGrandTotal($grandTotal - $totalDiscountAmount);
|
226 |
-
$objShippingAddress->setBaseGrandTotal($baseGrandTotal - $baseTotalDiscountAmount);
|
227 |
-
$objShippingAddress->save();
|
228 |
-
}
|
229 |
-
}
|
230 |
}
|
1 |
<?php
|
2 |
|
|
|
3 |
/**
|
4 |
+
* Class Bcash_Pagamento_Model_Creditcard
|
5 |
*/
|
6 |
+
class Bcash_Pagamento_Model_Creditcard extends Mage_Payment_Model_Method_Abstract
|
7 |
{
|
8 |
/**
|
9 |
* @var string
|
10 |
*/
|
11 |
+
protected $_code = 'bcash_creditcard';
|
12 |
|
13 |
/**
|
14 |
* @var string
|
15 |
*/
|
16 |
+
protected $_formBlockType = 'bcash/form_creditcard';
|
17 |
+
protected $_infoBlockType = 'bcash/info_creditcard';
|
18 |
|
19 |
+
/**
|
20 |
+
* Flag executa o método initalize() com o checkout completo.
|
21 |
* @var bool
|
22 |
*/
|
23 |
protected $_isInitializeNeeded = true;
|
25 |
protected $_isGateway = true;
|
26 |
protected $_canAuthorize = true;
|
27 |
protected $_canUseCheckout = true;
|
|
|
28 |
protected $_canUseForMultishipping = false;
|
29 |
|
30 |
protected $transaction;
|
31 |
|
|
|
32 |
/**
|
33 |
* Inicializa o método de pagamento. Chamado quando a compra é completa.
|
34 |
* Objeto Order será criado após a chamada deste método.
|
40 |
*/
|
41 |
public function initialize($paymentAction, $stateObject)
|
42 |
{
|
43 |
+
//Mage::helper("bcash")->saveLog('Called ' . __METHOD__ . ' with payment ' . $paymentAction);
|
44 |
+
//Mage::helper("bcash")->saveLog('Payment Creditcard visitor: ' . Mage::helper('core/http')->getRemoteAddr());
|
45 |
parent::initialize($paymentAction, $stateObject);
|
46 |
|
47 |
if ($paymentAction != 'sale') {
|
55 |
|
56 |
try {
|
57 |
$result = $this->_customBeginPayment();
|
|
|
58 |
$response = $result['response'];
|
59 |
$payment_method = $result['payment_method'];
|
60 |
$installments = $result['installments'];
|
116 |
$cart->save();
|
117 |
|
118 |
} catch (Exception $e) {
|
119 |
+
Mage::helper("bcash")->saveLog($e->getMessage());
|
120 |
throw new Mage_Payment_Model_Info_Exception($e->getMessage());
|
121 |
}
|
122 |
|
143 |
*/
|
144 |
public function assignData($data)
|
145 |
{
|
146 |
+
//Mage::helper("bcash")->saveLog('Creditcard :: Assign Data with Bcash');
|
147 |
$result = parent::assignData($data);
|
148 |
$params = Mage::app()->getFrontController()->getRequest()->getParams();
|
149 |
+
$params['installments_bcash'] = isset($params['installments_bcash']) ? $params['installments_bcash'] : 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
|
151 |
return $result;
|
152 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
}
|
app/code/community/Bcash/Pagamento/Model/Observer.php
CHANGED
@@ -17,7 +17,7 @@ class Bcash_Pagamento_Model_Observer
|
|
17 |
if (($origOrderData['state'] !== $newOrderData['state']) && ($newOrderData['state'] == Mage_Sales_Model_Order::STATE_CANCELED)) {
|
18 |
// Verifica se pedido possui transação Bcash relacionada
|
19 |
$order = $observer->getOrder()->getData();
|
20 |
-
if(!empty($order['transaction_id_bcash']) && !is_null($order['transaction_id_bcash'])) {
|
21 |
$orderId = $order['entity_id'];
|
22 |
$order = Mage::getModel('sales/order')->load($orderId);
|
23 |
$order->addStatusHistoryComment('Pedido não cancelado através do cancelamento Bcash. A transação ' . $order['transaction_id_bcash'] . ' não foi alterada.');
|
@@ -41,17 +41,16 @@ class Bcash_Pagamento_Model_Observer
|
|
41 |
// @var $quote Mage_Sales_Model_Quote
|
42 |
$quote = $event->getQuote();
|
43 |
|
44 |
-
|
45 |
$quoteId = $quote->getId();
|
46 |
$orderId = $order->getId();
|
47 |
$incrId = $order->getIncrementId();
|
48 |
|
49 |
// Sync datas
|
50 |
-
Mage::helper('
|
51 |
|
52 |
// Session values
|
53 |
$session = Mage::getSingleton('checkout/session');
|
54 |
-
Mage::
|
55 |
$session->setData('OrderIdBcash', $orderId);
|
56 |
$session->setData('OrderIncrementIdBcash', $incrId);
|
57 |
$session->setData('QuoteIdBcash', $quoteId);
|
@@ -68,7 +67,6 @@ class Bcash_Pagamento_Model_Observer
|
|
68 |
*/
|
69 |
public function orderSuccessEvent($observer)
|
70 |
{
|
71 |
-
Mage::log("Bcash_Pagamento_Model_Observer::showPaymentLink");
|
72 |
try {
|
73 |
$order = new Mage_Sales_Model_Order();
|
74 |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
@@ -85,14 +83,16 @@ class Bcash_Pagamento_Model_Observer
|
|
85 |
$block = $layout->createBlock(
|
86 |
'Mage_Core_Block_Template',
|
87 |
'link_pagamento_bcash',
|
88 |
-
array('template' => 'pagamento/checkout/success.phtml')
|
89 |
);
|
90 |
$block->setOrder($order);
|
91 |
$block->setQuote($quote);
|
92 |
$block->setType($type);
|
93 |
$layout->getBlock('content')->append($block);
|
94 |
-
|
95 |
-
Mage::
|
|
|
|
|
96 |
}
|
97 |
}
|
98 |
|
@@ -102,49 +102,10 @@ class Bcash_Pagamento_Model_Observer
|
|
102 |
if (!is_null($observer->getQuote())) {
|
103 |
$params = Mage::app()->getFrontController()->getRequest()->getParams();
|
104 |
$params['installments_bcash'] = isset($params['installments_bcash']) ? $params['installments_bcash'] : 1;
|
105 |
-
|
106 |
-
//Adiciona Desconto ao Pedido caso 1x Credito, Boleto ou TEF (configurados no Backend)
|
107 |
-
$discountAmount = 0;
|
108 |
-
if ($params['installments_bcash'] == 1) {
|
109 |
-
$transaction = new Bcash_Pagamento_Helper_Transaction();
|
110 |
-
$discountAmount = $transaction->calculateDiscount($params['payment-method']);
|
111 |
-
}
|
112 |
-
|
113 |
-
$quote = $observer->getQuote();
|
114 |
-
$quote->collectTotals();
|
115 |
-
|
116 |
-
if($discountAmount > 0) {
|
117 |
-
$grandTotal = $quote->getGrandTotal();
|
118 |
-
$subTotalWithDiscount = $quote->getSubtotalWithDiscount();
|
119 |
-
$baseGrandTotal = $quote->getBaseGrandTotal();
|
120 |
-
$baseSubTotalWithDiscount = $quote->getBaseSubtotalWithDiscount();
|
121 |
-
|
122 |
-
// Outros descontos aplicados
|
123 |
-
$objDiscountAmount = $quote->getDiscountAmount();
|
124 |
-
if ($objDiscountAmount <> 0) {
|
125 |
-
$discountAmount = (-1 * ((-$discountAmount) + $objDiscountAmount));
|
126 |
-
$grandTotal = $grandTotal + (-1 * $objDiscountAmount);
|
127 |
-
$subTotalWithDiscount = $subTotalWithDiscount + (-1 * $objDiscountAmount);
|
128 |
-
$baseGrandTotal = $baseGrandTotal + (-1 * $objDiscountAmount);
|
129 |
-
$baseSubTotalWithDiscount = $baseSubTotalWithDiscount + (-1 * $objDiscountAmount);
|
130 |
-
}
|
131 |
-
|
132 |
-
$totalDiscountAmount = $discountAmount;
|
133 |
-
$subtotalWithDiscount = $subTotalWithDiscount - $discountAmount;
|
134 |
-
$baseTotalDiscountAmount = $discountAmount;
|
135 |
-
$baseSubtotalWithDiscount = $baseSubTotalWithDiscount - $discountAmount;
|
136 |
-
|
137 |
-
$quote->setDiscountAmount(-$totalDiscountAmount);
|
138 |
-
$quote->setSubtotalWithDiscount($subtotalWithDiscount);
|
139 |
-
$quote->setBaseDiscountAmount($baseTotalDiscountAmount);
|
140 |
-
$quote->setBaseSubtotalWithDiscount($baseSubtotalWithDiscount);
|
141 |
-
$quote->setGrandTotal($grandTotal - $totalDiscountAmount);
|
142 |
-
$quote->setBaseGrandTotal($baseGrandTotal - $baseTotalDiscountAmount);
|
143 |
-
$quote->setTotalsCollectedFlag(false)->collectTotals();
|
144 |
-
$quote->save();
|
145 |
-
}
|
146 |
}
|
147 |
-
} catch (Exception $e) {
|
|
|
|
|
148 |
}
|
149 |
|
150 |
}
|
17 |
if (($origOrderData['state'] !== $newOrderData['state']) && ($newOrderData['state'] == Mage_Sales_Model_Order::STATE_CANCELED)) {
|
18 |
// Verifica se pedido possui transação Bcash relacionada
|
19 |
$order = $observer->getOrder()->getData();
|
20 |
+
if (!empty($order['transaction_id_bcash']) && !is_null($order['transaction_id_bcash'])) {
|
21 |
$orderId = $order['entity_id'];
|
22 |
$order = Mage::getModel('sales/order')->load($orderId);
|
23 |
$order->addStatusHistoryComment('Pedido não cancelado através do cancelamento Bcash. A transação ' . $order['transaction_id_bcash'] . ' não foi alterada.');
|
41 |
// @var $quote Mage_Sales_Model_Quote
|
42 |
$quote = $event->getQuote();
|
43 |
|
|
|
44 |
$quoteId = $quote->getId();
|
45 |
$orderId = $order->getId();
|
46 |
$incrId = $order->getIncrementId();
|
47 |
|
48 |
// Sync datas
|
49 |
+
Mage::helper('bcash')->updateOrderSyncBcashDataWithQuote($orderId, $quoteId);
|
50 |
|
51 |
// Session values
|
52 |
$session = Mage::getSingleton('checkout/session');
|
53 |
+
Mage::helper("bcash")->saveLog("Saving quote [$quoteId] and order [$incrId] to checkout/session");
|
54 |
$session->setData('OrderIdBcash', $orderId);
|
55 |
$session->setData('OrderIncrementIdBcash', $incrId);
|
56 |
$session->setData('QuoteIdBcash', $quoteId);
|
67 |
*/
|
68 |
public function orderSuccessEvent($observer)
|
69 |
{
|
|
|
70 |
try {
|
71 |
$order = new Mage_Sales_Model_Order();
|
72 |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
83 |
$block = $layout->createBlock(
|
84 |
'Mage_Core_Block_Template',
|
85 |
'link_pagamento_bcash',
|
86 |
+
array('template' => 'bcash/pagamento/checkout/success.phtml')
|
87 |
);
|
88 |
$block->setOrder($order);
|
89 |
$block->setQuote($quote);
|
90 |
$block->setType($type);
|
91 |
$layout->getBlock('content')->append($block);
|
92 |
+
|
93 |
+
Mage::helper("bcash")->saveLog("Pedido realizado com sucesso.");
|
94 |
+
} catch (Exception $e) {
|
95 |
+
Mage::helper("bcash")->saveLog($e->getMessage());
|
96 |
}
|
97 |
}
|
98 |
|
102 |
if (!is_null($observer->getQuote())) {
|
103 |
$params = Mage::app()->getFrontController()->getRequest()->getParams();
|
104 |
$params['installments_bcash'] = isset($params['installments_bcash']) ? $params['installments_bcash'] : 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
106 |
+
} catch (Exception $e) {
|
107 |
+
Mage::helper("bcash")->saveLog("Exception- Model_Observer->updateSalesQuotePayment: " . $e->getMessage());
|
108 |
+
}
|
109 |
}
|
110 |
|
111 |
}
|
app/code/community/Bcash/Pagamento/Model/Onlinetransfer.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Bcash_Pagamento_Model_Onlinetransfer
|
5 |
+
*/
|
6 |
+
class Bcash_Pagamento_Model_Onlinetransfer extends Mage_Payment_Model_Method_Abstract
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* @var string
|
10 |
+
*/
|
11 |
+
protected $_code = 'bcash_onlinetransfer';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var string
|
15 |
+
*/
|
16 |
+
protected $_formBlockType = 'bcash/form_onlinetransfer';
|
17 |
+
protected $_infoBlockType = 'bcash/info_onlinetransfer';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Flag executa o método initalize() com o checkout completo.
|
21 |
+
* @var bool
|
22 |
+
*/
|
23 |
+
protected $_isInitializeNeeded = true;
|
24 |
+
|
25 |
+
protected $_isGateway = true;
|
26 |
+
protected $_canAuthorize = true;
|
27 |
+
protected $_canUseCheckout = true;
|
28 |
+
protected $_canUseForMultishipping = false;
|
29 |
+
|
30 |
+
protected $transaction;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Inicializa o método de pagamento. Chamado quando a compra é completa.
|
34 |
+
* Objeto Order será criado após a chamada deste método.
|
35 |
+
*
|
36 |
+
* @param string $paymentAction
|
37 |
+
* @param Varien_Object $stateObject
|
38 |
+
* @return Mage_Payment_Model_Abstract
|
39 |
+
* @throws Mage_Payment_Model_Info_Exception
|
40 |
+
*/
|
41 |
+
public function initialize($paymentAction, $stateObject)
|
42 |
+
{
|
43 |
+
//Mage::helper("bcash")->saveLog('Called ' . __METHOD__ . ' with payment ' . $paymentAction);
|
44 |
+
//Mage::helper("bcash")->saveLog('Payment Onlinetransfer visitor: ' . Mage::helper('core/http')->getRemoteAddr());
|
45 |
+
parent::initialize($paymentAction, $stateObject);
|
46 |
+
|
47 |
+
if ($paymentAction != 'sale') {
|
48 |
+
return $this;
|
49 |
+
}
|
50 |
+
|
51 |
+
$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
52 |
+
$stateObject->setState($state);
|
53 |
+
$stateObject->setStatus(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
|
54 |
+
$stateObject->setIsNotified(false);
|
55 |
+
|
56 |
+
try {
|
57 |
+
$result = $this->_customBeginPayment();
|
58 |
+
$response = $result['response'];
|
59 |
+
$payment_method = $result['payment_method'];
|
60 |
+
$installments = $result['installments'];
|
61 |
+
|
62 |
+
/*
|
63 |
+
1 – Em andamento
|
64 |
+
3 – Aprovada
|
65 |
+
4 – Concluída
|
66 |
+
5 – Disputa
|
67 |
+
6 – Devolvida
|
68 |
+
7 – Cancelada
|
69 |
+
8 – Chargeback
|
70 |
+
*/
|
71 |
+
|
72 |
+
// Salvar o PEDIDO em caso de SUCESSO e adicionar os dados da Transação
|
73 |
+
if ($response->status != 1 && $response->status != 2) {
|
74 |
+
|
75 |
+
$setIsNotified = false;
|
76 |
+
switch($response->status)
|
77 |
+
{
|
78 |
+
case 3: //3 – Aprovada
|
79 |
+
case 4: //4 – Concluída
|
80 |
+
$state = Mage_Sales_Model_Order::STATE_PROCESSING;
|
81 |
+
$setIsNotified = true;
|
82 |
+
break;
|
83 |
+
case 6://6 – Devolvida
|
84 |
+
$state = Mage_Sales_Model_Order::STATE_HOLDED;
|
85 |
+
break;
|
86 |
+
case 7://7 – Cancelada
|
87 |
+
case 8://8 – Chargeback
|
88 |
+
$state = Mage_Sales_Model_Order::STATE_CANCELED;
|
89 |
+
break;
|
90 |
+
default:
|
91 |
+
$state = null;
|
92 |
+
break;
|
93 |
+
}
|
94 |
+
|
95 |
+
if(!is_null($state)){
|
96 |
+
$stateObject->setState($state);
|
97 |
+
$stateObject->setStatus($state);
|
98 |
+
$stateObject->setIsNotified($setIsNotified);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
Mage::getSingleton('core/session')->setTransactionIdBcash($response->transactionId);
|
103 |
+
Mage::getSingleton('core/session')->setStatusBcash($response->status);
|
104 |
+
Mage::getSingleton('core/session')->setDescriptionStatusBcash(urldecode($response->descriptionStatus));
|
105 |
+
Mage::getSingleton('core/session')->setPaymentLinkBcash(isset($response->paymentLink) ? urldecode($response->paymentLink) : null);
|
106 |
+
Mage::getSingleton('core/session')->setPaymentMethodBcash($payment_method);
|
107 |
+
Mage::getSingleton('core/session')->setInstallmentsBcash($installments);
|
108 |
+
|
109 |
+
$cart = Mage::getSingleton('checkout/cart')->getQuote();
|
110 |
+
$cart->setTransactionIdBcash($response->transactionId)
|
111 |
+
->setStatusBcash($response->status)
|
112 |
+
->setDescriptionStatusBcash(urldecode($response->descriptionStatus))
|
113 |
+
->setPaymentLinkBcash(isset($response->paymentLink) ? urldecode($response->paymentLink) : null)
|
114 |
+
->setPaymentMethodBcash($payment_method)
|
115 |
+
->setInstallmentsBcash($installments);
|
116 |
+
$cart->save();
|
117 |
+
|
118 |
+
} catch (Exception $e) {
|
119 |
+
Mage::helper("bcash")->saveLog("Exception: Model_Onlinetransfer->initialize: " . $e->getMessage());
|
120 |
+
throw new Mage_Payment_Model_Info_Exception($e->getMessage());
|
121 |
+
}
|
122 |
+
|
123 |
+
return $this;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Inicializa a transação atual via SDK Api Bcash.
|
128 |
+
* Respond with token
|
129 |
+
* @throws SoapFault
|
130 |
+
* @throws Mage_Exception
|
131 |
+
* @throws Exception
|
132 |
+
*/
|
133 |
+
protected function _customBeginPayment()
|
134 |
+
{
|
135 |
+
$this->transaction = new Bcash_Pagamento_Helper_Transaction();
|
136 |
+
return $this->transaction->startTransaction();
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Assign data to info model instance
|
141 |
+
* @param mixed $data
|
142 |
+
* @return Mage_Payment_Model_Info
|
143 |
+
*/
|
144 |
+
public function assignData($data)
|
145 |
+
{
|
146 |
+
//Mage::helper("bcash")->saveLog('OnlineTransfer :: Assign Data with Bcash');
|
147 |
+
$result = parent::assignData($data);
|
148 |
+
$params = Mage::app()->getFrontController()->getRequest()->getParams();
|
149 |
+
$params['installments_bcash'] = isset($params['installments_bcash']) ? $params['installments_bcash'] : 1;
|
150 |
+
|
151 |
+
return $result;
|
152 |
+
}
|
153 |
+
}
|
app/code/community/Bcash/Pagamento/Model/Order.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
require_once(Mage::getBaseDir("lib") . "/
|
|
|
4 |
|
5 |
-
use Bcash_Pagamento_Helper_RegisterSdk;
|
6 |
use Bcash\Service\Cancellation;
|
7 |
use Bcash\Exception\ValidationException;
|
8 |
use Bcash\Exception\ConnectionException;
|
@@ -12,18 +12,15 @@ use Bcash\Exception\ConnectionException;
|
|
12 |
*/
|
13 |
class Bcash_Pagamento_Model_Order extends Mage_Core_Model_Abstract
|
14 |
{
|
15 |
-
|
16 |
private $email;
|
17 |
private $token;
|
18 |
-
private $obj;
|
19 |
private $sandbox;
|
20 |
|
21 |
public function __construct()
|
22 |
{
|
23 |
-
$this->
|
24 |
-
$this->
|
25 |
-
$this->
|
26 |
-
$this->sandbox = $this->obj->getConfigData('sandbox');
|
27 |
}
|
28 |
|
29 |
/**
|
@@ -46,14 +43,31 @@ class Bcash_Pagamento_Model_Order extends Mage_Core_Model_Abstract
|
|
46 |
}
|
47 |
} catch (ValidationException $e) {
|
48 |
Mage::getSingleton('adminhtml/session')->addError('Erro: ' . $e->getMessage());
|
49 |
-
Mage::
|
50 |
|
51 |
} catch (ConnectionException $e) {
|
52 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage() . ' (Confirme se o serviço de cancelamento está habilitado para sua conta Bcash)');
|
53 |
-
Mage::
|
54 |
}
|
55 |
|
56 |
return $response;
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
1 |
<?php
|
2 |
|
3 |
+
require_once(Mage::getBaseDir("lib") . "/Bcash/AutoLoader.php");
|
4 |
+
Bcash\AutoLoader::register();
|
5 |
|
|
|
6 |
use Bcash\Service\Cancellation;
|
7 |
use Bcash\Exception\ValidationException;
|
8 |
use Bcash\Exception\ConnectionException;
|
12 |
*/
|
13 |
class Bcash_Pagamento_Model_Order extends Mage_Core_Model_Abstract
|
14 |
{
|
|
|
15 |
private $email;
|
16 |
private $token;
|
|
|
17 |
private $sandbox;
|
18 |
|
19 |
public function __construct()
|
20 |
{
|
21 |
+
$this->email = Mage::getStoreConfig('payment/bcash/email');
|
22 |
+
$this->token = Mage::getStoreConfig('payment/bcash/token');
|
23 |
+
$this->sandbox = Mage::getStoreConfig('payment/bcash/sandbox');
|
|
|
24 |
}
|
25 |
|
26 |
/**
|
43 |
}
|
44 |
} catch (ValidationException $e) {
|
45 |
Mage::getSingleton('adminhtml/session')->addError('Erro: ' . $e->getMessage());
|
46 |
+
Mage::helper("bcash")->saveLog("ValidationException - Model_Order->cancellation: " . $e->getMessage(), $e->getErrors());
|
47 |
|
48 |
} catch (ConnectionException $e) {
|
49 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage() . ' (Confirme se o serviço de cancelamento está habilitado para sua conta Bcash)');
|
50 |
+
Mage::helper("bcash")->saveLog("ConnectionException - Model_Order->cancellation: " . $e->getMessage(), $e->getErrors());
|
51 |
}
|
52 |
|
53 |
return $response;
|
54 |
}
|
55 |
|
56 |
+
public function getBcashInfoPayment($order_id){
|
57 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
|
58 |
+
$quoteId = $order->getQuoteId();
|
59 |
+
$quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteId);
|
60 |
+
|
61 |
+
$info_payments = array(
|
62 |
+
array("titulo" => "method_payment", "valor" => $quote->getPaymentMethodBcash()),
|
63 |
+
array("titulo" => "Id transação Bcash", "valor" => $quote->getTransactionIdBcash()),
|
64 |
+
array("titulo" => "Cod. do Status", "valor" => $quote->getStatusBcash()),
|
65 |
+
array("titulo" => "Descrição do Status", "valor" => $quote->getDescriptionStatusBcash()),
|
66 |
+
array("titulo" => "Link", "valor" => $quote->getPaymentLinkBcash()),
|
67 |
+
array("titulo" => "Parcelas", "valor" => $quote->getInstallmentsBcash() . "x")
|
68 |
+
);
|
69 |
+
|
70 |
+
return $info_payments;
|
71 |
+
}
|
72 |
+
|
73 |
}
|
app/code/community/Bcash/Pagamento/controllers/Admin/Sales/OrderController.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
require_once(Mage::getBaseDir("lib") . "/
|
|
|
4 |
|
5 |
use Bcash\Domain\NotificationStatusEnum;
|
6 |
|
@@ -93,11 +94,11 @@ class Bcash_Pagamento_Admin_Sales_OrderController extends Mage_Adminhtml_Control
|
|
93 |
$quoteId = $order->getQuoteId();
|
94 |
$quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteId);
|
95 |
$orderTransactionBcash = $quote->getTransactionIdBcash();
|
96 |
-
$transactionInfo = Mage::helper('
|
97 |
|
98 |
// Checa se o status da transaçao Bcash permite cancelamento
|
99 |
if($transactionInfo->transacao->cod_status == NotificationStatusEnum::IN_PROGRESS || $transactionInfo->transacao->cod_status == NotificationStatusEnum::APPROVED) {
|
100 |
-
$pagamentoOrderModel = Mage::getModel('
|
101 |
$responseCancellation = $pagamentoOrderModel->cancellation($orderTransactionBcash);
|
102 |
|
103 |
if ($responseCancellation != null) {
|
@@ -140,7 +141,7 @@ class Bcash_Pagamento_Admin_Sales_OrderController extends Mage_Adminhtml_Control
|
|
140 |
$this->_getSession()->addError($e->getMessage());
|
141 |
} catch (Exception $e) {
|
142 |
$this->_getSession()->addError($this->__('The order has not been cancelled.'));
|
143 |
-
Mage::
|
144 |
}
|
145 |
}
|
146 |
|
1 |
<?php
|
2 |
|
3 |
+
require_once(Mage::getBaseDir("lib") . "/Bcash/AutoLoader.php");
|
4 |
+
Bcash\AutoLoader::register();
|
5 |
|
6 |
use Bcash\Domain\NotificationStatusEnum;
|
7 |
|
94 |
$quoteId = $order->getQuoteId();
|
95 |
$quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteId);
|
96 |
$orderTransactionBcash = $quote->getTransactionIdBcash();
|
97 |
+
$transactionInfo = Mage::helper('bcash')->getTransaction($orderTransactionBcash);
|
98 |
|
99 |
// Checa se o status da transaçao Bcash permite cancelamento
|
100 |
if($transactionInfo->transacao->cod_status == NotificationStatusEnum::IN_PROGRESS || $transactionInfo->transacao->cod_status == NotificationStatusEnum::APPROVED) {
|
101 |
+
$pagamentoOrderModel = Mage::getModel('bcash/order');
|
102 |
$responseCancellation = $pagamentoOrderModel->cancellation($orderTransactionBcash);
|
103 |
|
104 |
if ($responseCancellation != null) {
|
141 |
$this->_getSession()->addError($e->getMessage());
|
142 |
} catch (Exception $e) {
|
143 |
$this->_getSession()->addError($this->__('The order has not been cancelled.'));
|
144 |
+
Mage::helper("bcash")->saveLog("Cancellation error - OrderController->cancelBcashTransaction: " . $e->getMessage(), $e->getErrors());
|
145 |
}
|
146 |
}
|
147 |
|
app/code/community/Bcash/Pagamento/controllers/NotificationController.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
require_once(Mage::getBaseDir("lib") . "/
|
|
|
4 |
|
5 |
use Bcash\Service\Notification;
|
6 |
use Bcash\Domain\NotificationContent;
|
@@ -24,12 +25,11 @@ class Bcash_Pagamento_NotificationController extends Mage_Core_Controller_Front_
|
|
24 |
protected function _construct()
|
25 |
{
|
26 |
// access log (debug)
|
27 |
-
Mage::
|
28 |
|
29 |
-
$this->
|
30 |
-
$this->
|
31 |
-
$this->
|
32 |
-
$this->sandbox = $this->obj->getConfigData('sandbox');
|
33 |
}
|
34 |
|
35 |
/**
|
@@ -44,7 +44,7 @@ class Bcash_Pagamento_NotificationController extends Mage_Core_Controller_Front_
|
|
44 |
$statusId = (int)Mage::app()->getRequest()->getParam('statusId');
|
45 |
|
46 |
// Notification Simulator
|
47 |
-
$urlSubmit = Mage::getUrl('
|
48 |
echo "<h1>Bcash Notification Simulator</h1>
|
49 |
<form method='GET' action='" . $urlSubmit . "'>
|
50 |
<label>Nro. Pedido:</label>
|
@@ -65,7 +65,7 @@ class Bcash_Pagamento_NotificationController extends Mage_Core_Controller_Front_
|
|
65 |
</form>";
|
66 |
|
67 |
if(!empty($transactionId) && !empty($statusId) && !empty($orderId)) {
|
68 |
-
$urlSimulator = Mage::getUrl('
|
69 |
$returnSimulator = $this->notificationSimulator($urlSimulator, $transactionId, $orderId, $statusId);
|
70 |
echo "<h2>Retorno:</h2> <div style='clear:both;'></div><pre style='background-color: #EAEAEA; padding:20px;'>";
|
71 |
var_dump($returnSimulator);
|
@@ -110,18 +110,16 @@ class Bcash_Pagamento_NotificationController extends Mage_Core_Controller_Front_
|
|
110 |
// Processamento da notificação no pedido
|
111 |
$this->processNotification($transactionId, $orderId, $statusId);
|
112 |
}else {
|
113 |
-
Mage::
|
114 |
}
|
115 |
} else {
|
116 |
-
Mage::
|
117 |
}
|
118 |
} catch (ValidationException $e) {
|
119 |
-
Mage::
|
120 |
-
Mage::log($e->getErrors());
|
121 |
|
122 |
} catch (ConnectionException $e) {
|
123 |
-
Mage::
|
124 |
-
Mage::log($e->getErrors());
|
125 |
}
|
126 |
}
|
127 |
|
@@ -228,7 +226,7 @@ class Bcash_Pagamento_NotificationController extends Mage_Core_Controller_Front_
|
|
228 |
}
|
229 |
|
230 |
// Sinc datas
|
231 |
-
Mage::helper('
|
232 |
}
|
233 |
|
234 |
/**
|
1 |
<?php
|
2 |
|
3 |
+
require_once(Mage::getBaseDir("lib") . "/Bcash/AutoLoader.php");
|
4 |
+
Bcash\AutoLoader::register();
|
5 |
|
6 |
use Bcash\Service\Notification;
|
7 |
use Bcash\Domain\NotificationContent;
|
25 |
protected function _construct()
|
26 |
{
|
27 |
// access log (debug)
|
28 |
+
Mage::helper("bcash")->saveLog('Notification visitor: ' . Mage::helper('core/http')->getRemoteAddr());
|
29 |
|
30 |
+
$this->email = Mage::getStoreConfig('payment/bcash/email');
|
31 |
+
$this->token = Mage::getStoreConfig('payment/bcash/token');
|
32 |
+
$this->sandbox = Mage::getStoreConfig('payment/bcash/sandbox');
|
|
|
33 |
}
|
34 |
|
35 |
/**
|
44 |
$statusId = (int)Mage::app()->getRequest()->getParam('statusId');
|
45 |
|
46 |
// Notification Simulator
|
47 |
+
$urlSubmit = Mage::getUrl('bcash/notification/index',array('_secure'=>true));
|
48 |
echo "<h1>Bcash Notification Simulator</h1>
|
49 |
<form method='GET' action='" . $urlSubmit . "'>
|
50 |
<label>Nro. Pedido:</label>
|
65 |
</form>";
|
66 |
|
67 |
if(!empty($transactionId) && !empty($statusId) && !empty($orderId)) {
|
68 |
+
$urlSimulator = Mage::getUrl('bcash/notification/request',array('_secure'=>true));
|
69 |
$returnSimulator = $this->notificationSimulator($urlSimulator, $transactionId, $orderId, $statusId);
|
70 |
echo "<h2>Retorno:</h2> <div style='clear:both;'></div><pre style='background-color: #EAEAEA; padding:20px;'>";
|
71 |
var_dump($returnSimulator);
|
110 |
// Processamento da notificação no pedido
|
111 |
$this->processNotification($transactionId, $orderId, $statusId);
|
112 |
}else {
|
113 |
+
Mage::helper("bcash")->saveLog("Atencao!!! Notificacao invalida recebida: Transaction: " . $transactionId . " - Status: " . $statusId);
|
114 |
}
|
115 |
} else {
|
116 |
+
Mage::helper("bcash")->saveLog("Atencao!!! Pedido " . $orderId . " nao identificado na notificacao recebida. ");
|
117 |
}
|
118 |
} catch (ValidationException $e) {
|
119 |
+
Mage::helper("bcash")->saveLog("Validation error - NotificationController->requestAction: " . $e->getMessage(), $e->getErrors());
|
|
|
120 |
|
121 |
} catch (ConnectionException $e) {
|
122 |
+
Mage::helper("bcash")->saveLog("Connection error - NotificationController->requestAction: " . $e->getMessage(), $e->getErrors());
|
|
|
123 |
}
|
124 |
}
|
125 |
|
226 |
}
|
227 |
|
228 |
// Sinc datas
|
229 |
+
Mage::helper('bcash')->updateOrderSyncBcashDataWithQuote($orderId, $quoteId);
|
230 |
}
|
231 |
|
232 |
/**
|
app/code/community/Bcash/Pagamento/controllers/PaymentController.php
CHANGED
@@ -12,7 +12,7 @@ class Bcash_Pagamento_PaymentController extends Mage_Core_Controller_Front_Actio
|
|
12 |
public function redirectAction()
|
13 |
{
|
14 |
$this->loadLayout();
|
15 |
-
$block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'paymentmethod', array('template' => 'pagamento/redirect.phtml'));
|
16 |
$this->getLayout()->getBlock('content')->append($block);
|
17 |
$this->renderLayout();
|
18 |
}
|
@@ -110,7 +110,7 @@ class Bcash_Pagamento_PaymentController extends Mage_Core_Controller_Front_Actio
|
|
110 |
$block = $this->getLayout()->createBlock(
|
111 |
'Mage_Core_Block_Template',
|
112 |
'link_pagamento_bcash',
|
113 |
-
array('template' => 'pagamento/checkout/success.phtml')
|
114 |
);
|
115 |
|
116 |
$block->setOrder($order);
|
@@ -132,7 +132,7 @@ class Bcash_Pagamento_PaymentController extends Mage_Core_Controller_Front_Actio
|
|
132 |
{
|
133 |
$method = Mage::app()->getRequest()->getPost('method');
|
134 |
|
135 |
-
$paymentInstallments = Mage::helper('
|
136 |
$response = "[{ccId : 0, ccName : '', ccNumber : '', ccDescript : '(Selecione o número de parcelas)'}";
|
137 |
$okInstallments = $paymentInstallments['ok'];
|
138 |
if($okInstallments):
|
12 |
public function redirectAction()
|
13 |
{
|
14 |
$this->loadLayout();
|
15 |
+
$block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'paymentmethod', array('template' => 'bcash/pagamento/redirect.phtml'));
|
16 |
$this->getLayout()->getBlock('content')->append($block);
|
17 |
$this->renderLayout();
|
18 |
}
|
110 |
$block = $this->getLayout()->createBlock(
|
111 |
'Mage_Core_Block_Template',
|
112 |
'link_pagamento_bcash',
|
113 |
+
array('template' => 'bcash/pagamento/checkout/success.phtml')
|
114 |
);
|
115 |
|
116 |
$block->setOrder($order);
|
132 |
{
|
133 |
$method = Mage::app()->getRequest()->getPost('method');
|
134 |
|
135 |
+
$paymentInstallments = Mage::helper('bcash')->getInstallments();
|
136 |
$response = "[{ccId : 0, ccName : '', ccNumber : '', ccDescript : '(Selecione o número de parcelas)'}";
|
137 |
$okInstallments = $paymentInstallments['ok'];
|
138 |
if($okInstallments):
|
app/code/community/Bcash/Pagamento/etc/config.xml
CHANGED
@@ -1,11 +1,59 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
|
|
4 |
<Bcash_Pagamento>
|
5 |
-
<version>
|
6 |
</Bcash_Pagamento>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
</modules>
|
|
|
8 |
<global>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
<fieldsets>
|
10 |
<sales_convert_quote>
|
11 |
<transaction_id_bcash>
|
@@ -66,30 +114,7 @@
|
|
66 |
</phone_bcash>
|
67 |
</sales_convert_order>
|
68 |
</fieldsets>
|
69 |
-
|
70 |
-
<pagamento>
|
71 |
-
<class>Bcash_Pagamento_Helper</class>
|
72 |
-
</pagamento>
|
73 |
-
</helpers>
|
74 |
-
<blocks>
|
75 |
-
<pagamento>
|
76 |
-
<class>Bcash_Pagamento_Block</class>
|
77 |
-
</pagamento>
|
78 |
-
<pagamento_adminhtml>
|
79 |
-
<class>Bcash_Pagamento_Block_Adminhtml</class>
|
80 |
-
</pagamento_adminhtml>
|
81 |
-
<adminhtml>
|
82 |
-
<rewrite>
|
83 |
-
<sales_order_view>Bcash_Pagamento_Block_Adminhtml_Sales_Order_View</sales_order_view>
|
84 |
-
<sales_order_grid>Bcash_Pagamento_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
|
85 |
-
</rewrite>
|
86 |
-
</adminhtml>
|
87 |
-
</blocks>
|
88 |
-
<models>
|
89 |
-
<pagamento>
|
90 |
-
<class>Bcash_Pagamento_Model</class>
|
91 |
-
</pagamento>
|
92 |
-
</models>
|
93 |
<resources>
|
94 |
<pagamento_setup>
|
95 |
<setup>
|
@@ -126,15 +151,16 @@
|
|
126 |
</order>
|
127 |
</sales>
|
128 |
</global>
|
|
|
129 |
<admin>
|
130 |
<routers>
|
131 |
-
<
|
132 |
<use>admin</use>
|
133 |
<args>
|
134 |
<module>Bcash_Pagamento</module>
|
135 |
-
<frontName>
|
136 |
</args>
|
137 |
-
</
|
138 |
</routers>
|
139 |
</admin>
|
140 |
<adminhtml>
|
@@ -143,15 +169,31 @@
|
|
143 |
<observers>
|
144 |
<sales_order_save_commit_after_handler>
|
145 |
<type>model</type>
|
146 |
-
<class>
|
147 |
<method>checkOrderState</method>
|
148 |
<args></args>
|
149 |
</sales_order_save_commit_after_handler>
|
150 |
</observers>
|
151 |
</sales_order_save_commit_after>
|
152 |
-
|
153 |
</adminhtml>
|
154 |
<frontend>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
<events>
|
156 |
<checkout_onepage_controller_success_action>
|
157 |
<observers>
|
@@ -179,34 +221,45 @@
|
|
179 |
</sales_quote_payment_import_data_before>
|
180 |
</events>
|
181 |
</frontend>
|
|
|
182 |
<default>
|
183 |
<payment>
|
184 |
-
<
|
185 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
<active>1</active>
|
187 |
-
<
|
|
|
188 |
<order_status>1</order_status>
|
189 |
<payment_action>sale</payment_action>
|
190 |
<allowspecific>0</allowspecific>
|
191 |
-
|
|
|
192 |
</payment>
|
193 |
</default>
|
194 |
-
<frontend>
|
195 |
-
<routers>
|
196 |
-
<pagamento>
|
197 |
-
<use>standard</use>
|
198 |
-
<args>
|
199 |
-
<module>Bcash_Pagamento</module>
|
200 |
-
<frontName>pagamento</frontName>
|
201 |
-
</args>
|
202 |
-
</pagamento>
|
203 |
-
</routers>
|
204 |
-
<layout>
|
205 |
-
<updates>
|
206 |
-
<bcash_pagamento>
|
207 |
-
<file>bcash/pagamento/layout.xml</file>
|
208 |
-
</bcash_pagamento>
|
209 |
-
</updates>
|
210 |
-
</layout>
|
211 |
-
</frontend>
|
212 |
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
+
|
5 |
<Bcash_Pagamento>
|
6 |
+
<version>1.2.2</version>
|
7 |
</Bcash_Pagamento>
|
8 |
+
|
9 |
+
<Bcash_Creditcard>
|
10 |
+
<version>1.2.2</version>
|
11 |
+
</Bcash_Creditcard>
|
12 |
+
|
13 |
+
<Bcash_Bankslip>
|
14 |
+
<version>1.2.2</version>
|
15 |
+
</Bcash_Bankslip>
|
16 |
+
|
17 |
+
<Bcash_Onlinetransfer>
|
18 |
+
<version>1.2.2</version>
|
19 |
+
</Bcash_Onlinetransfer>
|
20 |
+
|
21 |
</modules>
|
22 |
+
|
23 |
<global>
|
24 |
+
<models>
|
25 |
+
<bcash>
|
26 |
+
<class>Bcash_Pagamento_Model</class>
|
27 |
+
</bcash>
|
28 |
+
</models>
|
29 |
+
<blocks>
|
30 |
+
<bcash>
|
31 |
+
<class>Bcash_Pagamento_Block</class>
|
32 |
+
</bcash>
|
33 |
+
<bcash_adminhtml>
|
34 |
+
<class>Bcash_Pagamento_Block_Adminhtml</class>
|
35 |
+
</bcash_adminhtml>
|
36 |
+
<adminhtml>
|
37 |
+
<rewrite>
|
38 |
+
<sales_order_view>Bcash_Pagamento_Block_Adminhtml_Sales_Order_View</sales_order_view>
|
39 |
+
<sales_order_grid>Bcash_Pagamento_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
|
40 |
+
</rewrite>
|
41 |
+
</adminhtml>
|
42 |
+
</blocks>
|
43 |
+
<helpers>
|
44 |
+
<bcash>
|
45 |
+
<class>Bcash_Pagamento_Helper</class>
|
46 |
+
</bcash>
|
47 |
+
<bcash_creditcard>
|
48 |
+
<class>Bcash_Pagamento_Helper</class>
|
49 |
+
</bcash_creditcard>
|
50 |
+
<bcash_bankslip>
|
51 |
+
<class>Bcash_Pagamento_Helper</class>
|
52 |
+
</bcash_bankslip>
|
53 |
+
<bcash_onlinetransfer>
|
54 |
+
<class>Bcash_Pagamento_Helper</class>
|
55 |
+
</bcash_onlinetransfer>
|
56 |
+
</helpers>
|
57 |
<fieldsets>
|
58 |
<sales_convert_quote>
|
59 |
<transaction_id_bcash>
|
114 |
</phone_bcash>
|
115 |
</sales_convert_order>
|
116 |
</fieldsets>
|
117 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
<resources>
|
119 |
<pagamento_setup>
|
120 |
<setup>
|
151 |
</order>
|
152 |
</sales>
|
153 |
</global>
|
154 |
+
|
155 |
<admin>
|
156 |
<routers>
|
157 |
+
<bcash>
|
158 |
<use>admin</use>
|
159 |
<args>
|
160 |
<module>Bcash_Pagamento</module>
|
161 |
+
<frontName>bcash</frontName>
|
162 |
</args>
|
163 |
+
</bcash>
|
164 |
</routers>
|
165 |
</admin>
|
166 |
<adminhtml>
|
169 |
<observers>
|
170 |
<sales_order_save_commit_after_handler>
|
171 |
<type>model</type>
|
172 |
+
<class>bcash/observer</class>
|
173 |
<method>checkOrderState</method>
|
174 |
<args></args>
|
175 |
</sales_order_save_commit_after_handler>
|
176 |
</observers>
|
177 |
</sales_order_save_commit_after>
|
178 |
+
</events>
|
179 |
</adminhtml>
|
180 |
<frontend>
|
181 |
+
<routers>
|
182 |
+
<bcash>
|
183 |
+
<use>standard</use>
|
184 |
+
<args>
|
185 |
+
<module>Bcash_Pagamento</module>
|
186 |
+
<frontName>bcash</frontName>
|
187 |
+
</args>
|
188 |
+
</bcash>
|
189 |
+
</routers>
|
190 |
+
<layout>
|
191 |
+
<updates>
|
192 |
+
<bcash_pagamento>
|
193 |
+
<file>bcash/pagamento/layout.xml</file>
|
194 |
+
</bcash_pagamento>
|
195 |
+
</updates>
|
196 |
+
</layout>
|
197 |
<events>
|
198 |
<checkout_onepage_controller_success_action>
|
199 |
<observers>
|
221 |
</sales_quote_payment_import_data_before>
|
222 |
</events>
|
223 |
</frontend>
|
224 |
+
|
225 |
<default>
|
226 |
<payment>
|
227 |
+
<bcash>
|
228 |
+
<logfile>0</logfile>
|
229 |
+
<sandbox>1</sandbox>
|
230 |
+
<allowspecific>0</allowspecific>
|
231 |
+
</bcash>
|
232 |
+
|
233 |
+
<bcash_creditcard>
|
234 |
+
<active>1</active>
|
235 |
+
<title>Bcash - Cartão de Crédito</title>
|
236 |
+
<model>Bcash_Pagamento_Model_Creditcard</model>
|
237 |
+
<order_status>1</order_status>
|
238 |
+
<payment_action>sale</payment_action>
|
239 |
+
<allowspecific>0</allowspecific>
|
240 |
+
<sort_order>-3</sort_order>
|
241 |
+
<max_installments>24</max_installments>
|
242 |
+
</bcash_creditcard>
|
243 |
+
|
244 |
+
<bcash_bankslip>
|
245 |
+
<active>1</active>
|
246 |
+
<title>Bcash - Boleto</title>
|
247 |
+
<model>Bcash_Pagamento_Model_Bankslip</model>
|
248 |
+
<order_status>1</order_status>
|
249 |
+
<payment_action>sale</payment_action>
|
250 |
+
<allowspecific>0</allowspecific>
|
251 |
+
<sort_order>-2</sort_order>
|
252 |
+
</bcash_bankslip>
|
253 |
+
|
254 |
+
<bcash_onlinetransfer>
|
255 |
<active>1</active>
|
256 |
+
<title>Bcash - Transferência Online (TEF)</title>
|
257 |
+
<model>Bcash_Pagamento_Model_Onlinetransfer</model>
|
258 |
<order_status>1</order_status>
|
259 |
<payment_action>sale</payment_action>
|
260 |
<allowspecific>0</allowspecific>
|
261 |
+
<sort_order>-1</sort_order>
|
262 |
+
</bcash_onlinetransfer>
|
263 |
</payment>
|
264 |
</default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
</config>
|
app/code/community/Bcash/Pagamento/etc/system.xml
CHANGED
@@ -3,49 +3,28 @@
|
|
3 |
<sections>
|
4 |
<payment>
|
5 |
<groups>
|
6 |
-
<
|
7 |
-
<label>Bcash -
|
8 |
<sort_order>1</sort_order>
|
9 |
<show_in_default>1</show_in_default>
|
10 |
<show_in_website>1</show_in_website>
|
11 |
<show_in_store>0</show_in_store>
|
12 |
-
|
13 |
<fields>
|
14 |
-
<active translate="label">
|
15 |
-
<label>Habilitar módulo</label>
|
16 |
-
<tooltip>Deseja habilitar o módulo?</tooltip>
|
17 |
-
<frontend_type>select</frontend_type>
|
18 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
19 |
-
<sort_order>1</sort_order>
|
20 |
-
<show_in_default>1</show_in_default>
|
21 |
-
<show_in_website>1</show_in_website>
|
22 |
-
<show_in_store>0</show_in_store>
|
23 |
-
</active>
|
24 |
-
|
25 |
<sandbox translate="label">
|
26 |
-
<label>Sandbox
|
|
|
27 |
<tooltip>Deseja utilizar o módulo em ambiente de testes?</tooltip>
|
28 |
<frontend_type>select</frontend_type>
|
29 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
30 |
<sort_order>2</sort_order>
|
31 |
-
<show_in_default>2</show_in_default>
|
32 |
-
<show_in_website>2</show_in_website>
|
33 |
-
<show_in_store>0</show_in_store>
|
34 |
-
</sandbox>
|
35 |
-
|
36 |
-
<title translate="label">
|
37 |
-
<label>Titulo</label>
|
38 |
-
<tooltip>Informe o nome que deve ser apresentado para este meio de pagamento no checkout de sua loja.</tooltip>
|
39 |
-
<frontend_type>text</frontend_type>
|
40 |
-
<sort_order>3</sort_order>
|
41 |
<show_in_default>1</show_in_default>
|
42 |
<show_in_website>1</show_in_website>
|
43 |
<show_in_store>0</show_in_store>
|
44 |
-
</
|
45 |
|
46 |
<email translate="label">
|
47 |
<label>Email cadastrado no Bcash</label>
|
48 |
-
<comment>Clique <a href="https://www.bcash.com.br/criar-conta-comprador/" target="_blank">aqui</a> e cadastre-se.</comment>
|
49 |
<frontend_type>text</frontend_type>
|
50 |
<validate>validate-email</validate>
|
51 |
<sort_order>4</sort_order>
|
@@ -56,7 +35,7 @@
|
|
56 |
|
57 |
<token translate="label">
|
58 |
<label>Token</label>
|
59 |
-
<
|
60 |
<frontend_type>text</frontend_type>
|
61 |
<sort_order>5</sort_order>
|
62 |
<show_in_default>1</show_in_default>
|
@@ -66,9 +45,10 @@
|
|
66 |
|
67 |
<consumer_key translate="label">
|
68 |
<label>Consumer Key</label>
|
69 |
-
<
|
|
|
70 |
<frontend_type>text</frontend_type>
|
71 |
-
<sort_order>
|
72 |
<show_in_default>1</show_in_default>
|
73 |
<show_in_website>1</show_in_website>
|
74 |
<show_in_store>0</show_in_store>
|
@@ -77,85 +57,180 @@
|
|
77 |
<transacao_dependente>
|
78 |
<label>Transação dependente</label>
|
79 |
<tooltip>Adicione a comissão por transação dependente via Bcash, são válidos até 6 emails.</tooltip>
|
80 |
-
<frontend_model>
|
81 |
<backend_model>adminhtml/system_config_backend_serialized</backend_model>
|
82 |
-
<comment><![CDATA[Acesse
|
83 |
-
<sort_order>
|
84 |
<show_in_default>1</show_in_default>
|
85 |
-
<show_in_website>
|
86 |
<show_in_store>0</show_in_store>
|
87 |
<can_be_empty>0</can_be_empty>
|
88 |
</transacao_dependente>
|
89 |
-
|
90 |
-
<
|
91 |
-
<label>
|
92 |
-
<
|
93 |
-
<frontend_type>
|
94 |
-
<
|
95 |
-
<
|
96 |
<show_in_default>1</show_in_default>
|
97 |
<show_in_website>1</show_in_website>
|
98 |
<show_in_store>0</show_in_store>
|
99 |
-
</
|
100 |
|
101 |
-
<
|
102 |
-
<label>
|
103 |
-
<
|
104 |
-
<frontend_type>
|
105 |
-
<
|
106 |
-
<sort_order>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
<show_in_default>1</show_in_default>
|
108 |
<show_in_website>1</show_in_website>
|
109 |
<show_in_store>0</show_in_store>
|
110 |
-
|
|
|
|
|
|
|
111 |
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
<frontend_type>text</frontend_type>
|
116 |
-
<
|
117 |
-
<sort_order>9</sort_order>
|
118 |
<show_in_default>1</show_in_default>
|
119 |
<show_in_website>1</show_in_website>
|
120 |
<show_in_store>0</show_in_store>
|
121 |
-
</
|
122 |
|
123 |
<max_installments translate="label">
|
124 |
-
<label>Quantidade
|
125 |
<tooltip>Define o limite do número de parcelas</tooltip>
|
126 |
<frontend_type>select</frontend_type>
|
127 |
-
<source_model>
|
128 |
-
<sort_order>
|
129 |
-
<show_in_default>
|
130 |
-
<show_in_website>
|
131 |
<show_in_store>0</show_in_store>
|
132 |
</max_installments>
|
133 |
|
134 |
-
<
|
135 |
-
<label>
|
136 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
<frontend_type>select</frontend_type>
|
138 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
139 |
-
<sort_order>
|
140 |
<show_in_default>1</show_in_default>
|
141 |
<show_in_website>1</show_in_website>
|
142 |
<show_in_store>0</show_in_store>
|
143 |
-
</
|
144 |
|
145 |
-
<
|
146 |
-
<label>
|
147 |
-
<tooltip>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
<frontend_type>select</frontend_type>
|
149 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
150 |
-
<sort_order>
|
151 |
<show_in_default>1</show_in_default>
|
152 |
<show_in_website>1</show_in_website>
|
153 |
<show_in_store>0</show_in_store>
|
154 |
-
</
|
155 |
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
</groups>
|
160 |
</payment>
|
161 |
</sections>
|
3 |
<sections>
|
4 |
<payment>
|
5 |
<groups>
|
6 |
+
<bcash translate="label" module="bcash">
|
7 |
+
<label>Bcash - Configuração de Credenciais e Preferências</label>
|
8 |
<sort_order>1</sort_order>
|
9 |
<show_in_default>1</show_in_default>
|
10 |
<show_in_website>1</show_in_website>
|
11 |
<show_in_store>0</show_in_store>
|
|
|
12 |
<fields>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
<sandbox translate="label">
|
14 |
+
<label>Habilitar Sandbox?</label>
|
15 |
+
<comment>Deixe o Sandbox habilitado somente para utilização de credenciais em ambiente de testes/homologação.</comment>
|
16 |
<tooltip>Deseja utilizar o módulo em ambiente de testes?</tooltip>
|
17 |
<frontend_type>select</frontend_type>
|
18 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
19 |
<sort_order>2</sort_order>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
<show_in_default>1</show_in_default>
|
21 |
<show_in_website>1</show_in_website>
|
22 |
<show_in_store>0</show_in_store>
|
23 |
+
</sandbox>
|
24 |
|
25 |
<email translate="label">
|
26 |
<label>Email cadastrado no Bcash</label>
|
27 |
+
<comment>Não possui? Clique <a href="https://www.bcash.com.br/criar-conta-comprador/" target="_blank">aqui</a> e cadastre-se agora.</comment>
|
28 |
<frontend_type>text</frontend_type>
|
29 |
<validate>validate-email</validate>
|
30 |
<sort_order>4</sort_order>
|
35 |
|
36 |
<token translate="label">
|
37 |
<label>Token</label>
|
38 |
+
<comment>Acesse o menu do seu painel Bcash em "Ferramentas" > "Códigos Integração" > copie o código em "Sua Chave acesso"</comment>
|
39 |
<frontend_type>text</frontend_type>
|
40 |
<sort_order>5</sort_order>
|
41 |
<show_in_default>1</show_in_default>
|
45 |
|
46 |
<consumer_key translate="label">
|
47 |
<label>Consumer Key</label>
|
48 |
+
<comment>Acesse o menu do seu painel Bcash em "Ferramentas" > "Gerenciamento de APIs"</comment>
|
49 |
+
<tooltip>Acesse o menu do seu painel Bcash em Ferramentas > Gerenciamento de APIs. Caso não esteja disponível essa opção entre em contato com a equipe do comercial solicitando a liberação da API através do e-mail: comercial@bcash.com.br.</tooltip>
|
50 |
<frontend_type>text</frontend_type>
|
51 |
+
<sort_order>6</sort_order>
|
52 |
<show_in_default>1</show_in_default>
|
53 |
<show_in_website>1</show_in_website>
|
54 |
<show_in_store>0</show_in_store>
|
57 |
<transacao_dependente>
|
58 |
<label>Transação dependente</label>
|
59 |
<tooltip>Adicione a comissão por transação dependente via Bcash, são válidos até 6 emails.</tooltip>
|
60 |
+
<frontend_model>bcash/adminhtml_dependentes</frontend_model>
|
61 |
<backend_model>adminhtml/system_config_backend_serialized</backend_model>
|
62 |
+
<comment><![CDATA[Acesse o menu do seu painel Bcash em "Ferramentas > Transação Dependente", o limite definido aqui não deve ultrapassar o valor definido no painel.]]></comment>
|
63 |
+
<sort_order>7</sort_order>
|
64 |
<show_in_default>1</show_in_default>
|
65 |
+
<show_in_website>1</show_in_website>
|
66 |
<show_in_store>0</show_in_store>
|
67 |
<can_be_empty>0</can_be_empty>
|
68 |
</transacao_dependente>
|
69 |
+
|
70 |
+
<cpf translate="label">
|
71 |
+
<label>Solicitar CPF?</label>
|
72 |
+
<comment>Habilite esta opção se sua loja não possui CPF como obrigatório na criação de conta do cliente.</comment>
|
73 |
+
<frontend_type>select</frontend_type>
|
74 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
75 |
+
<sort_order>8</sort_order>
|
76 |
<show_in_default>1</show_in_default>
|
77 |
<show_in_website>1</show_in_website>
|
78 |
<show_in_store>0</show_in_store>
|
79 |
+
</cpf>
|
80 |
|
81 |
+
<phone translate="label">
|
82 |
+
<label>Solicitar Telefone?</label>
|
83 |
+
<comment>Habilite esta opção se sua loja não possui Telefone como obrigatório na criação de conta do cliente.</comment>
|
84 |
+
<frontend_type>select</frontend_type>
|
85 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
86 |
+
<sort_order>9</sort_order>
|
87 |
+
<show_in_default>1</show_in_default>
|
88 |
+
<show_in_website>1</show_in_website>
|
89 |
+
<show_in_store>0</show_in_store>
|
90 |
+
</phone>
|
91 |
+
<logfile translate="label">
|
92 |
+
<label>Salvar Logs?</label>
|
93 |
+
<frontend_type>select</frontend_type>
|
94 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
95 |
+
<sort_order>10</sort_order>
|
96 |
<show_in_default>1</show_in_default>
|
97 |
<show_in_website>1</show_in_website>
|
98 |
<show_in_store>0</show_in_store>
|
99 |
+
<comment>Local do arquivo: var\log\bcash-magento.log</comment>
|
100 |
+
</logfile>
|
101 |
+
</fields>
|
102 |
+
</bcash>
|
103 |
|
104 |
+
<bcash_creditcard translate="label" module="bcash_creditcard">
|
105 |
+
<label>Bcash - Cartão de Crédito</label>
|
106 |
+
<sort_order>2</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>0</show_in_store>
|
110 |
+
<fields>
|
111 |
+
<active translate="label">
|
112 |
+
<label>Habilitado?</label>
|
113 |
+
<tooltip>Deseja habilitar o método por Cartão de Crédito?</tooltip>
|
114 |
+
<frontend_type>select</frontend_type>
|
115 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
116 |
+
<sort_order>1</sort_order>
|
117 |
+
<show_in_default>1</show_in_default>
|
118 |
+
<show_in_website>1</show_in_website>
|
119 |
+
<show_in_store>0</show_in_store>
|
120 |
+
</active>
|
121 |
+
|
122 |
+
<title translate="label">
|
123 |
+
<label>Titulo do método de pagamento</label>
|
124 |
+
<tooltip>Informe o nome que deve ser apresentado para este meio de pagamento no checkout de sua loja.</tooltip>
|
125 |
<frontend_type>text</frontend_type>
|
126 |
+
<sort_order>2</sort_order>
|
|
|
127 |
<show_in_default>1</show_in_default>
|
128 |
<show_in_website>1</show_in_website>
|
129 |
<show_in_store>0</show_in_store>
|
130 |
+
</title>
|
131 |
|
132 |
<max_installments translate="label">
|
133 |
+
<label>Quantidade máxima de parcelas</label>
|
134 |
<tooltip>Define o limite do número de parcelas</tooltip>
|
135 |
<frontend_type>select</frontend_type>
|
136 |
+
<source_model>bcash/system_config_source_installments</source_model>
|
137 |
+
<sort_order>3</sort_order>
|
138 |
+
<show_in_default>1</show_in_default>
|
139 |
+
<show_in_website>1</show_in_website>
|
140 |
<show_in_store>0</show_in_store>
|
141 |
</max_installments>
|
142 |
|
143 |
+
<sort_order translate="label">
|
144 |
+
<label>Posição no Checkout</label>
|
145 |
+
<frontend_type>text</frontend_type>
|
146 |
+
<sort_order>4</sort_order>
|
147 |
+
<show_in_default>1</show_in_default>
|
148 |
+
<show_in_website>1</show_in_website>
|
149 |
+
<show_in_store>0</show_in_store>
|
150 |
+
<frontend_class>validate-number</frontend_class>
|
151 |
+
</sort_order>
|
152 |
+
</fields>
|
153 |
+
</bcash_creditcard>
|
154 |
+
|
155 |
+
<bcash_bankslip translate="label" module="bcash_bankslip">
|
156 |
+
<label>Bcash - Boleto</label>
|
157 |
+
<sort_order>3</sort_order>
|
158 |
+
<show_in_default>1</show_in_default>
|
159 |
+
<show_in_website>1</show_in_website>
|
160 |
+
<show_in_store>0</show_in_store>
|
161 |
+
<fields>
|
162 |
+
<active translate="label">
|
163 |
+
<label>Habilitado?</label>
|
164 |
+
<tooltip>Deseja habilitar o método por boleto?</tooltip>
|
165 |
<frontend_type>select</frontend_type>
|
166 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
167 |
+
<sort_order>1</sort_order>
|
168 |
<show_in_default>1</show_in_default>
|
169 |
<show_in_website>1</show_in_website>
|
170 |
<show_in_store>0</show_in_store>
|
171 |
+
</active>
|
172 |
|
173 |
+
<title translate="label">
|
174 |
+
<label>Titulo do método de pagamento</label>
|
175 |
+
<tooltip>Informe o nome que deve ser apresentado para este meio de pagamento no checkout de sua loja.</tooltip>
|
176 |
+
<frontend_type>text</frontend_type>
|
177 |
+
<sort_order>2</sort_order>
|
178 |
+
<show_in_default>1</show_in_default>
|
179 |
+
<show_in_website>1</show_in_website>
|
180 |
+
<show_in_store>0</show_in_store>
|
181 |
+
</title>
|
182 |
+
|
183 |
+
<sort_order translate="label">
|
184 |
+
<label>Posição no Checkout</label>
|
185 |
+
<frontend_type>text</frontend_type>
|
186 |
+
<sort_order>3</sort_order>
|
187 |
+
<show_in_default>1</show_in_default>
|
188 |
+
<show_in_website>1</show_in_website>
|
189 |
+
<show_in_store>0</show_in_store>
|
190 |
+
<frontend_class>validate-number</frontend_class>
|
191 |
+
</sort_order>
|
192 |
+
</fields>
|
193 |
+
</bcash_bankslip>
|
194 |
+
|
195 |
+
<bcash_onlinetransfer translate="label" module="bcash_onlinetransfer">
|
196 |
+
<label>Bcash - Transferência Online (TEF)</label>
|
197 |
+
<sort_order>4</sort_order>
|
198 |
+
<show_in_default>1</show_in_default>
|
199 |
+
<show_in_website>1</show_in_website>
|
200 |
+
<show_in_store>0</show_in_store>
|
201 |
+
<fields>
|
202 |
+
<active translate="label">
|
203 |
+
<label>Habilitado?</label>
|
204 |
+
<tooltip>Deseja habilitar o método por TEF?</tooltip>
|
205 |
<frontend_type>select</frontend_type>
|
206 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
207 |
+
<sort_order>1</sort_order>
|
208 |
<show_in_default>1</show_in_default>
|
209 |
<show_in_website>1</show_in_website>
|
210 |
<show_in_store>0</show_in_store>
|
211 |
+
</active>
|
212 |
|
213 |
+
<title translate="label">
|
214 |
+
<label>Titulo do método de pagamento</label>
|
215 |
+
<tooltip>Informe o nome que deve ser apresentado para este meio de pagamento no checkout de sua loja.</tooltip>
|
216 |
+
<frontend_type>text</frontend_type>
|
217 |
+
<sort_order>2</sort_order>
|
218 |
+
<show_in_default>1</show_in_default>
|
219 |
+
<show_in_website>1</show_in_website>
|
220 |
+
<show_in_store>0</show_in_store>
|
221 |
+
</title>
|
222 |
|
223 |
+
<sort_order translate="label">
|
224 |
+
<label>Posição no Checkout</label>
|
225 |
+
<frontend_type>text</frontend_type>
|
226 |
+
<sort_order>3</sort_order>
|
227 |
+
<show_in_default>1</show_in_default>
|
228 |
+
<show_in_website>1</show_in_website>
|
229 |
+
<show_in_store>0</show_in_store>
|
230 |
+
<frontend_class>validate-number</frontend_class>
|
231 |
+
</sort_order>
|
232 |
+
</fields>
|
233 |
+
</bcash_onlinetransfer>
|
234 |
</groups>
|
235 |
</payment>
|
236 |
</sections>
|
app/code/community/Bcash/Pagamento/sql/pagamento_setup/mysql4-install-0.1.0.php
CHANGED
@@ -128,7 +128,5 @@ try {
|
|
128 |
$installer->endSetup();
|
129 |
|
130 |
} catch (Exception $e) {
|
131 |
-
|
132 |
-
Mage::log($e->getMessage());
|
133 |
-
|
134 |
}
|
128 |
$installer->endSetup();
|
129 |
|
130 |
} catch (Exception $e) {
|
131 |
+
Mage::log("Exception - app/code/community/Bcash/Pagamento/sql/pagamento_setup/mysql4-install-0.1.0.php: " . $e->getMessage());
|
|
|
|
|
132 |
}
|
app/code/community/Bcash/Pagamento/sql/pagamento_setup/mysql4-upgrade-0.1.0-1.2.2.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Fix old payment method name
|
4 |
+
*/
|
5 |
+
try {
|
6 |
+
$installer = $this;
|
7 |
+
$installer->startSetup();
|
8 |
+
|
9 |
+
$table_order_payment = $installer->getTable('sales_flat_order_payment');
|
10 |
+
$table_order = $installer->getTable('sales_flat_order');
|
11 |
+
$table_quote_payment = $installer->getTable('sales_flat_quote_payment');
|
12 |
+
$table_quote = $installer->getTable('sales_flat_quote');
|
13 |
+
|
14 |
+
// Payment method codes
|
15 |
+
$credit_card = "(1, 2, 37, 45, 55, 56, 63)";
|
16 |
+
$bankslip = "10";
|
17 |
+
$onlinetransfer = "(58, 59, 60, 61, 62)";
|
18 |
+
|
19 |
+
$installer->run("
|
20 |
+
UPDATE `{$table_order_payment}`
|
21 |
+
SET `method` = 'bcash_creditcard'
|
22 |
+
WHERE `parent_id` IN
|
23 |
+
(SELECT `entity_id` FROM `{$table_order}`
|
24 |
+
WHERE `payment_method_bcash` IN {$credit_card}
|
25 |
+
);
|
26 |
+
|
27 |
+
UPDATE `{$table_order_payment}`
|
28 |
+
SET `method` = 'bcash_bankslip'
|
29 |
+
WHERE `parent_id` IN
|
30 |
+
(SELECT `entity_id` FROM `{$table_order}`
|
31 |
+
WHERE `payment_method_bcash` = {$bankslip}
|
32 |
+
);
|
33 |
+
|
34 |
+
UPDATE `{$table_order_payment}`
|
35 |
+
SET `method` = 'bcash_onlinetransfer'
|
36 |
+
WHERE `parent_id` IN
|
37 |
+
(SELECT `entity_id` FROM `{$table_order}`
|
38 |
+
WHERE `payment_method_bcash` IN {$onlinetransfer}
|
39 |
+
);
|
40 |
+
|
41 |
+
UPDATE `{$table_quote_payment}`
|
42 |
+
SET `method` = 'bcash_creditcard'
|
43 |
+
WHERE `quote_id` IN
|
44 |
+
(SELECT `entity_id` FROM `{$table_quote}`
|
45 |
+
WHERE `payment_method_bcash` IN {$credit_card}
|
46 |
+
);
|
47 |
+
|
48 |
+
UPDATE `{$table_quote_payment}`
|
49 |
+
SET `method` = 'bcash_bankslip'
|
50 |
+
WHERE `quote_id` IN
|
51 |
+
(SELECT `entity_id` FROM `{$table_quote}`
|
52 |
+
WHERE `payment_method_bcash` = {$bankslip}
|
53 |
+
);
|
54 |
+
|
55 |
+
UPDATE `{$table_quote_payment}`
|
56 |
+
SET `method` = 'bcash_onlinetransfer'
|
57 |
+
WHERE `quote_id` IN
|
58 |
+
(SELECT `entity_id` FROM `{$table_quote}`
|
59 |
+
WHERE `payment_method_bcash` IN {$onlinetransfer}
|
60 |
+
);
|
61 |
+
");
|
62 |
+
|
63 |
+
$installer->endSetup();
|
64 |
+
|
65 |
+
} catch (Exception $e) {
|
66 |
+
Mage::log("Exception - app/code/community/Bcash/Pagamento/sql/pagamento_setup/mysql4-upgrade-0.1.0-1.2.2.php: " . $e->getMessage());
|
67 |
+
}
|
app/design/adminhtml/default/default/template/bcash/pagamento/info.phtml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$info_payment = $this->getInfoPayment();
|
3 |
+
|
4 |
+
?>
|
5 |
+
<table cellspacing="0" class="form-list">
|
6 |
+
<tbody>
|
7 |
+
<tr>
|
8 |
+
<td class="label"><label>Meio de pagamento </label></td>
|
9 |
+
<td class="value"><label><strong><?php echo $this->getMethod()->getTitle() ?></strong></label></td>
|
10 |
+
</tr>
|
11 |
+
<?php foreach ($info_payment as $detalhes): ?>
|
12 |
+
<tr>
|
13 |
+
<?php if (!empty($detalhes['valor'])):
|
14 |
+
if ($detalhes['titulo'] == "method_payment"):
|
15 |
+
else:
|
16 |
+
echo '<td class="label"><label>' . $detalhes['titulo'] . '</label></td>';
|
17 |
+
echo '<td class="value"><label>' . ($detalhes['titulo'] == "Link" ? '<a href="' . $detalhes['valor'] . '" target="_blank">Acessar link de pagamento</a>' : $detalhes['valor']) . '</strong></label></td>';
|
18 |
+
endif;
|
19 |
+
endif; ?>
|
20 |
+
</tr>
|
21 |
+
<?php endforeach; ?>
|
22 |
+
</tbody>
|
23 |
+
</table>
|
24 |
+
<br/>
|
app/design/frontend/base/default/layout/bcash/pagamento/layout.xml
CHANGED
@@ -9,10 +9,10 @@
|
|
9 |
</checkout_onepage_paymentmethod>
|
10 |
<sales_order_view>
|
11 |
<reference name="sales.order.info.buttons">
|
12 |
-
<block type="sales/order_info_buttons" name="customer.order.payment.button" as="customer_order_payment_button" template="pagamento/sales/order/info/buttons/payment.phtml"></block>
|
13 |
</reference>
|
14 |
<reference name="sales.order.info">
|
15 |
-
<block type="sales/order_info" name="customer.order.payment" as="customer_order_payment" template="pagamento/sales/order/info/info.phtml"></block>
|
16 |
</reference>
|
17 |
</sales_order_view>
|
18 |
</layout>
|
9 |
</checkout_onepage_paymentmethod>
|
10 |
<sales_order_view>
|
11 |
<reference name="sales.order.info.buttons">
|
12 |
+
<block type="sales/order_info_buttons" name="customer.order.payment.button" as="customer_order_payment_button" template="bcash/pagamento/sales/order/info/buttons/payment.phtml"></block>
|
13 |
</reference>
|
14 |
<reference name="sales.order.info">
|
15 |
+
<block type="sales/order_info" name="customer.order.payment" as="customer_order_payment" template="bcash/pagamento/sales/order/info/info.phtml"></block>
|
16 |
</reference>
|
17 |
</sales_order_view>
|
18 |
</layout>
|
app/design/frontend/base/default/template/bcash/pagamento/checkout/success.phtml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<link rel="stylesheet" href="<?php echo $this->getSkinUrl('bcash/pagamento/css/application.css') ?>?v=<?php echo rand();?>" type="text/css"/>
|
2 |
+
<div id="bcash_pagamento" class="bcash-checkout-success">
|
3 |
+
<?php
|
4 |
+
$url = Mage::getUrl('', array('_secure' => true)) . 'sales/order/view/order_id/' . $this->getOrder()->getId();
|
5 |
+
$idPedido = $this->getQuote()->getReservedOrderId();
|
6 |
+
$type = $this->getType();
|
7 |
+
if ($type && $type->type == Bcash_Pagamento_Helper_PaymentMethod::CARD_TYPE): ?>
|
8 |
+
<!-- Compra realizada via Cartão de Crédito -->
|
9 |
+
<?php elseif ($type && $type->type == Bcash_Pagamento_Helper_PaymentMethod::ONLINE_TRANSFER_TYPE): ?>
|
10 |
+
<!-- Compra realizada via Transferência -->
|
11 |
+
<p>Clique no ícone para acessar seu banco e realizar a transferência:</p>
|
12 |
+
<div class="bcash-clr"></div>
|
13 |
+
<a href="<?php echo $this->getQuote()->getPaymentLinkBcash() ?>" target="_blank">
|
14 |
+
<label class="bandeira band-<?php echo $type->id ?>" for="payment-method-<?php echo $type->id ?>"></label>
|
15 |
+
</a>
|
16 |
+
<?php elseif ($type && $type->type == Bcash_Pagamento_Helper_PaymentMethod::BANKSLIP_TYPE): ?>
|
17 |
+
<!-- Compra realizada via Boleto -->
|
18 |
+
<p>Clique no ícone para gerar o boleto para pagamento:</p>
|
19 |
+
<div class="bcash-clr"></div>
|
20 |
+
<a href="<?php echo $this->getQuote()->getPaymentLinkBcash() ?>" target="_blank">
|
21 |
+
<label class="bandeira band-<?php echo $type->id ?>" for="payment-method-<?php echo $type->id ?>"></label>
|
22 |
+
</a>
|
23 |
+
<?php endif; ?>
|
24 |
+
</div>
|
app/design/frontend/base/default/template/bcash/pagamento/form/bankslip.phtml
ADDED
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$code = $this->getMethodCode();
|
3 |
+
$paymentMethods = $this->getPaymentMethods();
|
4 |
+
$size = count($paymentMethods);
|
5 |
+
?>
|
6 |
+
<div id="payment-<?php echo $code; ?>">
|
7 |
+
<link rel="stylesheet" href="<?php echo $this->getSkinUrl('bcash/pagamento/css/application.css') ?>?v=<?php echo rand();?>" type="text/css"/>
|
8 |
+
<div class="form-list" id="payment_form_<?php echo $code; ?>" style="display:none;">
|
9 |
+
<div class="payment-group" >
|
10 |
+
<div class="b-row" style="padding-left:15px; margin-bottom:10px">
|
11 |
+
<?php if($this->getCpf()) : ?>
|
12 |
+
<div class="" style="float:left; width:40%; margin:2px">
|
13 |
+
<label>CPF/CNPJ do titular</label>
|
14 |
+
<input type="text" class="b-form-control validate-cpf-cnpj-bankslip" id="cpf_cnpj_<?php echo $code; ?>"
|
15 |
+
name="cpf_cnpj_<?php echo $code; ?>" value=""
|
16 |
+
maxlength="18" autocomplete="off"/>
|
17 |
+
</div>
|
18 |
+
<?php endif; ?>
|
19 |
+
<?php if($this->getPhone()) : ?>
|
20 |
+
<div class="" style="float:left; width:53%; margin:3px; margin-left:10px">
|
21 |
+
<label>Telefone do titular</label><br />
|
22 |
+
<div style="width: 53px; float: left;">
|
23 |
+
<input type="text" class="b-form-control validate-ddd-bankslip" maxlength="2" value=""
|
24 |
+
name="ddd_<?php echo $code; ?>"
|
25 |
+
id="ddd_<?php echo $code; ?>">
|
26 |
+
</div>
|
27 |
+
<div style="width: 123px; float: left; margin-left:3px">
|
28 |
+
<input type="text" class="b-form-control validate-phone-bankslip" maxlength="9" value=""
|
29 |
+
name="phone_<?php echo $code; ?>"
|
30 |
+
id="phone_<?php echo $code; ?>">
|
31 |
+
</div>
|
32 |
+
|
33 |
+
</div>
|
34 |
+
<?php endif; ?>
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
|
39 |
+
<div id="payment-bcash-group-<?php echo $code; ?>">
|
40 |
+
<?php
|
41 |
+
if($size > 0) {
|
42 |
+
foreach ($paymentMethods as $paymentType => $payments) { ?>
|
43 |
+
<?php
|
44 |
+
$totalPayments = count($payments);
|
45 |
+
if ($totalPayments > 0) {
|
46 |
+
?>
|
47 |
+
<div class="payment-group">
|
48 |
+
<div>
|
49 |
+
<ul>
|
50 |
+
<?php foreach ($payments as $payment) { ?>
|
51 |
+
<li>
|
52 |
+
<input type="radio"
|
53 |
+
class="payment-method-bcash-<?php echo $code; ?> validate-one-required-by-name"
|
54 |
+
id="payment-method-<?php echo $payment->id ?>" name="bcash-payment-method"
|
55 |
+
value="<?php echo $payment->id ?>" class/>
|
56 |
+
<label class="bandeira bandeira-<?php echo $code; ?> band-<?php echo $payment->id ?>"
|
57 |
+
for="payment-method-<?php echo $payment->id ?>"></label>
|
58 |
+
</li>
|
59 |
+
<?php } ?>
|
60 |
+
</ul>
|
61 |
+
</div>
|
62 |
+
<?php if ($size > 1) { ?>
|
63 |
+
<hr>
|
64 |
+
<?php } ?>
|
65 |
+
</div>
|
66 |
+
<?php
|
67 |
+
} ?>
|
68 |
+
<!-- payment-group -->
|
69 |
+
<?php
|
70 |
+
$size--;
|
71 |
+
}
|
72 |
+
}else {
|
73 |
+
echo "Meio de pagamento indisponível no momento. Verifique suas credenciais e tente novamente.";
|
74 |
+
}?>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
<!-- div b-col-xs-4 -->
|
78 |
+
<script type="text/javascript">
|
79 |
+
//<![CDATA[
|
80 |
+
var requestUrl = '<?php echo Mage::getUrl('bcash/payment/dados',array('_secure'=>true)) ?>';
|
81 |
+
|
82 |
+
function in_array(needle, haystack, argStrict) {
|
83 |
+
var key = '',
|
84 |
+
strict = !!argStrict;
|
85 |
+
if (strict) {
|
86 |
+
for (key in haystack) {
|
87 |
+
if (haystack[key] === needle) {
|
88 |
+
return true;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
} else {
|
92 |
+
for (key in haystack) {
|
93 |
+
if (haystack[key] == needle) {
|
94 |
+
return true;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
return false;
|
99 |
+
}
|
100 |
+
|
101 |
+
var initBcashBankslipPagamento = function () {
|
102 |
+
|
103 |
+
function showBcashBankslipPaymentMethod() {
|
104 |
+
var paymentConteiner = document.getElementById('payment-<?php echo $code; ?>');
|
105 |
+
var paymentBcashConteiner = document.getElementById('payment-bcash-group-<?php echo $code; ?>');
|
106 |
+
|
107 |
+
var paymentRadios = document.getElementsByClassName("payment-method-bcash-<?php echo $code; ?>");
|
108 |
+
for (var i = paymentRadios.length - 1; i >= 0; i--) {
|
109 |
+
if (!hasClass(paymentRadios[i], 'validate-one-required-by-name')) {
|
110 |
+
paymentRadios[i].className = paymentRadios[i].className + " validate-one-required-by-name";
|
111 |
+
}
|
112 |
+
|
113 |
+
//Caso houver somente 1 item, carregar selecionado
|
114 |
+
if(paymentRadios.length == 1) {
|
115 |
+
paymentRadios[i].disabled = false;
|
116 |
+
paymentRadios[i].checked = true;
|
117 |
+
|
118 |
+
var option = paymentRadios[i].value;
|
119 |
+
var typePayment = 'boleto';
|
120 |
+
new Ajax.Request(requestUrl, {
|
121 |
+
method: 'POST',
|
122 |
+
parameters: 'input=' + typePayment + '&tipo=' + option
|
123 |
+
});
|
124 |
+
}else {
|
125 |
+
paymentRadios[i].disabled = true;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
if (hasClass(paymentBcashConteiner, 'b-hide')) {
|
129 |
+
paymentBcashConteiner.className = paymentBcashConteiner.className.replace(/\bb-hide\b/, '');
|
130 |
+
}
|
131 |
+
if (hasClass(paymentConteiner, 'b-hide')) {
|
132 |
+
paymentConteiner.className = paymentConteiner.className.replace(/\bb-hide\b/, '');
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
function hideBcashBankslipPaymentMethod() {
|
137 |
+
var paymentConteiner = document.getElementById('payment-<?php echo $code; ?>');
|
138 |
+
var paymentBcashConteiner = document.getElementById('payment-bcash-group-<?php echo $code; ?>');
|
139 |
+
|
140 |
+
var paymentRadios = document.getElementsByClassName("payment-method-bcash-<?php echo $code; ?>");
|
141 |
+
for (var i = paymentRadios.length - 1; i >= 0; i--) {
|
142 |
+
if (hasClass(paymentRadios[i], 'validate-one-required-by-name')) {
|
143 |
+
paymentRadios[i].className = paymentRadios[i].className.replace(/\bvalidate-one-required-by-name\b/, '');
|
144 |
+
}
|
145 |
+
paymentRadios[i].disabled = true;
|
146 |
+
}
|
147 |
+
|
148 |
+
// all
|
149 |
+
if (!hasClass(paymentBcashConteiner, 'b-hide')) {
|
150 |
+
paymentBcashConteiner.className = paymentBcashConteiner.className + " b-hide";
|
151 |
+
}
|
152 |
+
if (!hasClass(paymentConteiner, 'b-hide')) {
|
153 |
+
paymentConteiner.className = paymentConteiner.className + " b-hide";
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
function clickFlagBankslip(e) {
|
158 |
+
var elem, evt = e ? e : event;
|
159 |
+
if (evt.srcElement) {
|
160 |
+
elem = evt.srcElement;
|
161 |
+
} else if (evt.target) {
|
162 |
+
elem = evt.target;
|
163 |
+
}
|
164 |
+
|
165 |
+
var paymentMethodBcash = elem.attributes['for'].value;
|
166 |
+
var paymentRadio = document.getElementById(paymentMethodBcash);
|
167 |
+
document.getElementById(paymentMethodBcash).disabled = false;
|
168 |
+
document.getElementById(paymentMethodBcash).checked = true;
|
169 |
+
|
170 |
+
new Ajax.Request(requestUrl, {
|
171 |
+
method: 'POST',
|
172 |
+
parameters: 'input=boleto&tipo=' + paymentRadio.value
|
173 |
+
});
|
174 |
+
|
175 |
+
document.body.select('input[type=radio][name="payment[method]"]').each(function (e) {
|
176 |
+
if (e.value == '<?php echo $code; ?>') {
|
177 |
+
e.checked = true;
|
178 |
+
}
|
179 |
+
});
|
180 |
+
}
|
181 |
+
|
182 |
+
var paymentsOptions = document.getElementsByClassName("bandeira-<?php echo $code; ?>");
|
183 |
+
for (var i = paymentsOptions.length - 1; i >= 0; i--) {
|
184 |
+
var paymentFlags = paymentsOptions[i];
|
185 |
+
paymentFlags.onclick = clickFlagBankslip;
|
186 |
+
}
|
187 |
+
|
188 |
+
$(document).on('change', 'input[type=radio][name=payment[method]]', function (event) {
|
189 |
+
var target = event.target;
|
190 |
+
var paymentConteiner = document.getElementById('payment-<?php echo $code; ?>');
|
191 |
+
var paymentBcashConteiner = document.getElementById('payment-bcash-group-<?php echo $code; ?>');
|
192 |
+
if (target.id == 'p_method_<?php echo $code; ?>') {
|
193 |
+
showBcashBankslipPaymentMethod();
|
194 |
+
} else {
|
195 |
+
|
196 |
+
hideBcashBankslipPaymentMethod();
|
197 |
+
}
|
198 |
+
event.preventDefault();
|
199 |
+
});
|
200 |
+
|
201 |
+
function hasClass(element, cls) {
|
202 |
+
return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1;
|
203 |
+
}
|
204 |
+
|
205 |
+
};
|
206 |
+
initBcashBankslipPagamento();
|
207 |
+
//]]>
|
208 |
+
</script>
|
app/design/frontend/base/default/template/{pagamento/form/payment.phtml → bcash/pagamento/form/creditcard.phtml}
RENAMED
@@ -1,26 +1,19 @@
|
|
1 |
-
<!-- <h1>Bcash</h1> -->
|
2 |
-
<link rel="stylesheet" href="<?php echo $this->getSkinUrl('bcash/pagamento/css/application.css') ?>" type="text/css"/>
|
3 |
-
<!-- Script Start -->
|
4 |
-
<!--<script type="text/javascript" src="<?php echo $this->getSkinUrl('bcash/pagamento/js/payment.js'); ?>"></script>//-->
|
5 |
-
<!-- Script End -->
|
6 |
<?php
|
7 |
-
$code = $this->
|
8 |
$paymentMethods = $this->getPaymentMethods();
|
9 |
$paymentInstallments = $this->getInstallments();
|
10 |
$size = count($paymentMethods);
|
11 |
-
$paymentGroupName = array(
|
12 |
-
'CARD' => "Cartão de crédito",
|
13 |
-
'BANKSLIP' => "Boleto Bancário",
|
14 |
-
'ONLINE_TRANSFER' => "Transferência Bancária"
|
15 |
-
);
|
16 |
?>
|
17 |
<div id="payment-<?php echo $code; ?>">
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
21 |
|
22 |
<div class="b-row" style="padding-left:15px; margin-bottom:10px">
|
23 |
-
<?php if($this->getCpf()) : ?>
|
24 |
<div class="" style="float:left; width:40%; margin:2px">
|
25 |
<label>CPF/CNPJ do titular</label>
|
26 |
<input type="text" class="b-form-control validate-cpf-cnpj" id="cpf_cnpj_bcash"
|
@@ -28,9 +21,9 @@ $paymentGroupName = array(
|
|
28 |
maxlength="18" autocomplete="off"/>
|
29 |
</div>
|
30 |
<?php endif; ?>
|
31 |
-
<?php if($this->getPhone()) : ?>
|
32 |
<div class="" style="float:left; width:53%; margin:3px; margin-left:10px">
|
33 |
-
<label>Telefone do titular</label><br
|
34 |
|
35 |
<div style="width: 53px; float: left;">
|
36 |
<input type="text" class="b-form-control validate-ddd" maxlength="2" value=""
|
@@ -48,138 +41,151 @@ $paymentGroupName = array(
|
|
48 |
</div>
|
49 |
</div>
|
50 |
</div>
|
|
|
51 |
|
52 |
-
<div id="payment-bcash-group">
|
53 |
-
<?php foreach ($paymentMethods as $paymentType => $payments): ?>
|
54 |
<?php
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
<
|
62 |
-
|
63 |
-
<
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
<div id="card-conteiner" class="b-form-group b-hide">
|
77 |
-
<div class="b-n-row">
|
78 |
-
<div class="b-form-group b-col-xs-8">
|
79 |
-
<label>Número do cartão</label>
|
80 |
-
<input type="text" class="b-form-control validate-number-card" maxlength="20" value=""
|
81 |
-
id="card_number_bcash"
|
82 |
-
name="card_number_bcash"
|
83 |
-
autocomplete="off" style="width:100%">
|
84 |
-
</div>
|
85 |
-
<div class="b-form-group b-col-xs-4" style="padding:0px">
|
86 |
-
<div>
|
87 |
-
<label>CVV <span class="icon-tooltip" data-tooltip="Código de segurança do cartão de crédito.">?</span></label>
|
88 |
-
<input type="text" class="b-form-control validate-ccv-card" maxlength="3" value=""
|
89 |
-
name="cvv_bcash"
|
90 |
-
id="cvv_bcash">
|
91 |
-
</div>
|
92 |
-
</div>
|
93 |
</div>
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
<div class="b-
|
99 |
-
<div class="b-col-xs-
|
100 |
-
<
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
</div>
|
113 |
-
<div class="b-col-xs-7" style="padding:0px
|
114 |
-
<
|
115 |
-
|
116 |
-
|
|
|
117 |
<?php
|
118 |
-
$
|
119 |
-
$
|
120 |
-
|
121 |
-
$
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
126 |
?>
|
127 |
</select>
|
128 |
</div>
|
129 |
</div>
|
130 |
-
</div>
|
131 |
-
<div class="b-form-group b-col-xs-7" style="padding-right:0px">
|
132 |
-
<label>Parcelas</label>
|
133 |
-
<select class="b-form-control validate-installments-bcash" name="installments_bcash" id="installments_bcash" style="max-width:100% !important">
|
134 |
-
<option value="" disabled> (Selecione o número de parcelas) </option>
|
135 |
-
<?php
|
136 |
-
$okInstallments = $paymentInstallments['ok'];
|
137 |
-
$installments = $paymentInstallments["installments"];
|
138 |
-
if (!$okInstallments) :
|
139 |
-
foreach ($installments as $times => $value) :
|
140 |
-
?>
|
141 |
-
<option value="<?php echo $times ?>"><?php echo $times ?>x - R$ <?php echo number_format($value,2,',','.')?></option>
|
142 |
-
<?php
|
143 |
-
endforeach;
|
144 |
-
endif;
|
145 |
-
?>
|
146 |
-
</select>
|
147 |
-
</div>
|
148 |
-
</div>
|
149 |
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
|
|
158 |
|
159 |
-
|
160 |
|
161 |
-
|
162 |
|
163 |
|
164 |
-
|
165 |
|
166 |
-
|
167 |
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
|
|
|
|
|
|
177 |
</div>
|
178 |
</div>
|
179 |
<!-- div b-col-xs-4 -->
|
180 |
<script type="text/javascript">
|
181 |
//<![CDATA[
|
182 |
-
var requestUrl = '<?php echo Mage::getUrl('
|
183 |
|
184 |
function in_array(needle, haystack, argStrict) {
|
185 |
var key = '',
|
@@ -240,37 +246,38 @@ $paymentGroupName = array(
|
|
240 |
echo "];";
|
241 |
?>
|
242 |
|
243 |
-
var
|
244 |
checkPaymentOnLoad();
|
245 |
uncheckBcashPaymentMethods();
|
246 |
|
247 |
function parseJSON(data) {
|
248 |
-
return (window.JSON && window.JSON.parse ? window.JSON.parse(
|
249 |
}
|
250 |
|
251 |
-
function showInstallmentsOnlyForMethod(method)
|
252 |
-
{
|
253 |
changeInstallmentsSelect("Carregando...");
|
254 |
// Update installments before show
|
255 |
updateInstallments(method);
|
256 |
}
|
257 |
|
258 |
-
function showInstallmentsSelectBox(method, installmentsStr)
|
259 |
-
{
|
260 |
var newInstallments = eval('(' + installmentsStr + ')');
|
261 |
|
262 |
if (in_array(method, cards)) {
|
263 |
var select_id = 'installments_bcash';
|
264 |
-
var select =
|
265 |
|
266 |
-
if(newInstallments.length > 1) {
|
267 |
// Remove options
|
268 |
-
var i;
|
|
|
|
|
|
|
269 |
|
270 |
// Add options
|
271 |
var option = '';
|
272 |
-
for (i=0; i < newInstallments.length; i++) {
|
273 |
-
if(newInstallments[i].ccId == 0) {
|
274 |
option = document.createElement("option");
|
275 |
option.text = newInstallments[i].ccDescript;
|
276 |
option.value = '';
|
@@ -278,7 +285,7 @@ $paymentGroupName = array(
|
|
278 |
select.add(option);
|
279 |
option = '';
|
280 |
}
|
281 |
-
if(newInstallments[i].ccId == method) {
|
282 |
option = document.createElement("option");
|
283 |
option.text = newInstallments[i].ccDescript;
|
284 |
option.value = newInstallments[i].ccNumber;
|
@@ -293,9 +300,12 @@ $paymentGroupName = array(
|
|
293 |
|
294 |
function changeInstallmentsSelect(text) {
|
295 |
var changeSelect_id = 'installments_bcash';
|
296 |
-
var changeSelect =
|
297 |
// Remove installments options
|
298 |
-
var i;
|
|
|
|
|
|
|
299 |
var changeOption = document.createElement("option");
|
300 |
changeOption.text = text;
|
301 |
changeOption.value = '';
|
@@ -308,33 +318,33 @@ $paymentGroupName = array(
|
|
308 |
cvvInput = document.getElementById("cvv_bcash");
|
309 |
cvvInput.value = '';
|
310 |
// Amex
|
311 |
-
if(card == american_express) {
|
312 |
cvvInput.maxLength = 4;
|
313 |
-
}else {
|
314 |
cvvInput.maxLength = 3;
|
315 |
}
|
316 |
|
317 |
-
if(cvvInput.hasClassName("validation-passed")) {
|
318 |
cvvInput.removeClassName("validation-passed");
|
319 |
}
|
320 |
|
321 |
// CVV não obrigatório
|
322 |
-
if(card == aura) {
|
323 |
-
if(cvvInput.hasClassName("validate-ccv-card")) {
|
324 |
cvvInput.removeClassName("validate-ccv-card");
|
325 |
}
|
326 |
-
}else {
|
327 |
-
if(!cvvInput.hasClassName("validate-ccv-card")) {
|
328 |
cvvInput.addClassName("validate-ccv-card");
|
329 |
}
|
330 |
}
|
331 |
}
|
332 |
|
333 |
function forceReloadOrderReviewOsc() {
|
334 |
-
if (typeof(OSCPayment) !== 'undefined') {
|
335 |
OSCPayment.forcesavePayment();
|
336 |
}
|
337 |
-
if(typeof(checkout) !== 'undefined') {
|
338 |
if ((typeof(checkout.update) !== 'undefined') && (typeof(checkout.urls) !== 'undefined')) {
|
339 |
checkout.update(checkout.urls.payment_method);
|
340 |
}
|
@@ -345,25 +355,25 @@ $paymentGroupName = array(
|
|
345 |
var hasChecked = 0;
|
346 |
var isBcash = 0;
|
347 |
document.body.select('input[type=radio][name="payment[method]"]').each(function (e) {
|
348 |
-
if(e.checked == true) {
|
349 |
hasChecked = 1;
|
350 |
-
if(e.value == '
|
351 |
isBcash = 1;
|
352 |
showBcashPaymentMethod();
|
353 |
}
|
354 |
}
|
355 |
});
|
356 |
|
357 |
-
if(hasChecked == 0 && isBcash == 0) {
|
358 |
document.body.select('input[type=radio][name="payment[method]"]').each(function (e) {
|
359 |
-
if(e.value == '
|
360 |
e.checked = true;
|
361 |
showBcashPaymentMethod();
|
362 |
}
|
363 |
});
|
364 |
}
|
365 |
|
366 |
-
if(hasChecked == 1 && isBcash == 0) {
|
367 |
hideBcashPaymentMethod();
|
368 |
}
|
369 |
}
|
@@ -404,7 +414,7 @@ $paymentGroupName = array(
|
|
404 |
if (iscard) {
|
405 |
if (v.length > 0) {
|
406 |
return validateCardNumber();
|
407 |
-
}else {
|
408 |
return false;
|
409 |
}
|
410 |
}
|
@@ -492,7 +502,7 @@ $paymentGroupName = array(
|
|
492 |
showInstallmentsOnlyForMethod(paymentRadio.value);
|
493 |
ableCvv(paymentRadio.value);
|
494 |
document.body.select('input[type=radio][name="payment[method]"]').each(function (e) {
|
495 |
-
if(e.value == '
|
496 |
e.checked = true;
|
497 |
}
|
498 |
});
|
@@ -516,7 +526,7 @@ $paymentGroupName = array(
|
|
516 |
}
|
517 |
|
518 |
function disableUnunsed(paymentRadio) {
|
519 |
-
var paymentRadios = document.getElementsByClassName("payment-method-bcash");
|
520 |
for (var i = paymentRadios.length - 1; i >= 0; i--) {
|
521 |
paymentRadios[i].disabled = true;
|
522 |
}
|
@@ -525,7 +535,6 @@ $paymentGroupName = array(
|
|
525 |
}
|
526 |
|
527 |
function isCard(element) {
|
528 |
-
//console.log(element);
|
529 |
return cards.indexOf(element.value) > -1;
|
530 |
}
|
531 |
|
@@ -582,7 +591,7 @@ $paymentGroupName = array(
|
|
582 |
if (key == 8 || key == 46 || key == 37 || key == 39 || key == 9 || key == 35 || key == 36) {
|
583 |
return true;
|
584 |
}
|
585 |
-
else if (
|
586 |
return false;
|
587 |
}
|
588 |
return true;
|
@@ -678,7 +687,7 @@ $paymentGroupName = array(
|
|
678 |
}
|
679 |
}
|
680 |
|
681 |
-
var paymentsOptions = document.getElementsByClassName("bandeira");
|
682 |
for (var i = paymentsOptions.length - 1; i >= 0; i--) {
|
683 |
var paymentFlags = paymentsOptions[i];
|
684 |
paymentFlags.onclick = clickFlag;
|
@@ -717,9 +726,10 @@ $paymentGroupName = array(
|
|
717 |
}
|
718 |
});
|
719 |
var $isCard = isCard(ElementPaymentMethod);
|
720 |
-
|
721 |
return {'element': ElementPaymentMethod, 'isCard': $isCard};
|
722 |
}
|
|
|
723 |
<?php if($this->getCpf()) : ?>
|
724 |
$('cpf_cnpj_bcash').observe('blur', function (e) {
|
725 |
var RegExp = /^[0-9]{11,14}$/;
|
@@ -810,8 +820,7 @@ $paymentGroupName = array(
|
|
810 |
});
|
811 |
<?php endif; ?>
|
812 |
|
813 |
-
function validateCardNumber()
|
814 |
-
{
|
815 |
var RegExpHipercard = /^(3841\d{10}(\d{3})?)|(3841\d{15})$/;
|
816 |
var RegExpElo = /^((((636368)|(438935)|(504175)|(451416)|(636297))\d{0,10})|((5067)|(4576)|(4011))\d{0,12})$/;
|
817 |
var RegExpElo2 = /^(636368|438935|504175|451416|636297)([0-9]{10})$/;
|
@@ -825,7 +834,9 @@ $paymentGroupName = array(
|
|
825 |
if (paymentRadio.isCard) {
|
826 |
var cardNumber = document.getElementById("card_number_bcash").value;
|
827 |
cardNumber = cardNumber.trim();
|
828 |
-
if(cardNumber.length <= 0) {
|
|
|
|
|
829 |
var codeCard = paymentRadio.element.value;
|
830 |
switch (parseInt(codeCard)) {
|
831 |
case visa:
|
@@ -838,19 +849,27 @@ $paymentGroupName = array(
|
|
838 |
RegexFinal = RegExpAmex;
|
839 |
break;
|
840 |
case elo:
|
841 |
-
if(cardNumber.length <= 16) {
|
|
|
|
|
842 |
RegexFinal = RegExpElo;
|
843 |
break;
|
844 |
case hipercard:
|
845 |
-
if(cardNumber.length >= 16 && cardNumber.length <= 19) {
|
|
|
|
|
846 |
RegexFinal = RegExpHipercard;
|
847 |
break;
|
848 |
case dinners:
|
849 |
-
if(cardNumber.length >= 14 && cardNumber.length <= 16) {
|
|
|
|
|
850 |
RegexFinal = RegExpDiners;
|
851 |
break;
|
852 |
case aura:
|
853 |
-
if(cardNumber.length == 19) {
|
|
|
|
|
854 |
RegexFinal = RegExpAura;
|
855 |
break;
|
856 |
}
|
@@ -869,11 +888,11 @@ $paymentGroupName = array(
|
|
869 |
}
|
870 |
|
871 |
function updateInstallments(method) {
|
872 |
-
new Ajax.Request('<?php echo Mage::getUrl('
|
873 |
method: 'post',
|
874 |
parameters: 'method=' + method,
|
875 |
onSuccess: successGetInstallments,
|
876 |
-
onFailure:
|
877 |
});
|
878 |
}
|
879 |
|
@@ -887,17 +906,17 @@ $paymentGroupName = array(
|
|
887 |
showInstallmentsSelectBox(strMethodResponse, strInstallmentsResponse);
|
888 |
}
|
889 |
|
890 |
-
function failureGetInstallments(response){
|
891 |
-
alert("Falha inesperada ao atualizar parcelamentos. Por favor, selecione o meio de pagamento novamente."
|
892 |
}
|
893 |
|
894 |
function hideBcashPaymentMethod() {
|
895 |
var paymentConteiner = document.getElementById('payment-<?php echo $code; ?>');
|
896 |
-
var paymentBcashConteiner = document.getElementById('payment-bcash-group');
|
897 |
|
898 |
// cards
|
899 |
var cardConteiner = document.getElementById('card-conteiner');
|
900 |
-
if(!hasClass(cardConteiner, 'b-hide')){
|
901 |
cardConteiner.className = cardConteiner.className + " b-hide";
|
902 |
}
|
903 |
disableCardForm();
|
@@ -908,16 +927,16 @@ $paymentGroupName = array(
|
|
908 |
element.checked = false;
|
909 |
}
|
910 |
});
|
911 |
-
var paymentRadios = document.getElementsByClassName("payment-method-bcash");
|
912 |
for (var i = paymentRadios.length - 1; i >= 0; i--) {
|
913 |
-
if(hasClass(paymentRadios[i], 'validate-one-required-by-name')) {
|
914 |
paymentRadios[i].className = paymentRadios[i].className.replace(/\bvalidate-one-required-by-name\b/, '');
|
915 |
}
|
916 |
paymentRadios[i].disabled = true;
|
917 |
}
|
918 |
|
919 |
// all
|
920 |
-
if(!hasClass(paymentBcashConteiner, 'b-hide')){
|
921 |
paymentBcashConteiner.className = paymentBcashConteiner.className + " b-hide";
|
922 |
}
|
923 |
if (!hasClass(paymentConteiner, 'b-hide')) {
|
@@ -935,16 +954,16 @@ $paymentGroupName = array(
|
|
935 |
|
936 |
function showBcashPaymentMethod() {
|
937 |
var paymentConteiner = document.getElementById('payment-<?php echo $code; ?>');
|
938 |
-
var paymentBcashConteiner = document.getElementById('payment-bcash-group');
|
939 |
|
940 |
-
var paymentRadios = document.getElementsByClassName("payment-method-bcash");
|
941 |
for (var i = paymentRadios.length - 1; i >= 0; i--) {
|
942 |
-
if(!hasClass(paymentRadios[i], 'validate-one-required-by-name')) {
|
943 |
paymentRadios[i].className = paymentRadios[i].className + " validate-one-required-by-name";
|
944 |
}
|
945 |
paymentRadios[i].disabled = false;
|
946 |
}
|
947 |
-
if(hasClass(paymentBcashConteiner, 'b-hide')) {
|
948 |
paymentBcashConteiner.className = paymentBcashConteiner.className.replace(/\bb-hide\b/, '');
|
949 |
}
|
950 |
if (hasClass(paymentConteiner, 'b-hide')) {
|
@@ -955,8 +974,8 @@ $paymentGroupName = array(
|
|
955 |
$(document).on('change', 'input[type=radio][name=payment[method]]', function (event) {
|
956 |
var target = event.target;
|
957 |
var paymentConteiner = document.getElementById('payment-<?php echo $code; ?>');
|
958 |
-
var paymentBcashConteiner = document.getElementById('payment-bcash-group');
|
959 |
-
if(target.id == '
|
960 |
showBcashPaymentMethod();
|
961 |
} else {
|
962 |
|
@@ -986,6 +1005,6 @@ $paymentGroupName = array(
|
|
986 |
event.preventDefault();
|
987 |
});
|
988 |
};
|
989 |
-
|
990 |
//]]>
|
991 |
</script>
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
$code = $this->getMethodCode();
|
3 |
$paymentMethods = $this->getPaymentMethods();
|
4 |
$paymentInstallments = $this->getInstallments();
|
5 |
$size = count($paymentMethods);
|
|
|
|
|
|
|
|
|
|
|
6 |
?>
|
7 |
<div id="payment-<?php echo $code; ?>">
|
8 |
+
<link rel="stylesheet"
|
9 |
+
href="<?php echo $this->getSkinUrl('bcash/pagamento/css/application.css') ?>?v=<?php echo rand(); ?>"
|
10 |
+
type="text/css"/>
|
11 |
+
<?php if ($this->getCpf() || $this->getPhone()) : ?>
|
12 |
+
<div class="form-list" id="payment_form_<?php echo $code; ?>" style="display:none;">
|
13 |
+
<div class="payment-group">
|
14 |
|
15 |
<div class="b-row" style="padding-left:15px; margin-bottom:10px">
|
16 |
+
<?php if ($this->getCpf()) : ?>
|
17 |
<div class="" style="float:left; width:40%; margin:2px">
|
18 |
<label>CPF/CNPJ do titular</label>
|
19 |
<input type="text" class="b-form-control validate-cpf-cnpj" id="cpf_cnpj_bcash"
|
21 |
maxlength="18" autocomplete="off"/>
|
22 |
</div>
|
23 |
<?php endif; ?>
|
24 |
+
<?php if ($this->getPhone()) : ?>
|
25 |
<div class="" style="float:left; width:53%; margin:3px; margin-left:10px">
|
26 |
+
<label>Telefone do titular</label><br/>
|
27 |
|
28 |
<div style="width: 53px; float: left;">
|
29 |
<input type="text" class="b-form-control validate-ddd" maxlength="2" value=""
|
41 |
</div>
|
42 |
</div>
|
43 |
</div>
|
44 |
+
<?php endif; ?>
|
45 |
|
46 |
+
<div id="payment-bcash-group-<?php echo $code; ?>">
|
|
|
47 |
<?php
|
48 |
+
if($size > 0) {
|
49 |
+
foreach ($paymentMethods as $paymentType => $payments) { ?>
|
50 |
+
<?php
|
51 |
+
$totalPayments = count($payments);
|
52 |
+
if ($totalPayments > 0) {
|
53 |
+
?>
|
54 |
+
<div class="payment-group">
|
55 |
+
<div>
|
56 |
+
<ul>
|
57 |
+
<?php foreach ($payments as $payment) { ?>
|
58 |
+
<li>
|
59 |
+
<input type="radio"
|
60 |
+
class="payment-method-bcash-<?php echo $code; ?> validate-one-required-by-name"
|
61 |
+
id="payment-method-<?php echo $payment->id ?>" name="bcash-payment-method"
|
62 |
+
value="<?php echo $payment->id ?>" class/>
|
63 |
+
<label
|
64 |
+
class="bandeira bandeira-<?php echo $code; ?> band-<?php echo $payment->id ?>"
|
65 |
+
for="payment-method-<?php echo $payment->id ?>"></label>
|
66 |
+
</li>
|
67 |
+
<?php } ?>
|
68 |
+
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
</div>
|
70 |
+
|
71 |
+
<?php if ($paymentType == 'CARD'): ?>
|
72 |
+
|
73 |
+
<div id="card-conteiner" class="b-form-group b-hide">
|
74 |
+
<div class="b-n-row">
|
75 |
+
<div class="b-form-group b-col-xs-8">
|
76 |
+
<label>Número do cartão</label>
|
77 |
+
<input type="text" class="b-form-control validate-number-card" maxlength="20"
|
78 |
+
value=""
|
79 |
+
id="card_number_bcash"
|
80 |
+
name="card_number_bcash"
|
81 |
+
autocomplete="off" style="width:100%">
|
82 |
+
</div>
|
83 |
+
<div class="b-form-group b-col-xs-4" style="padding:0px">
|
84 |
+
<div>
|
85 |
+
<label>CVV <span class="icon-tooltip"
|
86 |
+
data-tooltip="Código de segurança do cartão de crédito.">?</span></label>
|
87 |
+
<input type="text" class="b-form-control validate-ccv-card" maxlength="3"
|
88 |
+
value=""
|
89 |
+
name="cvv_bcash"
|
90 |
+
id="cvv_bcash">
|
91 |
+
</div>
|
92 |
+
</div>
|
93 |
+
</div>
|
94 |
+
<div class="b-n-row">
|
95 |
+
<div class="b-form-group b-col-xs-5" style="padding-right:0px">
|
96 |
+
<label class="">Validade</label>
|
97 |
+
|
98 |
+
<div class="b-form-group">
|
99 |
+
<div class="b-col-xs-5" style="padding:0px">
|
100 |
+
<select class="b-form-control validate-month-bcash" id="month_bcash"
|
101 |
+
name="month_bcash" style="padding: 2px;">
|
102 |
+
<option value=""></option>
|
103 |
+
<?php
|
104 |
+
for ($i = 1; $i < 13; $i++) :
|
105 |
+
$month = str_pad($i, 2, '0', STR_PAD_LEFT);
|
106 |
+
?>
|
107 |
+
<option value="<?php echo $month ?>"><?php echo $month ?></option>
|
108 |
+
<?php
|
109 |
+
endfor;
|
110 |
+
?>
|
111 |
+
</select>
|
112 |
+
</div>
|
113 |
+
<div class="b-col-xs-7" style="padding:0px; padding-left:4px">
|
114 |
+
<select class="b-form-control validate-year-bcash" id="year_bcash"
|
115 |
+
name="year_bcash" style="padding: 2px;">
|
116 |
+
<option value=""></option>
|
117 |
+
<?php
|
118 |
+
$year = date("Y");
|
119 |
+
$endYear = $year + 10;
|
120 |
+
for ($i = $year; $i < $endYear; $i++) :
|
121 |
+
$month = str_pad($i, 2, '0', STR_PAD_LEFT);
|
122 |
+
?>
|
123 |
+
<option value="<?php echo $month ?>"><?php echo $month ?></option>
|
124 |
+
<?php
|
125 |
+
endfor;
|
126 |
+
?>
|
127 |
+
</select>
|
128 |
+
</div>
|
129 |
+
</div>
|
130 |
</div>
|
131 |
+
<div class="b-form-group b-col-xs-7" style="padding-right:0px">
|
132 |
+
<label>Parcelas</label>
|
133 |
+
<select class="b-form-control validate-installments-bcash" name="installments_bcash"
|
134 |
+
id="installments_bcash" style="max-width:100% !important">
|
135 |
+
<option value="" disabled> (Selecione o número de parcelas)</option>
|
136 |
<?php
|
137 |
+
$okInstallments = $paymentInstallments['ok'];
|
138 |
+
$installments = $paymentInstallments["installments"];
|
139 |
+
if (!$okInstallments) :
|
140 |
+
foreach ($installments as $times => $value) :
|
141 |
+
?>
|
142 |
+
<option value="<?php echo $times ?>"><?php echo $times ?>x -
|
143 |
+
R$ <?php echo number_format($value, 2, ',', '.') ?></option>
|
144 |
+
<?php
|
145 |
+
endforeach;
|
146 |
+
endif;
|
147 |
?>
|
148 |
</select>
|
149 |
</div>
|
150 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
+
<div class="b-n-row">
|
153 |
+
<div class="b-form-group" style="padding-left:17px">
|
154 |
+
<label>Nome titular</label>
|
155 |
+
<input type="text" class="b-form-control validate-name-card" value=""
|
156 |
+
name="name_card_bcash"
|
157 |
+
id="name_card_bcash" maxlength="100"
|
158 |
+
autocomplete="off" style="width:100%">
|
159 |
+
</div>
|
160 |
+
</div>
|
161 |
|
162 |
+
<div class="b-row">
|
163 |
|
164 |
+
</div>
|
165 |
|
166 |
|
167 |
+
</div> <!-- card-conteiner -->
|
168 |
|
169 |
+
<?php endif; ?>
|
170 |
|
171 |
+
<?php if ($size > 1) { ?>
|
172 |
+
<hr>
|
173 |
+
<?php } ?>
|
174 |
+
</div>
|
175 |
+
<?php } ?>
|
176 |
+
<!-- payment-group -->
|
177 |
+
<?php
|
178 |
+
$size--;
|
179 |
+
}
|
180 |
+
}else {
|
181 |
+
echo "Meio de pagamento indisponível no momento. Verifique suas credenciais e tente novamente.";
|
182 |
+
} ?>
|
183 |
</div>
|
184 |
</div>
|
185 |
<!-- div b-col-xs-4 -->
|
186 |
<script type="text/javascript">
|
187 |
//<![CDATA[
|
188 |
+
var requestUrl = '<?php echo Mage::getUrl('bcash/payment/dados',array('_secure'=>true)) ?>';
|
189 |
|
190 |
function in_array(needle, haystack, argStrict) {
|
191 |
var key = '',
|
246 |
echo "];";
|
247 |
?>
|
248 |
|
249 |
+
var initBcashCreditCardPagamento = function () {
|
250 |
checkPaymentOnLoad();
|
251 |
uncheckBcashPaymentMethods();
|
252 |
|
253 |
function parseJSON(data) {
|
254 |
+
return (window.JSON && window.JSON.parse ? window.JSON.parse(data) : (new Function("return " + data))());
|
255 |
}
|
256 |
|
257 |
+
function showInstallmentsOnlyForMethod(method) {
|
|
|
258 |
changeInstallmentsSelect("Carregando...");
|
259 |
// Update installments before show
|
260 |
updateInstallments(method);
|
261 |
}
|
262 |
|
263 |
+
function showInstallmentsSelectBox(method, installmentsStr) {
|
|
|
264 |
var newInstallments = eval('(' + installmentsStr + ')');
|
265 |
|
266 |
if (in_array(method, cards)) {
|
267 |
var select_id = 'installments_bcash';
|
268 |
+
var select = document.getElementById(select_id);
|
269 |
|
270 |
+
if (newInstallments.length > 1) {
|
271 |
// Remove options
|
272 |
+
var i;
|
273 |
+
for (i = select.options.length - 1; i >= 0; i--) {
|
274 |
+
select.remove(i);
|
275 |
+
}
|
276 |
|
277 |
// Add options
|
278 |
var option = '';
|
279 |
+
for (i = 0; i < newInstallments.length; i++) {
|
280 |
+
if (newInstallments[i].ccId == 0) {
|
281 |
option = document.createElement("option");
|
282 |
option.text = newInstallments[i].ccDescript;
|
283 |
option.value = '';
|
285 |
select.add(option);
|
286 |
option = '';
|
287 |
}
|
288 |
+
if (newInstallments[i].ccId == method) {
|
289 |
option = document.createElement("option");
|
290 |
option.text = newInstallments[i].ccDescript;
|
291 |
option.value = newInstallments[i].ccNumber;
|
300 |
|
301 |
function changeInstallmentsSelect(text) {
|
302 |
var changeSelect_id = 'installments_bcash';
|
303 |
+
var changeSelect = document.getElementById(changeSelect_id);
|
304 |
// Remove installments options
|
305 |
+
var i;
|
306 |
+
for (i = changeSelect.options.length - 1; i >= 0; i--) {
|
307 |
+
changeSelect.remove(i);
|
308 |
+
}
|
309 |
var changeOption = document.createElement("option");
|
310 |
changeOption.text = text;
|
311 |
changeOption.value = '';
|
318 |
cvvInput = document.getElementById("cvv_bcash");
|
319 |
cvvInput.value = '';
|
320 |
// Amex
|
321 |
+
if (card == american_express) {
|
322 |
cvvInput.maxLength = 4;
|
323 |
+
} else {
|
324 |
cvvInput.maxLength = 3;
|
325 |
}
|
326 |
|
327 |
+
if (cvvInput.hasClassName("validation-passed")) {
|
328 |
cvvInput.removeClassName("validation-passed");
|
329 |
}
|
330 |
|
331 |
// CVV não obrigatório
|
332 |
+
if (card == aura) {
|
333 |
+
if (cvvInput.hasClassName("validate-ccv-card")) {
|
334 |
cvvInput.removeClassName("validate-ccv-card");
|
335 |
}
|
336 |
+
} else {
|
337 |
+
if (!cvvInput.hasClassName("validate-ccv-card")) {
|
338 |
cvvInput.addClassName("validate-ccv-card");
|
339 |
}
|
340 |
}
|
341 |
}
|
342 |
|
343 |
function forceReloadOrderReviewOsc() {
|
344 |
+
if (typeof(OSCPayment) !== 'undefined') {
|
345 |
OSCPayment.forcesavePayment();
|
346 |
}
|
347 |
+
if (typeof(checkout) !== 'undefined') {
|
348 |
if ((typeof(checkout.update) !== 'undefined') && (typeof(checkout.urls) !== 'undefined')) {
|
349 |
checkout.update(checkout.urls.payment_method);
|
350 |
}
|
355 |
var hasChecked = 0;
|
356 |
var isBcash = 0;
|
357 |
document.body.select('input[type=radio][name="payment[method]"]').each(function (e) {
|
358 |
+
if (e.checked == true) {
|
359 |
hasChecked = 1;
|
360 |
+
if (e.value == 'bcash_creditcard') {
|
361 |
isBcash = 1;
|
362 |
showBcashPaymentMethod();
|
363 |
}
|
364 |
}
|
365 |
});
|
366 |
|
367 |
+
if (hasChecked == 0 && isBcash == 0) {
|
368 |
document.body.select('input[type=radio][name="payment[method]"]').each(function (e) {
|
369 |
+
if (e.value == 'bcash_creditcard') {
|
370 |
e.checked = true;
|
371 |
showBcashPaymentMethod();
|
372 |
}
|
373 |
});
|
374 |
}
|
375 |
|
376 |
+
if (hasChecked == 1 && isBcash == 0) {
|
377 |
hideBcashPaymentMethod();
|
378 |
}
|
379 |
}
|
414 |
if (iscard) {
|
415 |
if (v.length > 0) {
|
416 |
return validateCardNumber();
|
417 |
+
} else {
|
418 |
return false;
|
419 |
}
|
420 |
}
|
502 |
showInstallmentsOnlyForMethod(paymentRadio.value);
|
503 |
ableCvv(paymentRadio.value);
|
504 |
document.body.select('input[type=radio][name="payment[method]"]').each(function (e) {
|
505 |
+
if (e.value == 'bcash_creditcard') {
|
506 |
e.checked = true;
|
507 |
}
|
508 |
});
|
526 |
}
|
527 |
|
528 |
function disableUnunsed(paymentRadio) {
|
529 |
+
var paymentRadios = document.getElementsByClassName("payment-method-bcash-<?php echo $code; ?>");
|
530 |
for (var i = paymentRadios.length - 1; i >= 0; i--) {
|
531 |
paymentRadios[i].disabled = true;
|
532 |
}
|
535 |
}
|
536 |
|
537 |
function isCard(element) {
|
|
|
538 |
return cards.indexOf(element.value) > -1;
|
539 |
}
|
540 |
|
591 |
if (key == 8 || key == 46 || key == 37 || key == 39 || key == 9 || key == 35 || key == 36) {
|
592 |
return true;
|
593 |
}
|
594 |
+
else if (key < 48 || key > 57) {
|
595 |
return false;
|
596 |
}
|
597 |
return true;
|
687 |
}
|
688 |
}
|
689 |
|
690 |
+
var paymentsOptions = document.getElementsByClassName("bandeira-<?php echo $code; ?>");
|
691 |
for (var i = paymentsOptions.length - 1; i >= 0; i--) {
|
692 |
var paymentFlags = paymentsOptions[i];
|
693 |
paymentFlags.onclick = clickFlag;
|
726 |
}
|
727 |
});
|
728 |
var $isCard = isCard(ElementPaymentMethod);
|
729 |
+
|
730 |
return {'element': ElementPaymentMethod, 'isCard': $isCard};
|
731 |
}
|
732 |
+
|
733 |
<?php if($this->getCpf()) : ?>
|
734 |
$('cpf_cnpj_bcash').observe('blur', function (e) {
|
735 |
var RegExp = /^[0-9]{11,14}$/;
|
820 |
});
|
821 |
<?php endif; ?>
|
822 |
|
823 |
+
function validateCardNumber() {
|
|
|
824 |
var RegExpHipercard = /^(3841\d{10}(\d{3})?)|(3841\d{15})$/;
|
825 |
var RegExpElo = /^((((636368)|(438935)|(504175)|(451416)|(636297))\d{0,10})|((5067)|(4576)|(4011))\d{0,12})$/;
|
826 |
var RegExpElo2 = /^(636368|438935|504175|451416|636297)([0-9]{10})$/;
|
834 |
if (paymentRadio.isCard) {
|
835 |
var cardNumber = document.getElementById("card_number_bcash").value;
|
836 |
cardNumber = cardNumber.trim();
|
837 |
+
if (cardNumber.length <= 0) {
|
838 |
+
return false;
|
839 |
+
}
|
840 |
var codeCard = paymentRadio.element.value;
|
841 |
switch (parseInt(codeCard)) {
|
842 |
case visa:
|
849 |
RegexFinal = RegExpAmex;
|
850 |
break;
|
851 |
case elo:
|
852 |
+
if (cardNumber.length <= 16) {
|
853 |
+
return true;
|
854 |
+
}
|
855 |
RegexFinal = RegExpElo;
|
856 |
break;
|
857 |
case hipercard:
|
858 |
+
if (cardNumber.length >= 16 && cardNumber.length <= 19) {
|
859 |
+
return true;
|
860 |
+
}
|
861 |
RegexFinal = RegExpHipercard;
|
862 |
break;
|
863 |
case dinners:
|
864 |
+
if (cardNumber.length >= 14 && cardNumber.length <= 16) {
|
865 |
+
return true;
|
866 |
+
}
|
867 |
RegexFinal = RegExpDiners;
|
868 |
break;
|
869 |
case aura:
|
870 |
+
if (cardNumber.length == 19) {
|
871 |
+
return true;
|
872 |
+
}
|
873 |
RegexFinal = RegExpAura;
|
874 |
break;
|
875 |
}
|
888 |
}
|
889 |
|
890 |
function updateInstallments(method) {
|
891 |
+
new Ajax.Request('<?php echo Mage::getUrl('bcash/payment/installments',array('_secure'=>true)) ?>', {
|
892 |
method: 'post',
|
893 |
parameters: 'method=' + method,
|
894 |
onSuccess: successGetInstallments,
|
895 |
+
onFailure: failureGetInstallments
|
896 |
});
|
897 |
}
|
898 |
|
906 |
showInstallmentsSelectBox(strMethodResponse, strInstallmentsResponse);
|
907 |
}
|
908 |
|
909 |
+
function failureGetInstallments(response) {
|
910 |
+
alert("Falha inesperada ao atualizar parcelamentos. Por favor, selecione o meio de pagamento novamente.");
|
911 |
}
|
912 |
|
913 |
function hideBcashPaymentMethod() {
|
914 |
var paymentConteiner = document.getElementById('payment-<?php echo $code; ?>');
|
915 |
+
var paymentBcashConteiner = document.getElementById('payment-bcash-group-<?php echo $code; ?>');
|
916 |
|
917 |
// cards
|
918 |
var cardConteiner = document.getElementById('card-conteiner');
|
919 |
+
if (!hasClass(cardConteiner, 'b-hide')) {
|
920 |
cardConteiner.className = cardConteiner.className + " b-hide";
|
921 |
}
|
922 |
disableCardForm();
|
927 |
element.checked = false;
|
928 |
}
|
929 |
});
|
930 |
+
var paymentRadios = document.getElementsByClassName("payment-method-bcash-<?php echo $code; ?>");
|
931 |
for (var i = paymentRadios.length - 1; i >= 0; i--) {
|
932 |
+
if (hasClass(paymentRadios[i], 'validate-one-required-by-name')) {
|
933 |
paymentRadios[i].className = paymentRadios[i].className.replace(/\bvalidate-one-required-by-name\b/, '');
|
934 |
}
|
935 |
paymentRadios[i].disabled = true;
|
936 |
}
|
937 |
|
938 |
// all
|
939 |
+
if (!hasClass(paymentBcashConteiner, 'b-hide')) {
|
940 |
paymentBcashConteiner.className = paymentBcashConteiner.className + " b-hide";
|
941 |
}
|
942 |
if (!hasClass(paymentConteiner, 'b-hide')) {
|
954 |
|
955 |
function showBcashPaymentMethod() {
|
956 |
var paymentConteiner = document.getElementById('payment-<?php echo $code; ?>');
|
957 |
+
var paymentBcashConteiner = document.getElementById('payment-bcash-group-<?php echo $code; ?>');
|
958 |
|
959 |
+
var paymentRadios = document.getElementsByClassName("payment-method-bcash-<?php echo $code; ?>");
|
960 |
for (var i = paymentRadios.length - 1; i >= 0; i--) {
|
961 |
+
if (!hasClass(paymentRadios[i], 'validate-one-required-by-name')) {
|
962 |
paymentRadios[i].className = paymentRadios[i].className + " validate-one-required-by-name";
|
963 |
}
|
964 |
paymentRadios[i].disabled = false;
|
965 |
}
|
966 |
+
if (hasClass(paymentBcashConteiner, 'b-hide')) {
|
967 |
paymentBcashConteiner.className = paymentBcashConteiner.className.replace(/\bb-hide\b/, '');
|
968 |
}
|
969 |
if (hasClass(paymentConteiner, 'b-hide')) {
|
974 |
$(document).on('change', 'input[type=radio][name=payment[method]]', function (event) {
|
975 |
var target = event.target;
|
976 |
var paymentConteiner = document.getElementById('payment-<?php echo $code; ?>');
|
977 |
+
var paymentBcashConteiner = document.getElementById('payment-bcash-group-<?php echo $code; ?>');
|
978 |
+
if (target.id == 'p_method_bcash_creditcard') {
|
979 |
showBcashPaymentMethod();
|
980 |
} else {
|
981 |
|
1005 |
event.preventDefault();
|
1006 |
});
|
1007 |
};
|
1008 |
+
initBcashCreditCardPagamento();
|
1009 |
//]]>
|
1010 |
</script>
|
app/design/frontend/base/default/template/bcash/pagamento/form/onlinetransfer.phtml
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$code = $this->getMethodCode();
|
3 |
+
$paymentMethods = $this->getPaymentMethods();
|
4 |
+
$size = count($paymentMethods);
|
5 |
+
?>
|
6 |
+
<div id="payment-<?php echo $code; ?>">
|
7 |
+
<link rel="stylesheet" href="<?php echo $this->getSkinUrl('bcash/pagamento/css/application.css') ?>?v=<?php echo rand();?>" type="text/css"/>
|
8 |
+
<div class="form-list" id="payment_form_<?php echo $code; ?>" style="display:none;">
|
9 |
+
<div class="payment-group" >
|
10 |
+
<div class="b-row" style="padding-left:15px; margin-bottom:10px">
|
11 |
+
<?php if($this->getCpf()) : ?>
|
12 |
+
<div class="" style="float:left; width:40%; margin:2px">
|
13 |
+
<label>CPF/CNPJ do titular</label>
|
14 |
+
<input type="text" class="b-form-control validate-cpf-cnpj-onlinetransfer" id="cpf_cnpj_<?php echo $code; ?>"
|
15 |
+
name="cpf_cnpj_<?php echo $code; ?>" value=""
|
16 |
+
maxlength="18" autocomplete="off"/>
|
17 |
+
</div>
|
18 |
+
<?php endif; ?>
|
19 |
+
<?php if($this->getPhone()) : ?>
|
20 |
+
<div class="" style="float:left; width:53%; margin:3px; margin-left:10px">
|
21 |
+
<label>Telefone do titular</label><br />
|
22 |
+
<div style="width: 53px; float: left;">
|
23 |
+
<input type="text" class="b-form-control validate-ddd-onlinetransfer" maxlength="2" value=""
|
24 |
+
name="ddd_<?php echo $code; ?>"
|
25 |
+
id="ddd_<?php echo $code; ?>">
|
26 |
+
</div>
|
27 |
+
<div style="width: 123px; float: left; margin-left:3px">
|
28 |
+
<input type="text" class="b-form-control validate-phone-onlinetransfer" maxlength="9" value=""
|
29 |
+
name="phone_<?php echo $code; ?>"
|
30 |
+
id="phone_<?php echo $code; ?>">
|
31 |
+
</div>
|
32 |
+
|
33 |
+
</div>
|
34 |
+
<?php endif; ?>
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
|
39 |
+
<div id="payment-bcash-group-<?php echo $code; ?>">
|
40 |
+
<?php
|
41 |
+
if($size > 0) {
|
42 |
+
foreach ($paymentMethods as $paymentType => $payments) { ?>
|
43 |
+
<?php
|
44 |
+
$totalPayments = count($payments);
|
45 |
+
if ($totalPayments > 0) {
|
46 |
+
?>
|
47 |
+
<div class="payment-group">
|
48 |
+
<div>
|
49 |
+
<ul>
|
50 |
+
<?php foreach ($payments as $payment) { ?>
|
51 |
+
<li>
|
52 |
+
<input type="radio"
|
53 |
+
class="payment-method-bcash-<?php echo $code; ?> validate-one-required-by-name"
|
54 |
+
id="payment-method-<?php echo $payment->id ?>" name="bcash-payment-method"
|
55 |
+
value="<?php echo $payment->id ?>" class/>
|
56 |
+
<label class="bandeira bandeira-<?php echo $code; ?> band-<?php echo $payment->id ?>"
|
57 |
+
for="payment-method-<?php echo $payment->id ?>"></label>
|
58 |
+
</li>
|
59 |
+
<?php } ?>
|
60 |
+
</ul>
|
61 |
+
</div>
|
62 |
+
<?php if ($size > 1) { ?>
|
63 |
+
<hr>
|
64 |
+
<?php } ?>
|
65 |
+
</div>
|
66 |
+
<?php
|
67 |
+
} ?>
|
68 |
+
<!-- payment-group -->
|
69 |
+
<?php
|
70 |
+
$size--;
|
71 |
+
}
|
72 |
+
}else {
|
73 |
+
echo "Meio de pagamento indisponível no momento. Verifique suas credenciais e tente novamente.";
|
74 |
+
}?>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
<!-- div b-col-xs-4 -->
|
78 |
+
<script type="text/javascript">
|
79 |
+
//<![CDATA[
|
80 |
+
var requestUrl = '<?php echo Mage::getUrl('bcash/payment/dados',array('_secure'=>true)) ?>';
|
81 |
+
|
82 |
+
function in_array(needle, haystack, argStrict) {
|
83 |
+
var key = '',
|
84 |
+
strict = !!argStrict;
|
85 |
+
if (strict) {
|
86 |
+
for (key in haystack) {
|
87 |
+
if (haystack[key] === needle) {
|
88 |
+
return true;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
} else {
|
92 |
+
for (key in haystack) {
|
93 |
+
if (haystack[key] == needle) {
|
94 |
+
return true;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
return false;
|
99 |
+
}
|
100 |
+
|
101 |
+
var initBcashOnlinetransferPagamento = function () {
|
102 |
+
|
103 |
+
function showBcashOnlinetransferPaymentMethod() {
|
104 |
+
var paymentConteiner = document.getElementById('payment-<?php echo $code; ?>');
|
105 |
+
var paymentBcashConteiner = document.getElementById('payment-bcash-group-<?php echo $code; ?>');
|
106 |
+
|
107 |
+
var paymentRadios = document.getElementsByClassName("payment-method-bcash-<?php echo $code; ?>");
|
108 |
+
for (var i = paymentRadios.length - 1; i >= 0; i--) {
|
109 |
+
if (!hasClass(paymentRadios[i], 'validate-one-required-by-name')) {
|
110 |
+
paymentRadios[i].className = paymentRadios[i].className + " validate-one-required-by-name";
|
111 |
+
}
|
112 |
+
//Caso houver somente 1 item, carregar selecionado
|
113 |
+
if(paymentRadios.length == 1) {
|
114 |
+
paymentRadios[i].disabled = false;
|
115 |
+
paymentRadios[i].checked = true;
|
116 |
+
|
117 |
+
var option = paymentRadios[i].value;
|
118 |
+
var typePayment = 'boleto';
|
119 |
+
new Ajax.Request(requestUrl, {
|
120 |
+
method: 'POST',
|
121 |
+
parameters: 'input=' + typePayment + '&tipo=' + option
|
122 |
+
});
|
123 |
+
}else {
|
124 |
+
paymentRadios[i].disabled = true;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
if (hasClass(paymentBcashConteiner, 'b-hide')) {
|
128 |
+
paymentBcashConteiner.className = paymentBcashConteiner.className.replace(/\bb-hide\b/, '');
|
129 |
+
}
|
130 |
+
if (hasClass(paymentConteiner, 'b-hide')) {
|
131 |
+
paymentConteiner.className = paymentConteiner.className.replace(/\bb-hide\b/, '');
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
function hideBcashOnlinetransferPaymentMethod() {
|
136 |
+
var paymentConteiner = document.getElementById('payment-<?php echo $code; ?>');
|
137 |
+
var paymentBcashConteiner = document.getElementById('payment-bcash-group-<?php echo $code; ?>');
|
138 |
+
|
139 |
+
var paymentRadios = document.getElementsByClassName("payment-method-bcash-<?php echo $code; ?>");
|
140 |
+
for (var i = paymentRadios.length - 1; i >= 0; i--) {
|
141 |
+
if (hasClass(paymentRadios[i], 'validate-one-required-by-name')) {
|
142 |
+
paymentRadios[i].className = paymentRadios[i].className.replace(/\bvalidate-one-required-by-name\b/, '');
|
143 |
+
}
|
144 |
+
paymentRadios[i].disabled = true;
|
145 |
+
}
|
146 |
+
|
147 |
+
// all
|
148 |
+
if (!hasClass(paymentBcashConteiner, 'b-hide')) {
|
149 |
+
paymentBcashConteiner.className = paymentBcashConteiner.className + " b-hide";
|
150 |
+
}
|
151 |
+
if (!hasClass(paymentConteiner, 'b-hide')) {
|
152 |
+
paymentConteiner.className = paymentConteiner.className + " b-hide";
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
function clickFlagOnlinetransfer(e) {
|
157 |
+
var elem, evt = e ? e : event;
|
158 |
+
if (evt.srcElement) {
|
159 |
+
elem = evt.srcElement;
|
160 |
+
} else if (evt.target) {
|
161 |
+
elem = evt.target;
|
162 |
+
}
|
163 |
+
|
164 |
+
var paymentMethodBcash = elem.attributes['for'].value;
|
165 |
+
var paymentRadio = document.getElementById(paymentMethodBcash);
|
166 |
+
document.getElementById(paymentMethodBcash).disabled = false;
|
167 |
+
document.getElementById(paymentMethodBcash).checked = true;
|
168 |
+
|
169 |
+
new Ajax.Request(requestUrl, {
|
170 |
+
method: 'POST',
|
171 |
+
parameters: 'input=boleto&tipo=' + paymentRadio.value
|
172 |
+
});
|
173 |
+
|
174 |
+
document.body.select('input[type=radio][name="payment[method]"]').each(function (e) {
|
175 |
+
if (e.value == '<?php echo $code; ?>') {
|
176 |
+
e.checked = true;
|
177 |
+
}
|
178 |
+
});
|
179 |
+
}
|
180 |
+
|
181 |
+
var paymentsOptions = document.getElementsByClassName("bandeira-<?php echo $code; ?>");
|
182 |
+
for (var i = paymentsOptions.length - 1; i >= 0; i--) {
|
183 |
+
var paymentFlags = paymentsOptions[i];
|
184 |
+
paymentFlags.onclick = clickFlagOnlinetransfer;
|
185 |
+
}
|
186 |
+
|
187 |
+
$(document).on('change', 'input[type=radio][name=payment[method]]', function (event) {
|
188 |
+
var target = event.target;
|
189 |
+
var paymentConteiner = document.getElementById('payment-<?php echo $code; ?>');
|
190 |
+
var paymentBcashConteiner = document.getElementById('payment-bcash-group-<?php echo $code; ?>');
|
191 |
+
if (target.id == 'p_method_<?php echo $code; ?>') {
|
192 |
+
showBcashOnlinetransferPaymentMethod();
|
193 |
+
} else {
|
194 |
+
|
195 |
+
hideBcashOnlinetransferPaymentMethod();
|
196 |
+
}
|
197 |
+
event.preventDefault();
|
198 |
+
});
|
199 |
+
|
200 |
+
function hasClass(element, cls) {
|
201 |
+
return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1;
|
202 |
+
}
|
203 |
+
|
204 |
+
};
|
205 |
+
initBcashOnlinetransferPagamento();
|
206 |
+
//]]>
|
207 |
+
</script>
|
app/design/frontend/base/default/template/bcash/pagamento/info.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$info_payment = array();
|
3 |
+
if (Mage::app()->getRequest()->getRouteName() == "sales"):
|
4 |
+
$info_payment = $this->getInfoPayment();
|
5 |
+
endif;
|
6 |
+
?>
|
7 |
+
<link rel="stylesheet"
|
8 |
+
href="<?php echo $this->getSkinUrl('bcash/pagamento/css/application.css') ?>?v=<?php echo rand(); ?>"
|
9 |
+
type="text/css"/>
|
10 |
+
<table cellspacing="0" class="form-list">
|
11 |
+
<tbody>
|
12 |
+
<tr>
|
13 |
+
<td class="label"><label>Meio de pagamento </label></td>
|
14 |
+
<td class="value"><label><strong><?php echo $this->getMethod()->getTitle() ?></strong></label></td>
|
15 |
+
</tr>
|
16 |
+
<?php foreach ($info_payment as $detalhes): ?>
|
17 |
+
<tr>
|
18 |
+
<?php if (!empty($detalhes['valor'])):
|
19 |
+
if ($detalhes['titulo'] == "method_payment"):
|
20 |
+
echo '<td class="value"><label class="logo-bcash"></label></td>';
|
21 |
+
echo '<td class="value"><label class="bandeira band-' . $detalhes['valor'] . '" style="pointer-events: none !important;"></label></td>';
|
22 |
+
else:
|
23 |
+
echo '<td class="label"><label>' . $detalhes['titulo'] . '</label></td>';
|
24 |
+
echo '<td class="value"><label><strong>' . ($detalhes['titulo'] == "Link" ? '<a href="' . $detalhes['valor'] . '" target="_blank">Acessar link de pagamento</a>' : $detalhes['valor']) . '</strong></label></td>';
|
25 |
+
endif;
|
26 |
+
endif; ?>
|
27 |
+
</tr>
|
28 |
+
<?php endforeach; ?>
|
29 |
+
</tbody>
|
30 |
+
</table>
|
31 |
+
<br/>
|
app/design/frontend/base/default/template/{pagamento → bcash/pagamento}/sales/order/info/buttons/payment.phtml
RENAMED
@@ -1,10 +1,7 @@
|
|
1 |
<?php
|
2 |
$_order = $this->getOrder();
|
3 |
-
|
4 |
$quoteId = $_order->getQuoteId();
|
5 |
-
|
6 |
$quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteId);
|
7 |
-
|
8 |
$payment_link = $quote->getPaymentLinkBcash();
|
9 |
?>
|
10 |
|
1 |
<?php
|
2 |
$_order = $this->getOrder();
|
|
|
3 |
$quoteId = $_order->getQuoteId();
|
|
|
4 |
$quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteId);
|
|
|
5 |
$payment_link = $quote->getPaymentLinkBcash();
|
6 |
?>
|
7 |
|
app/design/frontend/base/default/template/pagamento/checkout/success.phtml
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<!-- <h1>Bcash</h1> -->
|
2 |
-
<link rel="stylesheet" href="<?php echo $this->getSkinUrl('bcash/pagamento/css/application.css') ?>" type="text/css"/>
|
3 |
-
<div id="bcash_pagamento" style="float:left; width: 100%; padding: 10px;">
|
4 |
-
<?php
|
5 |
-
//$this->escapeHtml($this->getOrder()->getViewOrderUrl())
|
6 |
-
$url = Mage::getUrl('', array('_secure'=>true)) . 'sales/order/view/order_id/' . $this->getOrder()->getId();
|
7 |
-
$idPedido = $this->getQuote()->getReservedOrderId();
|
8 |
-
$type = $this->getType();
|
9 |
-
if ($type && $type->type == Bcash_Pagamento_Helper_PaymentMethod::CARD_TYPE): ?>
|
10 |
-
<!-- Compra realizada via Cartão de Crédito -->
|
11 |
-
<?php elseif ($type &&$type->type == Bcash_Pagamento_Helper_PaymentMethod::ONLINE_TRANSFER_TYPE): ?>
|
12 |
-
<!-- Compra realizada via Transferência -->
|
13 |
-
Clique no icone ao lado para acessar seu banco para realizar a transferência
|
14 |
-
<a href="<?php echo $this->getQuote()->getPaymentLinkBcash() ?>" >
|
15 |
-
<label class="bandeira band-<?php echo $type->id ?>" for="payment-method-<?php echo $type->id ?>"></label>
|
16 |
-
</a>
|
17 |
-
<?php elseif ($type && $type->type == Bcash_Pagamento_Helper_PaymentMethod::BANKSLIP_TYPE): ?>
|
18 |
-
<!-- Compra realizada via Boleto -->
|
19 |
-
Clique no icone ao lado para gerar o boleto para pagamento
|
20 |
-
<a href="<?php echo $this->getQuote()->getPaymentLinkBcash() ?>" >
|
21 |
-
<label class="bandeira band-<?php echo $type->id ?>" for="payment-method-<?php echo $type->id ?>"></label>
|
22 |
-
</a>
|
23 |
-
<?php endif; ?>
|
24 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/{BcashApi/src → Bcash}/AutoLoader.php
RENAMED
@@ -34,6 +34,19 @@ class AutoLoader
|
|
34 |
*/
|
35 |
public static function register($prepend = false)
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
spl_autoload_register(array(new self, 'autoload'), true, $prepend);
|
38 |
}
|
39 |
/**
|
34 |
*/
|
35 |
public static function register($prepend = false)
|
36 |
{
|
37 |
+
// Autoloader varien fix
|
38 |
+
$mageHandler = set_error_handler(function () {});
|
39 |
+
set_error_handler(function ($errno, $errstr, $errfile, $errline) use ($mageHandler) {
|
40 |
+
if (E_WARNING === $errno
|
41 |
+
&& 0 === strpos($errstr, 'include(')
|
42 |
+
&& substr($errfile, -19) == 'Varien/Autoload.php'
|
43 |
+
){
|
44 |
+
return null;
|
45 |
+
}
|
46 |
+
return call_user_func($mageHandler, $errno, $errstr, $errfile, $errline);
|
47 |
+
});
|
48 |
+
|
49 |
+
// Autoloader register
|
50 |
spl_autoload_register(array(new self, 'autoload'), true, $prepend);
|
51 |
}
|
52 |
/**
|
lib/{BcashApi/src → Bcash}/Config/Config.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/Address.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/CreditCard.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/CurrencyEnum.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/Customer.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/DependentTransaction.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/GenderEnum.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/Model.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/NotificationContent.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/NotificationStatusEnum.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/PaymentMethod.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/PaymentMethodEnum.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/Product.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/ShippingTypeEnum.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/StateEnum.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Domain/TransactionRequest.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Exception/BaseException.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Exception/ConnectionException.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Exception/ValidationException.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Helper/HttpHelper.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Http/Authentication/Basic.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Http/Authentication/OAuth.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Http/Connection.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Http/GetRequest.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Http/PostRequest.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Http/PutRequest.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Http/Response.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Service/Account.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Service/Cancellation.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Service/Consultation.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Service/IEnvironmentManager.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Service/Installments.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Service/Notification.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Service/Payment.php
RENAMED
File without changes
|
lib/{BcashApi/src → Bcash}/Test/NotificationSimulator.php
RENAMED
File without changes
|
lib/BcashApi/autoloader.php
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once __DIR__.'/src/AutoLoader.php';
|
4 |
-
Bcash\AutoLoader::register();
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Bcash_Pagamento</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>
|
11 |
-
<notes
|
12 |
<authors><author><name>Bcash</name><user>Bcash</user><email>danilo.benedetti@bcash.com.br</email></author></authors>
|
13 |
-
<date>2015-
|
14 |
-
<time>16:
|
15 |
-
<contents><target name="magecommunity"><dir name="Bcash"><dir name="Pagamento"><dir name="Block"><dir name="Adminhtml"><file name="Dependentes.php" hash="817d7116d5ab890b5525a7185100ab37"/><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>5.6.14</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Bcash_Pagamento</name>
|
4 |
+
<version>1.2.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Bcash Magento Transparente (API)</summary>
|
10 |
+
<description>Bcash Magento Transparente (API)</description>
|
11 |
+
<notes>- Update old orders</notes>
|
12 |
<authors><author><name>Bcash</name><user>Bcash</user><email>danilo.benedetti@bcash.com.br</email></author></authors>
|
13 |
+
<date>2015-12-18</date>
|
14 |
+
<time>11:16:22</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Bcash"><dir name="Pagamento"><dir name="Block"><dir name="Adminhtml"><file name="Dependentes.php" hash="817d7116d5ab890b5525a7185100ab37"/><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="c5edf74ec8dedbf4578d8d8126157987"/><file name="View.php" hash="04e915acc1ca7b2148dd657ad7b39782"/></dir></dir></dir><dir name="Form"><file name="Bankslip.php" hash="2ca4f97c502fae164ea4079feb75e487"/><file name="Creditcard.php" hash="f009da6d0b0b592f4e57fd1d21c65c38"/><file name="Onlinetransfer.php" hash="3d2c667251c52f85ab1f2a5b3779b1f0"/></dir><dir name="Info"><file name="Bankslip.php" hash="5d627fa1b4e184ca314ae0c553f183a8"/><file name="Creditcard.php" hash="a5fa9c4d22c78b884b2f126098462a08"/><file name="Onlinetransfer.php" hash="e904739e0c43300b6aeeb62af9de5411"/></dir></dir><dir name="Helper"><file name="Data.php" hash="11de13ac908a8167f4011b75f55ff059"/><file name="PaymentMethod.php" hash="516dc381c251edce75d51a362f0e0bd0"/><file name="Transaction.php" hash="4c0ee06effa0bb482692ef03ec181bb4"/></dir><dir name="Model"><file name="Bankslip.php" hash="087f1f0ca27d28660f8a950f139fc2c5"/><file name="Creditcard.php" hash="be90e4bbfdefb6fdf2544289b3e0db32"/><file name="Observer.php" hash="f91c2b022bf137c2cd9cb1f298fd9d96"/><file name="Onlinetransfer.php" hash="25dfefce7da371bfaab2d07801cd72da"/><file name="Order.php" hash="4d646d09ccf6e24907e6e23412649b5a"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Installments.php" hash="5fae970a6cb83b5be079c5762b8e214d"/></dir></dir></dir></dir><dir name="controllers"><dir name="Admin"><dir name="Sales"><file name="OrderController.php" hash="5b7a924f03dc209a4dcd3a6f43d29c7c"/></dir></dir><file name="NotificationController.php" hash="c45b458a86c9fc832e59afc9e7e19aa6"/><file name="PaymentController.php" hash="c1a1086e309813ab7c06e240be697f42"/></dir><dir name="etc"><file name="config.xml" hash="a09ac869ccf92c053d3c36dea9139e9b"/><file name="system.xml" hash="a6f3757a03e94ba1a0ad105fe53152c9"/></dir><dir name="sql"><dir name="pagamento_setup"><file name="mysql4-install-0.1.0.php" hash="2e7c6977f85f3d3bd86f975c07490d5f"/><file name="mysql4-upgrade-0.1.0-1.2.2.php" hash="007a263bae22efa0d1e5a35152c78d4d"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="bcash"><dir name="pagamento"><file name="layout.xml" hash="2cc82944f642513a946299a26c1d0063"/></dir></dir></dir><dir name="template"><dir name="bcash"><dir name="pagamento"><dir name="checkout"><file name="success.phtml" hash="939702b20d07f17506edf119ca6d5121"/></dir><dir name="form"><file name="bankslip.phtml" hash="622324f3e4d9f039b57d4aa4430109ea"/><file name="creditcard.phtml" hash="82bd85f88542a7a718fe3bfc72df2d8f"/><file name="onlinetransfer.phtml" hash="90f61cd593a4cb75dc763a9c9adaecee"/></dir><file name="info.phtml" hash="c41cb9edc7653cd05bdc4a7ccd17c163"/><dir name="sales"><dir name="order"><dir name="info"><dir name="buttons"><file name="payment.phtml" hash="454b2bac39dac3e8729773ff50eabc26"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="bcash"><dir name="pagamento"><file name="info.phtml" hash="2d63fca436efc0431e365b35a83f0ce2"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bcash_Pagamento.xml" hash="3dd07f527dbcd104762897d392acb31b"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="bcash"><dir name="pagamento"><dir name="css"><file name="application.css" hash="cd3d8d4eff2299cd620c2abf3c5c2bc6"/></dir><dir name="images"><file name="application-sprite.png" hash="2c6c670b3ca8f7eb783f874bd387527e"/></dir><dir name="js"><file name="payment.js" hash="c0124aabf6a91849c0aa7db6cea6a471"/></dir></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="Bcash"><file name="AutoLoader.php" hash="498e3f6f8a4daed6823bfceb5cd88ea4"/><dir name="Config"><file name="Config.php" hash="027627d0781a1a6842ab2b6f7cb13512"/></dir><dir name="Domain"><file name="Address.php" hash="ebc176d33ba79ac46cf59561f479919f"/><file name="CreditCard.php" hash="bcf12a466ab99f25da348a93c2e7f995"/><file name="CurrencyEnum.php" hash="c2097c3796e8ab354a9b61ce1bb9c70e"/><file name="Customer.php" hash="68f056140a92bfb9a7534ced54939d44"/><file name="DependentTransaction.php" hash="2553d6ed93f39cb96ef185cbc886311c"/><file name="GenderEnum.php" hash="11377e531d5914b232b99f8cee61e61c"/><file name="Model.php" hash="f1b7fe3fb7384852f16f4b6931fc8545"/><file name="NotificationContent.php" hash="52b6ad7894c455dd4f4c199fdaf1fad3"/><file name="NotificationStatusEnum.php" hash="1635e03b18f7de30fd6bd80a7ff4f4d4"/><file name="PaymentMethod.php" hash="86fbfc29bc8671a4617f51a36031eba4"/><file name="PaymentMethodEnum.php" hash="d0deaeac659f54826bb38aa94d7f5c34"/><file name="Product.php" hash="674e7475e0555e9f2f592c7931098144"/><file name="ShippingTypeEnum.php" hash="4849b2ff3bf4294285e1d2e51d5226ea"/><file name="StateEnum.php" hash="75080122c0eb3807dcca92e064ff5d1d"/><file name="TransactionRequest.php" hash="f1e29973341750cca57dfac7f1496355"/></dir><dir name="Exception"><file name="BaseException.php" hash="e4d5637be15c9939cedb80b6aa54418e"/><file name="ConnectionException.php" hash="421fb7fbab02fe882a00765cc9cff569"/><file name="ValidationException.php" hash="03379f9626fcb19694a3662395da755f"/></dir><dir name="Helper"><file name="HttpHelper.php" hash="3ee5690f7eb45974cf888128643b2700"/></dir><dir name="Http"><dir name="Authentication"><file name="Basic.php" hash="b9ca27226db5535b70edea699d6d2e55"/><file name="OAuth.php" hash="92e6d135821380337561ace5572b8f9a"/></dir><file name="Connection.php" hash="381b6f242da04ef4c68691e70a3118b5"/><file name="GetRequest.php" hash="bbb366a1fb1396cd53e7976740880351"/><file name="PostRequest.php" hash="9e425ddf0278e72ffbb3b7369e18359d"/><file name="PutRequest.php" hash="7da14392d43109682f7373e8d4b12660"/><file name="Response.php" hash="f941571206e14c8251373168b08e297f"/></dir><dir name="Service"><file name="Account.php" hash="1e62bbf14e84348bb4b08a37ca843dfb"/><file name="Cancellation.php" hash="e1931a4e0bc1e66006670645336d93f4"/><file name="Consultation.php" hash="8c4fb3a25d9ffa418aad36cce99cab12"/><file name="IEnvironmentManager.php" hash="05668b184b91a5895f8308e5dc02d422"/><file name="Installments.php" hash="101e7aa5aace7e618156c3152aa894c8"/><file name="Notification.php" hash="550b7ee0fea57d7ac30c4648c9896c39"/><file name="Payment.php" hash="87a8184a928e04f56b6b9d796a6e9806"/></dir><dir name="Test"><file name="NotificationSimulator.php" hash="de77ea4d3c4c656a1dafd77f944aafbe"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>5.6.14</max></php></required></dependencies>
|
18 |
</package>
|
skin/frontend/base/default/bcash/pagamento/css/application.css
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
.payment-group li {
|
18 |
display: inline-block;
|
19 |
height: 42px;
|
20 |
-
padding:
|
21 |
}
|
22 |
|
23 |
.payment-group input[type='radio'] {
|
@@ -34,6 +34,17 @@
|
|
34 |
opacity: 0;
|
35 |
}
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
.bandeira {
|
38 |
display: inline-block;
|
39 |
background: url(../images/application-sprite.png) no-repeat;
|
@@ -43,7 +54,6 @@
|
|
43 |
cursor: pointer;
|
44 |
}
|
45 |
|
46 |
-
|
47 |
/* visa */
|
48 |
|
49 |
.band-1 {
|
@@ -646,3 +656,19 @@ hr {
|
|
646 |
filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
|
647 |
opacity: 1;
|
648 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
.payment-group li {
|
18 |
display: inline-block;
|
19 |
height: 42px;
|
20 |
+
padding: 0px 5px;
|
21 |
}
|
22 |
|
23 |
.payment-group input[type='radio'] {
|
34 |
opacity: 0;
|
35 |
}
|
36 |
|
37 |
+
/* logo bcash */
|
38 |
+
|
39 |
+
.logo-bcash {
|
40 |
+
display: inline-block;
|
41 |
+
background: url(../images/application-sprite.png) no-repeat;
|
42 |
+
width: 48px;
|
43 |
+
height: 60px;
|
44 |
+
text-indent: -9999px;
|
45 |
+
background-position: 0 0;
|
46 |
+
}
|
47 |
+
|
48 |
.bandeira {
|
49 |
display: inline-block;
|
50 |
background: url(../images/application-sprite.png) no-repeat;
|
54 |
cursor: pointer;
|
55 |
}
|
56 |
|
|
|
57 |
/* visa */
|
58 |
|
59 |
.band-1 {
|
656 |
filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
|
657 |
opacity: 1;
|
658 |
}
|
659 |
+
|
660 |
+
/* Clear */
|
661 |
+
.bcash-clr {
|
662 |
+
clear: both;
|
663 |
+
}
|
664 |
+
|
665 |
+
.bcash-checkout-success {
|
666 |
+
float:left;
|
667 |
+
width: 100%;
|
668 |
+
padding: 10px;
|
669 |
+
}
|
670 |
+
|
671 |
+
.bcash-checkout-success p {
|
672 |
+
padding-bottom: 10px;
|
673 |
+
}
|
674 |
+
|