Skip to content

Redirection before move commences, journey created after redirection

Martyn Whitwell edited this page May 7, 2021 · 1 revision

Move composed of a redirection and a single billable journey

Any changes made to the destination by the Authority before the move has been started will not be considered as a redirection for payment, and will be treated as a standard move.

  • Move from A to B, redirected to C before the move starts
  • Journey from A to C (billable, proposed -> in_transit -> completed), assuming the journey is created after the move was redirected
  1. Create a billable journey from A to C for the move (in a proposed state)

    curl --request POST \
      --url /api/moves/{MOVE_ID}/journeys \
      --header 'Authorization: Bearer {OAUTH_TOKEN}' \
      --header 'Content-Type: application/json' \
      --header 'Idempotency-Key: {RANDOM_UUID}' \
      --data '{
      "data":{
        "type":"journeys",
        "attributes":{
          "timestamp":"2021-05-07T11:08:39.276Z",
          "billable":true,
          "vehicle":{
            "id":"12345678ABC",
            "registration":"AB12 CDE"
          }
        },
        "relationships":{
          "from_location":{
            "data":{
              "type":"locations",
              "id":"AAAAAAAA-413b-48c8-b1cf-85c702c5f465"
            }
          },
          "to_location":{
            "data":{
              "type":"locations",
              "id":"CCCCCCCC-8ded-435c-b0c1-ffcade5f1bef"
            }
          }
        }
      }
    }'
  2. Start the journey, changing its state from proposed to in_progress

    curl --request POST \
      --url /api/events \
      --header 'Authorization: Bearer {OAUTH_TOKEN}' \
      --header 'Content-Type: application/json' \
      --header 'Idempotency-Key: {RANDOM_UUID}' \
      --data '{
      "data":{
        "type":"events",
        "attributes":{
          "occurred_at":"2021-05-07T11:13:44.088Z",
          "recorded_at":"2021-05-07T11:13:44.088Z",
          "notes":"example note: lorem ipsum dolor sit amet",
          "details":{
        
          },
          "event_type":"JourneyStart"
        },
        "relationships":{
          "eventable":{
            "data":{
              "type":"journeys",
              "id":"e73f6005-afec-41e2-bcaa-a9747b5af8e3"
            }
          }
        }
      }
    }'
  3. Complete the journey, changing its state from in_progress to completed

    curl --request POST \
      --url /api/events \
      --header 'Authorization: Bearer {OAUTH_TOKEN}' \
      --header 'Content-Type: application/json' \
      --header 'Idempotency-Key: {RANDOM_UUID}' \
      --data '{
      "data":{
        "type":"events",
        "attributes":{
          "occurred_at":"2021-05-07T11:19:34.624Z",
          "recorded_at":"2021-05-07T11:19:34.624Z",
          "notes":"example note: lorem ipsum dolor sit amet",
          "details":{
        
          },
          "event_type":"JourneyComplete"
        },
        "relationships":{
          "eventable":{
            "data":{
              "type":"journeys",
              "id":"e73f6005-afec-41e2-bcaa-a9747b5af8e3"
            }
          }
        }
      }
    }'
Clone this wiki locally