Version Notes
Versão estável.
Os bugs devem ser reportador na área de Issues no github do projeto em https://github.com/r-martins/PagSeguro-Magento-Transparente
Download this release
Release Info
Developer | Ricardo Martins |
Extension | RicardoMartins_PagSeguro |
Version | 1.0.1 |
Comparing to | |
See all releases |
Version 1.0.1
- app/code/community/RicardoMartins/PagSeguro/Block/Form/Cc.php +70 -0
- app/code/community/RicardoMartins/PagSeguro/Block/Form/Cc/Dob.php +14 -0
- app/code/community/RicardoMartins/PagSeguro/Block/Form/Directpayment.php +20 -0
- app/code/community/RicardoMartins/PagSeguro/Block/Form/Info/Cc.php +38 -0
- app/code/community/RicardoMartins/PagSeguro/Helper/Data.php +141 -0
- app/code/community/RicardoMartins/PagSeguro/Helper/Internal.php +55 -0
- app/code/community/RicardoMartins/PagSeguro/Helper/Params.php +329 -0
- app/code/community/RicardoMartins/PagSeguro/Model/Abstract.php +199 -0
- app/code/community/RicardoMartins/PagSeguro/Model/Observer.php +22 -0
- app/code/community/RicardoMartins/PagSeguro/Model/Payment/Cc.php +92 -0
- app/code/community/RicardoMartins/PagSeguro/Model/Source/Customer/Address/Attributes.php +34 -0
- app/code/community/RicardoMartins/PagSeguro/Model/Source/Customer/Address/Attributes/Optional.php +36 -0
- app/code/community/RicardoMartins/PagSeguro/Model/Source/Customer/Attributes.php +22 -0
- app/code/community/RicardoMartins/PagSeguro/Model/Source/Customer/Dob.php +28 -0
- app/code/community/RicardoMartins/PagSeguro/Model/Source/Paymentmethods.php +46 -0
- app/code/community/RicardoMartins/PagSeguro/controllers/AjaxController.php +14 -0
- app/code/community/RicardoMartins/PagSeguro/controllers/NotificationController.php +16 -0
- app/code/community/RicardoMartins/PagSeguro/controllers/TestController.php +123 -0
- app/code/community/RicardoMartins/PagSeguro/etc/config.xml +79 -0
- app/code/community/RicardoMartins/PagSeguro/etc/system.xml +219 -0
- app/design/adminhtml/base/default/template/ricardomartins_pagseguro/form/directpayment.phtml +18 -0
- app/design/adminhtml/base/default/template/ricardomartins_pagseguro/form/info/cc.phtml +11 -0
- app/design/frontend/base/default/template/ricardomartins_pagseguro/form/cc.phtml +80 -0
- app/design/frontend/base/default/template/ricardomartins_pagseguro/form/cc/dob.phtml +87 -0
- app/design/frontend/base/default/template/ricardomartins_pagseguro/form/directpayment.phtml +20 -0
- app/design/frontend/base/default/template/ricardomartins_pagseguro/form/info/cc.phtml +11 -0
- app/etc/modules/RicardoMartins_PagSeguro.xml +9 -0
- app/locale/pt_BR/RicardoMartins_PagSeguro.csv +50 -0
- js/pagseguro/pagseguro.js +134 -0
- package.xml +21 -0
- skin/frontend/base/default/pagseguro/selo/selo01_160x90.gif +0 -0
- skin/frontend/base/default/pagseguro/selo/selo01_200x60.gif +0 -0
- skin/frontend/base/default/pagseguro/selo/selo01_300x60.gif +0 -0
- skin/frontend/base/default/pagseguro/selo/selo02_160x90.gif +0 -0
- skin/frontend/base/default/pagseguro/selo/selo02_200x60.gif +0 -0
- skin/frontend/base/default/pagseguro/selo/selo02_300x60.gif +0 -0
- skin/frontend/base/default/pagseguro/selo/selo03_160x90.gif +0 -0
- skin/frontend/base/default/pagseguro/selo/selo03_200x60.gif +0 -0
- skin/frontend/base/default/pagseguro/selo/selo03_300x60.gif +0 -0
- skin/frontend/base/default/pagseguro/selo/selo04_160x90.gif +0 -0
- skin/frontend/base/default/pagseguro/selo/selo04_200x60.gif +0 -0
- skin/frontend/base/default/pagseguro/selo/selo04_300x60.gif +0 -0
app/code/community/RicardoMartins/PagSeguro/Block/Form/Cc.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Paygate
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
class RicardoMartins_PagSeguro_Block_Form_Cc extends Mage_Payment_Block_Form_Cc
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* Set block template
|
31 |
+
*/
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
parent::_construct();
|
35 |
+
$this->setTemplate('ricardomartins_pagseguro/form/cc.phtml');
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function _prepareLayout(){
|
39 |
+
// Mage::app()->getLayout()->getUpdate()->addHandle('pagseguro');
|
40 |
+
//adicionaremos o JS do pagseguro na tela que usará o bloco de cartao logo após o <body>
|
41 |
+
$scriptblock = Mage::app()->getLayout()->createBlock('core/text', 'js_pagseguro');
|
42 |
+
$scriptblock->setText(sprintf(
|
43 |
+
'
|
44 |
+
<script type="text/javascript">var RMPagSeguroSiteBaseURL = "%s";</script>
|
45 |
+
<script type="text/javascript" src="%s"></script>
|
46 |
+
<script type="text/javascript" src="%s"></script>
|
47 |
+
',
|
48 |
+
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK,true),
|
49 |
+
Mage::helper('ricardomartins_pagseguro')->getJsUrl(),
|
50 |
+
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS, true) . 'pagseguro/pagseguro.js'
|
51 |
+
));
|
52 |
+
$head = Mage::app()->getLayout()->getBlock('after_body_start');
|
53 |
+
|
54 |
+
// Mage::app()->getLayout()->getBlock('head')->addJs('pagseguro/pagseguro.js');
|
55 |
+
|
56 |
+
if($head)
|
57 |
+
{
|
58 |
+
$head->append($scriptblock);
|
59 |
+
}
|
60 |
+
|
61 |
+
return parent::_prepareLayout();
|
62 |
+
}
|
63 |
+
|
64 |
+
public function isDobVisible()
|
65 |
+
{
|
66 |
+
$owner_dob_attribute = Mage::getStoreConfig('payment/pagseguro_cc/owner_dob_attribute');
|
67 |
+
return empty($owner_dob_attribute);
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Block/Form/Cc/Dob.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class RicardoMartins_PagSeguro_Block_Form_Cc_Dob extends Mage_Customer_Block_Widget_Dob
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
|
9 |
+
// default template location | caminho do template de data de nascimento
|
10 |
+
$this->setTemplate('ricardomartins_pagseguro/form/cc/dob.phtml');
|
11 |
+
$this->setFieldNameFormat('payment[ps_cc_owner_birthday_%s]');
|
12 |
+
$this->setFieldIdFormat('pagseguro_ps_cc_owner_birthday_%s');
|
13 |
+
}
|
14 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Block/Form/Directpayment.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class RicardoMartins_PagSeguro_Block_Form_Directpayment extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->setTemplate('ricardomartins_pagseguro/form/directpayment.phtml');
|
8 |
+
}
|
9 |
+
|
10 |
+
protected function _toHtml()
|
11 |
+
{
|
12 |
+
// avoids block for being inserted twice
|
13 |
+
if(false == Mage::registry('directpayment_loaded')) {
|
14 |
+
Mage::register('directpayment_loaded', true);
|
15 |
+
return parent::_toHtml();
|
16 |
+
}
|
17 |
+
|
18 |
+
return '';
|
19 |
+
}
|
20 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Block/Form/Info/Cc.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Paygate
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
class RicardoMartins_PagSeguro_Block_Form_Info_Cc extends Mage_Payment_Block_Info
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* Set block template
|
31 |
+
*/
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
parent::_construct();
|
35 |
+
$this->setTemplate('ricardomartins_pagseguro/form/info/cc.phtml');
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Helper/Data.php
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class RicardoMartins_PagSeguro_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
const XML_PATH_PAYMENT_PAGSEGURO_EMAIL = 'payment/pagseguro/merchant_email';
|
6 |
+
const XML_PATH_PAYMENT_PAGSEGURO_TOKEN = 'payment/pagseguro/token';
|
7 |
+
const XML_PATH_PAYMENT_PAGSEGURO_DEBUG = 'payment/pagseguro/debug';
|
8 |
+
const XML_PATH_PAUMENT_PAGSEGURO_SANDBOX = 'payment/pagseguro/sandbox';
|
9 |
+
const XML_PATH_PAYMENT_PAGSEGURO_SANDBOX_EMAIL = 'payment/pagseguro/sandbox_merchant_email';
|
10 |
+
const XML_PATH_PAYMENT_PAGSEGURO_SANDBOX_TOKEN = 'payment/pagseguro/sandbox_token';
|
11 |
+
const XML_PATH_PAYMENT_PAGSEGURO_WS_URL = 'payment/pagseguro/ws_url';
|
12 |
+
const XML_PATH_PAYMENT_PAGSEGURO_JS_URL = 'payment/pagseguro/js_url';
|
13 |
+
const XML_PATH_PAYMENT_PAGSEGURO_SANDBOX_WS_URL = 'payment/pagseguro/sandbox_ws_url';
|
14 |
+
const XML_PATH_PAYMENT_PAGSEGURO_SANDBOX_JS_URL = 'payment/pagseguro/sandbox_js_url';
|
15 |
+
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Retorna o ID da sessao para ser usado nas chamadas JavaScript do Checkout Transparente
|
19 |
+
* ou FALSE no caso de erro
|
20 |
+
* @return bool|string
|
21 |
+
*/
|
22 |
+
public function getSessionId()
|
23 |
+
{
|
24 |
+
$client = new Zend_Http_Client($this->getWsUrl('sessions'));
|
25 |
+
$client->setMethod(Zend_Http_Client::POST);
|
26 |
+
$client->setParameterGet('email', $this->getMerchantEmail());
|
27 |
+
$client->setParameterGet('token', $this->getToken());
|
28 |
+
$client->setConfig(array('timeout'=>30));
|
29 |
+
try{
|
30 |
+
$response = $client->request();
|
31 |
+
}catch(Exception $e){
|
32 |
+
Mage::logException($e);
|
33 |
+
return false;
|
34 |
+
}
|
35 |
+
|
36 |
+
$response = $client->getLastResponse()->getBody();
|
37 |
+
|
38 |
+
libxml_use_internal_errors(true);
|
39 |
+
$xml = simplexml_load_string($response);
|
40 |
+
if(false === $xml){
|
41 |
+
$this->writeLog('Falha na autenticação com API do PagSeguro. Verifique email e token cadastrados. Retorno pagseguro: ' . $response);
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
return (string)$xml->id;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Retorna o email do lojista
|
49 |
+
* @return string
|
50 |
+
*/
|
51 |
+
public function getMerchantEmail()
|
52 |
+
{
|
53 |
+
if($this->isSandbox())
|
54 |
+
{
|
55 |
+
return Mage::getStoreConfig(self::XML_PATH_PAYMENT_PAGSEGURO_SANDBOX_EMAIL);
|
56 |
+
}
|
57 |
+
return Mage::getStoreConfig(self::XML_PATH_PAYMENT_PAGSEGURO_EMAIL);
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Retorna URL do Webservice do Pagseguro de acordo com o ambiente selecionado
|
62 |
+
* @param string $amend acrescenta algo no final
|
63 |
+
*
|
64 |
+
* @return string
|
65 |
+
*/
|
66 |
+
public function getWsUrl($amend='')
|
67 |
+
{
|
68 |
+
if($this->isSandbox())
|
69 |
+
{
|
70 |
+
return Mage::getStoreConfig(self::XML_PATH_PAYMENT_PAGSEGURO_SANDBOX_WS_URL) . $amend;
|
71 |
+
}
|
72 |
+
return Mage::getStoreConfig(self::XML_PATH_PAYMENT_PAGSEGURO_WS_URL) . $amend;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Retorna o url do JavaScript da lib do Pagseguro de acordo com o ambiente selecionado
|
77 |
+
* @return string
|
78 |
+
*/
|
79 |
+
public function getJsUrl()
|
80 |
+
{
|
81 |
+
if($this->isSandbox())
|
82 |
+
{
|
83 |
+
return Mage::getStoreConfig(self::XML_PATH_PAYMENT_PAGSEGURO_SANDBOX_JS_URL);
|
84 |
+
}
|
85 |
+
return Mage::getStoreConfig(self::XML_PATH_PAYMENT_PAGSEGURO_JS_URL);
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Verifica se o debug está ativado
|
90 |
+
* @return bool
|
91 |
+
*/
|
92 |
+
public function isDebugActive()
|
93 |
+
{
|
94 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_PAYMENT_PAGSEGURO_DEBUG);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Está no modo SandBox?
|
99 |
+
* @return bool
|
100 |
+
*/
|
101 |
+
public function isSandbox()
|
102 |
+
{
|
103 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_PAUMENT_PAGSEGURO_SANDBOX);
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Grava algo no pagseguro.log
|
108 |
+
* @param $obj mixed|string
|
109 |
+
*/
|
110 |
+
public function writeLog($obj)
|
111 |
+
{
|
112 |
+
if ($this->isDebugActive()) {
|
113 |
+
if(is_string($obj)){
|
114 |
+
Mage::log($obj, Zend_Log::DEBUG, 'pagseguro.log', true);
|
115 |
+
}else{
|
116 |
+
Mage::log(var_export($obj, true), Zend_Log::DEBUG, 'pagseguro.log', true);
|
117 |
+
}
|
118 |
+
}else{
|
119 |
+
Mage::log(var_export('debug inativo', true), null, 'martins.log', true);
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Retorna o TOKEN configurado pro ambiente selecionado. Retorna false caso não tenha sido preenchido.
|
125 |
+
* @return string | false
|
126 |
+
*/
|
127 |
+
public function getToken()
|
128 |
+
{
|
129 |
+
$token = Mage::getStoreConfig(self::XML_PATH_PAYMENT_PAGSEGURO_TOKEN);
|
130 |
+
if($this->isSandbox())
|
131 |
+
{
|
132 |
+
$token = Mage::getStoreConfig(self::XML_PATH_PAYMENT_PAGSEGURO_SANDBOX_TOKEN);
|
133 |
+
}
|
134 |
+
if(empty($token))
|
135 |
+
{
|
136 |
+
return false;
|
137 |
+
}
|
138 |
+
|
139 |
+
return Mage::helper('core')->decrypt($token);
|
140 |
+
}
|
141 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Helper/Internal.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class RicardoMartins_PagSeguro_Helper_Internal
|
4 |
+
* Trata chamadas internas da API
|
5 |
+
*
|
6 |
+
* @author Ricardo Martins <ricardo@ricardomartins.net.br>
|
7 |
+
*/
|
8 |
+
class RicardoMartins_PagSeguro_Helper_Internal extends Mage_Core_Helper_Abstract
|
9 |
+
{
|
10 |
+
/*
|
11 |
+
* Retorna campos de uma dada entidade
|
12 |
+
* @author Gabriela D'Ávila (http://davila.blog.br)
|
13 |
+
*/
|
14 |
+
public static function getFields($type = 'customer_address') {
|
15 |
+
$entityType = Mage::getModel('eav/config')->getEntityType($type);
|
16 |
+
$entityTypeId = $entityType->getEntityTypeId();
|
17 |
+
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($entityTypeId);
|
18 |
+
|
19 |
+
return $attributes->getData();
|
20 |
+
}
|
21 |
+
|
22 |
+
/*
|
23 |
+
* Retorna array associativo com parametros necessarios pra uma chamada de API para pagamento com Cartao
|
24 |
+
* @return array
|
25 |
+
*/
|
26 |
+
public function getCreditCardApiCallParams(Mage_Sales_Model_Order $order, $payment)
|
27 |
+
{
|
28 |
+
$helper = Mage::helper('ricardomartins_pagseguro');
|
29 |
+
$phelper = Mage::helper('ricardomartins_pagseguro/params'); //params helper - helper auxiliar de parametrização
|
30 |
+
$params = array(
|
31 |
+
'email' => $helper->getMerchantEmail(),
|
32 |
+
'token' => $helper->getToken(),
|
33 |
+
'paymentMode' => 'default',
|
34 |
+
'paymentMethod' => 'creditCard',
|
35 |
+
'receiverEmail' => $helper->getMerchantEmail(),
|
36 |
+
'currency' => 'BRL',
|
37 |
+
'creditCardToken' => $payment['additional_information']['credit_card_token'],
|
38 |
+
'reference' => $order->getIncrementId(),
|
39 |
+
'extraAmount'=> $phelper->getExtraAmount($order),
|
40 |
+
'notificationURL' => Mage::getUrl('ricardomartins_pagseguro/notification'),
|
41 |
+
);
|
42 |
+
$items = $phelper->getItemsParams($order);
|
43 |
+
$params = array_merge($params, $phelper->getItemsParams($order));
|
44 |
+
$params = array_merge($params, $phelper->getSenderParams($order,$payment));
|
45 |
+
$params = array_merge($params, $phelper->getAddressParams($order,'shipping'));
|
46 |
+
$params = array_merge($params, $phelper->getAddressParams($order,'billing'));
|
47 |
+
$params = array_merge($params, $phelper->getCreditCardHolderParams($order,$payment));
|
48 |
+
$params = array_merge($params, $phelper->getCreditCardInstallmentsParams($order,$payment));
|
49 |
+
|
50 |
+
// Mage::log(var_export($params, true), null, 'pagseguro.log', true);
|
51 |
+
|
52 |
+
return $params;
|
53 |
+
}
|
54 |
+
|
55 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Helper/Params.php
ADDED
@@ -0,0 +1,329 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class RicardoMartins_PagSeguro_Helper_Params
|
4 |
+
* Classe para auxiliar na montagem dos parametros de chamadas da api. Trata telefones, itens, dados do cliente e afins.
|
5 |
+
*
|
6 |
+
* @author Ricardo Martins <ricardo@ricardomartins.net.br>
|
7 |
+
*/
|
8 |
+
class RicardoMartins_PagSeguro_Helper_Params extends Mage_Core_Helper_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Retorna um array com informações dos itens para ser enviado pra API
|
13 |
+
* @param Mage_Sales_Model_Order $order
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public function getItemsParams(Mage_Sales_Model_Order $order)
|
17 |
+
{
|
18 |
+
$retorno = array();
|
19 |
+
if($items = $order->getAllVisibleItems())
|
20 |
+
{
|
21 |
+
for($x=1, $y=0, $c=count($items); $x <= $c; $x++, $y++)
|
22 |
+
{
|
23 |
+
$retorno['itemId'.$x] = $items[$y]->getId();
|
24 |
+
$retorno['itemDescription'.$x] = $this->normalizeChars($items[$y]->getName());
|
25 |
+
$retorno['itemAmount'.$x] = number_format($items[$y]->getPrice(),2,'.','');
|
26 |
+
$retorno['itemQuantity'.$x] = $items[$y]->getQtyOrdered();
|
27 |
+
}
|
28 |
+
}
|
29 |
+
return $retorno;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Retorna um array com informações do Sender(Cliente) para ser enviado pra API
|
34 |
+
* @param Mage_Sales_Model_Order $order
|
35 |
+
* @param $payment
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function getSenderParams(Mage_Sales_Model_Order $order, $payment)
|
39 |
+
{
|
40 |
+
$digits = new Zend_Filter_Digits();
|
41 |
+
|
42 |
+
/** @var Mage_Customer_Model_Customer $customer */
|
43 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
44 |
+
$customer_cpf_attribute = Mage::getStoreConfig('payment/pagseguro/customer_cpf_attribute');
|
45 |
+
$cpf = $customer->getResource()->getAttribute($customer_cpf_attribute)->getFrontend()->getValue($customer);
|
46 |
+
|
47 |
+
//telefone
|
48 |
+
$phone = $this->_extractPhone($order->getBillingAddress()->getTelephone());
|
49 |
+
|
50 |
+
|
51 |
+
$retorno = array(
|
52 |
+
'senderName' => sprintf('%s %s',$order->getCustomerFirstname(), $order->getCustomerLastname()),
|
53 |
+
'senderEmail' => $order->getCustomerEmail(),
|
54 |
+
'senderHash' => $payment['additional_information']['sender_hash'],
|
55 |
+
'senderCPF' => $digits->filter($cpf),
|
56 |
+
'senderAreaCode'=> $phone['area'],
|
57 |
+
'senderPhone' => $phone['number'],
|
58 |
+
);
|
59 |
+
|
60 |
+
return $retorno;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Retorna um array com informações do dono do Cartao(Cliente) para ser enviado pra API
|
65 |
+
* @param Mage_Sales_Model_Order $order
|
66 |
+
* @param $payment
|
67 |
+
* @return array
|
68 |
+
*/
|
69 |
+
public function getCreditCardHolderParams(Mage_Sales_Model_Order $order, $payment)
|
70 |
+
{
|
71 |
+
$digits = new Zend_Filter_Digits();
|
72 |
+
|
73 |
+
/** @var Mage_Customer_Model_Customer $customer */
|
74 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
75 |
+
$customer_cpf_attribute = Mage::getStoreConfig('payment/pagseguro/customer_cpf_attribute');
|
76 |
+
$cpf = $customer->getResource()->getAttribute($customer_cpf_attribute)->getFrontend()->getValue($customer);
|
77 |
+
|
78 |
+
|
79 |
+
$cpf = $customer->getResource()->getAttribute($customer_cpf_attribute)->getFrontend()->getValue($customer);
|
80 |
+
|
81 |
+
//dados
|
82 |
+
$creditCardHolderBirthDate = $this->_getCustomerCcDobValue($customer,$payment);
|
83 |
+
$phone = $this->_extractPhone($order->getBillingAddress()->getTelephone());
|
84 |
+
|
85 |
+
|
86 |
+
$retorno = array(
|
87 |
+
'creditCardHolderName' => $payment['additional_information']['credit_card_owner'],
|
88 |
+
'creditCardHolderBirthDate' => $creditCardHolderBirthDate,
|
89 |
+
'creditCardHolderCPF' => $digits->filter($cpf),
|
90 |
+
'creditCardHolderAreaCode' => $phone['area'],
|
91 |
+
'creditCardHolderPhone' => $phone['number'],
|
92 |
+
);
|
93 |
+
|
94 |
+
return $retorno;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Retorna um array com informações de parcelamento (Cartao) para ser enviado pra API
|
99 |
+
* @param Mage_Sales_Model_Order $order
|
100 |
+
* @param $payment Mage_Sales_Model_Order_Payment
|
101 |
+
* @return array
|
102 |
+
*/
|
103 |
+
public function getCreditCardInstallmentsParams(Mage_Sales_Model_Order $order, $payment)
|
104 |
+
{
|
105 |
+
$retorno = array();
|
106 |
+
if($payment->getAdditionalInformation('installment_quantity') && $payment->getAdditionalInformation('installment_value'))
|
107 |
+
{
|
108 |
+
$retorno = array(
|
109 |
+
'installmentQuantity' => $payment->getAdditionalInformation('installment_quantity'),
|
110 |
+
'installmentValue' => number_format($payment->getAdditionalInformation('installment_value'),2,'.',''),
|
111 |
+
);
|
112 |
+
}else{
|
113 |
+
$retorno = array(
|
114 |
+
'installmentQuantity' => '1',
|
115 |
+
'installmentValue' => number_format($order->getGrandTotal(),2,'.',''),
|
116 |
+
);
|
117 |
+
}
|
118 |
+
return $retorno;
|
119 |
+
}
|
120 |
+
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Retorna um array com informações do endereço de entrega/cobranca para ser enviado pra API
|
124 |
+
* @param Mage_Sales_Model_Order $order
|
125 |
+
* @param string (billing|shipping) $type
|
126 |
+
* @return array
|
127 |
+
*/
|
128 |
+
public function getAddressParams(Mage_Sales_Model_Order $order, $type)
|
129 |
+
{
|
130 |
+
$digits = new Zend_Filter_Digits();
|
131 |
+
|
132 |
+
//atributos de endereço
|
133 |
+
/** @var Mage_Sales_Model_Order_Address $address */
|
134 |
+
$address = ($type=='shipping' && !$order->getIsVirtual()) ? $order->getShippingAddress() : $order->getBillingAddress();
|
135 |
+
$address_street_attribute = Mage::getStoreConfig('payment/pagseguro/address_street_attribute');
|
136 |
+
$address_number_attribute = Mage::getStoreConfig('payment/pagseguro/address_number_attribute');
|
137 |
+
$address_complement_attribute = Mage::getStoreConfig('payment/pagseguro/address_complement_attribute');
|
138 |
+
$address_neighborhood_attribute = Mage::getStoreConfig('payment/pagseguro/address_neighborhood_attribute');
|
139 |
+
|
140 |
+
//obtendo dados de endereço
|
141 |
+
$addressStreet = $this->_getAddressAttributeValue($address,$address_street_attribute);
|
142 |
+
$addressNumber = $this->_getAddressAttributeValue($address,$address_number_attribute);
|
143 |
+
$addressComplement = $this->_getAddressAttributeValue($address,$address_complement_attribute);
|
144 |
+
$addressDistrict = $this->_getAddressAttributeValue($address,$address_neighborhood_attribute);
|
145 |
+
$addressPostalCode = $address->getPostcode();
|
146 |
+
$addressCity = $address->getCity();
|
147 |
+
$addressState = $this->getStateCode( $address->getRegion() );
|
148 |
+
|
149 |
+
|
150 |
+
$retorno = array(
|
151 |
+
$type.'AddressStreet' => $this->normalizeChars($addressStreet),
|
152 |
+
$type.'AddressNumber' => $addressNumber,
|
153 |
+
$type.'AddressComplement' => $this->normalizeChars($addressComplement),
|
154 |
+
$type.'AddressDistrict' => $this->normalizeChars($addressDistrict),
|
155 |
+
$type.'AddressPostalCode' => $addressPostalCode,
|
156 |
+
$type.'AddressCity' => $this->normalizeChars($addressCity),
|
157 |
+
$type.'AddressState' => $addressState,
|
158 |
+
$type.'AddressCountry' => 'BRA',
|
159 |
+
);
|
160 |
+
|
161 |
+
//específico pra shipping
|
162 |
+
if($type == 'shipping')
|
163 |
+
{
|
164 |
+
$shippingType = $this->_getShippingType($order);
|
165 |
+
$shippingCost = $order->getShippingAmount();
|
166 |
+
$retorno['shippingType'] = $shippingType;
|
167 |
+
if($shippingCost > 0)
|
168 |
+
{
|
169 |
+
$retorno['shippingCost'] = number_format($shippingCost,2,'.','');
|
170 |
+
}
|
171 |
+
}
|
172 |
+
return $retorno;
|
173 |
+
}
|
174 |
+
|
175 |
+
public function getStateCode($state)
|
176 |
+
{
|
177 |
+
if(strlen($state) == 2 && is_string($state))
|
178 |
+
{
|
179 |
+
return mb_convert_case($state,MB_CASE_UPPER);
|
180 |
+
}
|
181 |
+
else if(strlen($state) > 2 && is_string($state))
|
182 |
+
{
|
183 |
+
$state = $this->normalizeChars($state);
|
184 |
+
$state = trim($state);
|
185 |
+
$state = mb_convert_case($state, MB_CASE_UPPER);
|
186 |
+
$codes = array("AC"=>"ACRE", "AL"=>"ALAGOAS", "AM"=>"AMAZONAS", "AP"=>"AMAPA","BA"=>"BAHIA","CE"=>"CEARA","DF"=>"DISTRITO FEDERAL","ES"=>"ESPIRITO SANTO","GO"=>"GOIAS","MA"=>"MARANHAO","MT"=>"MATO GROSSO","MS"=>"MATO GROSSO DO SUL","MG"=>"MINAS GERAIS","PA"=>"PARA","PB"=>"PARAIBA","PR"=>"PARANA","PE"=>"PERNAMBUCO","PI"=>"PIAUI","RJ"=>"RIO DE JANEIRO","RN"=>"RIO GRANDE DO NORTE","RO"=>"RONDONIA","RS"=>"RIO GRANDE DO SUL","RR"=>"RORAIMA","SC"=>"SANTA CATARINA","SE"=>"SERGIPE","SP"=>"SAO PAULO","TO"=>"TOCANTINS");
|
187 |
+
if($code = array_search($state,$codes))
|
188 |
+
{
|
189 |
+
return $code;
|
190 |
+
}
|
191 |
+
}
|
192 |
+
return $state;
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Replace language-specific characters by ASCII-equivalents.
|
197 |
+
* @see http://stackoverflow.com/a/16427125/529403
|
198 |
+
* @param string $s
|
199 |
+
* @return string
|
200 |
+
*/
|
201 |
+
public static function normalizeChars($s) {
|
202 |
+
$replace = array(
|
203 |
+
'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'Ae', 'Å'=>'A', 'Æ'=>'A', 'Ă'=>'A',
|
204 |
+
'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'ae', 'å'=>'a', 'ă'=>'a', 'æ'=>'ae',
|
205 |
+
'þ'=>'b', 'Þ'=>'B',
|
206 |
+
'Ç'=>'C', 'ç'=>'c',
|
207 |
+
'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E',
|
208 |
+
'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e',
|
209 |
+
'Ğ'=>'G', 'ğ'=>'g',
|
210 |
+
'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'İ'=>'I', 'ı'=>'i', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i',
|
211 |
+
'Ñ'=>'N',
|
212 |
+
'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'Oe', 'Ø'=>'O', 'ö'=>'oe', 'ø'=>'o',
|
213 |
+
'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o',
|
214 |
+
'Š'=>'S', 'š'=>'s', 'Ş'=>'S', 'ș'=>'s', 'Ș'=>'S', 'ş'=>'s', 'ß'=>'ss',
|
215 |
+
'ț'=>'t', 'Ț'=>'T',
|
216 |
+
'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'Ue',
|
217 |
+
'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ü'=>'ue',
|
218 |
+
'Ý'=>'Y',
|
219 |
+
'ý'=>'y', 'ý'=>'y', 'ÿ'=>'y',
|
220 |
+
'Ž'=>'Z', 'ž'=>'z'
|
221 |
+
);
|
222 |
+
return strtr($s, $replace);
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Calcula o valor "Extra", que será o valor das Taxas subtraído do valor dos impostos
|
227 |
+
* @param Mage_Sales_Model_Order $order
|
228 |
+
*
|
229 |
+
* @return string
|
230 |
+
*/
|
231 |
+
public function getExtraAmount($order)
|
232 |
+
{
|
233 |
+
$discount = $order->getDiscountAmount();
|
234 |
+
$tax_amount = $order->getTaxAmount();
|
235 |
+
$extra = $discount+$tax_amount;
|
236 |
+
return number_format($extra,2, '.','');
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Extraí codigo de area e telefone e devolve array com area e number como chave
|
241 |
+
* @author Ricardo Martins <ricardo@ricardomartins.net.br>
|
242 |
+
* @param string $phone
|
243 |
+
* @return array
|
244 |
+
*/
|
245 |
+
private function _extractPhone($phone)
|
246 |
+
{
|
247 |
+
$digits = new Zend_Filter_Digits();
|
248 |
+
$phone = $digits->filter($phone);
|
249 |
+
$original_phone = $phone;
|
250 |
+
|
251 |
+
$phone = preg_replace('/^(\d{2})(\d{7,9})$/','$1-$2',$phone);
|
252 |
+
if(is_array($phone) && count($phone) == 2)
|
253 |
+
{
|
254 |
+
list($area,$number) = explode('-',$phone);
|
255 |
+
return array(
|
256 |
+
'area' => $area,
|
257 |
+
'number'=>$number
|
258 |
+
);
|
259 |
+
}
|
260 |
+
|
261 |
+
return array(
|
262 |
+
'area' => (string)substr($original_phone,0,2),
|
263 |
+
'number'=> (string)substr($original_phone,2,9),
|
264 |
+
);
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Retorna a forma de envio do produto
|
269 |
+
* 1 – PAC, 2 – SEDEX, 3 - Desconhecido
|
270 |
+
* @param Mage_Sales_Model_Order $order
|
271 |
+
*
|
272 |
+
* @return string
|
273 |
+
*/
|
274 |
+
private function _getShippingType(Mage_Sales_Model_Order $order)
|
275 |
+
{
|
276 |
+
$method = strtolower($order->getShippingMethod());
|
277 |
+
if(strstr($method,'pac') !== false){
|
278 |
+
return '1';
|
279 |
+
}else if(strstr($method,'sedex') !== false)
|
280 |
+
{
|
281 |
+
return '2';
|
282 |
+
}
|
283 |
+
return '3';
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Pega um atributo de endereço baseado em um dos Id's vindos de RicardoMartins_PagSeguro_Model_Source_Customer_Address_*
|
288 |
+
* @param Mage_Sales_Model_Order_Address $address
|
289 |
+
* @param string $attribute_id
|
290 |
+
*/
|
291 |
+
private function _getAddressAttributeValue($address, $attribute_id)
|
292 |
+
{
|
293 |
+
$is_streetline = preg_match('/^street_(\d{1})$/', $attribute_id, $matches);
|
294 |
+
|
295 |
+
if($is_streetline !== false && isset($matches[1])) //usa Streetlines
|
296 |
+
{
|
297 |
+
return $address->getStreet(intval($matches[1]));
|
298 |
+
}
|
299 |
+
else if($attribute_id == '') //Nao informar ao pagseguro
|
300 |
+
{
|
301 |
+
return '';
|
302 |
+
}
|
303 |
+
return (string)$address->getData($attribute_id);
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Retorna a Data de Nascimento do cliente baseado na selecao realizada na configuração do Cartao de credito do modulo
|
308 |
+
* @param Mage_Customer_Model_Customer $customer
|
309 |
+
* @param $payment
|
310 |
+
*
|
311 |
+
* @return mixed
|
312 |
+
*/
|
313 |
+
private function _getCustomerCcDobValue(Mage_Customer_Model_Customer $customer, $payment)
|
314 |
+
{
|
315 |
+
$cc_dob_attribute = Mage::getStoreConfig('payment/pagseguro_cc/owner_dob_attribute');
|
316 |
+
|
317 |
+
if(empty($cc_dob_attribute)) //Soliciado ao cliente junto com os dados do cartao
|
318 |
+
{
|
319 |
+
if(isset($payment['additional_information']['credit_card_owner_birthdate'])){
|
320 |
+
return $payment['additional_information']['credit_card_owner_birthdate'];
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
$dob = $customer->getResource()->getAttribute($cc_dob_attribute)->getFrontend()->getValue($customer);
|
325 |
+
|
326 |
+
|
327 |
+
return date('d/m/Y', strtotime($dob));
|
328 |
+
}
|
329 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Model/Abstract.php
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class RicardoMartins_PagSeguro_Model_Abstract extends Mage_Payment_Model_Method_Abstract
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Processa o XML de retorno da notificação. O XML é enviado no ato do pedido, e depois nas consultas de atualizacao de pedido.
|
6 |
+
* @see https://pagseguro.uol.com.br/v2/guia-de-integracao/api-de-notificacoes.html#v2-item-servico-de-notificacoes
|
7 |
+
* @param SimpleXMLElement $resultXML
|
8 |
+
*/
|
9 |
+
public function proccessNotificatonResult(SimpleXMLElement $resultXML)
|
10 |
+
{
|
11 |
+
if(isset($resultXML->error)){
|
12 |
+
$errMsg = Mage::helper('ricardomartins_pagseguro')->__((string)$resultXML->error->message);
|
13 |
+
Mage::throwException($this->_getHelper()->__('Problemas ao processar seu pagamento. %s(%s)', $errMsg, (string)$resultXML->error->code));
|
14 |
+
}
|
15 |
+
if(isset($resultXML->reference))
|
16 |
+
{
|
17 |
+
/** @var Mage_Sales_Model_Order $order */
|
18 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId((string)$resultXML->reference);
|
19 |
+
$payment = $order->getPayment();
|
20 |
+
$processedState = $this->processStatus((int)$resultXML->status);
|
21 |
+
$message = $processedState->getMessage();
|
22 |
+
|
23 |
+
if((int)$resultXML->status == 6) //valor devolvido (gera credit memo e tenta cancelar o pedido)
|
24 |
+
{
|
25 |
+
if ($order->canUnhold()) {
|
26 |
+
$order->unhold();
|
27 |
+
}
|
28 |
+
if($order->canCancel())
|
29 |
+
{
|
30 |
+
$payment->registerRefundNotification(floatval($resultXML->grossAmount));
|
31 |
+
$order->cancel();
|
32 |
+
$order->save();
|
33 |
+
}else{
|
34 |
+
$order->addStatusHistoryComment('Devolvido: o valor foi devolvido ao comprador, mas o pedido encontra-se em um estado que não pode ser cancelado.')
|
35 |
+
->save();
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
if($processedState->getStateChanged())
|
40 |
+
{
|
41 |
+
$order->setState($processedState->getState(),true,$processedState->getIsCustomerNotified())->save();
|
42 |
+
}
|
43 |
+
|
44 |
+
if((int)$resultXML->status == 3) //Quando o pedido foi dado como Pago
|
45 |
+
{
|
46 |
+
$payment->registerCaptureNotification(floatval($resultXML->grossAmount));
|
47 |
+
}
|
48 |
+
|
49 |
+
if((int)$resultXML->status == 7 && isset($resultXML->cancellationSource)) //Especificamos a fonte do cancelamento do pedido
|
50 |
+
{
|
51 |
+
switch((string)$resultXML->cancellationSource)
|
52 |
+
{
|
53 |
+
case 'INTERNAL':
|
54 |
+
$message .= ' O próprio PagSeguro negou ou cancelou a transação.';
|
55 |
+
break;
|
56 |
+
case 'EXTERNAL':
|
57 |
+
$message .= ' A transação foi negada ou cancelada pela instituição bancária.';
|
58 |
+
break;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
$order->addStatusHistoryComment($message);
|
63 |
+
$payment->save();
|
64 |
+
$order->save();
|
65 |
+
Mage::dispatchEvent('pagseguro_proccess_notification_after',array(
|
66 |
+
'order' => $order,
|
67 |
+
'payment'=> $payment,
|
68 |
+
'result_xml' => $resultXML,
|
69 |
+
));
|
70 |
+
}else{
|
71 |
+
Mage::throwException('Retorno inválido. Referência do pedido não encontrada.');
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Pega um codigo de notificacao (enviado pelo pagseguro quando algo acontece com o pedido) e consulta o que mudou no status
|
77 |
+
* @param $notificationCode
|
78 |
+
*
|
79 |
+
* @return SimpleXMLElement
|
80 |
+
*/
|
81 |
+
public function getNotificationStatus($notificationCode)
|
82 |
+
{
|
83 |
+
$helper = Mage::helper('ricardomartins_pagseguro');
|
84 |
+
$url = $helper->getWsUrl('transactions/notifications/' . $notificationCode);
|
85 |
+
$client = new Zend_Http_Client($url);
|
86 |
+
$client->setParameterGet(array(
|
87 |
+
'token'=>$helper->getToken(),
|
88 |
+
'email'=> $helper->getMerchantEmail(),
|
89 |
+
));
|
90 |
+
$client->request();
|
91 |
+
$helper->writeLog(sprintf('Retorno do Pagseguro para notificationCode %s: %s', $notificationCode, $client->getLastResponse()->getBody()));
|
92 |
+
return simplexml_load_string($client->getLastResponse()->getBody());
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Processa o status do pedido devolvendo informacoes como status e state do pedido
|
97 |
+
* @param $statusCode
|
98 |
+
* @return Varien_Object
|
99 |
+
*/
|
100 |
+
public function processStatus($statusCode)
|
101 |
+
{
|
102 |
+
$return = new Varien_Object();
|
103 |
+
$return->setStateChanged(true);
|
104 |
+
$return->setIsTransactionPending(true); //payment is pending?
|
105 |
+
switch($statusCode)
|
106 |
+
{
|
107 |
+
case '1':
|
108 |
+
$return->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
|
109 |
+
$return->setIsCustomerNotified(true);
|
110 |
+
$return->setMessage('Aguardando pagamento: o comprador iniciou a transação, mas até o momento o PagSeguro não recebeu nenhuma informação sobre o pagamento.');
|
111 |
+
break;
|
112 |
+
case '2':
|
113 |
+
$return->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW);
|
114 |
+
$return->setIsCustomerNotified(true);
|
115 |
+
$return->setMessage('Em análise: o comprador optou por pagar com um cartão de crédito e o PagSeguro está analisando o risco da transação.');
|
116 |
+
break;
|
117 |
+
case '3':
|
118 |
+
$return->setState(Mage_Sales_Model_Order::STATE_PROCESSING);
|
119 |
+
$return->setIsCustomerNotified(true);
|
120 |
+
$return->setMessage('Paga: a transação foi paga pelo comprador e o PagSeguro já recebeu uma confirmação da instituição financeira responsável pelo processamento.');
|
121 |
+
$return->setIsTransactionPending(false);
|
122 |
+
break;
|
123 |
+
case '4':
|
124 |
+
$return->setMessage('Disponível: a transação foi paga e chegou ao final de seu prazo de liberação sem ter sido retornada e sem que haja nenhuma disputa aberta.');
|
125 |
+
$return->setIsCustomerNotified(false);
|
126 |
+
$return->setStateChanged(false);
|
127 |
+
$return->setIsTransactionPending(false);
|
128 |
+
break;
|
129 |
+
case '5':
|
130 |
+
$return->setState(Mage_Sales_Model_Order::STATE_PROCESSING);
|
131 |
+
$return->setIsCustomerNotified(false);
|
132 |
+
$return->setIsTransactionPending(false);
|
133 |
+
$return->setMessage('Em disputa: o comprador, dentro do prazo de liberação da transação, abriu uma disputa.');
|
134 |
+
break;
|
135 |
+
case '6':
|
136 |
+
$return->setState(Mage_Sales_Model_Order::STATE_CLOSED);
|
137 |
+
$return->setIsCustomerNotified(false);
|
138 |
+
$return->setIsTransactionPending(false);
|
139 |
+
$return->setMessage('Devolvida: o valor da transação foi devolvido para o comprador.');
|
140 |
+
break;
|
141 |
+
case '7':
|
142 |
+
$return->setState(Mage_Sales_Model_Order::STATE_CANCELED);
|
143 |
+
$return->setIsCustomerNotified(true);
|
144 |
+
$return->setMessage('Cancelada: a transação foi cancelada sem ter sido finalizada.');
|
145 |
+
break;
|
146 |
+
default:
|
147 |
+
$return->setIsCustomerNotified(false);
|
148 |
+
$return->setStateChanged(false);
|
149 |
+
$return->setMessage('Codigo de status inválido retornado pelo PagSeguro. (' . $statusCode . ')');
|
150 |
+
}
|
151 |
+
return $return;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Chama API pra realizar um pagamento
|
156 |
+
* @param $params
|
157 |
+
* @param $payment
|
158 |
+
*
|
159 |
+
* @return SimpleXMLElement
|
160 |
+
*/
|
161 |
+
public function callApi($params, $payment)
|
162 |
+
{
|
163 |
+
$helper = Mage::helper('ricardomartins_pagseguro');
|
164 |
+
$client = new Zend_Http_Client($helper->getWsUrl('transactions'));
|
165 |
+
$client->setMethod(Zend_Http_Client::POST);
|
166 |
+
$client->setConfig(array('timeout'=>30));
|
167 |
+
|
168 |
+
$client->setParameterPost($params); //parametros enviados via POST
|
169 |
+
|
170 |
+
$helper->writeLog('Parametros sendo enviados para API (/transactions): '. var_export($params,true));
|
171 |
+
try{
|
172 |
+
$response = $client->request(); //faz o request
|
173 |
+
}catch(Exception $e){
|
174 |
+
Mage::throwException('Falha na comunicação com Pagseguro (' . $e->getMessage() . ')');
|
175 |
+
}
|
176 |
+
|
177 |
+
$response = $client->getLastResponse()->getBody();
|
178 |
+
$helper->writeLog('Retorno PagSeguro (/transactions): ' . var_export($response,true));
|
179 |
+
|
180 |
+
libxml_use_internal_errors(true);
|
181 |
+
$xml = simplexml_load_string($response);
|
182 |
+
if(false === $xml){
|
183 |
+
switch($response){
|
184 |
+
case 'Unauthorized':
|
185 |
+
$helper->writeLog('Token/email não autorizado pelo PagSeguro. Verifique suas configurações no painel.');
|
186 |
+
break;
|
187 |
+
case 'Forbidden':
|
188 |
+
$helper->writeLog('Acesso não autorizado à Api Pagseguro. Verifique se você tem permissão para usar este serviço. Retorno: ' . var_export($response,true));
|
189 |
+
break;
|
190 |
+
default:
|
191 |
+
$helper->writeLog('Retorno inesperado do PagSeguro. Retorno: ' . var_export($response,true));
|
192 |
+
}
|
193 |
+
Mage::throwException('Houve uma falha ao processar seu pedido/pagamento. Por favor entre em contato conosco.');
|
194 |
+
}
|
195 |
+
|
196 |
+
|
197 |
+
return $xml;
|
198 |
+
}
|
199 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Model/Observer.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class RicardoMartins_PagSeguro_Model_Observer
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Adiciona o bloco do direct payment logo após um dos forms do pagseguro ter sido inserido.
|
6 |
+
* @param $observer
|
7 |
+
*
|
8 |
+
* @return $this
|
9 |
+
*/
|
10 |
+
public function addDirectPaymentBlock($observer)
|
11 |
+
{
|
12 |
+
$pagseguroBlocks = array('ricardomartins_pagseguropro/form_boleto','ricardomartins_pagseguro/form_cc');
|
13 |
+
$blockType = $observer->getBlock()->getType();
|
14 |
+
if(in_array($blockType,$pagseguroBlocks)){
|
15 |
+
$output = $observer->getTransport()->getHtml();
|
16 |
+
$directpayment = Mage::app()->getLayout()->createBlock('ricardomartins_pagseguro/form_directpayment')->toHtml();
|
17 |
+
$observer->getTransport()->setHtml($output . $directpayment);
|
18 |
+
|
19 |
+
}
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Model/Payment/Cc.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class RicardoMartins_PagSeguro_Model_Payment_Cc extends RicardoMartins_PagSeguro_Model_Abstract
|
3 |
+
{
|
4 |
+
protected $_code = 'pagseguro_cc';
|
5 |
+
protected $_formBlockType = 'ricardomartins_pagseguro/form_cc';
|
6 |
+
protected $_infoBlockType = 'ricardomartins_pagseguro/form_info_cc';
|
7 |
+
protected $_isGateway = true;
|
8 |
+
protected $_canAuthorize = true;
|
9 |
+
protected $_canCapture = true;
|
10 |
+
protected $_canRefund = false;
|
11 |
+
protected $_canVoid = true;
|
12 |
+
protected $_canUseInternal = true;
|
13 |
+
protected $_canUseCheckout = true;
|
14 |
+
protected $_canUseForMultishipping = true;
|
15 |
+
protected $_canSaveCc = false;
|
16 |
+
|
17 |
+
public function assignData($data)
|
18 |
+
{
|
19 |
+
if(!($data instanceof Varien_Object)){
|
20 |
+
$data = new Varien_Object($data);
|
21 |
+
}
|
22 |
+
|
23 |
+
$info = $this->getInfoInstance();
|
24 |
+
$info->setAdditionalInformation('sender_hash',$data->getSenderHash())
|
25 |
+
->setAdditionalInformation('credit_card_token',$data->getCreditCardToken())
|
26 |
+
->setAdditionalInformation('credit_card_owner', $data->getPsCcOwner())
|
27 |
+
->setCcType($data->getPsCardType())
|
28 |
+
->setCcLast4(substr($data->getPsCcNumber(), -4));
|
29 |
+
|
30 |
+
//data de nascimento
|
31 |
+
$owner_dob_attribute = Mage::getStoreConfig('payment/pagseguro_cc/owner_dob_attribute');
|
32 |
+
if(empty($owner_dob_attribute)){// pegar o dob e salvar aí
|
33 |
+
$info->setAdditionalInformation('credit_card_owner_birthdate', date('d/m/Y',strtotime(
|
34 |
+
$data->getPsCcOwnerBirthdayYear().'/'.$data->getPsCcOwnerBirthdayMonth().'/'.$data->getPsCcOwnerBirthdayDay()
|
35 |
+
)));
|
36 |
+
}
|
37 |
+
|
38 |
+
//parcelas
|
39 |
+
if($data->getPsCcInstallments())
|
40 |
+
{
|
41 |
+
$installments = explode('|', $data->getPsCcInstallments());
|
42 |
+
if(false !== $installments && count($installments)==2){
|
43 |
+
$info->setAdditionalInformation('installment_quantity', (int)$installments[0]);
|
44 |
+
$info->setAdditionalInformation('installment_value', $installments[1]);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
return $this;
|
49 |
+
}
|
50 |
+
|
51 |
+
public function validate()
|
52 |
+
{
|
53 |
+
parent::validate();
|
54 |
+
$info = $this->getInfoInstance();
|
55 |
+
|
56 |
+
$sender_hash = $info->getAdditionalInformation('sender_hash');
|
57 |
+
$credit_card_token = $info->getAdditionalInformation('credit_card_token');
|
58 |
+
|
59 |
+
if(empty($credit_card_token) || empty($sender_hash))
|
60 |
+
{
|
61 |
+
Mage::helper('ricardomartins_pagseguro')->writeLog('Falha ao obter o token do cartao ou sender_hash. Veja se os dados "sender_hash" e "credit_card_token" foram enviados no formulário. Um problema de JavaScript pode ter ocorrido.');
|
62 |
+
Mage::throwException('Falha ao processar pagamento junto ao PagSeguro. Por favor, entre em contato com nossa equipe.');
|
63 |
+
}
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
|
67 |
+
public function order(Varien_Object $payment, $amount)
|
68 |
+
{
|
69 |
+
$order = $payment->getOrder();
|
70 |
+
|
71 |
+
//montaremos os dados a ser enviados via POST pra api em $params
|
72 |
+
$params = Mage::helper('ricardomartins_pagseguro/internal')->getCreditCardApiCallParams($order, $payment);
|
73 |
+
|
74 |
+
//chamamos a API
|
75 |
+
$xmlRetorno = $this->callApi($params,$payment);
|
76 |
+
$this->proccessNotificatonResult($xmlRetorno);
|
77 |
+
|
78 |
+
if(isset($xmlRetorno->errors)){
|
79 |
+
$errMsg = array();
|
80 |
+
foreach($xmlRetorno->errors as $error){
|
81 |
+
$errMsg[] = (string)$error->message . '(' . $error->code . ')';
|
82 |
+
}
|
83 |
+
Mage::throwException('Um ou mais erros ocorreram no seu pagamento.' . PHP_EOL . implode(PHP_EOL,$errMsg));
|
84 |
+
}
|
85 |
+
|
86 |
+
if(isset($xmlRetorno->code)){
|
87 |
+
$payment->setAdditionalInformation(array('transaction_id'=>(string)$xmlRetorno->code));
|
88 |
+
}
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
|
92 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Model/Source/Customer/Address/Attributes.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Payment Method Codes
|
5 |
+
*
|
6 |
+
* @author Ricardo Martins <ricardo@ricardomartins.net.br>
|
7 |
+
*/
|
8 |
+
class RicardoMartins_PagSeguro_Model_Source_Customer_Address_Attributes
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Retorna os atributos de endereco
|
12 |
+
* @author Gabriela D'Ávila (http://davila.blog.br)
|
13 |
+
* @return array
|
14 |
+
*/
|
15 |
+
public function toOptionArray() {
|
16 |
+
$fields = Mage::helper('ricardomartins_pagseguro/internal')->getFields('customer_address');
|
17 |
+
$options = array();
|
18 |
+
|
19 |
+
foreach($fields as $key => $value) {
|
20 |
+
if(!is_null($value['frontend_label'])) {
|
21 |
+
//caso esteja sendo usado a propriedade multilinha do endereco, ele aceita indicar o que cada linha faz
|
22 |
+
if($value['attribute_code'] == 'street') {
|
23 |
+
$street_lines = Mage::getStoreConfig('customer/address/street_lines');
|
24 |
+
for($i = 1; $i <= $street_lines; $i++){
|
25 |
+
$options[] = array('value' => 'street_'.$i, 'label' => 'Street Line '.$i);
|
26 |
+
}
|
27 |
+
} else {
|
28 |
+
$options[] = array('value' => $value['attribute_code'], 'label' => $value['frontend_label']);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
32 |
+
return $options;
|
33 |
+
}
|
34 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Model/Source/Customer/Address/Attributes/Optional.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Payment Method Codes
|
5 |
+
*
|
6 |
+
* @author Ricardo Martins <ricardo@ricardomartins.net.br>
|
7 |
+
*/
|
8 |
+
class RicardoMartins_PagSeguro_Model_Source_Customer_Address_Attributes_Optional
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Retorna os atributos de endereco
|
12 |
+
* @author Gabriela D'Ávila (http://davila.blog.br)
|
13 |
+
* @return array
|
14 |
+
*/
|
15 |
+
public function toOptionArray() {
|
16 |
+
$fields = Mage::helper('ricardomartins_pagseguro/internal')->getFields('customer_address');
|
17 |
+
$options = array();
|
18 |
+
$options[] = array('value'=>'','label'=>'Não Informar ao PagSeguro');
|
19 |
+
|
20 |
+
foreach($fields as $key => $value) {
|
21 |
+
if(!is_null($value['frontend_label'])) {
|
22 |
+
//caso esteja sendo usado a propriedade multilinha do endereco, ele aceita indicar o que cada linha faz
|
23 |
+
if($value['attribute_code'] == 'street') {
|
24 |
+
$street_lines = Mage::getStoreConfig('customer/address/street_lines');
|
25 |
+
for($i = 1; $i <= $street_lines; $i++){
|
26 |
+
$options[] = array('value' => 'street_'.$i, 'label' => 'Street Line '.$i);
|
27 |
+
}
|
28 |
+
} else {
|
29 |
+
$options[] = array('value' => $value['attribute_code'], 'label' => $value['frontend_label']);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
return $options;
|
35 |
+
}
|
36 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Model/Source/Customer/Attributes.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Payment Method Codes
|
5 |
+
*
|
6 |
+
* @author Ricardo Martins <ricardo@ricardomartins.net.br>
|
7 |
+
*/
|
8 |
+
class RicardoMartins_PagSeguro_Model_Source_Customer_Attributes
|
9 |
+
{
|
10 |
+
public function toOptionArray() {
|
11 |
+
$fields = Mage::helper('ricardomartins_pagseguro/internal')->getFields('customer');
|
12 |
+
$options = array();
|
13 |
+
|
14 |
+
foreach($fields as $key => $value) {
|
15 |
+
if(!is_null($value['frontend_label'])) {
|
16 |
+
$options[$value['frontend_label']] = array('value' => $value['attribute_code'], 'label' => $value['frontend_label']);
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
return $options;
|
21 |
+
}
|
22 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Model/Source/Customer/Dob.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Payment Method Codes
|
5 |
+
*
|
6 |
+
* @author Ricardo Martins <ricardo@ricardomartins.net.br>
|
7 |
+
*/
|
8 |
+
class RicardoMartins_PagSeguro_Model_Source_Customer_Dob
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Retorna os atributos de endereco
|
12 |
+
* @author Gabriela D'Ávila (http://davila.blog.br)
|
13 |
+
* @return array
|
14 |
+
*/
|
15 |
+
public function toOptionArray() {
|
16 |
+
$fields = Mage::helper('ricardomartins_pagseguro/internal')->getFields('customer');
|
17 |
+
$options = array();
|
18 |
+
$options[] = array('value'=>'','label'=>'Solicitar ao cliente junto com dados do cartão');
|
19 |
+
|
20 |
+
foreach($fields as $key => $value) {
|
21 |
+
if(!is_null($value['frontend_label'])) {
|
22 |
+
$options[] = array('value' => $value['attribute_code'], 'label' => $value['frontend_label']);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
return $options;
|
27 |
+
}
|
28 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/Model/Source/Paymentmethods.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Payment Method Codes
|
4 |
+
*
|
5 |
+
* @author Ricardo Martins <ricardo@ricardomartins.net.br>
|
6 |
+
*/
|
7 |
+
class RicardoMartins_PagSeguro_Model_Source_Paymentmethods
|
8 |
+
{
|
9 |
+
public function toOptionArray()
|
10 |
+
{
|
11 |
+
$options = array();
|
12 |
+
$options[] = array('value'=>'101','label'=>'Cartão de crédito Visa');
|
13 |
+
$options[] = array('value'=>'102','label'=>'Cartão de crédito MasterCard');
|
14 |
+
$options[] = array('value'=>'103','label'=>'Cartão de crédito American Express');
|
15 |
+
$options[] = array('value'=>'104','label'=>'Cartão de crédito Diners');
|
16 |
+
$options[] = array('value'=>'105','label'=>'Cartão de crédito Hipercard');
|
17 |
+
$options[] = array('value'=>'106','label'=>'Cartão de crédito Aura');
|
18 |
+
$options[] = array('value'=>'107','label'=>'Cartão de crédito Elo');
|
19 |
+
$options[] = array('value'=>'108','label'=>'Cartão de crédito PLENOCard');
|
20 |
+
$options[] = array('value'=>'109','label'=>'Cartão de crédito PersonalCard');
|
21 |
+
$options[] = array('value'=>'110','label'=>'Cartão de crédito JCB');
|
22 |
+
$options[] = array('value'=>'111','label'=>'Cartão de crédito Discover');
|
23 |
+
$options[] = array('value'=>'112','label'=>'Cartão de crédito BrasilCard');
|
24 |
+
$options[] = array('value'=>'113','label'=>'Cartão de crédito FORTBRASIL');
|
25 |
+
$options[] = array('value'=>'114','label'=>'Cartão de crédito CARDBAN');
|
26 |
+
$options[] = array('value'=>'115','label'=>'Cartão de crédito VALECARD');
|
27 |
+
$options[] = array('value'=>'116','label'=>'Cartão de crédito Cabal');
|
28 |
+
$options[] = array('value'=>'117','label'=>'Cartão de crédito Mais!');
|
29 |
+
$options[] = array('value'=>'118','label'=>'Cartão de crédito Avista');
|
30 |
+
$options[] = array('value'=>'119','label'=>'Cartão de crédito GRANDCARD');
|
31 |
+
$options[] = array('value'=>'201','label'=>'Boleto Bradesco');
|
32 |
+
$options[] = array('value'=>'202','label'=>'Boleto Santander');
|
33 |
+
$options[] = array('value'=>'301','label'=>'Débito online Bradesco');
|
34 |
+
$options[] = array('value'=>'302','label'=>'Débito online Itaú');
|
35 |
+
$options[] = array('value'=>'303','label'=>'Débito online Unibanco');
|
36 |
+
$options[] = array('value'=>'304','label'=>'Débito online Banco do Brasil');
|
37 |
+
$options[] = array('value'=>'305','label'=>'Débito online Banco Real');
|
38 |
+
$options[] = array('value'=>'306','label'=>'Débito online Banrisul');
|
39 |
+
$options[] = array('value'=>'307','label'=>'Débito online HSBC');
|
40 |
+
$options[] = array('value'=>'401','label'=>'Saldo PagSeguro');
|
41 |
+
$options[] = array('value'=>'501','label'=>'Oi Paggo');
|
42 |
+
$options[] = array('value'=>'701','label'=>'Depósito em conta - Banco do Brasil');
|
43 |
+
|
44 |
+
return $options;
|
45 |
+
}
|
46 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/controllers/AjaxController.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class RicardoMartins_PagSeguro_AjaxController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Metodo auxiliar para obter o total do pedido
|
6 |
+
*/
|
7 |
+
public function getGrandTotalAction()
|
8 |
+
{
|
9 |
+
$total = Mage::helper('checkout/cart')->getQuote()->getGrandTotal();
|
10 |
+
|
11 |
+
$this->getResponse()->setHeader('Content-type','application/json');
|
12 |
+
$this->getResponse()->setBody(json_encode(array('total'=>$total)));
|
13 |
+
}
|
14 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/controllers/NotificationController.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class RicardoMartins_PagSeguro_NotificationController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Recebe e processa as notificações do pagseguro quando há alguma notificacao.
|
6 |
+
* Não esqueça de configurar a url de retorno como http://sualoja.com.br/pagseguro/notification
|
7 |
+
*/
|
8 |
+
public function indexAction()
|
9 |
+
{
|
10 |
+
/** @var RicardoMartins_PagSeguro_Model_Abstract $model */
|
11 |
+
Mage::helper('ricardomartins_pagseguro')->writeLog('Recebido notificacao do pagseguro com os parametros:'. var_export($this->getRequest()->getParams(),true));
|
12 |
+
$model = Mage::getModel('ricardomartins_pagseguro/abstract');
|
13 |
+
$response = $model->getNotificationStatus($this->getRequest()->getPost('notificationCode'));
|
14 |
+
$model->proccessNotificatonResult($response);
|
15 |
+
}
|
16 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/controllers/TestController.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class RicardoMartins_PagSeguro_TestController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction(){
|
5 |
+
|
6 |
+
$client = new Zend_Http_Client('https://ws.pagseguro.uol.com.br/v2/sessions/');
|
7 |
+
$client->setMethod(Zend_Http_Client::POST);
|
8 |
+
$client->setParameterGet('email','ricardo@ricardomartins.info');
|
9 |
+
$client->setParameterGet('token','9F79900A9B454CE6B18613D7224C0621');
|
10 |
+
$client->request();
|
11 |
+
|
12 |
+
var_dump($client->getLastResponse()->getBody());
|
13 |
+
}
|
14 |
+
|
15 |
+
public function xmlAction()
|
16 |
+
{
|
17 |
+
echo Mage::helper('ricardomartins_pagseguro')->_getToken();
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
public function formAction()
|
22 |
+
{
|
23 |
+
$this->loadLayout();
|
24 |
+
|
25 |
+
$scriptblock = Mage::app()->getLayout()->createBlock('core/text', 'js_pagseguro');
|
26 |
+
$scriptblock->setText(sprintf(
|
27 |
+
'<script type="text/javascript" src="%s"></script>
|
28 |
+
<script type="text/javascript" src="/js/pagseguro/pagseguro.js"/>
|
29 |
+
',
|
30 |
+
Mage::helper('ricardomartins_pagseguro')->getJsUrl()
|
31 |
+
));
|
32 |
+
$head = Mage::app()->getLayout()->getBlock('after_body_start');
|
33 |
+
$head->append($scriptblock);
|
34 |
+
|
35 |
+
$_helper = Mage::helper('ricardomartins_pagseguro');
|
36 |
+
|
37 |
+
|
38 |
+
$html =<<<EOF
|
39 |
+
|
40 |
+
<form id="meu_form" action="#">
|
41 |
+
<li>
|
42 |
+
<label for="pagseguro_cc_cc_number" class="required"><em>*</em>Credit Card Number</label>
|
43 |
+
<div class="input-box">
|
44 |
+
<input autocomplete="off" id="pagseguro_cc_cc_number" name="payment[ps_cc_number]" title="Credit Card Number" class="input-text validate-cc-number validate-cc-type" value="" type="text">
|
45 |
+
<span id="card-brand"></span>
|
46 |
+
</div>
|
47 |
+
</li>
|
48 |
+
<li id="pagseguro_cc_cc_type_exp_div">
|
49 |
+
<label for="pagseguro_cc_expiration" class="required"><em>*</em>Expiration Date</label>
|
50 |
+
<div class="input-box">
|
51 |
+
<div class="v-fix">
|
52 |
+
<select autocomplete="off" id="pagseguro_cc_expiration" name="payment[ps_cc_exp_month]" class="month validate-cc-exp required-entry">
|
53 |
+
<option value="" selected="selected">Month</option>
|
54 |
+
<option value="1">01 - janeiro</option>
|
55 |
+
<option value="2">02 - fevereiro</option>
|
56 |
+
<option value="3">03 - março</option>
|
57 |
+
<option value="4">04 - abril</option>
|
58 |
+
<option value="5">05 - maio</option>
|
59 |
+
<option value="6">06 - junho</option>
|
60 |
+
<option value="7">07 - julho</option>
|
61 |
+
<option value="8">08 - agosto</option>
|
62 |
+
<option value="9">09 - setembro</option>
|
63 |
+
<option value="10">10 - outubro</option>
|
64 |
+
<option value="11">11 - novembro</option>
|
65 |
+
<option value="12">12 - dezembro</option>
|
66 |
+
</select>
|
67 |
+
</div>
|
68 |
+
<div class="v-fix">
|
69 |
+
<select autocomplete="off" id="pagseguro_cc_expiration_yr" name="payment[ps_cc_exp_year]" class="year required-entry">
|
70 |
+
<option value="" selected="selected">Year</option>
|
71 |
+
<option value="2014">2014</option>
|
72 |
+
<option value="2015">2015</option>
|
73 |
+
<option value="2016">2016</option>
|
74 |
+
<option value="2017">2017</option>
|
75 |
+
<option value="2018">2018</option>
|
76 |
+
<option value="2019">2019</option>
|
77 |
+
<option value="2020">2020</option>
|
78 |
+
<option value="2021">2021</option>
|
79 |
+
<option value="2022">2022</option>
|
80 |
+
<option value="2023">2023</option>
|
81 |
+
<option value="2024">2024</option>
|
82 |
+
</select>
|
83 |
+
</div>
|
84 |
+
</div>
|
85 |
+
</li>
|
86 |
+
<li id="pagseguro_cc_cc_type_cvv_div">
|
87 |
+
<label for="pagseguro_cc_cc_cid" class="required"><em>*</em>Card Verification Number</label>
|
88 |
+
<div class="input-box">
|
89 |
+
<div class="v-fix">
|
90 |
+
<input autocomplete="off" title="Card Verification Number" class="input-text cvv required-entry validate-cc-cvn" id="ps_cc_cid" name="payment[ps_cc_cid]" value="" type="text">
|
91 |
+
</div>
|
92 |
+
<a href="#" class="cvv-what-is-this">What is this?</a>
|
93 |
+
</div>
|
94 |
+
|
95 |
+
<?php #nao remover/alterar ?>
|
96 |
+
<input type="hidden" name="payment[sender_hash]"/>
|
97 |
+
<input type="hidden" name="payment[credit_card_token]"/>
|
98 |
+
|
99 |
+
|
100 |
+
<input type="submit"/>
|
101 |
+
|
102 |
+
|
103 |
+
|
104 |
+
</li>
|
105 |
+
</form>
|
106 |
+
<script type="text/javascript">
|
107 |
+
//<![CDATA[
|
108 |
+
|
109 |
+
|
110 |
+
PagSeguroDirectPayment.setSessionId('{$_helper->getSessionId()}');
|
111 |
+
|
112 |
+
|
113 |
+
//]]>
|
114 |
+
</script>
|
115 |
+
|
116 |
+
EOF;
|
117 |
+
|
118 |
+
$block = Mage::app()->getLayout()->createBlock('core/text')->setText($html);
|
119 |
+
|
120 |
+
Mage::app()->getLayout()->getBlock('content')->append($block, 'teste');
|
121 |
+
$this->renderLayout();
|
122 |
+
}
|
123 |
+
}
|
app/code/community/RicardoMartins/PagSeguro/etc/config.xml
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<RicardoMartins_PagSeguro>
|
5 |
+
<version>1.0.1</version>
|
6 |
+
</RicardoMartins_PagSeguro>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<ricardomartins_pagseguro>
|
11 |
+
<class>RicardoMartins_PagSeguro_Model</class>
|
12 |
+
</ricardomartins_pagseguro>
|
13 |
+
</models>
|
14 |
+
<blocks>
|
15 |
+
<ricardomartins_pagseguro>
|
16 |
+
<class>RicardoMartins_PagSeguro_Block</class>
|
17 |
+
</ricardomartins_pagseguro>
|
18 |
+
</blocks>
|
19 |
+
<helpers>
|
20 |
+
<ricardomartins_pagseguro>
|
21 |
+
<class>RicardoMartins_PagSeguro_Helper</class>
|
22 |
+
</ricardomartins_pagseguro>
|
23 |
+
</helpers>
|
24 |
+
</global>
|
25 |
+
<frontend>
|
26 |
+
<routers>
|
27 |
+
<ricardomartins_pagseguro>
|
28 |
+
<use>standard</use>
|
29 |
+
<args>
|
30 |
+
<module>RicardoMartins_PagSeguro</module>
|
31 |
+
<frontName>pseguro</frontName>
|
32 |
+
</args>
|
33 |
+
</ricardomartins_pagseguro>
|
34 |
+
</routers>
|
35 |
+
<translate>
|
36 |
+
<modules>
|
37 |
+
<ricardomartins_pagseguro>
|
38 |
+
<files>
|
39 |
+
<default>RicardoMartins_PagSeguro.csv</default>
|
40 |
+
</files>
|
41 |
+
</ricardomartins_pagseguro>
|
42 |
+
</modules>
|
43 |
+
</translate>
|
44 |
+
<events>
|
45 |
+
<core_block_abstract_to_html_after>
|
46 |
+
<observers>
|
47 |
+
<ricardomartins_pagseguro>
|
48 |
+
<type>model</type>
|
49 |
+
<class>RicardoMartins_PagSeguro_Model_Observer</class>
|
50 |
+
<method>addDirectPaymentBlock</method>
|
51 |
+
</ricardomartins_pagseguro>
|
52 |
+
</observers>
|
53 |
+
</core_block_abstract_to_html_after>
|
54 |
+
</events>
|
55 |
+
</frontend>
|
56 |
+
<default>
|
57 |
+
<payment>
|
58 |
+
<pagseguro_cc>
|
59 |
+
<active>0</active>
|
60 |
+
<title>Cartão de Crédito - via PagSeguro UOL</title>
|
61 |
+
<order_status>pending</order_status>
|
62 |
+
<payment_action>order</payment_action>
|
63 |
+
<model>ricardomartins_pagseguro/payment_cc</model>
|
64 |
+
<allowspecific>0</allowspecific>
|
65 |
+
<!--<specificcountry>BR</specificcountry>-->
|
66 |
+
</pagseguro_cc>
|
67 |
+
<pagseguro>
|
68 |
+
<customer_cpf_attribute>taxvat</customer_cpf_attribute>
|
69 |
+
<address_street_attribute>street_1</address_street_attribute>
|
70 |
+
<address_number_attribute>street_2</address_number_attribute>
|
71 |
+
<address_neighborhood_attribute>street_2</address_neighborhood_attribute>
|
72 |
+
<ws_url>https://ws.pagseguro.uol.com.br/v2/</ws_url>
|
73 |
+
<js_url>https://stc.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js</js_url>
|
74 |
+
<sandbox_ws_url>https://ws.sandbox.pagseguro.uol.com.br/v2/</sandbox_ws_url>
|
75 |
+
<sandbox_js_url>https://stc.sandbox.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js</sandbox_js_url>
|
76 |
+
</pagseguro>
|
77 |
+
</payment>
|
78 |
+
</default>
|
79 |
+
</config>
|
app/code/community/RicardoMartins/PagSeguro/etc/system.xml
ADDED
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_Paygate
|
24 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<sections>
|
30 |
+
<payment>
|
31 |
+
<groups>
|
32 |
+
<pagseguro module="ricardomartins_pagseguro">
|
33 |
+
<comment><![CDATA[<a href="http://r-martins.github.io/PagSeguro-Magento-Transparente" target="_blank">Precisa de ajuda?</a><br/> Lembre-se de <a href="https://pagseguro.uol.com.br/receba-pagamentos.jhtml#checkout-transparent" target="_blank">solicitar acesso</a> à API transparente.]]></comment>
|
34 |
+
<label>PagSeguro - Ricardo Martins</label>
|
35 |
+
<frontend_type>text</frontend_type>
|
36 |
+
<sort_order>110</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>1</show_in_website>
|
39 |
+
<show_in_store>1</show_in_store>
|
40 |
+
<!--<comment><![CDATA[<a href="http://celinks.magento.com/authorize_netRegistration" target="_blank">Click here to sign up for an Authorize.net account</a>]]></comment>-->
|
41 |
+
<fields>
|
42 |
+
<merchant_email translate="label">
|
43 |
+
<label>E-mail</label>
|
44 |
+
<frontend_type>text</frontend_type>
|
45 |
+
<validate>validate-email</validate>
|
46 |
+
<sort_order>10</sort_order>
|
47 |
+
<show_in_default>1</show_in_default>
|
48 |
+
<show_in_website>1</show_in_website>
|
49 |
+
<show_in_store>0</show_in_store>
|
50 |
+
<comment>E-mail da loja (conta vendedor)</comment>
|
51 |
+
</merchant_email>
|
52 |
+
<token translate="label">
|
53 |
+
<label>Token</label>
|
54 |
+
<frontend_type>obscure</frontend_type>
|
55 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
56 |
+
<sort_order>20</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>0</show_in_store>
|
60 |
+
</token>
|
61 |
+
<sandbox translate="label">
|
62 |
+
<label>Ambiente de testes?</label>
|
63 |
+
<frontend_type>select</frontend_type>
|
64 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
65 |
+
<sort_order>21</sort_order>
|
66 |
+
<show_in_default>1</show_in_default>
|
67 |
+
<show_in_website>1</show_in_website>
|
68 |
+
<show_in_store>0</show_in_store>
|
69 |
+
<comment><![CDATA[No modo de testes, os dados são enviados para sandbox do PagSeguro. Habilite o acesso à Sandbox <a href="http://sandbox.pagseguro.uol.com.br" target="_blank">aqui</a>]]></comment>
|
70 |
+
</sandbox>
|
71 |
+
<sandbox_merchant_email translate="label">
|
72 |
+
<label>E-mail Sandbox</label>
|
73 |
+
<frontend_type>text</frontend_type>
|
74 |
+
<validate>validate-email</validate>
|
75 |
+
<sort_order>22</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 |
+
<depends>
|
80 |
+
<sandbox>1</sandbox>
|
81 |
+
</depends>
|
82 |
+
<comment>E-mail da loja (conta vendedor) no ambiente de testes</comment>
|
83 |
+
</sandbox_merchant_email>
|
84 |
+
<sandbox_token translate="label">
|
85 |
+
<label>Token Sandbox</label>
|
86 |
+
<frontend_type>obscure</frontend_type>
|
87 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
88 |
+
<sort_order>23</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>0</show_in_store>
|
92 |
+
<depends>
|
93 |
+
<sandbox>1</sandbox>
|
94 |
+
</depends>
|
95 |
+
</sandbox_token>
|
96 |
+
<debug translate="label">
|
97 |
+
<label>Debug</label>
|
98 |
+
<frontend_type>select</frontend_type>
|
99 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
100 |
+
<sort_order>30</sort_order>
|
101 |
+
<show_in_default>1</show_in_default>
|
102 |
+
<show_in_website>1</show_in_website>
|
103 |
+
<show_in_store>0</show_in_store>
|
104 |
+
<comment>Veja a saída de log em var/log/pagseguro.log</comment>
|
105 |
+
</debug>
|
106 |
+
<customer_cpf_attribute>
|
107 |
+
<label>CPF do cliente</label>
|
108 |
+
<frontend_type>select</frontend_type>
|
109 |
+
<source_model>ricardomartins_pagseguro/source_customer_attributes</source_model>
|
110 |
+
<sort_order>31</sort_order>
|
111 |
+
<show_in_default>1</show_in_default>
|
112 |
+
<show_in_website>1</show_in_website>
|
113 |
+
<show_in_store>0</show_in_store>
|
114 |
+
<comment><![CDATA[Caso sua loja utilize um atributo personalizado para o CPF do cliente, selecione aqui.]]></comment>
|
115 |
+
</customer_cpf_attribute>
|
116 |
+
<address_street_attribute>
|
117 |
+
<label>Atributo Rua de entrega</label>
|
118 |
+
<frontend_type>select</frontend_type>
|
119 |
+
<source_model>ricardomartins_pagseguro/source_customer_address_attributes</source_model>
|
120 |
+
<sort_order>40</sort_order>
|
121 |
+
<show_in_default>1</show_in_default>
|
122 |
+
<show_in_website>1</show_in_website>
|
123 |
+
<show_in_store>0</show_in_store>
|
124 |
+
<comment><![CDATA[Caso sua loja utilize um atributo personalizado para a Rua de entrega, selecione aqui.]]></comment>
|
125 |
+
</address_street_attribute>
|
126 |
+
<address_number_attribute>
|
127 |
+
<label>Atributo Número</label>
|
128 |
+
<frontend_type>select</frontend_type>
|
129 |
+
<source_model>ricardomartins_pagseguro/source_customer_address_attributes</source_model>
|
130 |
+
<sort_order>50</sort_order>
|
131 |
+
<show_in_default>1</show_in_default>
|
132 |
+
<show_in_website>1</show_in_website>
|
133 |
+
<show_in_store>0</show_in_store>
|
134 |
+
<comment><![CDATA[Caso sua loja utilize um atributo personalizado para o campo 'Número' de entrega, selecione aqui.]]></comment>
|
135 |
+
</address_number_attribute>
|
136 |
+
<address_complement_attribute>
|
137 |
+
<label>Atributo Complemento</label>
|
138 |
+
<frontend_type>select</frontend_type>
|
139 |
+
<source_model>ricardomartins_pagseguro/source_customer_address_attributes_optional</source_model>
|
140 |
+
<sort_order>60</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>0</show_in_store>
|
144 |
+
<comment><![CDATA[Caso sua loja utilize um atributo personalizado para o campo 'Complemento' de entrega, selecione aqui. Você pode omitir esta informação ao PagSeguro.]]></comment>
|
145 |
+
</address_complement_attribute>
|
146 |
+
<address_neighborhood_attribute>
|
147 |
+
<label>Atributo Bairro</label>
|
148 |
+
<frontend_type>select</frontend_type>
|
149 |
+
<source_model>ricardomartins_pagseguro/source_customer_address_attributes</source_model>
|
150 |
+
<sort_order>70</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 |
+
<comment><![CDATA[Caso sua loja utilize um atributo personalizado para o campo 'Bairro' de entrega, selecione aqui.]]></comment>
|
155 |
+
</address_neighborhood_attribute>
|
156 |
+
</fields>
|
157 |
+
</pagseguro>
|
158 |
+
<pagseguro_cc module="ricardomartins_pagseguro">
|
159 |
+
<label>PagSeguro - Cartão de Crédito - Ricardo Martins</label>
|
160 |
+
<frontend_type>text</frontend_type>
|
161 |
+
<sort_order>111</sort_order>
|
162 |
+
<show_in_default>1</show_in_default>
|
163 |
+
<show_in_website>1</show_in_website>
|
164 |
+
<show_in_store>1</show_in_store>
|
165 |
+
<fields>
|
166 |
+
<active translate="label">
|
167 |
+
<label>Enabled</label>
|
168 |
+
<frontend_type>select</frontend_type>
|
169 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
170 |
+
<sort_order>10</sort_order>
|
171 |
+
<show_in_default>1</show_in_default>
|
172 |
+
<show_in_website>1</show_in_website>
|
173 |
+
<show_in_store>1</show_in_store>
|
174 |
+
</active>
|
175 |
+
<title translate="label">
|
176 |
+
<label>Title</label>
|
177 |
+
<frontend_type>text</frontend_type>
|
178 |
+
<sort_order>20</sort_order>
|
179 |
+
<show_in_default>1</show_in_default>
|
180 |
+
<show_in_website>1</show_in_website>
|
181 |
+
<show_in_store>0</show_in_store>
|
182 |
+
<depends>
|
183 |
+
<active>1</active>
|
184 |
+
</depends>
|
185 |
+
</title>
|
186 |
+
<order_status translate="label">
|
187 |
+
<label>New Order Status</label>
|
188 |
+
<frontend_type>select</frontend_type>
|
189 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
190 |
+
<sort_order>21</sort_order>
|
191 |
+
<show_in_default>1</show_in_default>
|
192 |
+
<show_in_website>1</show_in_website>
|
193 |
+
<show_in_store>0</show_in_store>
|
194 |
+
</order_status>
|
195 |
+
<owner_dob_attribute>
|
196 |
+
<label>Data de Nascimento</label>
|
197 |
+
<frontend_type>select</frontend_type>
|
198 |
+
<source_model>ricardomartins_pagseguro/source_customer_dob</source_model>
|
199 |
+
<sort_order>30</sort_order>
|
200 |
+
<show_in_default>1</show_in_default>
|
201 |
+
<show_in_website>1</show_in_website>
|
202 |
+
<show_in_store>0</show_in_store>
|
203 |
+
<comment><![CDATA[Data de nascimento do dono do cartão de crédito é obrigatório para o PagSeguro.]]></comment>
|
204 |
+
</owner_dob_attribute>
|
205 |
+
<sort_order translate="label">
|
206 |
+
<label>Sort Order</label>
|
207 |
+
<frontend_type>text</frontend_type>
|
208 |
+
<sort_order>40</sort_order>
|
209 |
+
<show_in_default>1</show_in_default>
|
210 |
+
<show_in_website>1</show_in_website>
|
211 |
+
<show_in_store>0</show_in_store>
|
212 |
+
<frontend_class>validate-number</frontend_class>
|
213 |
+
</sort_order>
|
214 |
+
</fields>
|
215 |
+
</pagseguro_cc>
|
216 |
+
</groups>
|
217 |
+
</payment>
|
218 |
+
</sections>
|
219 |
+
</config>
|
app/design/adminhtml/base/default/template/ricardomartins_pagseguro/form/directpayment.phtml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_helper = Mage::helper('ricardomartins_pagseguro');
|
3 |
+
?>
|
4 |
+
<input type="hidden" name="payment[sender_hash]"/>
|
5 |
+
<script type="text/javascript">
|
6 |
+
//<![CDATA[
|
7 |
+
PagSeguroDirectPayment.setSessionId('<?php echo $_helper->getSessionId();?>');
|
8 |
+
var iid = setInterval(function()
|
9 |
+
{
|
10 |
+
if(typeof PagSeguroDirectPayment != "undefined" && PagSeguroDirectPayment.ready){
|
11 |
+
console.log('PagSeguro ready boleto');
|
12 |
+
|
13 |
+
clearInterval(iid);
|
14 |
+
RMPagSeguro.updateSenderHash();
|
15 |
+
}
|
16 |
+
}, 4000);
|
17 |
+
//]]>
|
18 |
+
</script>
|
app/design/adminhtml/base/default/template/ricardomartins_pagseguro/form/info/cc.phtml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<strong><?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?> (PagSeguro)</strong>
|
2 |
+
<?php if($info = $this->getInfo()): ?>
|
3 |
+
<br/>
|
4 |
+
<?php if($additional = $info->getAdditionalInformation()):?>
|
5 |
+
Id Transação: <?php echo $this->escapeHtml($additional['transaction_id']);?>
|
6 |
+
<br/>
|
7 |
+
<?php endif;?>
|
8 |
+
Bandeira: <?php echo ucfirst($this->escapeHtml($info->getCcType()));?>
|
9 |
+
<br/>
|
10 |
+
Últimos 4 dígitos: <?php echo $this->escapeHtml($info->getCcLast4());?>
|
11 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/ricardomartins_pagseguro/form/cc.phtml
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_code=$this->getMethodCode();
|
3 |
+
?>
|
4 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
5 |
+
<?php /*
|
6 |
+
<li>
|
7 |
+
<div class="input-box">
|
8 |
+
<label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
|
9 |
+
<input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->escapeHtml($this->getInfoData('cc_owner')) ?>" />
|
10 |
+
</div>
|
11 |
+
</li>
|
12 |
+
*/ ?>
|
13 |
+
<li>
|
14 |
+
<label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Credit Card Owner\'s Name') ?></label>
|
15 |
+
<div class="input-box">
|
16 |
+
<input type="text" id="<?php echo $_code ?>_cc_owner" name="payment[ps_cc_owner]" title="<?php echo $this->__('Credit Card Owner\'s Name') ?>" class="input-text required-entry" value=""/>
|
17 |
+
</div>
|
18 |
+
</li>
|
19 |
+
<?php if($this->isDobVisible()):?>
|
20 |
+
<li id="<?php echo $_code ?>_cc_dob_div">
|
21 |
+
<?php $_dob = $this->getLayout()->createBlock('ricardomartins_pagseguro/form_cc_dob') ?>
|
22 |
+
<?php echo $_dob->toHtml() ?>
|
23 |
+
</li>
|
24 |
+
<?php endif ?>
|
25 |
+
<li>
|
26 |
+
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
27 |
+
<div class="input-box">
|
28 |
+
<input type="text" id="<?php echo $_code ?>_cc_number" name="payment[ps_cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value=""/>
|
29 |
+
<?php #nao remover os 3 campos abaixo ?>
|
30 |
+
<span id="card-brand" style="text-transform: capitalize;"></span>
|
31 |
+
<input type="hidden" name="payment[ps_card_type]"/>
|
32 |
+
<input type="hidden" name="payment[credit_card_token]"/>
|
33 |
+
</div>
|
34 |
+
</li>
|
35 |
+
<li id="<?php echo $_code ?>_cc_type_exp_div">
|
36 |
+
<label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
|
37 |
+
<div class="input-box">
|
38 |
+
<div class="v-fix">
|
39 |
+
<select id="<?php echo $_code ?>_expiration" name="payment[ps_cc_exp_month]" class="month validate-cc-exp required-entry">
|
40 |
+
<?php $_ccExpMonth = $this->getInfoData('ps_cc_exp_month') ?>
|
41 |
+
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
42 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
43 |
+
<?php endforeach ?>
|
44 |
+
</select>
|
45 |
+
</div>
|
46 |
+
<div class="v-fix">
|
47 |
+
<?php $_ccExpYear = $this->getInfoData('ps_cc_exp_year') ?>
|
48 |
+
<select id="<?php echo $_code ?>_expiration_yr" name="payment[ps_cc_exp_year]" class="year required-entry">
|
49 |
+
<?php foreach ($this->getCcYears() as $k=>$v): ?>
|
50 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
51 |
+
<?php endforeach ?>
|
52 |
+
</select>
|
53 |
+
</div>
|
54 |
+
</div>
|
55 |
+
</li>
|
56 |
+
<li id="<?php echo $_code ?>_cc_type_cvv_div">
|
57 |
+
<label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
|
58 |
+
<div class="input-box">
|
59 |
+
<div class="v-fix">
|
60 |
+
<input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[ps_cc_cid]" value="" />
|
61 |
+
</div>
|
62 |
+
<a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
|
63 |
+
</div>
|
64 |
+
</li>
|
65 |
+
<li id="<?php echo $_code ?>_cc_installments_div">
|
66 |
+
<label for="<?php echo $_code ?>_cc_installments"><?php echo $this->__('Installments') ?></label>
|
67 |
+
<div class="input-box">
|
68 |
+
<div class="v-fix">
|
69 |
+
<select name="payment[ps_cc_installments]" id="<?php echo $_code ?>_cc_installments" class="required">
|
70 |
+
<option value="">Informe os dados do cartão para calcular</option>
|
71 |
+
</select>
|
72 |
+
</div>
|
73 |
+
</div>
|
74 |
+
</li>
|
75 |
+
<?php echo $this->getChildHtml() ?>
|
76 |
+
<li>
|
77 |
+
<?php /* O selo do PagSeguro deve ser exibido obrigatoriamente. Você pode escolher outra imagem disponivel na pasta 'selo' */ ?>
|
78 |
+
<div class="selo-pagseguro"><img src="<?php echo $this->getSkinUrl('pagseguro/selo/selo04_200x60.gif');?>" alt="Pagamento processado pelo PagSeguro"/></div>
|
79 |
+
</li>
|
80 |
+
</ul>
|
app/design/frontend/base/default/template/ricardomartins_pagseguro/form/cc/dob.phtml
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
USAGE:
|
29 |
+
|
30 |
+
Simple:
|
31 |
+
|
32 |
+
<?php echo $this->getLayout()->createBlock('customer/widget_dob')
|
33 |
+
->setDate($this->getCustomer()->getDob())
|
34 |
+
->toHtml() ?>
|
35 |
+
|
36 |
+
For checkout/onepage/billing.phtml:
|
37 |
+
|
38 |
+
<?php echo $this->getLayout()->createBlock('customer/widget_dob')
|
39 |
+
->setDate($this->getCustomer()->getDob())
|
40 |
+
->setFieldIdFormat('billing:%s')
|
41 |
+
->setFieldNameFormat('billing[%s]')
|
42 |
+
->toHtml() ?>
|
43 |
+
|
44 |
+
NOTE: Regarding styles - if we leave it this way, we'll move it to boxes.css
|
45 |
+
Alternatively we could calculate widths automatically using block input parameters.
|
46 |
+
*/
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @see Mage_Customer_Block_Widget_Dob
|
50 |
+
*/
|
51 |
+
?>
|
52 |
+
<label for="<?php echo $this->getFieldId('month')?>" class="required"><em>*</em><?php echo $this->__('Date of Birth') ?></label>
|
53 |
+
<div class="input-box customer-dob">
|
54 |
+
<?php
|
55 |
+
$this->setDateInput('d',
|
56 |
+
'<div class="dob-day">
|
57 |
+
<input type="text" id="' . $this->getFieldId('day') . '" name="' . $this->getFieldName('day') . '" value="' . $this->getDay() . '" title="' . $this->__('Day') . '" class="input-text validate-custom" ' . $this->getFieldParams() . ' />
|
58 |
+
<label for="' . $this->getFieldId('day') . '">' . $this->__('DD') . '</label>
|
59 |
+
</div>'
|
60 |
+
);
|
61 |
+
|
62 |
+
$this->setDateInput('m',
|
63 |
+
'<div class="dob-month">
|
64 |
+
<input type="text" id="' . $this->getFieldId('month') . '" name="' . $this->getFieldName('month') . '" value="' . $this->getMonth() . '" title="' . $this->__('Month') . '" class="input-text validate-custom" ' . $this->getFieldParams() . ' />
|
65 |
+
<label for="' . $this->getFieldId('month') . '">' . $this->__('MM') . '</label>
|
66 |
+
</div>'
|
67 |
+
);
|
68 |
+
|
69 |
+
$this->setDateInput('y',
|
70 |
+
'<div class="dob-year">
|
71 |
+
<input type="text" id="' . $this->getFieldId('year') . '" name="' . $this->getFieldName('year') . '" value="' . $this->getYear() . '" title="' . $this->__('Year') . '" class="input-text validate-custom" ' . $this->getFieldParams() . ' />
|
72 |
+
<label for="' . $this->getFieldId('year') . '">' . $this->__('YYYY') . '</label>
|
73 |
+
</div>'
|
74 |
+
);
|
75 |
+
?>
|
76 |
+
<?php echo $this->getSortedDateInputs() ?>
|
77 |
+
<div class="dob-full" style="display:none;">
|
78 |
+
<input type="hidden" id="<?php echo $this->getFieldId('dob')?>" name="<?php echo $this->getFieldName('dob')?>" />
|
79 |
+
</div>
|
80 |
+
|
81 |
+
<div class="validation-advice" style="display:none;"></div>
|
82 |
+
</div>
|
83 |
+
<script type="text/javascript">
|
84 |
+
//<![CDATA[
|
85 |
+
var customer_dob = new Varien.DOB('.customer-dob', 'true', '<?php echo $this->getDateFormat() ?>');
|
86 |
+
//]]>
|
87 |
+
</script>
|
app/design/frontend/base/default/template/ricardomartins_pagseguro/form/directpayment.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_helper = Mage::helper('ricardomartins_pagseguro');
|
3 |
+
?>
|
4 |
+
<input type="hidden" name="payment[sender_hash]"/>
|
5 |
+
<script type="text/javascript">
|
6 |
+
//<![CDATA[
|
7 |
+
PagSeguroDirectPayment.setSessionId('<?php echo $_helper->getSessionId();?>');
|
8 |
+
var iid = setInterval(function()
|
9 |
+
{
|
10 |
+
if(typeof PagSeguroDirectPayment != "undefined" && PagSeguroDirectPayment.ready){
|
11 |
+
console.log('PagSeguro ready');
|
12 |
+
|
13 |
+
clearInterval(iid);
|
14 |
+
RMPagSeguro.updateSenderHash();
|
15 |
+
RMPagSeguro.addBrandObserver();
|
16 |
+
RMPagSeguro.addCardFieldsObserver();
|
17 |
+
}
|
18 |
+
}, 4000);
|
19 |
+
//]]>
|
20 |
+
</script>
|
app/design/frontend/base/default/template/ricardomartins_pagseguro/form/info/cc.phtml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<strong><?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?> (PagSeguro)</strong>
|
2 |
+
<?php if($info = $this->getInfo()): ?>
|
3 |
+
<br/>
|
4 |
+
<?php if($additional = $info->getAdditionalInformation()):?>
|
5 |
+
Id Transação: <?php echo $this->escapeHtml($additional['transaction_id']);?>
|
6 |
+
<br/>
|
7 |
+
<?php endif;?>
|
8 |
+
Bandeira: <?php echo ucfirst($this->escapeHtml($info->getCcType()));?>
|
9 |
+
<br/>
|
10 |
+
Últimos 4 dígitos: <?php echo $this->escapeHtml($info->getCcLast4());?>
|
11 |
+
<?php endif; ?>
|
app/etc/modules/RicardoMartins_PagSeguro.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<RicardoMartins_PagSeguro>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</RicardoMartins_PagSeguro>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/pt_BR/RicardoMartins_PagSeguro.csv
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Credit Card Owner's Name","Nome do Dono do Cartão"
|
2 |
+
"Installments","Parcelas"
|
3 |
+
"sender hash invalid.","Sender Hash inválido."
|
4 |
+
"items invalid quantity.","Quantidade inválida de itens."
|
5 |
+
"currency is required.","Moeda é obrigatório."
|
6 |
+
"sender email is required.","E-mail do comprador obrigatório."
|
7 |
+
"sender name is required.","Nome do comprador obrigatório."
|
8 |
+
"sender area code is required.","Código de área do comprador obrigatório."
|
9 |
+
"sender phone is required.","Telefone do comprador obrigatório."
|
10 |
+
"shipping address postal code is required.","CEP do comprador obrigatório."
|
11 |
+
"shipping address street is required.","Endereço de entrega do comprador obrigatório."
|
12 |
+
"shipping address number is required.","Número do endereço de entrega obrigatório."
|
13 |
+
"shipping address district is required.","Bairro para entrega obrigatório."
|
14 |
+
"shipping address city is required.","Cidade de entrega é obrigatório."
|
15 |
+
"shipping address state is required.","Estado para entrega obrigatório."
|
16 |
+
"shipping address country is required.","País é obrigatório."
|
17 |
+
"credit card token is required.","Token do cartão de crédito é obrigatório."
|
18 |
+
"installment quantity is required.","Número de parcelas é obrigatório."
|
19 |
+
"installment value is required.","Valor da parcela é obrigatório."
|
20 |
+
"credit card holder name is required.","Nome do portador do cartão é obrigatório."
|
21 |
+
"credit card holder cpf is required.","CPF do dono do cartão é obrigatório."
|
22 |
+
"credit card holder birthdate is required.","Data de Nascimento do dono do cartão é obrigatório."
|
23 |
+
"credit card holder area code is required.","DDD do dono do cartão é obrigatório."
|
24 |
+
"credit card holder phone is required.","Telefone do dono do cartão é obrigatório."
|
25 |
+
"billing address postal code is required.","CEP do endereço de cobrança é obrigatório."
|
26 |
+
"billing address street is required.","Rua do endereço de cobrança é obrigatório."
|
27 |
+
"billing address number is required.","Número do endereço de cobrança é obrigatório."
|
28 |
+
"billing address district is required.","Bairro do endereço de cobrança é obrigatório."
|
29 |
+
"billing address city is required.","Cidade do endereço de cobrança é obrigatório."
|
30 |
+
"billing address state is required.","Estado do endereço de cobrança é obrigatório."
|
31 |
+
"billing address country is required.","País do endereço de cobrança é obrigatório."
|
32 |
+
"item id is required.","ID do item é obrigatório."
|
33 |
+
"item description is required.","Descrição do item é obrigatório."
|
34 |
+
"item quantity is required.","Quantidade do item é obrigatório."
|
35 |
+
"item amount is required.","Valor do item é obrigatório."
|
36 |
+
"sender is related to receiver.","Comprador está relacionado com o recebedor."
|
37 |
+
"payment method unavailable.","Método de pagamento indisponível."
|
38 |
+
"invalid credit card data.","Dados do cartão inválido."
|
39 |
+
"sender hash invalid.","Identificação do comprador(hash) inválido."
|
40 |
+
"credit card brand is not accepted.","Bandeira do cartão não é aceita."
|
41 |
+
"payment mode invalid value, valid values are default and gateway.","PaymentMode inváido, valores válidos são default e gateway."
|
42 |
+
"payment method invalid value, valid values are creditCard, boleto e eft.","PaymentMethod inválido, valores válidos são creditCard, boleto e eft"
|
43 |
+
"shipping cost was provided, shipping address must be complete.","Custo de envio foi fornecido, endereço de envio deve estar completo."
|
44 |
+
"sender information was provided, email must be provided too.","Informações do comprador foram fornecidas, email também deve ser fornecido."
|
45 |
+
"credit card holder is incomplete.","Dados do dono do cartão incompletos."
|
46 |
+
"shipping address information was provided, sender email must be provided too.","Endereço de entrega foi informado, o e-mail do comprador também deve ser fornecido."
|
47 |
+
"eft bank is required.","Banco para EFT deve ser informado."
|
48 |
+
"eft bank is not accepted.","Banco não é aceito."
|
49 |
+
"sender is blocked.","Comprador bloqueado."
|
50 |
+
"credit card token invalid.","Token de cartão de crédito inválido."
|
js/pagseguro/pagseguro.js
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* PagSeguro Transparente para Magento
|
3 |
+
* @author Ricardo Martins <ricardo@ricardomartins.net.br>
|
4 |
+
* @link https://github.com/r-martins/PagSeguro-Magento-Transparente
|
5 |
+
* @version 0.2.0
|
6 |
+
*/
|
7 |
+
document.observe("dom:loaded", function() {
|
8 |
+
RMPagSeguro = function RMPagSeguro(){};
|
9 |
+
RMPagSeguro.updateSenderHash = function(){
|
10 |
+
var senderHash = PagSeguroDirectPayment.getSenderHash();
|
11 |
+
if(typeof senderHash != "undefined")
|
12 |
+
{
|
13 |
+
$$('input[name="payment[sender_hash]"]').first().value = senderHash;
|
14 |
+
$$('input[name="payment[sender_hash]"]').first().enable();
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
RMPagSeguro.addBrandObserver = function(){
|
19 |
+
var elm = $$('input[name="payment[ps_cc_number]"]').first();
|
20 |
+
Event.observe(elm, 'change', function(e){
|
21 |
+
var elmValue = elm.value.replace(/^\s+|\s+$/g,'');
|
22 |
+
if(elmValue.length >= 6){
|
23 |
+
var cBin = elmValue.substr(0,6);
|
24 |
+
PagSeguroDirectPayment.getBrand({
|
25 |
+
cardBin: cBin,
|
26 |
+
success: function(psresponse){
|
27 |
+
RMPagSeguro.brand= psresponse.brand;
|
28 |
+
$('card-brand').innerHTML = psresponse.brand.name;
|
29 |
+
$('card-brand').className = psresponse.brand.name.replace(/[^a-zA-Z]*/g,'');
|
30 |
+
$$('input[name="payment[ps_card_type]"]').first().value = psresponse.brand.name;
|
31 |
+
RMPagSeguro.getInstallments();
|
32 |
+
},
|
33 |
+
error: function(psresponse){
|
34 |
+
RMPagSeguro.brand= psresponse;
|
35 |
+
$('card-brand').innerHTML = 'Cartão inválido';
|
36 |
+
}
|
37 |
+
});
|
38 |
+
}
|
39 |
+
});
|
40 |
+
}
|
41 |
+
|
42 |
+
RMPagSeguro.updateCreditCardToken = function(){
|
43 |
+
var ccNum = $$('input[name="payment[ps_cc_number]"]').first().value.replace(/^\s+|\s+$/g,'');
|
44 |
+
var ccExpMo = $$('select[name="payment[ps_cc_exp_month]"]').first().value;
|
45 |
+
var ccExpYr = $$('select[name="payment[ps_cc_exp_year]"]').first().value;
|
46 |
+
var ccCvv = $$('input[name="payment[ps_cc_cid]"]').first().value;
|
47 |
+
var ccTokenElm = $$('input[name="payment[credit_card_token]"]').first();
|
48 |
+
|
49 |
+
if(ccNum.length > 6 && ccExpMo != "" && ccExpYr != "" && ccCvv.length >= 3)
|
50 |
+
{
|
51 |
+
PagSeguroDirectPayment.createCardToken({
|
52 |
+
cardNumber: ccNum,
|
53 |
+
brand: RMPagSeguro.brand.name,
|
54 |
+
cvv: ccCvv,
|
55 |
+
expirationMonth: ccExpMo,
|
56 |
+
expirationYear: ccExpYr,
|
57 |
+
success: function(psresponse){
|
58 |
+
ccTokenElm.value = psresponse.card.token;
|
59 |
+
},
|
60 |
+
error: function(psresponse){
|
61 |
+
console.log('Falha ao obter o token do cartao.');
|
62 |
+
},
|
63 |
+
complete: function(psresponse){
|
64 |
+
// console.log(psresponse);
|
65 |
+
RMPagSeguro.reCheckSenderHash();
|
66 |
+
}
|
67 |
+
});
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
RMPagSeguro.addCardFieldsObserver = function(){
|
72 |
+
var ccNumElm = $$('input[name="payment[ps_cc_number]"]').first();
|
73 |
+
var ccExpMoElm = $$('select[name="payment[ps_cc_exp_month]"]').first();
|
74 |
+
var ccExpYrElm = $$('select[name="payment[ps_cc_exp_year]"]').first();
|
75 |
+
var ccCvvElm = $$('input[name="payment[ps_cc_cid]"]').first();
|
76 |
+
|
77 |
+
Element.observe(ccNumElm,'keyup',function(e){RMPagSeguro.updateCreditCardToken();});
|
78 |
+
Element.observe(ccExpMoElm,'keyup',function(e){RMPagSeguro.updateCreditCardToken();});
|
79 |
+
Element.observe(ccExpYrElm,'keyup',function(e){RMPagSeguro.updateCreditCardToken();});
|
80 |
+
Element.observe(ccCvvElm,'keyup',function(e){RMPagSeguro.updateCreditCardToken();});
|
81 |
+
}
|
82 |
+
|
83 |
+
RMPagSeguro.getInstallments = function(){
|
84 |
+
var _url = RMPagSeguroSiteBaseURL + 'pseguro/ajax/getGrandTotal';
|
85 |
+
new Ajax.Request(_url, {
|
86 |
+
onSuccess: function(response){
|
87 |
+
var grandTotal = response.responseJSON.total;
|
88 |
+
|
89 |
+
PagSeguroDirectPayment.getInstallments({
|
90 |
+
amount: grandTotal,
|
91 |
+
brand: RMPagSeguro.brand.name,
|
92 |
+
success: function(response) {
|
93 |
+
var parcelsDrop = document.getElementById('pagseguro_cc_cc_installments');
|
94 |
+
for( installment in response.installments) break;
|
95 |
+
// console.log(response.installments);
|
96 |
+
var b = response.installments[RMPagSeguro.brand.name];
|
97 |
+
parcelsDrop.length = 0;
|
98 |
+
for(var x=0; x < b.length; x++){
|
99 |
+
var option = document.createElement('option');
|
100 |
+
option.text = b[x].quantity + "x de R$" + b[x].installmentAmount.toString().replace('.',',');
|
101 |
+
option.text += (b[x].interestFree)?" sem juros":" com juros";
|
102 |
+
option.value = b[x].quantity + "|" + b[x].installmentAmount;
|
103 |
+
parcelsDrop.add(option);
|
104 |
+
}
|
105 |
+
// console.log(b[0].quantity);
|
106 |
+
// console.log(b[0].installmentAmount);
|
107 |
+
|
108 |
+
},
|
109 |
+
error: function(response) {
|
110 |
+
console.log(response);
|
111 |
+
},
|
112 |
+
complete: function(response) {
|
113 |
+
// console.log(response);
|
114 |
+
RMPagSeguro.reCheckSenderHash();
|
115 |
+
}
|
116 |
+
});
|
117 |
+
},
|
118 |
+
onFailure: function(response){
|
119 |
+
return 0;
|
120 |
+
}
|
121 |
+
});
|
122 |
+
}
|
123 |
+
|
124 |
+
//verifica se o sender hash foi pego e tenta atualizar denvoo caso não tenha sido.
|
125 |
+
RMPagSeguro.reCheckSenderHash = function()
|
126 |
+
{
|
127 |
+
if($$('input[name="payment[sender_hash]"]').first().value == '')
|
128 |
+
{
|
129 |
+
RMPagSeguro.updateSenderHash();
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
|
134 |
+
});
|
package.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>RicardoMartins_PagSeguro</name>
|
4 |
+
<version>1.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>MIT</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>PagSeguro transparente (cartões)</summary>
|
10 |
+
<description>Com o PagSeguro transparente o cliente não precisa ir até o site do pagseguro, e faz o checkout com cartão na sua própria loja sem ser redirecionado.
|
11 |
+
Os dados do cartão são enviados para o site do pagseguro de forma segura via https.</description>
|
12 |
+
<notes>Versão estável.
|
13 |
+

|
14 |
+
Os bugs devem ser reportador na área de Issues no github do projeto em https://github.com/r-martins/PagSeguro-Magento-Transparente</notes>
|
15 |
+
<authors><author><name>Ricardo Martins</name><user>MAG001517858</user><email>ricardo@ricardomartins.info</email></author></authors>
|
16 |
+
<date>2014-06-28</date>
|
17 |
+
<time>02:02:21</time>
|
18 |
+
<contents><target name="magecommunity"><dir name="RicardoMartins"><dir name="PagSeguro"><dir name="Block"><dir name="Form"><dir name="Cc"><file name="Dob.php" hash="ed45c9f5576c289897eb5c86a46c6d85"/></dir><file name="Cc.php" hash="3ec300291bfb59a545bfb99a23f2d670"/><file name="Directpayment.php" hash="937273e541d362f353b2bde87c041631"/><dir name="Info"><file name="Cc.php" hash="ef4952bfb9d12dae0b6ce13afeb0d1bb"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="aea4cef5f8cfc6b17e1508b2cf18e67f"/><file name="Internal.php" hash="fbf64a95060a3d2f47ef44bde57a5c70"/><file name="Params.php" hash="4473d48319f0ddf015298d557f25c2c6"/></dir><dir name="Model"><file name="Abstract.php" hash="7fe5bc8bbf84b64243c45ec520b27f95"/><file name="Observer.php" hash="e709c92bc86416ffdcfe2fda5b8a4d37"/><dir name="Payment"><file name="Cc.php" hash="9a5f04d85dacf420bab1bcf8a755d508"/></dir><dir name="Source"><dir name="Customer"><dir name="Address"><dir name="Attributes"><file name="Optional.php" hash="966a3dd2db773c460c0aba9921da36a0"/></dir><file name="Attributes.php" hash="c51bd60053e598daf9558d717c70d0e2"/></dir><file name="Attributes.php" hash="0e62e095d16e30c358410603197e1328"/><file name="Dob.php" hash="754ae1fbbae1c8ee89100201b59172bf"/></dir><file name="Paymentmethods.php" hash="5ea1877c9f73a6dec6bc91900309a5a5"/></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="9b6c47c1c81e32168c447d3f67faaffd"/><file name="NotificationController.php" hash="47641a62f0d1850ea7711d997bfa1fa5"/><file name="TestController.php" hash="b0d6a8e347b45f3013435a4c2ac4a16b"/></dir><dir name="etc"><file name="config.xml" hash="914c29192dc10588876610a8b07db17b"/><file name="system.xml" hash="4dce4e127ca52505eff764795eeabbd5"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="RicardoMartins_PagSeguro.xml" hash="82d8294eccac1fb4047f27566b0c9f2a"/></dir></target><target name="magelocale"><dir name="pt_BR"><file name="RicardoMartins_PagSeguro.csv" hash="6c1504a7d1c8d5f3b4127f36d6459bfa"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="pagseguro"><dir><dir name="selo"><file name="selo01_160x90.gif" hash="e6729bb969abb20588f134f7d29ea0ec"/><file name="selo01_200x60.gif" hash="e91ed131018bae7d9abc2cc1a72f539b"/><file name="selo01_300x60.gif" hash="13b07e35250b30a61c86c98815e3310c"/><file name="selo02_160x90.gif" hash="4e65530d2c42bae4e5fab617a4d0afdf"/><file name="selo02_200x60.gif" hash="ba629a85cef8982423c7679a4875283c"/><file name="selo02_300x60.gif" hash="5827aca40455f22caffee1392917f16c"/><file name="selo03_160x90.gif" hash="e3c69ace0991d7841728c6203fc305bf"/><file name="selo03_200x60.gif" hash="63135b65df64a70629748d66f5c0c453"/><file name="selo03_300x60.gif" hash="e88f1529f2d27d4732cd7c374752618e"/><file name="selo04_160x90.gif" hash="8e71cb1942c15427ba96ac21aacdb9d6"/><file name="selo04_200x60.gif" hash="f08b80b40541e35491a8d966cb420c78"/><file name="selo04_300x60.gif" hash="43f9fc4ad730111654777c26059e9fbf"/></dir></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="ricardomartins_pagseguro"><dir><dir name="form"><dir name="cc"><file name="dob.phtml" hash="32306fe3702175d3bbc7975c0ca54271"/></dir><file name="cc.phtml" hash="6e0a672021b19acd5c94880d41efeb50"/><file name="directpayment.phtml" hash="e4c2ed8d53d1334f6715f3c6fb638369"/><dir name="info"><file name="cc.phtml" hash="bb3cee8610379241500d765c7963050a"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="ricardomartins_pagseguro"><dir><dir name="form"><file name="directpayment.phtml" hash="d7f02da712e3bb310a6f785ebc36e3d3"/><dir name="info"><file name="cc.phtml" hash="bb3cee8610379241500d765c7963050a"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="pagseguro"><file name="pagseguro.js" hash="0be6fd340e0be7af5a6f07a280cfc059"/></dir></dir></target></contents>
|
19 |
+
<compatible/>
|
20 |
+
<dependencies><required><php><min>5.2.1</min><max>5.4.0</max></php></required></dependencies>
|
21 |
+
</package>
|
skin/frontend/base/default/pagseguro/selo/selo01_160x90.gif
ADDED
Binary file
|
skin/frontend/base/default/pagseguro/selo/selo01_200x60.gif
ADDED
Binary file
|
skin/frontend/base/default/pagseguro/selo/selo01_300x60.gif
ADDED
Binary file
|
skin/frontend/base/default/pagseguro/selo/selo02_160x90.gif
ADDED
Binary file
|
skin/frontend/base/default/pagseguro/selo/selo02_200x60.gif
ADDED
Binary file
|
skin/frontend/base/default/pagseguro/selo/selo02_300x60.gif
ADDED
Binary file
|
skin/frontend/base/default/pagseguro/selo/selo03_160x90.gif
ADDED
Binary file
|
skin/frontend/base/default/pagseguro/selo/selo03_200x60.gif
ADDED
Binary file
|
skin/frontend/base/default/pagseguro/selo/selo03_300x60.gif
ADDED
Binary file
|
skin/frontend/base/default/pagseguro/selo/selo04_160x90.gif
ADDED
Binary file
|
skin/frontend/base/default/pagseguro/selo/selo04_200x60.gif
ADDED
Binary file
|
skin/frontend/base/default/pagseguro/selo/selo04_300x60.gif
ADDED
Binary file
|