Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Quickbooks Payments OAuth2 by Dec 17, 2019 #3370

Open
vanboom opened this issue Sep 25, 2019 · 3 comments
Open

Support Quickbooks Payments OAuth2 by Dec 17, 2019 #3370

vanboom opened this issue Sep 25, 2019 · 3 comments

Comments

@vanboom
Copy link

vanboom commented Sep 25, 2019

Quickbooks Online API Access will require OAuth2 by Dec 17, 2019.

vanboom pushed a commit to vanboom/active_merchant that referenced this issue Sep 25, 2019
@daniela-genebygene
Copy link

This seems to be completed with release 1.101.0, however, the documentation has not been updated to reflect the appropriate usage of OAuth2 implementation.

I tried to parse the test cases to identify the appropriate use of the implementation, but I'm confused on the requirement to provide access_token and refresh_token on constructing the gateway. In the intuit documentation, you only need to provide the client_id and secret, so should these just be placeholders?

If there is any example code of this functionality being used, please let me know. Thanks in advance!

@vanboom
Copy link
Author

vanboom commented Sep 6, 2021

I have been using this version of the Quickbooks gateway on my fork...
https://github.com/vanboom/active_merchant/blob/4e6e43bef685c7c0c454824d1e325551412cc0e5/lib/active_merchant/billing/gateways/quickbooks_oauth2.rb

It initializes with the access token (and no refresh token). Notice that my my fork does not have any of the refresh token logic in it. I do not think it is the job of ActiveMerchant to refresh the access token. Honestly I am not sure where my version came from - maybe it was posted here at some point in time. Imho the master version here needs some work to remove the backward compatibility logic and access token refresh logic. I would be happy to issue a PR if some folks could use this. I have been using my fork because it seems like this gateway is not heavily used or maintained here so I don't want to add a PR to the big PR pile.

  gateway = ActiveMerchant::Billing::QuickbooksOauth2Gateway.new(
        :consumer_key=>client_id,
        :consumer_secret=>client_secret,
        :access_token=>oauth_access_token.token || "",
        :token_secret=>refresh_token || "",
        :realm=>company_id || "",
        :test=>true
      )

@vanboom
Copy link
Author

vanboom commented Sep 6, 2021

Another note about refreshing the access token...

The gateway calls will fail if the access_token is not accepted by Quickbooks. I think it is the job of the application level error handling to refresh the access token (i.e. manage the authentication with Quickbooks), and the job of ActiveMerchant to use the access_token to process transactions. Suggested in #4104

vanboom pushed a commit to vanboom/active_merchant that referenced this issue Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants