RicardoMartins_PagSeguro - Version 3.2.4

Version Notes

Versão estável.

Os bugs devem ser reportados 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 3.2.4
Comparing to
See all releases


Code changes from version 3.2.0 to 3.2.4

app/code/community/RicardoMartins/PagSeguro/Helper/Params.php CHANGED
@@ -20,12 +20,21 @@ class RicardoMartins_PagSeguro_Helper_Params extends Mage_Core_Helper_Abstract
20
public function getItemsParams(Mage_Sales_Model_Order $order)
21
{
22
$return = array();
23
- if ($items = $order->getAllVisibleItems()) {
24
- for ($x=1, $y=0, $c=count($items); $x <= $c; $x++, $y++) {
25
$return['itemId'.$x] = $items[$y]->getId();
26
$return['itemDescription'.$x] = substr($items[$y]->getName(), 0, 100);
27
- $return['itemAmount'.$x] = number_format($items[$y]->getPrice(), 2, '.', '');
28
- $return['itemQuantity'.$x] = $items[$y]->getQtyOrdered();
29
}
30
}
31
return $return;
@@ -161,7 +170,7 @@ class RicardoMartins_PagSeguro_Helper_Params extends Mage_Core_Helper_Abstract
161
$type.'AddressCity' => substr($addressCity, 0, 60),
162
$type.'AddressState' => $addressState,
163
$type.'AddressCountry' => 'BRA',
164
- );
165
166
//shipping specific
167
if ($type == 'shipping') {
@@ -277,7 +286,15 @@ class RicardoMartins_PagSeguro_Helper_Params extends Mage_Core_Helper_Abstract
277
$extra = $discount + $taxAmount;
278
279
if ($this->_shouldSplit($order)) {
280
- $extra = $extra+0.01;
281
}
282
return number_format($extra, 2, '.', '');
283
}
@@ -399,8 +416,7 @@ class RicardoMartins_PagSeguro_Helper_Params extends Mage_Core_Helper_Abstract
399
}
400
}
401
402
- // $dob = $customer->getResource()->getAttribute($ccDobAttribute)->getFrontend()->getValue($customer);
403
- $dob = $payment->getOrder()->getData('customer_' . $ccDobAttribute);
404
405
406
return date('d/m/Y', strtotime($dob));
@@ -448,7 +464,7 @@ class RicardoMartins_PagSeguro_Helper_Params extends Mage_Core_Helper_Abstract
448
'order' => $order,
449
'payment' => $payment,
450
'cpf_obj' => $cpfObj,
451
- )
452
);
453
454
return $cpfObj->getCpf();
@@ -504,4 +520,4 @@ class RicardoMartins_PagSeguro_Helper_Params extends Mage_Core_Helper_Abstract
504
505
return false;
506
}
507
- }
20
public function getItemsParams(Mage_Sales_Model_Order $order)
21
{
22
$return = array();
23
+ $items = $order->getAllVisibleItems();
24
+ if ($items) {
25
+ $itemsCount = count($items);
26
+ for ($x=1, $y=0; $x <= $itemsCount; $x++, $y++) {
27
+ $itemPrice = $items[$y]->getPrice();
28
+ $qtyOrdered = $items[$y]->getQtyOrdered();
29
$return['itemId'.$x] = $items[$y]->getId();
30
$return['itemDescription'.$x] = substr($items[$y]->getName(), 0, 100);
31
+ $return['itemAmount'.$x] = number_format($itemPrice, 2, '.', '');
32
+ $return['itemQuantity'.$x] = $qtyOrdered;
33
+
34
+ //We can't send 0.00 as value to PagSeguro. Will be discounted on extraAmount.
35
+ if ($itemPrice == 0) {
36
+ $return['itemAmount'.$x] = 0.01;
37
+ }
38
}
39
}
40
return $return;
170
$type.'AddressCity' => substr($addressCity, 0, 60),
171
$type.'AddressState' => $addressState,
172
$type.'AddressCountry' => 'BRA',
173
+ );
174
175
//shipping specific
176
if ($type == 'shipping') {
286
$extra = $discount + $taxAmount;
287
288
if ($this->_shouldSplit($order)) {
289
+ $extra += 0.01;
290
+ }
291
+
292
+ //Discounting gift products
293
+ $orderItems = $order->getAllVisibleItems();
294
+ foreach ($orderItems as $item) {
295
+ if ($item->getPrice() == 0) {
296
+ $extra -= 0.01 * $item->getQtyOrdered();
297
+ }
298
}
299
return number_format($extra, 2, '.', '');
300
}
416
}
417
}
418
419
+ $dob = $customer->getResource()->getAttribute($ccDobAttribute)->getFrontend()->getValue($customer);
420
421
422
return date('d/m/Y', strtotime($dob));
464
'order' => $order,
465
'payment' => $payment,
466
'cpf_obj' => $cpfObj,
467
+ )
468
);
469
470
return $cpfObj->getCpf();
520
521
return false;
522
}
523
+ }
app/code/community/RicardoMartins/PagSeguro/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
<config>
3
<modules>
4
<RicardoMartins_PagSeguro>
5
- <version>3.2.0</version>
6
</RicardoMartins_PagSeguro>
7
</modules>
8
<global>
2
<config>
3
<modules>
4
<RicardoMartins_PagSeguro>
5
+ <version>3.2.4</version>
6
</RicardoMartins_PagSeguro>
7
</modules>
8
<global>
js/pagseguro/pagseguro.js CHANGED
@@ -2,7 +2,7 @@
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 3.2.0
6
*/
7
8
RMPagSeguro = Class.create({
@@ -21,21 +21,37 @@ RMPagSeguro = Class.create({
21
console.log('RMPagSeguro prototype class has been initialized.');
22
23
this.config = config;
24
25
PagSeguroDirectPayment.setSessionId(config.PagSeguroSessionId);
26
27
28
var senderHashSuccess = this.updateSenderHash();
29
if(!senderHashSuccess){
30
- console.log('Uma nova tentativa de obter o sender_hash será realizada.');
31
- document.observe("click", function(e){
32
- var senderHashSuccess = RMPagSeguroObj.updateSenderHash();
33
- if(!senderHashSuccess){
34
- console.log('PagSeguro: segunda tentativa de obter o hash do comprador (sender_hash) falhou. Tente manualmente com RMPagSeguroObj.updateSenderHash().');
35
- return;
36
}
37
- document.stopObserving('click');
38
- });
39
}
40
Validation.add('validate-pagseguro', 'Falha ao atualizar dados do pagaento. Entre novamente com seus dados.',
41
function(v, el){
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 3.2.3
6
*/
7
8
RMPagSeguro = Class.create({
21
console.log('RMPagSeguro prototype class has been initialized.');
22
23
this.config = config;
24
+ this.config.maxSenderHashAttempts = 30;
25
26
PagSeguroDirectPayment.setSessionId(config.PagSeguroSessionId);
27
28
29
var senderHashSuccess = this.updateSenderHash();
30
if(!senderHashSuccess){
31
+ console.log('Uma nova tentativa de obter o sender_hash será realizada em 3 segundos.');
32
+ var intervalSenderHash;
33
+ var senderHashAttempts = 0;
34
+ intervalSenderHash = setInterval(function(){
35
+ senderHashAttempts++;
36
+ if(PagSeguroDirectPayment.ready){
37
+ RMPagSeguroObj.updateSenderHash();
38
+ clearInterval(intervalSenderHash);
39
+ return true;
40
}
41
+ if (senderHashAttempts == RMPagSeguroObj.config.maxSenderHashAttempts) {
42
+ clearInterval(intervalSenderHash);
43
+ console.error('Não foi possível obter o sender_hash após várias tentativas.');
44
+ }
45
+ }, 3000 );
46
+
47
+ // document.observe("click", function(e){
48
+ // var senderHashSuccess = RMPagSeguroObj.updateSenderHash();
49
+ // if(!senderHashSuccess){
50
+ // console.log('PagSeguro: segunda tentativa de obter o hash do comprador (sender_hash) falhou. Tente manualmente com RMPagSeguroObj.updateSenderHash().');
51
+ // return;
52
+ // }
53
+ // document.stopObserving('click');
54
+ // });
55
}
56
Validation.add('validate-pagseguro', 'Falha ao atualizar dados do pagaento. Entre novamente com seus dados.',
57
function(v, el){
package.xml CHANGED
@@ -1,7 +1,7 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>RicardoMartins_PagSeguro</name>
4
- <version>3.2.0</version>
5
<stability>stable</stability>
6
<license>MIT</license>
7
<channel>community</channel>
@@ -13,9 +13,9 @@ Os dados do cart&#xE3;o s&#xE3;o enviados para o site do pagseguro de forma segu
13
&#xD;
14
Os bugs devem ser reportados na &#xE1;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>2017-05-10</date>
17
- <time>09:14:14</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="be21c9528c260dd377ddc67bd4ed329f"/><file name="Directpayment.php" hash="98ba4fb562b4ad777dc20b15ca345381"/><dir name="Info"><file name="Cc.php" hash="ef4952bfb9d12dae0b6ce13afeb0d1bb"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="0dd3cb536116e4e39417955f1c7ec5e2"/><file name="Internal.php" hash="faed0e7778904c2b74a0632c1ae2f844"/><file name="Params.php" hash="fbbeced5affa1a64b8392af5bea123c7"/></dir><dir name="Model"><file name="Abstract.php" hash="15a6b8a684033b6276ad6f4c03682808"/><file name="Observer.php" hash="6a9d4a53e3cc3c527940d7603b0b1e40"/><dir name="Payment"><file name="Cc.php" hash="e69590afe338c3caa101719b9b941b21"/><file name="Ccview.php" hash="0e8ff1dd7156934d0faa6062900a9cb1"/></dir><dir name="Source"><file name="Ccbrand.php" hash="d9696c3a2854d5e07fb96af55929e738"/><dir name="Customer"><dir name="Address"><dir name="Attributes"><file name="Optional.php" hash="cb7cc6beb016941997051a9d5eb1014c"/></dir><file name="Attributes.php" hash="0ffab3cf1d51871f7d57d95dd95822ec"/></dir><file name="Attributes.php" hash="96c7da94017a8b38bd3804e9b0401a58"/><file name="Cpf.php" hash="da6e6525163d2ba954d69c687d101d7d"/><file name="Dob.php" hash="f82a41da22e5a84e77c35ff91d7dfab9"/></dir><file name="Paymentmethods.php" hash="88897d21a7b5217f834eda0daead22c3"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Token.php" hash="9d099f156f5bd6b18c8f315954da7b7f"/></dir><dir name="Source"><dir name="Customer"><file name="Groups.php" hash="f08bac32afcde8078a098446db79bc65"/></dir></dir></dir></dir></dir><dir name="Test"><dir name="Helper"><file name="Params.php" hash="a596ea4060cdfe0a4d7e981d9543301f"/></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="c7db6498379d63ef44a3848af6daf987"/><file name="NotificationController.php" hash="e7056961e4ada5cc5614c5a40ef78a75"/><file name="TestController.php" hash="19594af040ac8e903d91e90d608188be"/></dir><dir name="data"><dir name="ricardomartins_pagseguro_setup"><file name="data-install-3.0.0.php" hash="038f4e1d3ff6e8b18b46c356f8499025"/></dir></dir><dir name="etc"><file name="config.xml" hash="e214c289b82c8f81f025957bebe60f42"/><file name="system.xml" hash="642efacc3ef633720798cb9e18ea2462"/></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="84a6cc4fb73769ac822c9e8e22b8cec8"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="pagseguro"><dir><dir name="selo"><file name="brflag.png" hash="ed8f0f1d2cd9cd7bc9a8584af417601e"/><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="0545c2e8967213c298802723d9b1a1a2"/></dir><file name="cc.phtml" hash="f82b13a41b24d5acae5f5da5a8002f1c"/><file name="directpayment.phtml" hash="754716867f9bb46edd6942a45997f666"/><dir name="info"><file name="cc.phtml" hash="0a3aa78e0775cd51bb7a168b813dd466"/></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"><dir name="cc"><file name="dob.phtml" hash="0545c2e8967213c298802723d9b1a1a2"/></dir><file name="cc.phtml" hash="aa72e48d34ecd4c3f3f8b476774c9942"/><file name="directpayment.phtml" hash="2b6de8deb0560a2d0a9898e887bf1a84"/><dir name="info"><file name="cc.phtml" hash="0a3aa78e0775cd51bb7a168b813dd466"/></dir></dir></dir></dir></dir><dir name="layout"><dir name="ricardomartins_pagseguro"><file name="pagseguro.xml" hash="dabe29bc130ac063b1715a66f979b131"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="pagseguro"><file name="card.js" hash="2446373da8bcf1712515d85ad481a464"/><file name="pagseguro.js" hash="0569c16bb5747f73da80aff0c328ce96"/></dir></dir></target></contents>
19
<compatible/>
20
<dependencies><required><php><min>5.2.1</min><max>7.5.0</max></php></required></dependencies>
21
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>RicardoMartins_PagSeguro</name>
4
+ <version>3.2.4</version>
5
<stability>stable</stability>
6
<license>MIT</license>
7
<channel>community</channel>
13
&#xD;
14
Os bugs devem ser reportados na &#xE1;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>2017-07-28</date>
17
+ <time>11:37:24</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="be21c9528c260dd377ddc67bd4ed329f"/><file name="Directpayment.php" hash="98ba4fb562b4ad777dc20b15ca345381"/><dir name="Info"><file name="Cc.php" hash="ef4952bfb9d12dae0b6ce13afeb0d1bb"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="0dd3cb536116e4e39417955f1c7ec5e2"/><file name="Internal.php" hash="faed0e7778904c2b74a0632c1ae2f844"/><file name="Params.php" hash="d21ac8704eb24acc3c77545eb5d36891"/></dir><dir name="Model"><file name="Abstract.php" hash="15a6b8a684033b6276ad6f4c03682808"/><file name="Observer.php" hash="6a9d4a53e3cc3c527940d7603b0b1e40"/><dir name="Payment"><file name="Cc.php" hash="e69590afe338c3caa101719b9b941b21"/><file name="Ccview.php" hash="0e8ff1dd7156934d0faa6062900a9cb1"/></dir><dir name="Source"><file name="Ccbrand.php" hash="d9696c3a2854d5e07fb96af55929e738"/><dir name="Customer"><dir name="Address"><dir name="Attributes"><file name="Optional.php" hash="cb7cc6beb016941997051a9d5eb1014c"/></dir><file name="Attributes.php" hash="0ffab3cf1d51871f7d57d95dd95822ec"/></dir><file name="Attributes.php" hash="96c7da94017a8b38bd3804e9b0401a58"/><file name="Cpf.php" hash="da6e6525163d2ba954d69c687d101d7d"/><file name="Dob.php" hash="f82a41da22e5a84e77c35ff91d7dfab9"/></dir><file name="Paymentmethods.php" hash="88897d21a7b5217f834eda0daead22c3"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Token.php" hash="9d099f156f5bd6b18c8f315954da7b7f"/></dir><dir name="Source"><dir name="Customer"><file name="Groups.php" hash="f08bac32afcde8078a098446db79bc65"/></dir></dir></dir></dir></dir><dir name="Test"><dir name="Helper"><file name="Params.php" hash="a596ea4060cdfe0a4d7e981d9543301f"/></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="c7db6498379d63ef44a3848af6daf987"/><file name="NotificationController.php" hash="e7056961e4ada5cc5614c5a40ef78a75"/><file name="TestController.php" hash="19594af040ac8e903d91e90d608188be"/></dir><dir name="data"><dir name="ricardomartins_pagseguro_setup"><file name="data-install-3.0.0.php" hash="038f4e1d3ff6e8b18b46c356f8499025"/></dir></dir><dir name="etc"><file name="config.xml" hash="b9e9ac3c2c62da94882b83c25c27f654"/><file name="system.xml" hash="642efacc3ef633720798cb9e18ea2462"/></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="84a6cc4fb73769ac822c9e8e22b8cec8"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="pagseguro"><dir><dir name="selo"><file name="brflag.png" hash="ed8f0f1d2cd9cd7bc9a8584af417601e"/><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="0545c2e8967213c298802723d9b1a1a2"/></dir><file name="cc.phtml" hash="f82b13a41b24d5acae5f5da5a8002f1c"/><file name="directpayment.phtml" hash="754716867f9bb46edd6942a45997f666"/><dir name="info"><file name="cc.phtml" hash="0a3aa78e0775cd51bb7a168b813dd466"/></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"><dir name="cc"><file name="dob.phtml" hash="0545c2e8967213c298802723d9b1a1a2"/></dir><file name="cc.phtml" hash="aa72e48d34ecd4c3f3f8b476774c9942"/><file name="directpayment.phtml" hash="2b6de8deb0560a2d0a9898e887bf1a84"/><dir name="info"><file name="cc.phtml" hash="0a3aa78e0775cd51bb7a168b813dd466"/></dir></dir></dir></dir></dir><dir name="layout"><dir name="ricardomartins_pagseguro"><file name="pagseguro.xml" hash="dabe29bc130ac063b1715a66f979b131"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="pagseguro"><file name="card.js" hash="2446373da8bcf1712515d85ad481a464"/><file name="pagseguro.js" hash="e9d94a22754f7a912004842b791e1efc"/></dir></dir></target></contents>
19
<compatible/>
20
<dependencies><required><php><min>5.2.1</min><max>7.5.0</max></php></required></dependencies>
21
</package>