Git Product home page Git Product logo

quickbooks's Introduction

#Quickbooks

Build Status

Usage

Authentication

$quickbooks = new ActiveCollab\Quickbooks\Quickbooks([
    'identifier'    => 'example-consumer-key',
    'secret'        => 'example-consumer-key-secret',
    'callback_uri'  => 'http://example.com'
]);

Sandbox

$sandbox = new ActiveCollab\Quickbooks\Sandbox(
    'example-consumer-key',
    'example-consumer-key-secret',
    'example-access-token',
    'example-access-token-secret',
    'example-realmId'
);

Querying API

$dataService = new ActiveCollab\Quickbooks\DataService(
    'example-consumer-key',
    'example-consumer-key-secret',
    'example-access-token',
    'example-access-token-secret',
    'example-realmId'
);

quickbooks's People

Contributors

ilijastuden avatar markodobric avatar petarslavnic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quickbooks's Issues

OAuth parameter absent : oauth_verifier

Hello,

At the "callback" step, when trying to get the token credentials (Server#getTokenCredentials()), i'm getting the following 400 error from QuickBooks :

oauth_problem=parameter_absent&oauth_parameters_absent=oauth_verifier

This a POST request, and QuickBooks always seems to expect to get the "oauth_verifier" argument from the query string, while the league/oauth1-client library puts it in the request body :

namespace League\OAuth1\Client\Server;

abstract class Server
{
    //...
    public function getTokenCredentials(TemporaryCredentials $temporaryCredentials, $temporaryIdentifier, $verifier)
    {
        //...
        $uri = $this->urlTokenCredentials();
        $bodyParameters = array('oauth_verifier' => $verifier);

        $client = $this->createHttpClient();

        $headers = $this->getHeaders($temporaryCredentials, 'POST', $uri, $bodyParameters);
        //...
    }
    //...
}

Am I the only one getting this error ?
It looks like an incompatibility between QuickBooks and league/oauth1-client, but I'm surprised not to see anything about this error anywhere, because it won't work at all for me. I might be doing things wrong, but I still haven't found what.

What confirms my thought is that Magento implementation, which seems to have the same specificity :
https://github.com/thephpleague/oauth1-client/blob/master/src/Client/Server/Magento.php
Maybe the QuickBooks implementation should have the same workaround ?

Here is a sum up of how I build my request :

// TemporaryCredentials $temporaryCredentials : received from the previous step
// string $oauthToken : extracted from the query string
// string $oauthVerifier : "      "           "
// strings $consumerKey $consumerSecret and $callbackUri speak for themselves

$clientCredentials = new ClientCredentials();
$clientCredentials->setIdentifier($consumerKey);
$clientCredentials->setSecret($consumerSecret);

$quickbooks = new Quickbooks($clientCredentials);

$quickbooks->getTokenCredentials($temporaryCredentials, $oauthToken, $oauthVerifier)

Just to give it a try, I tried to override protocolHeader() and additionalProtocolParameters() in the QuickBooks class to read this parameter and add it to the query string before the request, and it worked fine :

namespace ActiveCollab\Quickbooks;

class Quickbooks extends Server
{
    //...

    private $tempAddedProtocolParameters = [];

    protected function protocolHeader($method, $uri, CredentialsInterface $credentials, array $bodyParameters = array())
    {                                                                                                                                                                                                                                          
        $prevValue = $this->tempAddedProtocolParameters;

        if (isset($bodyParameters['oauth_verifier'])) {
            $this->tempAddedProtocolParameters['oauth_verifier'] = $bodyParameters['oauth_verifier'];
        }
        $result = parent::protocolHeader($method, $uri, $credentials, $bodyParameters);
        $this->tempAddedProtocolParameters = $prevValue;
        return $result;
    }

    protected function additionalProtocolParameters()
    {
        return array_merge(
            parent::additionalProtocolParameters(),
            $this->tempAddedProtocolParameters
        );
    }
}

(I did it very quickly, before I found the Magento implementation, that's why it's a bit different ... and ugly)

Is it really an issue, or am I doing something wrong ?

Thanks in advance

Guzzle not found

It looks like the recent updates of league/oauth1-client's Guzzle dependency breaks the DataService because Guzzle is now in a different namespace. Seems to be some other breaking changes in Guzzle as well...looking into it

  "message": "Class 'Guzzle\\Service\\Client' not found",
  "code": 1,
  "status_code": 500,
  "debug": {
    "line": 68,

Quickbooks 3100 and 500 internal server error for sandbox

Hi there,

We're giving this repo a try and we can't seem to get it to work. We tried the $dataService method to select customer data, but we keep getting a 3100 error and a 500 internal server error.

We found this post here:

https://intuitdeveloper.lc.intuit.com/questions/1335951-getting-a-3100-errorcode-and-500-internal-server-error-on-any-request

That seems to indicate that the client secret needs to be url encoded, which we tried but we still get the same error. Any help would be greatly appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.