Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
KGOrders
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cam Hayes
KGOrders
Commits
4b122972
Commit
4b122972
authored
Mar 24, 2025
by
Cam Hayes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated qb qpi stil doesnt work
parent
55ffb9ae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
34 deletions
+28
-34
qbAPI.pas
kgOrdersServer/Source/qbAPI.pas
+27
-33
kgOrdersServer.ini
kgOrdersServer/kgOrdersServer.ini
+1
-1
No files found.
kgOrdersServer/Source/qbAPI.pas
View file @
4b122972
...
@@ -10,7 +10,7 @@ uses
...
@@ -10,7 +10,7 @@ uses
System
.
Generics
.
Collections
,
AdvEdit
,
vcl
.
wwdblook
,
vcl
.
wwdbdatetimepicker
,
System
.
Generics
.
Collections
,
AdvEdit
,
vcl
.
wwdblook
,
vcl
.
wwdbdatetimepicker
,
System
.
Hash
,
Api
.
Database
,
Vcl
.
ExtCtrls
,
WEBLib
.
Forms
,
WEBLib
.
Controls
,
WEBLib
.
StdCtrls
,
System
.
Hash
,
Api
.
Database
,
Vcl
.
ExtCtrls
,
WEBLib
.
Forms
,
WEBLib
.
Controls
,
WEBLib
.
StdCtrls
,
WEBLib
.
ExtCtrls
,
WEBLib
.
REST
,
WEBLib
.
WebTools
,
System
.
Net
.
HttpClient
,
WEBLib
.
ExtCtrls
,
WEBLib
.
REST
,
WEBLib
.
WebTools
,
System
.
Net
.
HttpClient
,
System
.
Net
.
URLClient
,
System
.
Net
.
HttpClientComponent
;
System
.
Net
.
URLClient
,
System
.
Net
.
HttpClientComponent
,
System
.
netencoding
;
type
type
...
@@ -25,6 +25,7 @@ type
...
@@ -25,6 +25,7 @@ type
{ Public declarations }
{ Public declarations }
procedure
getCompanyInfo
();
procedure
getCompanyInfo
();
procedure
getAccessToken
();
procedure
getAccessToken
();
//function refreshAccessToken(): boolean;
end
;
end
;
var
var
...
@@ -40,6 +41,8 @@ begin
...
@@ -40,6 +41,8 @@ begin
//getCompanyInfo();
//getCompanyInfo();
end
;
end
;
procedure
TfQB
.
getAccessToken
();
procedure
TfQB
.
getAccessToken
();
var
var
restClient
:
TRESTClient
;
restClient
:
TRESTClient
;
...
@@ -63,54 +66,45 @@ begin
...
@@ -63,54 +66,45 @@ begin
client
:=
'ABgO14uvjh8XqLud7spQ8lkb98AUpcdA7HbyMJfCAtl65sQ5yy'
;
client
:=
'ABgO14uvjh8XqLud7spQ8lkb98AUpcdA7HbyMJfCAtl65sQ5yy'
;
secret
:=
'bQ06TRemHeAGFzVHRaTUvUoBU9jpU9itK6MOMgqN'
;
secret
:=
'bQ06TRemHeAGFzVHRaTUvUoBU9jpU9itK6MOMgqN'
;
companyID
:=
'9341454272655710'
;
companyID
:=
'9341454272655710'
;
RefreshToken
:=
'AB11751305638q5pAyQI2MPvhkIGjH1ur3PRsas2zSKGGcC4vs'
;
RefreshToken
:=
'AB11751554594LX59YtRB69e6vWUjg56d9zCWjOOUisSTd6VfC'
;
EncodedAuth
:=
'QUJnTzE0dXZqaDhYcUx1ZDdzcFE4bGtiOThBVXBjZEE3SGJ5TUpmQ0F0bDY1c1E1eXk6YlEwNlRSZW1IZUFHRnpWSFJhVFV2VW9CVTlqcFU5aXRLNk1PTWdxTg=='
;
//EncodedAuth := 'QUJnTzE0dXZqaDhYcUx1ZDdzcFE4bGtiOThBVXBjZEE3SGJ5TUpmQ0F0bDY1c1E1eXk6YlEwNlRSZW1IZUFHRnpWSFJhVFV2VW9CVTlqcFU5aXRLNk1PTWdxTg==';
EncodedAuth
:=
TNetEncoding
.
Base64
.
Encode
(
client
+
':'
+
secret
);
// Prepare the REST client and request
// Prepare the REST client and request
restClient
:=
TRESTClient
.
Create
(
'https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer'
);
restClient
:=
TRESTClient
.
Create
(
nil
);
restRequest
:=
TRESTRequest
.
Create
(
nil
);
restRequest
:=
TRESTRequest
.
Create
(
nil
);
restRequest
.
Client
:=
restClient
;
restRequest
.
Client
:=
restClient
;
restResponse
:=
TRESTResponse
.
Create
(
nil
);
restResponse
:=
TRESTResponse
.
Create
(
nil
);
restRequest
.
Response
:=
restResponse
;
restRequest
.
Response
:=
restResponse
;
rest
Request
.
Method
:=
rmPOST
;
rest
Client
.
BaseURL
:=
'https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer'
;
// Set the Accept header (application/json)
restRequest
.
Method
:=
rmPOST
;
restRequest
.
Params
.
Clear
;
// Add Content-Type and Accept headers
// Add Content-Type and Accept headers
rest
Request
.
AddParameter
(
'Content-Type'
,
'application/x-www-form-urlencoded'
,
pkHTTPHEADER
)
;
rest
Client
.
Accept
:=
'application/json'
;
rest
Request
.
AddParameter
(
'Accept'
,
'application/json'
,
pkHTTPHEADER
)
;
rest
Client
.
ContentType
:=
'application/x-www-form-urlencoded'
;
restRequest
.
AddParameter
(
'Authorization'
,
'Basic '
+
EncodedAuth
,
pkHTTPHEADER
)
;
//restClient.RaiseExceptionOn500 := false
;
// Construct body content like -d "grant_type=refresh_token&refresh_token=AB11751305638q5pAyQI2MPvhkIGjH1ur3PRsas2zSKGGcC4vs"
restRequest
.
Params
.
Clear
;
body
:=
'grant_type=refresh_token&refresh_token='
+
RefreshToken
;
Memo1
.
Lines
.
add
(
restRequest
.
ContentType
);
param
:=
restRequest
.
Params
.
AddItem
;
// Add body parameters as form-urlencoded data
param
.
Name
:=
'Authorization'
;
restRequest
.
AddBody
(
body
,
TRESTContentType
.
ctAPPLICATION_X_WWW_FORM_URLENCODED
);
param
.
Kind
:=
pkHTTPHEADER
;
param
.
Options
:=
param
.
Options
+
[
TRESTRequestParameterOption
.
poDoNotEncode
];
param
.
Value
:=
'Basic '
+
EncodedAuth
;
//restRequest.Params.AddHeader('Authorization', 'Basic ' + EncodedAuth);
// Log the request URL and method
restRequest
.
Params
.
AddItem
(
'grant_type'
,
'refresh_token'
);
Memo1
.
Lines
.
Add
(
'Request URL: '
+
restRequest
.
Client
.
BaseURL
+
restRequest
.
Resource
);
restRequest
.
Params
.
AddItem
(
'refresh_token'
,
RefreshToken
);
// Log headers
for
item
in
restRequest
.
Params
do
Memo1
.
Lines
.
Add
(
'Headers:'
);
Memo1
.
Lines
.
Add
(
item
.
Name
+
':'
+
item
.
Value
);
for
item
in
restRequest
.
Params
do
restRequest
.
Method
:=
rmPOST
;
begin
Memo1
.
Lines
.
Add
(
item
.
Value
);
end
;
// Log body (raw form data)
Memo1
.
Lines
.
Add
(
'Body:'
);
Memo1
.
Lines
.
Add
(
body
);
Memo1
.
Lines
.
Add
(
'--- Request Logged ---'
);
restRequest
.
Execute
;
restRequest
.
Execute
;
// Log response for debugging
//Memo1.Lines.Add(restRequest.Response.Content);
Memo1
.
Lines
.
Add
(
'Status Code: '
+
IntToStr
(
restResponse
.
StatusCode
));
Memo1
.
Lines
.
Add
(
'Response: '
+
restResponse
.
Content
);
Memo1
.
Lines
.
Add
(
'Response Headers: '
+
restResponse
.
Headers
.
Text
);
restClient
.
Free
;
restClient
.
Free
;
restRequest
.
Free
;
restRequest
.
Free
;
...
...
kgOrdersServer/kgOrdersServer.ini
View file @
4b122972
[Settings]
[Settings]
MemoLogLevel
=
4
MemoLogLevel
=
4
FileLogLevel
=
5
FileLogLevel
=
5
LogFileNum
=
3
54
LogFileNum
=
3
72
webClientVersion
=
1.0.0
webClientVersion
=
1.0.0
[Database]
[Database]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment