Sale completion Date/Time can't be set to a future date.

darryl_ssdarryl_ss Member Posts: 65
edited July 8 in Development

Hi,

Could you please help with this error?

Error: Sale completion Date/Time can't be set to a future date.

data: {
    employeeID: '3',
    registerID: 1,
    shopID: 1,
    completed: true,
    completeTime: '2020-07-08T12:17:28.537',
    referenceNumber: '36908',
    referenceNumberSource: 'Opsuite',
    SaleLines: { SaleLine: [Array] },
    SalePayments: { SalePayment: [Object] }
  }

completeTime is not in the future?

I'm assuming that completeTime should also be the date and time that displays in the transaction when logged into Lightspeed but that doesn't appear to be the case, should I be posting the date/time to a different field?

Post edited by darryl_ss on
Tags:

11 comments

  • gregaricangregarican Member Posts: 511 
    edited July 8

    While I'm sure UTC can come into play, if you are posting a new transaction via the API, I don't know of many API endpoints that will take a transaction date that's in the future. Perhaps an estimated completion date for a task or job, but for a transactional commit date/time that's pretty much unheard of?

    It says right in the API documentation that this field cannot be set to the future...



  • darryl_ssdarryl_ss Member Posts: 65
    edited July 8

    That's my point it's not set in the future??

    UTC = GMT +1

    I can't see anything in the docs about a time offset?

  • darryl_ssdarryl_ss Member Posts: 65

    @Lightspeed Can you please advise on my date issue above. I assume you are using UTC?

    Why would the API reject the above data when it was not set in the future please?

  • gregaricangregarican Member Posts: 511 

    @darryl_ss , you posted above that "UTC = GMT +1" although I don't think that's correct. While GMT is technically a time zone, both UTC and GMT share the same literal time. So 12:15:15 UTC is equivalent to 12:15:15 GMT.

    Did you try for a test to set complete_time to something that's, say, 10 hours prior to the current time where you are implementing things from?

  • darryl_ssdarryl_ss Member Posts: 65
    edited July 9

    @gregarican @Lightspeed

    Yes, UTC = GMT, but currently we are in BST, so GMT = UTC + 1 or vice versa.


    This has absolutely no bearing on my issue though, semantics.


    The data is pulled 07:00 till 20:00 GMT, trading hours are 09:00 til 17:30 GMT.


    The transaction was at 12:17 GMT on the 08/07/20, attempts to post a few minutes before 20:00 GMT on the 08/07/20 and the error reported is Error: Sale completion Date/Time can't be set to a future date.


    I need to understand what is happening here as ironically time is running short 😉.

  • darryl_ssdarryl_ss Member Posts: 65

    @LucienVersendaal,

    Are you able to offer any advice on this one please?

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 351 moderator
    edited July 10

    @darryl_ss,

    Can you see what time zone your retail account is in by doing a call to the GET /Shop endpoint

    Or can you give me you accountID, so I can check?

    Another question for you, why are you using this field? When you don't use this field it will automatically pick the current dateTime in your shops time zone. It is possible to create a Sale with that completeTime field. For example this is my payload:

    {
      "employeeID": 2,
      "registerID": 3,
      "shopID": 2,
      "completed": true,
      "customerID" : 5,
      "SaleLines": {
        "SaleLine": [
        {
          "itemID": 135,
          "unitQuantity" : 1,
          "tax": true,
          "unitPrice": 50,
          "taxClassID": 1
        },
          {
          "itemID": 78,
          "unitQuantity" : 2,
          "tax": true,
          "unitPrice": 20,
          "taxClassID": 1
        }
       ]
      },
      "SalePayments": {
        "SalePayment": {
            "amount": 90,
            "paymentTypeID": 1
      }
      }, 
      "ShipTo":{
                "shipToID": "10"
      }
    }
    

    This will create a sale.

  • darryl_ssdarryl_ss Member Posts: 65

    Hi @LucienVersendaal ,

    Time zone is Europe/London

    {
      "@attributes": {
        "count": "1",
        "offset": "0",
        "limit": "100"
      },
      "Shop": {
        "shopID": "1",
        "name": "Shooting Supplies Ltd",
        "serviceRate": "0",
        "timeZone": "Europe\/London",
        "taxLabor": "false",
        "labelTitle": "Shop Name",
        "labelMsrp": "false",
        "archived": "false",
        "timeStamp": "2020-03-23T07:01:04+00:00",
        "companyRegistrationNumber": "",
        "vatNumber": "",
        "zebraBrowserPrint": "true",
        "contactID": "2",
        "taxCategoryID": "1",
        "receiptSetupID": "1",
        "ccGatewayID": "0",
        "gatewayConfigID": "",
        "priceLevelID": "1"
      }
    }
    

    I'm updating sales in the evening not on a transaction by transaction basis, I want the time and date of sale in Lightspeed to reflect that of the origin system.

  • darryl_ssdarryl_ss Member Posts: 65

    @LucienVersendaal ,

    The timezone is reported as Europe/London

    {
      "@attributes": {
        "count": "1",
        "offset": "0",
        "limit": "100"
      },
      "Shop": {
        "shopID": "1",
        "name": "Shooting Supplies Ltd",
        "serviceRate": "0",
        "timeZone": "Europe\/London",
        "taxLabor": "false",
        "labelTitle": "Shop Name",
        "labelMsrp": "false",
        "archived": "false",
        "timeStamp": "2020-03-23T07:01:04+00:00",
        "companyRegistrationNumber": "",
        "vatNumber": "",
        "zebraBrowserPrint": "true",
        "contactID": "2",
        "taxCategoryID": "1",
        "receiptSetupID": "1",
        "ccGatewayID": "0",
        "gatewayConfigID": "",
        "priceLevelID": "1"
      }
    }
    

    I am not posting on a transaction by transaction basis.

    At the end of the day I shall upload the days transactions from the origin system, (this is a temporary measure until we switch to Lightspeed on a full time basis, not a permanent integration) .

    If I omit this field the transactions will display at the time of post(in the evening).

    We want to reflect the actual time of the transaction in Lightspeed from the origin.

  • gregaricangregarican Member Posts: 511 

    @darryl_ss , what if for a test you push a new sale record via API, and specify the completeTime as like a full day prior?

    I recall a few years ago when we were scoping out Lightspeed using a trial subscription we wanted to import in historical sales transactions. I couldn't sworn that the hard-coded behavior back then was posting a new transaction wouldn't allow the completeTime to be provided. But we could modify an existing transaction to then backdate the completeTime, once the record was already out there. I could be wrong, and this was back in 2017...

  • darryl_ssdarryl_ss Member Posts: 65

    I don't know what happened with this particular transaction, but all others are fine. An anomaly I guess.

Sign In or Register to comment.