This commit is contained in:
@@ -367,13 +367,24 @@ namespace AyaNova.PlugIn.QBOI
|
||||
//case 3671
|
||||
//Modify the below code to instead work with a static tokens obtained from qBridge (just for initial testing)
|
||||
//then test that all ops work witha fresh company connection
|
||||
static public void StartAuthorization()
|
||||
static public bool StartAuthorization()
|
||||
{
|
||||
//used to tie this session to the auth key on our server for fetching later
|
||||
QBOI2_SESSION_TOKEN = RandomInt64().ToString();
|
||||
//shell out to browser for user to login to QB
|
||||
System.Diagnostics.Process.Start("https://qboauth.ayanova.com/start/" + QBOI2_SESSION_TOKEN);
|
||||
|
||||
|
||||
//Open dialog that polls for token repeatedly, there is a delay built into the server
|
||||
//so no need to delay here, just keep attempting to fetch over and over or until cancel
|
||||
GetToken gt = new GetToken(QBOI2_SESSION_TOKEN);
|
||||
DialogResult tokenResult=gt.ShowDialog();
|
||||
if (tokenResult == DialogResult.Cancel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//LOOP over and over every 5 seconds checking repeatedly for the state token to get off the server or until user selects quit in some dialog that needs to be shown here
|
||||
|
||||
|
||||
@@ -431,7 +442,9 @@ namespace AyaNova.PlugIn.QBOI
|
||||
//' For data updates, create DataService:
|
||||
|
||||
Intuit.Ipp.DataService.DataService loDataService = new Intuit.Ipp.DataService.DataService(SC);
|
||||
|
||||
_AuthenticationCompleted = true;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -522,14 +535,14 @@ namespace AyaNova.PlugIn.QBOI
|
||||
if (!_AuthenticationCompleted)
|
||||
{
|
||||
IntegrationLog.Log(QBID, "PFC: Authenticating...");
|
||||
StartAuthorization();//case 3671
|
||||
if (!StartAuthorization()) {
|
||||
//user cancelled or some other issue, close qboi
|
||||
IntegrationLog.Log(QBID, "PFC: QuickBooks connection not authorized");
|
||||
return pfstat.Cancel;
|
||||
}
|
||||
}
|
||||
|
||||
while (!_AuthenticationCompleted)
|
||||
{
|
||||
//wait for authorization,
|
||||
//TODO: add timeout here
|
||||
}
|
||||
|
||||
|
||||
IntegrationLog.Log(QBID, "PFC: Authentication completed, validating company data");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user