Skip to content

Commit 258ebd0

Browse files
Fixes #181, adds OAuth v2 support.
1 parent 8797b41 commit 258ebd0

File tree

9 files changed

+337
-317
lines changed

9 files changed

+337
-317
lines changed

QuickBooks/Driver/Sql.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,7 +2149,7 @@ protected function _oauthRequestResolveV2($state)
21492149
" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_OAUTHV2TABLE) . "
21502150
WHERE
21512151
oauth_state = '%s' AND
2152-
request_datetime >= '%s'
2152+
request_datetime >= '%s'
21532153
", $errnum, $errmsg, null, null, array( $state, date('Y-m-d H:i:s', strtotime('-30 minutes')) )));
21542154
}
21552155

@@ -2275,9 +2275,8 @@ protected function _oauthRequestWriteV1($app_tenant, $token, $token_secret)
22752275
// Insert it
22762276
return $this->query("
22772277
INSERT INTO
2278-
" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_OAUTHTABLE) . "
2278+
" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_OAUTHV1TABLE) . "
22792279
(
2280-
app_username,
22812280
app_tenant,
22822281
oauth_request_token,
22832282
oauth_request_token_secret,
@@ -2286,7 +2285,6 @@ protected function _oauthRequestWriteV1($app_tenant, $token, $token_secret)
22862285
'%s',
22872286
'%s',
22882287
'%s',
2289-
'%s',
22902288
'%s'
22912289
)", $errnum, $errmsg, null, null, array( $app_tenant, $token, $token_secret, date('Y-m-d H:i:s') ));
22922290
}
@@ -2321,7 +2319,7 @@ protected function _oauthAccessWriteV1($request_token, $token, $token_secret, $r
23212319
// Exists... UPDATE!
23222320
return $this->query("
23232321
UPDATE
2324-
" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_OAUTHTABLE) . "
2322+
" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_OAUTHV1TABLE) . "
23252323
SET
23262324
oauth_access_token = '%s',
23272325
oauth_access_token_secret = '%s',
@@ -2402,9 +2400,9 @@ protected function _oauthAccessWriteV2($state, $encrypted_access_token, $encrypt
24022400
oauth_refresh_token = '%s',
24032401
oauth_access_expiry = '%s',
24042402
oauth_refresh_expiry = '%s',
2405-
access_datetime = '%s',
2403+
access_datetime = '%s',
24062404
last_access_datetime = '%s',
2407-
last_refresh_datetime = '%s'
2405+
last_refresh_datetime = '%s'
24082406
" . $more . "
24092407
WHERE
24102408
oauth_state = '%s' ", $errnum, $errmsg, null, null, $vars);
@@ -2421,7 +2419,7 @@ protected function _oauthAccessDelete($app_username, $app_tenant)
24212419
// Exists... DELETE!
24222420
$this->query("
24232421
DELETE FROM
2424-
" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_OAUTHTABLE) . "
2422+
" . $this->_mapTableName(QUICKBOOKS_DRIVER_SQL_OAUTHV1TABLE) . "
24252423
WHERE
24262424
app_username = '%s' AND
24272425
app_tenant = '%s' ", $errnum, $errmsg, null, null, array( $app_username, $app_tenant ));

QuickBooks/IPP.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ protected function _request($Context, $type, $url, $action, $data, $post = true)
12391239
$this->_authcred['oauth_access_token_secret'])
12401240
{
12411241
// Sign the request
1242-
$OAuth = new QuickBooks_IPP_OAuth($this->_authcred['oauth_consumer_key'], $this->_authcred['oauth_consumer_secret']);
1242+
$OAuth = new QuickBooks_IPP_OAuthv1($this->_authcred['oauth_consumer_key'], $this->_authcred['oauth_consumer_secret']);
12431243

12441244
// Different than default signature method?
12451245
if ($this->_authsign)
@@ -1249,11 +1249,11 @@ protected function _request($Context, $type, $url, $action, $data, $post = true)
12491249

12501250
if ($post)
12511251
{
1252-
$action = QuickBooks_IPP_OAuth::METHOD_POST;
1252+
$action = QuickBooks_IPP_OAuthv1::METHOD_POST;
12531253
}
12541254
else
12551255
{
1256-
$action = QuickBooks_IPP_OAuth::METHOD_GET;
1256+
$action = QuickBooks_IPP_OAuthv1::METHOD_GET;
12571257
}
12581258

12591259
$signdata = null;

0 commit comments

Comments
 (0)