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

Commit 5941967

Browse files
authored
Merge pull request #91 from gabriellucius/fix-errorpage-redirect-payment
Fix errorpage redirect payment
2 parents 6fae28e + 718a860 commit 5941967

File tree

7 files changed

+20
-4
lines changed

7 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Changelog
22
---------
3+
3.16.1
4+
- Fix: redirecionamento para tela de erro caso ocorra algum problema no checkout padrão ou lightbox
35

46
3.16.0
57
- Inserir configuração de Status do PagSeguro por Notificação (admin) em relação ao states do Magento

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ 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.7
22+
- [Magento](https://www.magentocommerce.com/) Community 1.9.0 até 1.9.3.8
2323
- [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)
@@ -33,7 +33,7 @@ Com o módulo instalado e configurado, você pode pode oferecer o PagSeguro como
3333
3434
- Certifique-se de que não há instalação de outros módulos para o PagSeguro em seu sistema;
3535
- Caso utilize a compilação do Magento, desative-a e limpe-a *(Sistema -> Ferramentas -> Compilação)*;
36-
- Baixe a última versão do módulo **[nesse link](https://github.com/pagseguro/magento/raw/master/UOL_PagSeguro-3.16.0.tgz)** ou então baixe o repositório como arquivo zip através do botão do GitHub;
36+
- Baixe a última versão do módulo **[nesse link](https://github.com/pagseguro/magento/raw/master/UOL_PagSeguro-3.16.1.tgz)** ou então baixe o repositório como arquivo zip através do botão do GitHub;
3737
- 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;
3838
- 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;
3939
- Caso utilize a compilação, volte para a área administrativa do Magento, ative-a e execute-a novamente;

UOL_PagSeguro-3.16.0.tgz

-528 KB
Binary file not shown.

UOL_PagSeguro-3.16.1.tgz

528 KB
Binary file not shown.

UOL_PagSeguro.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<description>Aceite mais de 25 meios de pagamentos com apenas 1 contrato. Seus clientes podem parcelar no cartão em até 18x e se preferir, você também pode oferecer parcelamento sem acréscimo.</description>
1010
<license>Apache Software License</license>
1111
<license_uri>http://opensource.org/licenses/apachepl.php</license_uri>
12-
<version>3.16.0</version>
12+
<version>3.16.1</version>
1313
<stability>stable</stability>
1414
<notes>- Add PagSeguro status to magento state configuration
1515
- Retry payment page when checkout finishes with error

app/code/community/UOL/PagSeguro/controllers/PaymentController.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,18 @@ public function defaultAction()
102102
* @var \PagSeguro\Domains\Requests\DirectPayment\Boleto|\PagSeguro\Domains\Requests\DirectPayment\CreditCard|\PagSeguro\Domains\Requests\DirectPayment\OnlineDebit $result
103103
*/
104104
$link = $this->payment->paymentRegister($payment);
105+
if ($link == false) {
106+
throw new Exception('Can\'t generate PagSeguro payment url for lightbox checkout.');
107+
}
105108
$order->sendNewOrderEmail();
106109
} catch (Exception $exception) {
107110
\PagSeguro\Resources\Log\Logger::error($exception);
108111
Mage::logException($exception);
109112
$this->canceledStatus($order);
113+
return Mage_Core_Controller_Varien_Action::_redirect(
114+
'pagseguro/payment/error',
115+
['_secure' => false]
116+
);
110117
}
111118

112119
return $this->loadAndRenderLayout([
@@ -239,11 +246,18 @@ public function lightboxAction()
239246
* @var \PagSeguro\Domains\Requests\DirectPayment\Boleto|\PagSeguro\Domains\Requests\DirectPayment\CreditCard|\PagSeguro\Domains\Requests\DirectPayment\OnlineDebit $result
240247
*/
241248
$code = $this->payment->paymentRegister($payment, true);
249+
if ($code == false) {
250+
throw new Exception('Can\'t generate PagSeguro payment code for lightbox checkout.');
251+
}
242252
$order->sendNewOrderEmail();
243253
} catch (Exception $exception) {
244254
\PagSeguro\Resources\Log\Logger::error($exception);
245255
Mage::logException($exception);
246256
$this->canceledStatus($order);
257+
return Mage_Core_Controller_Varien_Action::_redirect(
258+
'pagseguro/payment/error',
259+
['_secure' => false]
260+
);
247261
}
248262

249263
if ($this->library->getEnvironment() === 'production') {

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.16.0</version>
22+
<version>3.16.1</version>
2323
</UOL_PagSeguro>
2424
</modules>
2525
<global>

0 commit comments

Comments
 (0)