XeroAPI / Xero-NetStandard

A wrapper of the Xero API in the .NetStandard 2.0 framework. Supports Accounting, Payroll AU/US, and Files
MIT License
118 stars 119 forks source link

Tracking Option does not save when creating/updating Quote #510

Closed liamkavfc closed 2 months ago

liamkavfc commented 3 months ago

SDK you're using (please complete the following information):

Describe the bug I am creating a quote whilst trying to include a Tracking Option on a line Item. The payload looks fine but still doesn't add the Tracking Option. The quote returned to me has empty 'Tracking' and this reflects in the Xero UI.

Quote xeroQuote = new()
{
    QuoteID = quote.XeroId ?? null,
    Contact = new()
    {
        ContactID = customer.XeroId
    },
    Reference = quote.Reference,
    CurrencyCode = "GBP",
    Date = DateTime.Now,
    ExpiryDate = quote.ExpiryDate,
    LineItems = quote.Items.Select(x => new LineItem()
    {
        LineItemID = x.XeroLineItemId ?? null,
        ItemCode = x.ItemCode,
        Description = $"Some Description",
        UnitAmount = x.UnitAmount,
        Quantity = x.Quantity,
        LineAmount = x.LineAmount,
        Tracking = new()
        {
            new()
            {
                TrackingCategoryID = x.TrackingGroupOptionParentId,
                Name = x.TrackingGroupName,
                TrackingOptionID = x.TrackingGroupOptionId,
                Option = x.TrackingGroupOptionName
            }
        }
    }).ToList(),
    LineAmountTypes = QuoteLineAmountTypes.EXCLUSIVE
};

Payload:

{
  "Quotes": [
    {
      "CurrencyCode": "GBP",
      "LineAmountTypes": "EXCLUSIVE",
      "QuoteID": "Guid?",
      "Contact": {
        "ContactID": "Guid?"
      },
      "LineItems": [
        {
          "Description": "Some Description",
          "Quantity": 1,
          "UnitAmount": 15,
          "ItemCode": "GB3-White",
          "LineAmount": 15,
          "Tracking": [
            {
              "TrackingCategoryID": "Guid?",
              "TrackingOptionID": "Guid?",
              "Name": "Category Name",
              "Option": "Option Name"
            }
          ]
        }
      ],
      "Date": "2024-04-05T10:25:07.4838546Z"
    }
  ]
}

NOTE: Sensitive data has been replaced.

Whilst I am aware the docs say to just include TrackingOptionID, I have tried every possible configuration and nothing has worked so far.

To Reproduce Steps to reproduce the behavior:

  1. Create Quote using the AccountingApi.UpdateOrCreateQuotesAsync Class and method
  2. Observe payload
  3. Notice that the response has empty tracking in line item (Also see in Xero Dashboard/UI)

Expected behavior I expect to see my selected Tracking option for the line item.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

github-actions[bot] commented 3 months ago

PETOSS-411

github-actions[bot] commented 3 months ago

Thanks for raising an issue, a ticket has been created to track your request

liamkavfc commented 2 months ago

Turns out I was using my Database Id and not the Xero Id...