Skip to content

Call to Invoices returns four null invoices - may be related to new invoicing released by Xero #923

@gurubobnz

Description

@gurubobnz

We noticed that we were getting some null object Invoices coming back from the Xero API, specifically:

$xero = Load::lib('xero')->getApplication();
$invoices = $xero->load(Invoice::class)
	->where('Type', 'ACCREC')
	->page(1)
	->execute();
dd($invoices);

(don't mind the method used to load the Xero library, that is from our platform)

This returns not 100 results (the number expected on a single page), but 104. The extra four appear to be invoice objects with null properties. We started seeing this on one of our tenants as of 17/07/2024 at approx 11:54am NZST. We confirmed that it is happening on another four tenants also, with differing versions of this library.

At a glance the Xero API explorer appears to not be reporting the same, but I am confirming this.

Here is the dump that we get from the above code:

XeroPHP\Remote\Collection {#139
  #_associated_objects: null
  storage: array:104 [
    0 => XeroPHP\Models\Accounting\Invoice {#136
      #_data: array:32 [
        "Type" => null
        "Contact" => null
        "LineItems" => null
        "Date" => null
        "DueDate" => null
        "LineAmountTypes" => null
        "InvoiceNumber" => null
        "Reference" => null
        "BrandingThemeID" => null
        "Url" => null
        "CurrencyCode" => null
        "CurrencyRate" => null
        "Status" => null
        "SentToContact" => null
        "ExpectedPaymentDate" => null
        "PlannedPaymentDate" => null
        "SubTotal" => null
        "TotalTax" => null
        "Total" => null
        "TotalDiscount" => null
        "InvoiceID" => null
        "RepeatingInvoiceID" => null
        "HasAttachments" => null
        "Payments" => null
        "Prepayments" => null
        "Overpayments" => null
        "AmountDue" => null
        "AmountPaid" => null
        "FullyPaidOnDate" => null
        "AmountCredited" => null
        "UpdatedDateUTC" => null
        "CreditNotes" => null
      ]
      #_dirty: []
      #_associated_objects: []
      #_application: XeroPHP\Application {#108
        #config: array:1 [ …1]
        -transport: GuzzleHttp\Client {#119 …1}
      }
    }
    1 => XeroPHP\Models\Accounting\Invoice {#127
      #_data: array:32 [
        "Type" => null
        "Contact" => null
        "LineItems" => null
        "Date" => null
        "DueDate" => null

and so on, for the first four records, then we get normal invoices.

The timing is in line with Xero announcing their new invoicing functionality, but there is no mention of any API changes.

References:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions