michaeldouglas / laravel-pagseguro

Integração com o gateway de pagamento pagseguro, para utilização com o Laravel
357 stars 119 forks source link

Notificação #74

Closed f0ntana closed 8 years ago

f0ntana commented 8 years ago

Bom dia,

Pessoal não estou recebendo a notificação, vou colocar meu código mas acredito que não tenha nada de errado, estou conseguindo ir e fazer o pagamento e estou recebendo o o redirect mas não recebo notification:

Routas:

Route::any('/pagseguro-redirect', ['as' => 'pagseguro.redirect', 'uses' => 'FrontController@pagseguroRedirect']);

Route::any('/pagseguro-notification', ['as' => 'pagseguro.notification', 'uses' => 'FrontController@pagseguroNotification']);

Controller: `public function addPayment(){

    $params = Input::all();

    if($params['btnPageSeguro']){
        $user_plan = new UserPlan();
        $user_plan->user_id = $params['user_id'];
        $user_plan->plan_id = $params['plan_id'];

        if($user_plan->save()){
            $data = [
                'reference' => $user_plan->id,
                'items' => [
                    [
                        'id' => $user_plan->plan->id,
                        'description' => $user_plan->plan->name,
                        'quantity' => '1',
                        'amount' => $user_plan->plan->price,
                    ],
                ],
                'sender' => [
                    'email' => $user_plan->user->email,
                    'name' => $user_plan->user->name,
                    'phone' => $user_plan->user->phone
                ]
            ];

            $checkout = PagSeguro::checkout()->createFromArray($data);
            $credentials = PagSeguro::credentials()->get();
            $information = $checkout->send($credentials);
            return  Redirect::to($information->getLink());
        }
    }
}

public function pagseguroRedirect()
{
    return Redirect::route('profileclient');
}

public function pagseguroNotification()
{
    $user_plan = new UserPlan();
    $user_plan->user_id = 13;
    $user_plan->plan_id = 1;
    $user_plan->getCode = serialize(Input::all());
    $user_plan->save();

}`

Config

` <?php

return [ /* DEFINE SE SERÁ UTILIZADO O AMBIENTE DE TESTES */ 'use-sandbox' => false,

/*
 * Coloque abaixo as informações do seu cadastro no PagSeguro
 */
'credentials' => [//INFORME AS CREDENCIAIS PADRÕES DE SUA LOJA, MAS PORDERÁ SER ALTERADA EM RUNTIME
     'email' => "meuemail",
     'token' => "meu token",
],

/*
 * Informe abaixo o nome / url das rotas de aplicação para notificações
 * e redirecionamento após pagamento
 * Parâmetro: "route-name" para nome de rota laravel ou "fixed" para url fixa (URL completa)
 * Ex. 01: "route-name" => "tela-de-obrigado" (Nome de Rota)
 * Ex. 02: "fixed" => "http://minhaloja.com.br/pagamento/tela-de-obrigado" (URL Fixa)
 *
 * PARA MAIS INFORMAÇÕES VIDE:
 * https://sandbox.pagseguro.uol.com.br/vendedor/configuracoes.html
 */
'routes' => [
    'redirect' => [
        'route-name' => 'pagseguro.redirect', // Criar uma rota com este nome
    ],
    'notification' => [
        'callback' => null, // Callable callback to Notification function (notificationInfo) : void {}
        'credential' => 'default', // Callable resolve credential function (notificationCode) : Credentials {}
        'route-name' => 'pagseguro.notification', // Criar uma rota com este nome
    ],
],

/*
 * MOEDA QUE SERÁ UTILIZADA COMO MEIO DE PAGAMENTO
 * Somente BRL é aceito no momento (Real do Brasil)
 * */
'currency' => [
    'type' => 'BRL'
],

/**
 * Adaptador de Requisições
 */
'http' => [
    'adapter' => [
        'type' => 'curl',
        'options' => [
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0,
            //CURLOPT_PROXY => 'http://user:pass@host:port', // PROXY OPTION
        ]
    ],
],

/*
 * ATENÇÃO: Não altere as configurações abaixo
 * */
'host' => [
    'production' => 'https://ws.pagseguro.uol.com.br',
    'sandbox' => 'https://ws.sandbox.pagseguro.uol.com.br'
],
'url' => [
    'checkout' => '/v2/checkout',
    'transactions' => '/v3/transactions',
    'transactions-notifications' => '/v3/transactions/notifications',
    'transactions-history' => '/v2/transactions',
    'transactions-abandoned' => '/v2/transactions/abandoned',
],

]; `

f0ntana commented 8 years ago

Detectado problema, bloqueio CloudFlare