statisicGroup data returned by dailyFinancials bug?

mhcmhc Member Posts: 4


I'm having an issue with the data returned by the dailyFinancials endpoint, e.g. for this call:

https://api.lsk.lightspeed.app/f/finance/{businessLocation}/dailyFinancials?date=2021-12-06&includeConsumers=false&include=payments

The salesLines items normally include a 'categories' field that contains the Statistic Group classifications for the item in the transaction, e.g.

"categories": [{"category": "SomeStatisticGroupName1", "value": "SomeStatisticGroupValue"}, {"category": "SomeStatisticGroupName2", "value": "SomeOtherStatisticGroupValue"}, ...]

However, occasionally, the categories field is missing and instead the data appears in a "statisticGroup" field like this:

"statisticGroup": "[{\"category\":\"SomeStatisticGroupName\",\"value\":\"SomeOtherStatisticGroupValue\"}]

I have noticed that for the transactions in question, these are sales.type VOID and are associated with a infrequently occurring deviceName, in this case "BackOffice"

Is this behaviour expected? It creates difficulty parsing the JSON

7 comments

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 991 moderator

    Hi @mhc,

    Thank you for contacting us.

    Can you provide me the businessLocationID?

  • DanFoxDanFox Member Posts: 1

    Yes, one of our locations is 667583946686466

  • mhcmhc Member Posts: 4
    edited December 2021

    Hi, on 2021-12-06 you will only find this data issue on business location id 667583946686627, e.g. salesLine id S133548.316

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 991 moderator

    Hi @mhc,

    I see, this is weird. I need to check this with our devs. When I got something back I'll let you know.

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 991 moderator

    Hi guys,

    This is what I got back from our devs.

    The categories array is returned only for transactions created on v3 and above devices. If a transaction is created in the Back Office, then my guess it's that it is not considered a "real" device and there is no version number for it, so the fallback response is to return the statisticGroup field instead.

    I hope this helps.

  • mhcmhc Member Posts: 4

    Hi Lucien,

    I appreciate that the categories array in the sales data is the item reference data as existed at the time of the transaction, but the format of item reference data shouldn't depend on the device used to get the transaction.

    Perhaps this wouldn't be such a serious problem if the Items api returned the categories array. It seems to be impossible to get the current statistic group information for an item from the API.

    Could you please create a request to fix this issue with the api?

    Best regards,

    Mike

  • Ali_MasoumieAli_Masoumie Moderator, Lightspeed Staff Posts: 345 moderator

    Hi Mike,

    I will discuss this internally and will create a report for it.

Sign In or Register to comment.