Payout returned stopped being suddenly received

3

I have a problem with a site that I made a short time ago, in the first days, when a customer made a payment in PagSeguro I received the return normally with the updates of the status of the purchase, however, about two weeks ago I stopped receive this return suddenly. I ran my code several times behind a possible error, I researched in various ways in Google, I even disabled mod_security on the server as some sites suggested and nothing ...

Return file code

header('Access-Control-Allow-Origin: *');
require('../../PagSeguroLibrary/PagSeguroLibrary.php');

/* Tipo de notificação recebida */
$type = $_REQUEST['notificationType'];
LogPagSeguro::info("Uma Notificação do tipo '{$type}' chegou!");
/*
* Código da notificação recebida
* https://pagseguro.uol.com.br/v2/guia-de-integracao/api-de-notificacoes.html
*/
$code = $_REQUEST['notificationCode'];
/* Verificando tipo de notificação recebida */
if ($type == 'transaction') {
LogPagSeguro::info('Nova notificação retornada do PagSeguro');
$credencial = PagSeguroConfig::getAccountCredentials();
/* Obtendo o objeto PagSeguroTransaction a partir do código de notificação */
$transaction = PagSeguroNotificationService::checkTransaction(
    $credencial,
    $code
);
/* código do status da transação */
$status = (int) $transaction->getStatus()->getValue();
$requestId = (int) $transaction->getReference();
$statusNome = $transaction->getStatus()->getTypeFromValue();

if($status && $requestId){
    /*atualiza o status da compra

      Código adicional

      grava no log do pagseguro
    */
    if($qrUpdateInfo->affected_rows == 1) LogPagSeguro::info('Pedido "'.$requestId.'" atualizado com sucesso!');
    else LogPagSeguro::warning("Ocorreu um erro na atualização do status do pedido         '{$requestId}'! mysqli_errno({$qrUpdateInfo->errno})");
}
}else{
    LogPagSeguro::warning("Uma Notificação do tipo '{$type}' foi recusada!");
}

I am using $_REQUEST because strangely it did not receive $_POST s from PayPal . So far no mystery, I think.

But at the time I make the purchase, it sends me the return of that purchase and writes to the log file as usual, but updates to the purchase status are not coming any more ...

Log:

{2014/05/19 13:41:32} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 79,
  'SenderEmail' => 'null',
)) - begin 
{2014/05/19 13:41:33} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 79,
  'SenderEmail' => 'null',
)) - end {1}13DC46D97171BB4444F60F81E8A4A98C 
{2014/05/19 13:56:36} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 80,
  'SenderEmail' => 'null',
)) - begin 
{2014/05/19 13:56:38} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 80,
  'SenderEmail' => 'null',
)) - end {1}E0E95A81EAEA5B2AA4C66F9C8806485E 
{2014/05/19 14:28:02} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 84,
  'SenderEmail' => 'null',
)) - begin 
{2014/05/19 14:28:04} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 84,
  'SenderEmail' => 'null',
)) - end {1}A864EE379C9C8FFCC4A48FBACABECBC3 
{2014/05/19 14:30:57} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 85,
  'SenderEmail' => 'null',
)) - begin 
{2014/05/19 14:30:59} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 85,
  'SenderEmail' => 'null',
)) - end {1}53AD3EF23F3F89A884559FBFBD464A36 
{2014/05/19 14:56:27} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 86,
  'SenderEmail' => 'null',
)) - begin 
{2014/05/19 14:56:28} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 86,
  'SenderEmail' => 'null',
)) - end {1}ABC65A77767683A774117FA5386D3C90 
{2014/05/19 14:59:10} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 87,
  'SenderEmail' => 'null',
)) - begin 
{2014/05/19 14:59:11} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 87,
  'SenderEmail' => 'null',
)) - end {1}27E7C9EE7F7F95E334BFDF9131FBDA3E 
{2014/05/19 15:16:17} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 88,
  'SenderEmail' => 'null',
)) - begin 
{2014/05/19 15:16:19} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
  'Reference' => 88,
  'SenderEmail' => 'null',
)) - end {1}D4E7C61FADAD6FF99403AFB16E1D0930 

Another question, could server firewall be blocking the return of PagSeguro?

I honestly have already lost hope with PagSeguro, but since I can not migrate this client to Moip I have to find a way to resolve it.

    
asked by anonymous 28.05.2014 / 13:49

2 answers

1

I found the problem, and some more recommendations ...

  • 1 - Do not just set the return url, when you send the purchase you have to set the return url as well

      

    $ pagSeguro-> setNotificationURL (' http://seudominio/arquivoderetorno ');

  • 2 - Release the ips on your firewall

    186.234.16.8
    186.234.16.9
    186.234.48.8
    186.234.48.9
    200.147.112.136
    200.147.112.137
    
  • 3 - Disable your mod_security

Sources:
IMasters
Blog insurance page

    
28.05.2014 / 19:09
1

I did not analyze your code, but as I had no answers I will give you 2 ways that will help you solve problems;

1st - check if the payment is not paid, the account you are using to pay, has not disabled the return page, if it has been disabled for some mistake, it will not send anything to you.

2º - Make a test, this page that receives the return, causes it to create a .txt file if it is accessed, makes a test purchase, and verify that it created the file. if it does not create the file for some reason it is not running.

    
28.05.2014 / 16:19