Coder Social home page Coder Social logo

quickbooks-sync's People

Contributors

adamskt avatar davidcc avatar dteske25 avatar jsgoupil avatar rogerfar avatar tofer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar

quickbooks-sync's Issues

StepQueryWithIterator could pass ticket to interested methods

I think the StepQueryWithIterator class could pass the authenticatedTicket to the SaveMessage and RetrieveMessage methods in lieu of the current ticket and step. This would be useful because (in my implementation, for example) the ticket I use inherits from the AuthenticatedTicket class and is tracked in memory while storing a state (associated with the ticket) that can be used throughout the step process. So passing the instance of the ticket would save one the trouble of looking up the authenticated ticket by the ticket ID in certain implementations.

UnitOfMeasureUnit is missing from ColDesc in reports.

QuickBooksDesktop.Services.WebConnectorHandler: Error: An exception occurred during processing a step for ticket 304100f0-3bca-495c-b692-2db0228b6bad. Step: GeneralSummaryReportQuery

QbSync.WebConnector.Core.QbSyncException: Exception of type 'QbSync.WebConnector.Core.QbSyncException' was thrown.
 ---> System.InvalidOperationException: There is an error in XML document (23, 3).
 ---> System.InvalidOperationException: Instance validation error: 'UnitOfMeasureUnit' is not a valid value for ColType.
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderQBXML.Read904_ColType(String s)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderQBXML.Read906_ColDesc(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderQBXML.Read916_ReportRet(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderQBXML.Read1063_Item(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderQBXML.Read1348_QBXMLMsgsRs(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderQBXML.Read1399_QBXML(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderQBXML.Read1400_QBXML()
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---

Handle StatusCode error better

Currently, in the ExecuteResponse we check if the main required object is present. But when there is an error, it ends up to be an ugly if case for each status error code.

Example with InvoiceAdd

if (response.InvoiceRet != null) { ... }
else if (response.statusCode == "3120") {

}

Not only this is ugly, but when the response is coming back with an error, there are no state saved properly with what has been sent and what is being returned.
So I end up doing either a save to the database or something ugly like:

                // If the object cannot be added, it's because the parent has been deleted.
                ////"Object "80000027-1429563689" specified in the request cannot be found.  QuickBooks error message: Invalid argument.  The specified record does not exist in the list."
                var startsWith = "Object \"";
                var endsWith = "\" specified in the request cannot be found.  QuickBooks error message: Invalid argument.  The specified record does not exist in the list.";
                if (response.statusMessage.StartsWith(startsWith) && response.statusMessage.EndsWith(endsWith))
                {
                    // We will remove the entity sync, we can't sync this invoice. We will also remove the site.
                    var invoiceIdStr = messageService.RetrieveMessage(authenticatedTicket.Ticket, GetName(), Key);
                    int invoiceId = 0;
                    if (invoiceIdStr != null && int.TryParse(invoiceIdStr, out invoiceId))
                    {

Help for integrating with my local database

Hi. I want to integrate this application for quickbook sync but not able how to use this example. Like I,m creating one console app and trying to use these methods but its not working. If you can help me that would be great. Like any other example using this quickbook_sync. Thanks in advance.

OwnerID doesn't support "0" value for custom fields

Multiple request, response, and ret types use property OwnerID, and are of type GUIDTYPE or GUIDTYPE[], but this does not support the allowed value of "0" to retrieve or set custom fields from QuickBooks. Limiting to GUIDs seems to limit compatibility with private data only.

Note: I did try new GUIDTYPE("0") but that gets formatted to {00000000-0000-0000-0000-000000000000}

I found the following quickbooks documentation in chapter 11 (page 137) for more info on the difference between custom fields and private data, and page 146 for an example query with the "0" value: https://developer-static.intuit.com/qbSDK-current/doc/PDF/QBSDK_ProGuide.pdf

I did some very limited testing, and changing OwnerID to string or string[] I was able to get custom fields successfully via the DataExtRet.

Support customizable iterator records

Currently, the StepQueryWithIterator<T, Y>.ExecuteRequest method simply sets the QbIteratorRequest.MaxReturned value to 100. We could check for an existing valid value and set one if there isn't.

int maxVal;
bool isValid = int.TryParse(request.MaxReturned, out maxVal);

// Max 200 is arbitrary--maybe there shouldn't be a max.
if (!isValid || (isValid && (0 > maxVal || maxVal > 200)))
{
    // Not a valid max returned value. Set to 100 by default.
    request.MaxReturned = "100";
}

Allow QBWC to run without QB Open

Sync Manager is currently hardcoding setting which means it will only talk with the currently opened company. Would be nice if this parameter was exposed so we can use this library with QB closed.

                        ret[1] = string.Empty; // Use the company that is opened on the client.

How can i Iterator for JournalEntryAddRqType.

As i have to push Multi pal days entry of Night audit to QB JournalEntry.

I have scenario like i have to pass ascending order by dates Journal entry to QB, if i get error to pass any date entry, i need to stop from it, and need to solve. then again start from the error date.

QuickBooks found an error when parsing the provided XML text stream.

I'm trying to create a Sales Order but receive message: QuickBooks found an error when parsing the provided XML text stream.
This is my XML:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
  <QBXMLMsgsRq onError="stopOnError">
    <SalesOrderAddRq>
      <SalesOrderAdd defMacro="MACROTYPE">
        <SalesOrderLineAdd>
          <Rate>1.00</Rate>
          <ItemRef>
            <ListID>160000-933272656</ListID>
          </ItemRef>
          <Quantity>2.00</Quantity>
          <Amount>200.00</Amount>
        </SalesOrderLineAdd>
        <SalesOrderLineAdd>
          <Rate>1.00</Rate>
          <ItemRef>
            <ListID>1C0000-933272656</ListID>
          </ItemRef>
          <Quantity>2.00</Quantity>
          <Amount>200.00</Amount>
        </SalesOrderLineAdd>
        <CustomerRef>
          <ListID>800000DD-1702612106</ListID>
        </CustomerRef>
        <RefNumber>SO-001</RefNumber>
        <BillAddress>
          <Addr1>110 Main Street</Addr1>
          <Addr2>Suite 2000</Addr2>
          <State>TX</State>
          <PostalCode>99875</PostalCode>
          <Country>US</Country>
        </BillAddress>
        <DueDate>2019-10-10</DueDate>
      </SalesOrderAdd>
    </SalesOrderAddRq>
  </QBXMLMsgsRq>
</QBXML>

The reason is the order of fields is not match. For example, in your request the first tag should be CustomerRef, then RefNumber, after BillAddress etc. So here is a correct version of the request:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
  <QBXMLMsgsRq onError="stopOnError">
    <SalesOrderAddRq>
      <SalesOrderAdd defMacro="MACROTYPE">
       <CustomerRef>
          <ListID>800000DD-1702612106</ListID>
        </CustomerRef>
        <RefNumber>SO-001</RefNumber>
        <BillAddress>
          <Addr1>110 Main Street</Addr1>
          <Addr2>Suite 2000</Addr2>
          <State>TX</State>
          <PostalCode>99875</PostalCode>
          <Country>US</Country>
        </BillAddress>
        <DueDate>2019-10-10</DueDate>
        <SalesOrderLineAdd>
          <ItemRef>
            <ListID>160000-933272656</ListID>
          </ItemRef>
          <Quantity>2.00</Quantity>
          <Rate>1.00</Rate>
          <Amount>200.00</Amount>
        </SalesOrderLineAdd>
        <SalesOrderLineAdd>
          <ItemRef>
            <ListID>1C0000-933272656</ListID>
          </ItemRef>
          <Quantity>2.00</Quantity>
          <Rate>1.00</Rate>
          <Amount>200.00</Amount>
        </SalesOrderLineAdd>
      </SalesOrderAdd>
    </SalesOrderAddRq>
  </QBXMLMsgsRq>
</QBXML>

How to fix it in the code?

Rate or RatePercent not being set on SalesOrderLineRet

I was trying to write some unit tests and needed to create a sample quickbooks sales order response. However, for some reason, the Rate and RatePercent aren't being set no matter what I do, strangely. After the initialization the rate is still null and the rate percent is also zero. I also tried setting it via a property afterwards (e.g. newVal.Rate = 100M) but even then the resulting object still has newVal.Rate=null.

E.g. the rate is set to 100
image

But then after setting it, the Rate parameter on the final object is null...?
image

Locals view of newVal
image

Question About Querying Items

I am looking to query items. I am interested in ItemNonInventoryRet, ItemInventoryRet, ItemInventoryAssemblyRet & ItemServiceRet.

Is there a way to only include these item types and not the other types?

Here is my current query:

var request = new QbXmlRequest();
            var innerRequest = new ItemQueryRqType {
                MaxReturned = MaxReturned,
                iterator = IteratorType.Start,
                FromModifiedDate = SyncLog.FromDate,
                ToModifiedDate = SyncLog.ToDate,
                ActiveStatus = ActiveStatus.ActiveOnly
            };

Support QBXml 14.

The new version is out and the difference can be found here:

https://static.developer.intuit.com/resources/ReleaseNotes_QBXMLSDK_14_0.pdf

The main things we should fix is to add the QBXml 14 Schema. change the VERSION to 14. Update the Objects.

And potentially fix the issue they mention here

In a VehicleMileageQuery, if you specify time values (for example, 2002-06-05T10:21:10) in any of the date range filters, you get a statuscode error 3020 statusSeverity="Error" statusMessage="There was an error when converting the date value...”
The reason for this is that Vehicle Mileage supports only Date values, not DateTime values, despite what the OSR says. The
workaround is to use only date values, as follows: 2002-06-05.

decimal precision in QUANTYPE

Hello, we are trying to send quantities such as 0.16667 as the quantity on a CreditMemoLineAdd, and the QBXML being generated is 0.17.

I believe this is due to the use of
return _value.ToString("F", CultureInfo.InvariantCulture);

in the FLOATTYPE superclass. Since (I believe) QBXML supports 5 decimal places, would "F5" be more appropriate here?

Common Interfaces

It would be very helpful if common types had either common base types or common interfaces.

For Example, VendorAddress and BillAddress are both identical address types.
But since the generated code doesn't generate them from a common type or assign a common interface, mapping code requires either reflection or copy-paste duplication.

Another example would be the common properties of all Mod types or Ret types (ListId, EditSequence, etc.).

If the XSD and generator can't be updated to do this automatically, it would be possible to add them manually if the generator built all types with the partial keyword. Then common interfaces could be manually added to your codebase and associated with appropriate types.

Unexpected keys in EmployeePayrollInfo causing issues deserializing

Hello! We are having some issues parsing older versions of the QBD SDK with this package.
Some of our clients is sending the following 4 keys under the <EmployeeRet><EmployeePayrollInfo> key.
When these keys are present, the entire EmployeePayrollInfo object fails to deserialize, causing unexpected behavior on our platform. Is there a way to allow these extra keys to be present and ignored, or to just be added?
If there's an easy change that I can submit, please let me know.

qbxmlops50.xml
qbxmlops70.xml

  • IsCoveredByQualifiedPensionPlan - appears on qbxmlops50.xml, qbxmlops70.xml
<IsCoveredByQualifiedPensionPlan>BOOLTYPE</IsCoveredByQualifiedPensionPlan> <!-- PRIVATE, opt, v5.0 -->
  • PayScheduleRef - appears on qbxmlops70.xml
<PayScheduleRef>                                  <!-- PRIVATE, opt, v6.0 -->
  <ListID>IDTYPE</ListID>                         <!-- PRIVATE, opt -->
  <FullName>STRTYPE</FullName>                    <!-- PRIVATE, opt, max length = 31 for QBD|QBCA|QBUK|QBAU -->
</PayScheduleRef>
  • EmployeeTaxInfo - appears on qbxmlops50.xml, qbxmlops70.xml
<EmployeeTaxInfo>                                 <!-- PRIVATE, opt, v5.0 -->
  <StateLived>STRTYPE</StateLived>                <!-- PRIVATE, opt, max length = 21 for QBD|QBCA|QBUK|QBAU -->
  <StateWorked>STRTYPE</StateWorked>              <!-- PRIVATE, opt, max length = 21 for QBD|QBCA|QBUK|QBAU -->
  <IsStandardTaxationRequired>BOOLTYPE</IsStandardTaxationRequired> <!-- PRIVATE, opt -->
  <EmployeeTax>                                   <!-- PRIVATE, opt, may rep -->
    <IsSubjectToTax>BOOLTYPE</IsSubjectToTax>     <!-- PRIVATE, opt -->
    <PayrollItemTaxRef>                           <!-- PRIVATE -->
      <ListID>IDTYPE</ListID>                     <!-- opt -->
      <FullName>STRTYPE</FullName>                <!-- opt, max length = 31 for QBD|QBCA|QBUK|QBAU -->
    </PayrollItemTaxRef>
    <TaxLawVersion>INTTYPE</TaxLawVersion>        <!-- PRIVATE, opt -->
    <TaxInfo>                                     <!-- PRIVATE, opt, may rep -->
      <TaxInfoCategory>STRTYPE</TaxInfoCategory>  <!-- PRIVATE, max length = 100 for QBD|QBCA|QBUK|QBAU -->
      <TaxInfoValue>STRTYPE</TaxInfoValue>        <!-- PRIVATE -->
    </TaxInfo>
  </EmployeeTax>
</EmployeeTaxInfo>
  • EmployeeDirectDepositAccount - appears on qbxmlops50.xml, qbxmlops70.xml
<EmployeeDirectDepositAccount>                    <!-- PRIVATE, opt, may rep, v5.0 -->
  <!-- BEGIN OR: You may optionally have Amount OR RatePercent -->
  <Amount>AMTTYPE</Amount>                        <!-- PRIVATE -->
  <!-- OR -->
  <RatePercent>PERCENTTYPE</RatePercent>          <!-- PRIVATE -->
  <!-- END OR -->
  <BankName>STRTYPE</BankName>                    <!-- PRIVATE, max length = 31 for QBD|QBCA|QBUK|QBAU -->
  <RoutingNumber>STRTYPE</RoutingNumber>          <!-- PRIVATE, max length = 9 for QBD|QBCA|QBUK|QBAU -->
  <AccountNumber>STRTYPE</AccountNumber>          <!-- PRIVATE, max length = 25 for QBD|QBCA|QBUK|QBAU -->
  <!-- BankAccountType may have one of the following values: Checking, Savings -->
  <BankAccountType>ENUMTYPE</BankAccountType>     <!-- PRIVATE -->
</EmployeeDirectDepositAccount>

QuickBooks Sync does not work with .NET 7

I built the sample application to connect with Quick books.
i am getting "Authentication failed" back from the webConnector when it tries to connect with the application.

here's the logs from the WebConnector

20221114.18:53:19 UTC : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session locked *********************
20221114.18:53:19 UTC : QBWebConnector.SOAPWebService.instantiateWebService() : Initiated connection to the following application.
20221114.18:53:19 UTC : QBWebConnector.SOAPWebService.instantiateWebService() : AppName: My App
20221114.18:53:19 UTC : QBWebConnector.SOAPWebService.instantiateWebService() : AppUniqueName (if available): My App
20221114.18:53:19 UTC : QBWebConnector.SOAPWebService.instantiateWebService() : AppURL: http://localhost:64642/QBConnectorAsync.asmx
20221114.18:53:19 UTC : QBWebConnector.SOAPWebService.do_serverVersion() : *** Calling serverVersion().
20221114.18:53:19 UTC : QBWebConnector.SOAPWebService.do_serverVersion() : Received from serverVersion() following parameter:<serverVersionRet="3.0.2.0">
20221114.18:53:19 UTC : QBWebConnector.SOAPWebService.do_clientVersion() : *** Calling clientVersion() with following parameter:<productVersion="2.3.0.215">
20221114.18:53:19 UTC : QBWebConnector.SOAPWebService.do_clientVersion() : Received from clientVersion() following parameter:<clientVersionRet="">
20221114.18:53:19 UTC : QBWebConnector.SOAPWebService.do_clientVersion() : This application agrees with the current version of QBWebConnector. Allowing update operation.
20221114.18:53:19 UTC : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'My App', username = 'username'
20221114.18:53:19 UTC : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="username"><password=
20221114.18:53:19 UTC : QBWebConnector.SOAPWebService.do_authenticate() : QBWC1012: Authentication failed due to following error message.
Object reference not set to an instance of an object.
More info:
StackTrace = at QBWebConnector.WebService.do_authenticate(String& ticket, String& companyFileName)
Source = QBWebConnector
20221114.18:53:20 UTC : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to False
20221114.18:53:20 UTC : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session unlocked *********************
20221114.18:53:20 UTC : QBWebConnector.WebServiceManager.DoUpdate() : Update completed with errors. See log (QWClog.txt) for details.
20221114.18:53:20 UTC : UpdateThisScheduledApp() : QBWC1031: Update completed with some error. Application has been notified of the error accordingly. See QWCLog for further information.

Assocating exceptions with tickets

Just filing an issue for a future issue I will address in a PR.

Currently, when an exception occurs in SendRequestXML or ReceiveRequestXML, exceptions are caught and forwarded to an overridable method, but neglect to pass in the ticket if one was found or not. This makes it difficult to track errors by tickets when Web Connector comes knocking for the last error by ticket. I propose there should be a way to catch exceptions after the ticket is retrieved, then pass that ticket to the exception handling.

Solution 1

try
{
    var authenticatedTicket = authenticator.GetAuthenticationFromTicket(ticket);

    try
    {
        ...
    }
    catch (Exception ex)
    {
        OnException(authenticatedTicket, ex);
    }
}
catch (Exception ex)
{
    OnException(null, ex);
}

Soltution 2

public class QbSyncException : Exception
{
    public QbSyncException(AuthenticatedTicket ticket, Exception innerException)
        : base(null, innerException)
    {
        this.Ticket = ticket;
    }

    public AuthenticatedTicket Ticket { get; private set; }
}

try
{
    var authenticatedTicket = authenticator.GetAuthenticationFromTicket(ticket);

    try
    {
        ...
    }
    catch (Exception ex)
    {
        throw new QbSyncException(authenticatedTicket, ex);
    }
}
catch (QbSyncException ex)
{
    OnException(ex.Ticket, ex);
}
catch (Exception ex)
{
    OnException(null, ex);
}

StepQueryResponseBase should not constrain to new()

I've hit a small wall in my implementation. I now have a step that can return 1 of 2 request types, based on runtime results. But given the generic arguments of StepQueryResponseBase, I can only provide one type to be serialized for the request and one type to be deserialized for the response, and those types must be a class and must have a parameterless constructor.

I believe we can resolve this by not constraining to new() on StepQueryResponseBase. This way, the generic type can simply be a contract. I would then be able to, for example, make a wrapper class that implements both QbRequest and QbResponse, and then run logic based on the type of the returned response. Or I could just return a QbRequest when creating the request, and the serializer will still serialize properly. The onus would then be on the imeplementer to cast the returned response appropriately.

Then we could also make StepQueryResponseBase.CreateRequest either abstract to allow the implementer to return whatever is required for that call, or keep it virtual and try to invoke a parameterless constructor via reflection to get an instance of T (then maybe wrap/throw if an exception is thrown).

protected virtual T CreateRequest(AuthenticatedTicket authenticatedTicket)
{
    System.Type tType = typeof(T);

    ConstructorInfo ctor = tType.GetConstructor(System.Type.EmptyTypes);
    if (ctor == null)
        throw new MissingMethodException(tType.Name, tType.Name);

    return (T)ctor.Invoke(null);
}

The only hangup I see with the reflection approach (opposed to the abstract approach) is that I don't believe we are using reflection anywhere else in the project, and reflection can require higher permissions if the assembly is loaded with restricted permissions in a locked down environment (like a GoDaddy shared host or something).

XmlCodeExporter Missing

Hi,

I am using .NET Core 6 and I upgraded from .NET Standard 2.0.

I am in this file:

\quickbooks-sync\src\XsdGenerator\Program.cs

I built the solution. I get a build error here:

Line 51

        var codeExporter = new XmlCodeExporter(codeNamespace, compileUnit, CodeGenerationOptions.GenerateProperties | CodeGenerationOptions.GenerateOrder);

It appears this code is unavailable in .NET Core. Is there a workaround?

Parsing amounts incorrectly from string to decimal

When the WebConnector's host OS is setup with a different culture (having a different decimal symbol) than the server running the QBSync.QbXml library, the values parsed in QbSync.QbXml.Objects.FLOATYPE from string to decimal are being parsed wrong. This is the case when QBSync.Qxml is running on en-US, where the decimal symbol is point (".") and the WebConnector is running on fr-CA, where the decimal symbol is comma (","). eg, an amount sent in the original QbXml by the WebConnector as "20,00", will be parsed to "2000.00".

Looking at the code, we can see that the private method Parse in QbSync.QbXml.Objects.FLOATYPE implementation, used to parse the values from string to decimal is using the Decimal.TryParse overload that receives only the string as parameter. This overload will use the current thread culture (in the case of a web app).

       private static decimal Parse(string value)
        {
            if (decimal.TryParse(value, out decimal output))
            {
                return output;
            }

            return 0m;
        }

This issue could be solved using the Decimal.TryParse overload that receives also the number style and the culture as parameter. It means that the culture should be sent a) as parameter on every call to deserialize a FLOATYPE, or b) sent as parameter in the FLOATYPE constructor and use it in the Parse method.

This is a little example to illustrate the problem and the solution:
https://dotnetfiddle.net/V20rXq

This issue is probably also impacting the parsing from decimal to string, however, after some tests I've made with the WebConnector, looks like it is able to manage properly both decimal symbols regardless the host culture.

In my opinion, it is important that the culture will be set explicitly for each usage of the serialization logic, or at the app initialization (or both), to highlight the fact that the culture used to serialize/deserialze the QbXmls actually matters, and may impact the values of some properties.

[Questions] Can we call a step from an api endpoint

Hey! Just wondering if there is a way to call a step without waiting for the web connector to make the request. I'd like to be able to call an endpoint /sync and start the sync process.

I'm assuming I'd have to build up the manager inside of the endpoint, but not sure.

Upgrade to QbSync 2.3.0 causes MissingMethodException

Setup

Visual Studio Version: 16.8.5
Project .NET Version: 5.0.3
QbSync.QbXml Version 2.3.0
QbSync.WebConnector.AspNetCore: 2.0.2

Issue
When using QbSync.QbXml version 2.2.0, all steps complete without issue. However, when upgrading to version 2.3.0 (using NuGet package manager), the following error is observed on the first step. Please note the followoing:

  • Authentication works flawlessly and we are getting to the first step.
  • This first step is a simple AccountQuery type.
  • The returned XML observed in the debugger looks fine, aka, Quickbooks is returning the proper response.
  • The only way I could seem to get insight into this issue was wrapping the base.ReceiveXMLAsync call in a try/catch.

image

Request Code

public class Request : StepQueryRequestBase<AccountQueryRqType>
        {
            public override string Name => StepName;
            ///This only exists to ensure we are sending good XML during testing of the 2.3.0 issue
            public override async Task<string> SendXMLAsync(IAuthenticatedTicket authenticatedTicket)
            {
                var results = await base.SendXMLAsync(authenticatedTicket);
                return results;
            }

            protected override Task<bool> ExecuteRequestAsync(IAuthenticatedTicket ticket, AccountQueryRqType request)
            {
                request.ActiveStatus = ActiveStatus.All;
                request.metaData = AccountQueryRqTypeMetaData.NoMetaData;
                request.IncludeRetElement = new []
                {
                    nameof(AccountRet.ListID),
                    nameof(AccountRet.EditSequence),
                    nameof(AccountRet.Name),
                    nameof(AccountRet.FullName),
                    nameof(AccountRet.AccountType),
                    nameof(AccountRet.SpecialAccountType),
                    nameof(AccountRet.AccountNumber)
                };
                return base.ExecuteRequestAsync(ticket, request);
            }
        }

The response class' ExecuteResponseAsync is never called in this scenario.

I don't mind keeping our solution at version 2.2.0, but if I am implementing something incorrectly, I want to ensure I am not version locked here going forward.

Thanks for an awesome project

SONumber

Hello, thanks for the awesome package. I'm trying to send the SONumber from our system, and I only see the SONumber field in the remarks of the object.cs file. It will not let me set the SOnumber in the QbSync.QbXml.Objects.InvoiceAdd method. The property is not available here, so is there another way to send this to QB. Do we need to upgrade to version 16?

Thank you!!

InvoiceAdd order wrong

In the latest version the order of InvoiceAdd has changed (that's the only entity I verified, there might be others):

v0.2:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
	<QBXMLMsgsRq onError="continueOnError">
		<InvoiceAddRq>
			<InvoiceAdd>
				<InvoiceLineAdd>
					<Desc>TEST</Desc>
				</InvoiceLineAdd>
				<CustomerRef>
					<ListID>80000003-1547478958</ListID>
					<FullName>Arnett-Wessin Energy Services</FullName>
				</CustomerRef>
				<TemplateRef>
					<ListID>80000002-1547157537</ListID>
					<FullName>Intuit Professional Invoice</FullName>
				</TemplateRef>
				<TxnDate>2019-03-20</TxnDate>
				<RefNumber>3</RefNumber>
				<BillAddress />
				<TermsRef>
					<ListID>80000001-1547157549</ListID>
					<FullName>1% 10 Net 30</FullName>
				</TermsRef>
				<ShipDate>2019-03-20</ShipDate>
				<CustomerSalesTaxCodeRef>
					<ListID>80000001-1547157549</ListID>
					<FullName>G</FullName>
				</CustomerSalesTaxCodeRef>
			</InvoiceAdd>
		</InvoiceAddRq>
	</QBXMLMsgsRq>
</QBXML>

v0.11:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
	<QBXMLMsgsRq onError="continueOnError">
		<InvoiceAddRq>
			<InvoiceAdd>
				<CustomerRef>
					<ListID>80000003-1547478958</ListID>
					<FullName>Arnett-Wessin Energy Services</FullName>
				</CustomerRef>
				<TemplateRef>
					<ListID>80000002-1547157537</ListID>
					<FullName>Intuit Professional Invoice</FullName>
				</TemplateRef>
				<TxnDate>2019-03-20</TxnDate>
				<RefNumber>3</RefNumber>
				<BillAddress />
				<TermsRef>
					<ListID>80000001-1547157549</ListID>
					<FullName>1% 10 Net 30</FullName>
				</TermsRef>
				<ShipDate>2019-03-20</ShipDate>
				<CustomerSalesTaxCodeRef>
					<ListID>80000001-1547157549</ListID>
					<FullName>G</FullName>
				</CustomerSalesTaxCodeRef>
				<InvoiceLineAdd>
					<Desc>TEST</Desc>
				</InvoiceLineAdd>
			</InvoiceAdd>
		</InvoiceAddRq>
	</QBXMLMsgsRq>
</QBXML>

The former will error out in the QB validator saying that the order is wrong.

SoapCore 0.9.9 is not compatible with .NET core 3.1

DigDes/SoapCore#373

TypeLoadException: Could not load type 'Microsoft.AspNetCore.Http.Internal.BufferingHelper' from assembly 'Microsoft.AspNetCore.Http, Version=3.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

Need to update SoapCore.
But they way they do not support .NET Core 2.2.

Upgrading to 1.0.0 should work.

Payment receipt template returns `true` for template type

I was using a sample company today and noticed that all the templates of type Payment Receipt return a TemplateType of true.

Very strange behaviour, but breaks XML deserialization because it's expecting an enum.

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
	<QBXMLMsgsRq onError="continueOnError">
		<TemplateQueryRq requestID="10a28a0a-526d-4dac-9282-5e87db89cbb7" />
	</QBXMLMsgsRq>
</QBXML>
<QBXML>
	<QBXMLMsgsRs>
		<TemplateQueryRs requestID="10a28a0a-526d-4dac-9282-5e87db89cbb7"
               			statusCode="0"
               			statusSeverity="Info"
               			statusMessage="Status OK">
			<TemplateRet>
				<ListID>A0000-1193777333</ListID>
				<TimeCreated>2007-10-30T14:48:53-07:00</TimeCreated>
				<TimeModified>2008-01-01T15:40:55-07:00</TimeModified>
				<EditSequence>1199227255</EditSequence>
				<Name>Work Order</Name>
				<IsActive>true</IsActive>
				<TemplateType>SalesOrder</TemplateType>
			</TemplateRet>
			<TemplateRet>
				<ListID>80000028-1924956754</ListID>
				<TimeCreated>2030-12-31T07:12:34-07:00</TimeCreated>
				<TimeModified>2030-12-31T07:12:34-07:00</TimeModified>
				<EditSequence>1924956754</EditSequence>
				<Name>Intuit Standard Payment Receipt</Name>
				<IsActive>true</IsActive>
				<TemplateType>true</TemplateType>
			</TemplateRet>
			<TemplateRet>
				<ListID>8000002A-1988119998</ListID>
				<TimeCreated>2032-12-31T08:33:18-07:00</TimeCreated>
				<TimeModified>2032-12-31T08:33:18-07:00</TimeModified>
				<EditSequence>1988119998</EditSequence>
				<Name>New Payment Receipt Template</Name>
				<IsActive>true</IsActive>
				<TemplateType>true</TemplateType>
			</TemplateRet>
		</TemplateQueryRs>
	</QBXMLMsgsRs>
</QBXML>

This seems a new type of template introduced in QB 2021 (https://www.intuitiveaccountant.com/accounting-tech/general-ledger/quickbooks-desktop-2021-customize-payment-receipts/).

I'm not sure if this something we should fix in the parser, or address with Intuit, but doing the latter will 99% result in a, works as intended, or we don't really care response.

"Interactive mode" support?

Can you support "Interactive mode" in the QbManager?
This means the QbManager class need implement many methods such as “getInteractiveURL”, “interactiveDone”, “interactiveRejected”,...

InvoiceAdd.InvoiceLineAdd items being reordered

Some items are getting reordered by InvoiceAdd.InvoiceLineAdd. Unable to see why this is happening

image

image

80000007-1554843372 QB Desktop Test 8000001E-1555443730 A/R 2019-05-10 0008 Owner Invoice ID 0008: momo 1 {a66c95ac-fac9-43fa-822e-3219204a45c3} 800000F4-1555593041 01-0050 · Plans and Specs 0.03 3.00 80000002-1553892706 800000D2-1555593040 06-1000 · Rough Carpentry 0.03 3.69 80000002-1553892706

Tracking iterator progress

Currently, example contains the following code:

var lastFromModifiedDate = response.CustomerRet.OrderBy(m => m.TimeModified).Select(m => m.TimeModified).LastOrDefault();
await dbContext.SaveIfNewerAsync(LAST_MODIFIED_CUSTOMER, lastFromModifiedDate);

I've noticed that entities received in response are not sorted and in case sync is interrupted next sync can skip some records.

Example. The first batch has lastFromModifiedDate = 01.01.2020, the second batch lastFromModifiedDate = 01.01.2019, third batch lastFromModifiedDate = 21.05.2020. So LAST_MODIFIED_CUSTOMER is now 21.05.2020, but there are few more batches pending (i.e. from 2018). If system crashes or connection drops - next sync will set request.FromModifiedDate = 21.05.2020... and miss all remaining items.

Is there any way to track sync in a safe manner?

Upgrade from old version

Hello I am upgrading an old project from version 0.0.3 to latest and it appears several of the references/class names have changed. Do you have a migration/changelog that can help with the migration? Thanks

Error always logged on sync complete

We get a an error logged each sync with the message

[QBError] Out - {KEY} Sync Completed

trying to find out if there actually an error occuring that we need to fix, or if this should be an informational message instead of an error.

Check ExecuteRequest before CreateRequest

I wonder if it would make more sense to check ExecuteRequest before CreateRequest is called. This way, we can confirm that a request should even bother being made before a request object is formed.

For example: create a CustomerAdd step, call ExecuteRequest first to check if any customers need to be added (via querying the database or something); if so, return true. If true, then call CreateRequest to create the request. If the result is not null (it really shouldn't be since ExecuteRequest is true), then call qbXmlRequest.GetRequest. This essentially just reverses the order of CreateRequest and ExecuteRequest, but you gain the ability to check before forming the request for the Web Connector.

Authenticator Null Reference

Hi,

I am in QbManager > AuthenticateAsync.

I receive a null reference here on line 82:

quickbooks-sync\test\WebApplication.Sample\Application\Authenticator.cs

How is your code getting the current step? I just passed the

image

.NET naming conventions

Some simple changes that I have noticed so far that I would change to follow the .NET conventions. Feel free to disregard and close the issue if you disagree. 😄

Interfaces like QbRequest, QbIteratorRequest, QbResponse, and QbIteratorResponse should begin with a capital I. (Were these autogenerated?)

This is a matter of opinion: I feel that StepQueryResponseBase<T, Y>.GetName() should be an abstract property if its only purpose is to return a string with a name. I think making it a property will convey the idea that it should be simple and nothing complicated.

QuickBooks does not handle UTC time properly, so we should have a way to handle timezone for the developer

A request as such:
2016-05-17T20:00:00
Actually means that it checks for 20:00 LOCAL time on QuickBooks machine.

If we are in PST. For 20:00 local time, it's actually 3:00am (next day)

Now, if we set
request.FromModifiedDate = new DateTime(long.Parse(lastSync), DateTimeKind.Utc); // 3:00am UTC

This will actually end up requesting a real UTC time. Then QuickBooks will actually think you are requesting a 3:00am local time.

Then I have to end up doing this:
request.FromModifiedDate = new DateTime(long.Parse(lastSync), DateTimeKind.Utc).ToLocalTime(); // Which would be the client timezone

or

request.FromModifiedDate = Instant.FromDateTimeUtc(new DateTime(long.Parse(lastSync), DateTimeKind.Utc)).InZone(localTimeZone).ToDateTimeUnspecified();

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.