RicardoMartins_PagSeguro - Version 2.3.1

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 2.3.1
Comparing to
See all releases


Code changes from version 2.3.0 to 2.3.1

app/code/community/RicardoMartins/PagSeguro/Helper/Params.php CHANGED
@@ -241,26 +241,14 @@ class RicardoMartins_PagSeguro_Helper_Params extends Mage_Core_Helper_Abstract
241
public static function normalizeChars($s)
242
{
243
$replace = array(
244
- 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'Ae', 'Å'=>'A', 'Æ'=>'A', 'Ă'=>'A',
245
- 'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'ae', 'å'=>'a', 'ă'=>'a', 'æ'=>'ae',
246
- 'þ'=>'b', 'Þ'=>'B',
247
- 'Ç'=>'C', 'ç'=>'c',
248
- 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E',
249
- 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e',
250
- 'Ğ'=>'G', 'ğ'=>'g',
251
- 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'İ'=>'I', 'ı'=>'i', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i',
252
- 'Ñ'=>'N',
253
- 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'Oe', 'Ø'=>'O', 'ö'=>'oe', 'ø'=>'o',
254
- 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o',
255
- 'Š'=>'S', 'š'=>'s', 'Ş'=>'S', 'ș'=>'s', 'Ș'=>'S', 'ş'=>'s', 'ß'=>'ss',
256
- 'ț'=>'t', 'Ț'=>'T',
257
- 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'Ue',
258
- 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ü'=>'ue',
259
- 'Ý'=>'Y',
260
- 'ý'=>'y', 'ý'=>'y', 'ÿ'=>'y',
261
- 'Ž'=>'Z', 'ž'=>'z'
262
);
263
- return strtr($s, $replace);
264
}
265
266
/**
@@ -289,7 +277,9 @@ class RicardoMartins_PagSeguro_Helper_Params extends Mage_Core_Helper_Abstract
289
*/
290
public function removeDuplicatedSpaces($string)
291
{
292
- return preg_replace('/\s+/', ' ', $string);
293
}
294
295
/**
@@ -453,4 +443,4 @@ class RicardoMartins_PagSeguro_Helper_Params extends Mage_Core_Helper_Abstract
453
}
454
return (abs($extraAmount) == $totalAmount);
455
}
456
- }
241
public static function normalizeChars($s)
242
{
243
$replace = array(
244
+ 'Ä' => 'A', 'Å' => 'A', 'Æ' => 'AE', 'È' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Î' => 'I', 'Ï' => 'I',
245
+ 'Ñ' => 'N', 'Ò' => 'O', 'Ö' => 'O', 'Ø' => 'O', 'Ù' => 'U', 'Û' => 'U', 'Ü' => 'U', 'Ý' => 'Y',
246
+ 'ä' => 'a', 'å' => 'a', 'æ' => 'ae', 'è' => 'e', 'ë' => 'e', 'ì' => 'i', 'î' => 'i', 'ï' => 'i',
247
+ 'ñ' => 'n', 'ò' => 'o', 'ö' => 'o', 'ø' => 'o', 'ù' => 'ú', 'û' => 'u', 'ü' => 'ý', 'ÿ' => 'y',
248
+ 'Œ' => 'OE', 'œ' => 'oe', 'Š' => 'š', 'Ÿ' => 'Y', 'ƒ' => 'f', 'Ğ'=>'G', 'ğ'=>'g', 'Š'=>'S',
249
+ 'š'=>'s', 'Ş'=>'S', 'ș'=>'s', 'Ș'=>'S', 'ş'=>'s', 'ț'=>'t', 'Ț'=>'T', 'ÿ'=>'y', 'Ž'=>'Z', 'ž'=>'z'
250
);
251
+ return preg_replace('/[^0-9A-Za-zÃÁÀÂÇÉÊÍÕÓÔÚÜãáàâçéêíõóôúü.\-\/ ]/u', '', strtr($s, $replace));
252
}
253
254
/**
277
*/
278
public function removeDuplicatedSpaces($string)
279
{
280
+ $string = $this->normalizeChars($string);
281
+
282
+ return preg_replace('/\s+/', ' ', trim($string));
283
}
284
285
/**
443
}
444
return (abs($extraAmount) == $totalAmount);
445
}
446
+ }
app/code/community/RicardoMartins/PagSeguro/Model/Abstract.php CHANGED
@@ -133,7 +133,13 @@ class RicardoMartins_PagSeguro_Model_Abstract extends Mage_Payment_Model_Method_
133
134
$helper->writeLog(sprintf('Retorno do Pagseguro para notificationCode %s: %s', $notificationCode, $resposta));
135
136
- return simplexml_load_string(trim($resposta));
137
}
138
139
/**
133
134
$helper->writeLog(sprintf('Retorno do Pagseguro para notificationCode %s: %s', $notificationCode, $resposta));
135
136
+ libxml_use_internal_errors(true);
137
+ $xml = simplexml_load_string(trim($resposta));
138
+ if (false === $xml) {
139
+ $helper->writeLog('Retorno de notificacao XML PagSeguro em formato não esperado. Retorno: ' . $resposta);
140
+ }
141
+
142
+ return $xml;
143
}
144
145
/**
app/code/community/RicardoMartins/PagSeguro/Model/Payment/Cc.php CHANGED
@@ -157,6 +157,11 @@ class RicardoMartins_PagSeguro_Model_Payment_Cc extends RicardoMartins_PagSeguro
157
}
158
Mage::throwException('Um ou mais erros ocorreram no seu pagamento.' . PHP_EOL . implode(PHP_EOL, $errMsg));
159
}
160
161
$payment->setSkipOrderProcessing(true);
162
157
}
158
Mage::throwException('Um ou mais erros ocorreram no seu pagamento.' . PHP_EOL . implode(PHP_EOL, $errMsg));
159
}
160
+ if (isset($returnXml->error)) {
161
+ $error = $returnXml->error;
162
+ $errMsg[] = (string)$error->message . ' (' . $error->code . ')';
163
+ Mage::throwException('Um erro ocorreu em seu pagamento.' . PHP_EOL . implode(PHP_EOL, $errMsg));
164
+ }
165
166
$payment->setSkipOrderProcessing(true);
167
app/code/community/RicardoMartins/PagSeguro/controllers/NotificationController.php CHANGED
@@ -30,6 +30,11 @@ class RicardoMartins_PagSeguro_NotificationController extends Mage_Core_Controll
30
);
31
$model = Mage::getModel('ricardomartins_pagseguro/abstract');
32
$response = $model->getNotificationStatus($this->getRequest()->getPost('notificationCode'));
33
$model->proccessNotificatonResult($response);
34
}
35
}
30
);
31
$model = Mage::getModel('ricardomartins_pagseguro/abstract');
32
$response = $model->getNotificationStatus($this->getRequest()->getPost('notificationCode'));
33
+ if (false === $response) {
34
+ Mage::throwException('Falha ao processar retorno XML do PagSeguro.');
35
+ }
36
$model->proccessNotificatonResult($response);
37
+
38
+
39
}
40
}
app/code/community/RicardoMartins/PagSeguro/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
<config>
3
<modules>
4
<RicardoMartins_PagSeguro>
5
- <version>2.3.0</version>
6
</RicardoMartins_PagSeguro>
7
</modules>
8
<global>
2
<config>
3
<modules>
4
<RicardoMartins_PagSeguro>
5
+ <version>2.3.1</version>
6
</RicardoMartins_PagSeguro>
7
</modules>
8
<global>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>RicardoMartins_PagSeguro</name>
4
- <version>2.3.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>2015-11-02</date>
17
- <time>15:02:22</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="ca42cfcb32b98712a70da26ba168759d"/><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="f5e774e3c75acceff48e36d23762749a"/><file name="Internal.php" hash="5911252bc71b056c888a61df5f3bf58d"/><file name="Params.php" hash="85b35362605b43c792dc3ff8422148fd"/></dir><dir name="Model"><file name="Abstract.php" hash="9871f99771c89b5e698f451b77203176"/><file name="Observer.php" hash="29a784cdb6203baf6b5f0abeeeda99ed"/><dir name="Payment"><file name="Cc.php" hash="c358df044471194cb58cd2f0376c0981"/></dir><dir name="Source"><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="05b6ea4b355cefcbb1a50d66aba637f6"/></dir><dir name="Source"><dir name="Customer"><file name="Groups.php" hash="f08bac32afcde8078a098446db79bc65"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="89b915bbfc061beb7550a56248177c9f"/><file name="NotificationController.php" hash="c4e32484a82f960db314969a2bfccbff"/><file name="TestController.php" hash="0e2c2bd2fc77ced55f880d1860e4318d"/></dir><dir name="etc"><file name="config.xml" hash="5c25836b488b28667c44d503164f1ad8"/><file name="system.xml" hash="c652e549376568bda40e540486fe110b"/></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="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="0ea9d4ff767a43d1393ddf1e2882a5da"/></dir><file name="cc.phtml" hash="1e5f98f09a867256ddfbd17b22320dcb"/><file name="directpayment.phtml" hash="05b00f5b33e53fd1091b5a84b31d7c85"/><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"><file name="directpayment.phtml" hash="d7f02da712e3bb310a6f785ebc36e3d3"/><dir name="info"><file name="cc.phtml" hash="0a3aa78e0775cd51bb7a168b813dd466"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="pagseguro"><file name="pagseguro.js" hash="37540fcc2280186dd08a2c44b1f397c5"/></dir></dir></target></contents>
19
<compatible/>
20
<dependencies><required><php><min>5.2.1</min><max>5.6.16</max></php></required></dependencies>
21
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>RicardoMartins_PagSeguro</name>
4
+ <version>2.3.1</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>2015-11-15</date>
17
+ <time>22:32:40</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="ca42cfcb32b98712a70da26ba168759d"/><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="f5e774e3c75acceff48e36d23762749a"/><file name="Internal.php" hash="5911252bc71b056c888a61df5f3bf58d"/><file name="Params.php" hash="8ea91a758d8415bac722ad7f3b4d83e0"/></dir><dir name="Model"><file name="Abstract.php" hash="b717e43a0ec8646d5abef80dc332d070"/><file name="Observer.php" hash="29a784cdb6203baf6b5f0abeeeda99ed"/><dir name="Payment"><file name="Cc.php" hash="15c9f561eb43629457bdbdd3c9ac7715"/></dir><dir name="Source"><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="05b6ea4b355cefcbb1a50d66aba637f6"/></dir><dir name="Source"><dir name="Customer"><file name="Groups.php" hash="f08bac32afcde8078a098446db79bc65"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="89b915bbfc061beb7550a56248177c9f"/><file name="NotificationController.php" hash="e7056961e4ada5cc5614c5a40ef78a75"/><file name="TestController.php" hash="0e2c2bd2fc77ced55f880d1860e4318d"/></dir><dir name="etc"><file name="config.xml" hash="e2cfa9c37ae196682689c89a98c186e6"/><file name="system.xml" hash="c652e549376568bda40e540486fe110b"/></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="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="0ea9d4ff767a43d1393ddf1e2882a5da"/></dir><file name="cc.phtml" hash="1e5f98f09a867256ddfbd17b22320dcb"/><file name="directpayment.phtml" hash="05b00f5b33e53fd1091b5a84b31d7c85"/><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"><file name="directpayment.phtml" hash="d7f02da712e3bb310a6f785ebc36e3d3"/><dir name="info"><file name="cc.phtml" hash="0a3aa78e0775cd51bb7a168b813dd466"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="pagseguro"><file name="pagseguro.js" hash="37540fcc2280186dd08a2c44b1f397c5"/></dir></dir></target></contents>
19
<compatible/>
20
<dependencies><required><php><min>5.2.1</min><max>5.6.16</max></php></required></dependencies>
21
</package>