[#634] book() clientTimeOffset Inconsistency

Migrated from Redmine #634 | Author: Tony DLT
Status: New | Priority: High, I’m very impatient | Created: 2021-01-06


Hi, I’ve noticed that when passing a negative clientTimeOffset to the book() endpoint from the company public service API, it does not get formatted into seconds. The API treats it like minutes. This is unlike a positive offset, where it gets transformed into seconds (correct as per the documentation).

Request with a negative offset:

{
  "jsonrpc":"2.0",
  "method":"book",
  "params":[
    "5",
    "1",
    "13",
    "2021-01-07",
    "09:00:00",
    "2021-01-07",
    "10:00:00",
    "-7200"
  ],
  "id":3
}

Response with negative offset:

{
  require_confirm: false,
  bookings: [
    {
      id: '8',
      event_id: '5',
      unit_id: '1',
      client_id: '13',
      client_hash: '745b82d990c7dfb7c5892bedd7996dc3',
      start_date_time: '2021-01-07 09:00:00',
      end_date_time: '2021-01-07 10:00:00',
      time_offset: '-7200',
      is_confirmed: '1',
      require_payment: false,
      code: '1hgm79m0',
      hash: 'fbc2b7d091e6877596d3fb73744c17ec'
    }
  ],
  invoice: null
}

Request with positive offset:

{
  "jsonrpc":"2.0",
  "method":"book",
  "params":[
    "5",
    "1",
    "14",
    "2021-01-07",
    "09:00:00",
    "2021-01-07",
    "10:00:00",
    "7200"
  ],
  "id":3
}

Response with positive offset:

{
  require_confirm: false,
  bookings: [
    {
      id: '9',
      event_id: '5',
      unit_id: '1',
      client_id: '14',
      client_hash: '8c27a89f706523eb34a78b9a0b9acfdc',
      start_date_time: '2021-01-07 09:00:00',
      end_date_time: '2021-01-07 10:00:00',
      time_offset: '120',
      is_confirmed: '1',
      require_payment: false,
      code: '1hgm8qrj',
      hash: '939dfa649e2b3e9e32df37517f28bff7'
    }
  ],
  invoice: null
}

This results in the client getting an email notification that their appointment is booked for 5 days (7200 minutes) ago, as opposed to 2 hours (7200 seconds) ago.