This commit is contained in:
2025-06-15 19:03:59 -04:00

View File

@@ -21,7 +21,7 @@ module QuickbooksOauth
begin begin
yield oauth_access_token yield oauth_access_token
rescue OAuth2::Error, Quickbooks::AuthorizationFailure => ex rescue OAuth2::Error, Quickbooks::AuthorizationFailure => ex
Rails.logger.info("QuickbooksOauth.perform: #{ex.message}") Rails.logger.error("QuickbooksOauth.perform: #{ex.message}")
# to prevent an infinite loop here keep a counter and bail out after N times... # to prevent an infinite loop here keep a counter and bail out after N times...
attempts += 1 attempts += 1
@@ -36,6 +36,7 @@ module QuickbooksOauth
end end
def refresh_token! def refresh_token!
Rails.logger.info("QuickbooksOauth.refresh_token!")
t = oauth_access_token t = oauth_access_token
refreshed = t.refresh! refreshed = t.refresh!
@@ -45,6 +46,8 @@ module QuickbooksOauth
oauth2_refresh_token_expires_at = 100.days.from_now oauth2_refresh_token_expires_at = 100.days.from_now
end end
Rails.logger.info("QuickbooksOauth.refresh_token!: #{oauth2_refresh_token_expires_at}")
update!( update!(
oauth2_access_token: refreshed.token, oauth2_access_token: refreshed.token,
oauth2_access_token_expires_at: Time.at(refreshed.expires_at), oauth2_access_token_expires_at: Time.at(refreshed.expires_at),