Skip to content
This repository was archived by the owner on Apr 24, 2023. It is now read-only.

Commit 602f8ed

Browse files
authored
Merge pull request #75 from pagseguro/desenvolvimento
3.5.0
2 parents a21f4db + 1cb2cd8 commit 602f8ed

File tree

14 files changed

+253
-43
lines changed

14 files changed

+253
-43
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Changelog
22
---------
3+
3.5.0
4+
- Não exibe meio de pagamento transparente na tela de checkout caso o mesmo não esteja habilitado ou configurado corretamente na conta do vendedor ou aplicação do PagSeguro configurada no módulo
5+
- Exibe na interface administrativa o estado (ativo, inativo) dos meios de pagamento do checkout transparente da conta do PagSeguro configurada no módulo
6+
7+
38
3.4.0
49
- Atualizada biblioteca PHP do PagSeguro para versão 3.3.0
510
- Fix: erro no "credit card holder phone" (não estava sendo enviado o telefone do usuário)

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Com o módulo instalado e configurado, você pode pode oferecer o PagSeguro como
1919
**[Licença](#licença)**<br>
2020

2121
## Requisitos
22-
- [Magento](https://www.magentocommerce.com/) Community 1.9.0 até 1.9.3.4 (ainda em fase de testes nas versões 1.6.x, 1.7.x, 1.8.x)
23-
- [PHP](http://www.php.net/) 5.4.27+, 5.5.x+, 5.6.x+ (ainda em fase de testes nas versões 7.x)
22+
- [Magento](https://www.magentocommerce.com/) Community 1.9.0 até 1.9.3.7
23+
- [PHP](http://www.php.net/) 5.4.27+, 5.5.x+, 5.6.x+
2424
- [SPL](http://php.net/manual/en/book.spl.php)
2525
- [cURL](http://php.net/manual/en/book.curl.php)
2626
- [SimpleXML](http://php.net/manual/en/book.simplexml.php)
@@ -30,7 +30,7 @@ Com o módulo instalado e configurado, você pode pode oferecer o PagSeguro como
3030
3131
- Certifique-se de que não há instalação de outros módulos para o PagSeguro em seu sistema;
3232
- Caso utilize a compilação do Magento, desative-a e limpe-a *(Sistema -> Ferramentas -> Compilação)*;
33-
- Baixe a última versão do módulo **[nesse link](https://github.com/pagseguro/magento/raw/master/UOL_PagSeguro-3.4.0.tgz)** ou então baixe o repositório como arquivo zip através do botão do GitHub;
33+
- Baixe a última versão do módulo **[nesse link](https://github.com/pagseguro/magento/raw/master/UOL_PagSeguro-3.5.0.tgz)** ou então baixe o repositório como arquivo zip através do botão do GitHub;
3434
- Na área administrativa do seu Magento, acesse o menu *Sistema/System -> Magento Connect -> Magento Connect Manager*. Caso tenha uma versão anterior do módulo instalada faça a remoção agora;
3535
- No Magento Connect Manger, dentro da seção Direct package file upload, clique em **Escolher arquivo/Choose file**, selecione o arquivo UOL_PagSeguro-x.x.x.tgz (baixado anteriormente), clique no botão de upload e acompanhe a instalação do módulo no console da página;
3636
- Caso utilize a compilação, volte para a área administrativa do Magento, ative-a e execute-a novamente;

UOL_PagSeguro-3.4.0.tgz

-502 KB
Binary file not shown.

UOL_PagSeguro-3.5.0.tgz

504 KB
Binary file not shown.

app/code/community/UOL/PagSeguro/Model/Adminhtml/Config.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class UOL_PagSeguro_Model_Adminhtml_Config
2727
private $logo;
2828
private $skin;
2929
private $version;
30+
private $session;
31+
private $stc;
3032

3133
public function __construct()
3234
{
@@ -46,6 +48,20 @@ public function __construct()
4648
$this->background = $skinUrl.'images/background.png';
4749
//Set version
4850
$this->version = Mage::helper('pagseguro')->getVersion();
51+
if (Mage::getStoreConfig('payment/pagseguro/token') && Mage::getStoreConfig('payment/pagseguro/email')) {
52+
try {
53+
$this->session = \PagSeguro\Services\Session::create($this->library->getAccountCredentials())->getResult();
54+
} catch (Exception $exception){
55+
$this->session = null;
56+
// TODO make a default format of exception
57+
Mage::log('[PAGSEGURO] Error: ' . $exception->getCode() . ' - ' . $exception->getMessage());
58+
}
59+
}
60+
if (Mage::getStoreConfig('payment/pagseguro/environment') === 'production') {
61+
$this->stc = 'https://stc.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js';
62+
} else {
63+
$this->stc = 'https://stc.sandbox.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js?';
64+
}
4965
}
5066

5167
/**
@@ -82,6 +98,10 @@ public function getCommentText()
8298
//TODO javascript na model!?
8399
$comment = '<script src="'.$this->jquery.'"></script>';
84100
$comment .= '<script src="'.$this->js.'"></script>';
101+
$comment .= '<script src="'.$this->stc.'"></script>';
102+
if ($this->session) {
103+
$comment .= '<script>PagSeguroDirectPayment.setSessionId("' . $this->session . '")</script>';
104+
}
85105
$comment .= '<script src="'.$this->jsColorbox.'"></script>';
86106
$comment .= '<script type="text/javascript">
87107
var jQuery = jQuery.noConflict();

app/code/community/UOL/PagSeguro/etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ limitations under the License.
1919
<config>
2020
<modules>
2121
<UOL_PagSeguro>
22-
<version>3.4.0</version>
22+
<version>3.5.0</version>
2323
</UOL_PagSeguro>
2424
</modules>
2525
<global>

app/code/community/UOL/PagSeguro/etc/system.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,13 @@ limitations under the License.
413413
</pagseguro_online_debit>
414414
</fields>
415415
</pagseguro_payment>
416+
417+
<pagseguro_payments_enabled type="group" translate="label">
418+
<label>Consultar meios de pagamentos ativos na conta PagSeguro</label>
419+
<sort_order>900</sort_order>
420+
<show_in_default>1</show_in_default>
421+
<expanded>0</expanded>
422+
</pagseguro_payments_enabled>
416423
</fields>
417424
</pagseguro_settings>
418425
</groups>

app/design/frontend/base/default/template/uol/pagseguro/form/boleto.phtml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
<style>
2+
#dt_method_<?php echo $this->getMethodCode() ?> {
3+
display: none;
4+
}
5+
</style>
6+
7+
<script>
8+
//<![CDATA[
9+
var pagseguro_boleto_options = jQuery('#dt_method_<?php echo $this->getMethodCode() ?>')
10+
paymentMethods()
11+
var BoletoOptions = false
12+
13+
pagseguroBoletoOptions = function (res) {
14+
if (!BoletoOptions) {
15+
BoletoOptions = true
16+
if (!res['error']) {
17+
if (res['paymentMethods']) {
18+
if (res['paymentMethods'] && res['paymentMethods']['BOLETO'] && res['paymentMethods']['BOLETO']['options']['BOLETO']['status'] === 'AVAILABLE') {
19+
pagseguro_boleto_options.show()
20+
} else {
21+
pagseguro_creditcard_dt.find('input').prop('disabled', true)
22+
}
23+
}
24+
} else {
25+
console.log(res['error'])
26+
}
27+
}
28+
}
29+
//]]>
30+
</script>
31+
132
<script type="text/javascript">
233
//<![CDATA[
334
// get value fromm one step checkout guest document to be used in pagseguro direct payment

app/design/frontend/base/default/template/uol/pagseguro/form/creditcard.phtml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,55 @@
1+
<style>
2+
#dt_method_<?php echo $this->getMethodCode() ?> {
3+
display: none;
4+
}
5+
</style>
6+
7+
<script>
8+
//<![CDATA[
9+
var pagseguro_creditcard_dt = jQuery('#dt_method_<?php echo $this->getMethodCode() ?>')
10+
var pagseguro_credit_card_options = jQuery('#pagseguro-credit-card-options')
11+
paymentMethods()
12+
var CreditcardOptions = false
13+
14+
pagseguroCreditcardOptions = function (res) {
15+
if (!CreditcardOptions) {
16+
pagseguro_credit_card_options.on('click', 'a', function () {
17+
pagseguro_credit_card_options.find('li').css('display', 'inline-flex')
18+
pagseguro_credit_card_options.find('li.more_cc').css('display', 'none')
19+
})
20+
if (!res['error']) {
21+
if (res['paymentMethods'] && res['paymentMethods']['CREDIT_CARD'] && res['paymentMethods']['CREDIT_CARD']['options']) {
22+
var k = 0
23+
pagseguro_credit_card_options.empty()
24+
jQuery.each(res['paymentMethods']['CREDIT_CARD']['options'], function (i, item) {
25+
if (item['status'] === 'AVAILABLE') {
26+
++k
27+
if (k > 0) {
28+
pagseguro_creditcard_dt.show()
29+
}
30+
if (k <= 6) {
31+
pagseguro_credit_card_options.append('<li style="display: inline-flex; padding: 0 3px 3px 0; margin: 0;"><img src="https://stc.pagseguro.uol.com.br' + item['images']['SMALL']['path'] + '"></li>')
32+
if (k === 6) {
33+
pagseguro_credit_card_options.append('<li style="display: inline-flex; padding: 0 3px 3px 0; margin: 0;" class="more_cc"><a >mais</a></li>')
34+
}
35+
}
36+
if (k > 6) {
37+
pagseguro_credit_card_options.append('<li style="display: none; padding: 0 3px 3px 0; margin: 0;"><img src="https://stc.pagseguro.uol.com.br' + item['images']['SMALL']['path'] + '"></li>')
38+
}
39+
}
40+
})
41+
if (k === 0) {
42+
pagseguro_onlinedebit_dt.find('input').prop('disabled', true)
43+
}
44+
}
45+
} else {
46+
console.log(res['error'])
47+
}
48+
}
49+
}
50+
//]]>
51+
</script>
52+
153
<script type="text/javascript">
254
//<![CDATA[
355
// get value from one step checkout guest (if it is enabled) document to be used in pagseguro direct payment
@@ -53,6 +105,7 @@
53105
<div class="pagseguro-cc-input-div">
54106
<input class="pagseguro-cc-input required-entry" type="text" id="creditCardNum" onkeydown="creditCardMask(this)" onblur="getBrand(this)" maxlength="19">
55107
<div class="display-none validation-advice creditCardNum-error-message">Insira um número de cartão válido</div>
108+
<ul id="pagseguro-credit-card-options" style="padding: 4px 0;"></ul>
56109
</div>
57110
</div>
58111

app/design/frontend/base/default/template/uol/pagseguro/form/onlinedebit.phtml

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
<style>
2+
#dt_method_<?php echo $this->getMethodCode() ?> {
3+
display: none;
4+
}
5+
</style>
6+
7+
<script>
8+
//<![CDATA[
9+
var pagseguro_onlinedebit_dt = jQuery('#dt_method_<?php echo $this->getMethodCode() ?>')
10+
var pagseguro_online_debit_options = jQuery('#pagseguro-online-debit-options')
11+
paymentMethods()
12+
var OnlinedebitOptions = false
13+
14+
pagseguroOnlinedebitOptions = function (res) {
15+
if (!OnlinedebitOptions) {
16+
if (!res['error']) {
17+
if (res['paymentMethods'] && res['paymentMethods']['ONLINE_DEBIT'] && res['paymentMethods']['ONLINE_DEBIT']['options']) {
18+
var k = 0
19+
pagseguro_online_debit_options.empty()
20+
jQuery.each(res['paymentMethods']['ONLINE_DEBIT']['options'], function (i, item) {
21+
if (item['status'] === 'AVAILABLE') {
22+
++k
23+
if (k > 0) {
24+
pagseguro_onlinedebit_dt.show()
25+
}
26+
pagseguro_online_debit_options.append('<div><label>' +
27+
'<input class="input-radio required-entry" type="radio" id="debitbankName" name="debitbankName" value="' + i + '" required onclick="validateDebitBankName(this)">'
28+
+ item['displayName'] + '</label></div>')
29+
}
30+
})
31+
if (k === 0) {
32+
pagseguro_onlinedebit_dt.find('input').prop('disabled', true)
33+
}
34+
}
35+
} else {
36+
console.log(res['error'])
37+
}
38+
}
39+
}
40+
//]]>
41+
</script>
42+
143
<script type="text/javascript">
244
//<![CDATA[
345
// get value from one step checkout guest (if it is enabled) document to be used in pagseguro direct payment
@@ -37,7 +79,7 @@
3779
}
3880
//]]>
3981
</script>
40-
82+
4183
<div class="form-list" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
4284
<input type="hidden" id="onlineDebitHash" value="" name="payment[online_debit_hash]">
4385
<input type="hidden" id="onlineDebitBankName" value="" name="payment[online_debit_bank_name]">
@@ -63,44 +105,7 @@
63105
</div>
64106
<div class="input-box">
65107
<label class="required" style="padding: 0.9em 0em 0em;"><?php echo $this->__('Selecione abaixo seu banco') ?></label>
66-
<div style="padding: 0em 1em;">
67-
<div>
68-
<div>
69-
<label>
70-
<input class="input-radio required-entry" type="radio" id="debitbankName" name="debitbankName" value="itau"
71-
required onclick="validateDebitBankName(this)">
72-
Itaú
73-
</label>
74-
</div>
75-
</div>
76-
<div>
77-
<div>
78-
<label>
79-
<input class="input-radio required-entry" type="radio" id="debitbankName" name="debitbankName" value="bradesco"
80-
required onclick="validateDebitBankName(this)">
81-
Bradesco
82-
</label>
83-
</div>
84-
</div>
85-
<div>
86-
<div>
87-
<label>
88-
<input class="input-radio required-entry" type="radio" id="debitbankName" name="debitbankName" value="banrisul"
89-
required onclick="validateDebitBankName(this)">
90-
Banrisul
91-
</label>
92-
</div>
93-
</div>
94-
<div>
95-
<div>
96-
<label>
97-
<input class="input-radio required-entry" type="radio" id="debitbankName" name="debitbankName"
98-
value="bancodobrasil" onclick="validateDebitBankName(this)">
99-
Banco do Brasil
100-
</label>
101-
</div>
102-
</div>
103-
</div>
108+
<div id="pagseguro-online-debit-options" style="padding: 0em 1em;"></div>
104109
</div>
105110
<div class="display-none validation-advice debitbankName-error-message">Escolha um banco</div>
106111
<div style="display: inline-block; "class="pagseguro-label-spacing pagseguro-cc-group-div">

0 commit comments

Comments
 (0)