Commit 581b41ab authored by abkrim's avatar abkrim

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

parent b04e7b12
......@@ -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'])
]
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment