This commit is contained in:
@@ -212,6 +212,12 @@
|
||||
<Compile Include="AyaMapDetails.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GetToken.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GetToken.Designer.cs">
|
||||
<DependentUpon>GetToken.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SetAYImportPartVendor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -357,6 +363,9 @@
|
||||
<DependentUpon>AyaMapDetails.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GetToken.resx">
|
||||
<DependentUpon>GetToken.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SetAYImportPartVendor.resx">
|
||||
<DependentUpon>SetAYImportPartVendor.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -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