update
This commit is contained in:
@@ -28,10 +28,9 @@ class IntegrationsRepository
|
||||
public function getSettings( string $provider ): array
|
||||
{
|
||||
$table = $this->settingsTable( $provider );
|
||||
$stmt = $this->db->query( "SELECT * FROM $table" );
|
||||
$results = $stmt ? $stmt->fetchAll( \PDO::FETCH_ASSOC ) : [];
|
||||
$rows = $this->db->select( $table, [ 'name', 'value' ] );
|
||||
$settings = [];
|
||||
foreach ( $results as $row )
|
||||
foreach ( $rows ?: [] as $row )
|
||||
$settings[$row['name']] = $row['value'];
|
||||
|
||||
return $settings;
|
||||
@@ -160,10 +159,15 @@ class IntegrationsRepository
|
||||
if ( empty( $response['accessToken'] ) )
|
||||
return false;
|
||||
|
||||
$this->saveSetting( 'apilo', 'access-token', $response['accessToken'] );
|
||||
$this->saveSetting( 'apilo', 'refresh-token', $response['refreshToken'] );
|
||||
$this->saveSetting( 'apilo', 'access-token-expire-at', $response['accessTokenExpireAt'] );
|
||||
$this->saveSetting( 'apilo', 'refresh-token-expire-at', $response['refreshTokenExpireAt'] );
|
||||
try {
|
||||
$this->saveSetting( 'apilo', 'access-token', $response['accessToken'] );
|
||||
$this->saveSetting( 'apilo', 'refresh-token', $response['refreshToken'] );
|
||||
$this->saveSetting( 'apilo', 'access-token-expire-at', $response['accessTokenExpireAt'] );
|
||||
$this->saveSetting( 'apilo', 'refresh-token-expire-at', $response['refreshTokenExpireAt'] );
|
||||
} catch ( \Exception $e ) {
|
||||
error_log( '[shopPRO] Apilo: błąd zapisu tokenów: ' . $e->getMessage() );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user