Commit 581b41ab authored by Abdelkarim's avatar Abdelkarim 😀
Browse files

Mejorando sales invoices y correcciones en contactos 2018-12-18-20-09-47

parent b04e7b12
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -243,6 +243,7 @@ class SageProvider extends AbstractProvider implements ProviderInterface
        $now = Carbon::now();
        //dd($now->timestamp, Carbon::parse($tokenInfo->access_expires)->timestamp);
        // Si el token a expirado hay que solicitar un nuevo token usando el de refresco si este no ha expirado
        Log::debug('Verificar active token');
        if ($now->timestamp > Carbon::parse($tokenInfo->access_expires)->timestamp) {
            // Necesitamos un nuevo token
            // https://oauth.accounting.sage.com/token
@@ -311,7 +312,7 @@ class SageProvider extends AbstractProvider implements ProviderInterface
                        'scope' => $auth_token['scope'],
                        'access' => $auth_token['access_token'],
                        'refresh' => $auth_token['refresh_token'],
                        'access_expires' => Carbon::now()->addSeconds($auth_token['expires_in']),
                        'access_expires' => (Carbon::now()->addSeconds($auth_token['expires_in']-30)),
                        'refresh_expires' => Carbon::now()->addSeconds($auth_token['refresh_token_expires_in'])
                    ]
                );
@@ -324,7 +325,7 @@ class SageProvider extends AbstractProvider implements ProviderInterface
                    'scope' => $auth_token['scope'],
                    'access' => $auth_token['access_token'],
                    'refresh' => $auth_token['refresh_token'],
                    'access_expires' => Carbon::now()->addSeconds($auth_token['expires_in']),
                    'access_expires' => (Carbon::now()->addSeconds($auth_token['expires_in']-30)),
                    'refresh_expires' => Carbon::now()->addSeconds($auth_token['refresh_token_expires_in'])
                ]
            );