Redirection after move commences, supplier not at fault - ministryofjustice/hmpps-book-secure-move-api GitHub Wiki
Move composed of a redirection plus a cancelled billable journey and a completed billable journey
Where redirection events occur under no fault of the supplier, suppliers are entitled payment for the initial journey commenced (A to B) before the redirection event and payment for the actual journey completed (A to C). The initial journey (A to B) should be marked as billable (when suppliers are not at fault) for the system to recognise payment is required for the journey.
- Move from
AtoB, redirected toCafter the move starts where the supplier is not at fault - Journey from
AtoB(billable,proposed -> in_transit -> cancelled), created before the move was redirected - Journey from
AtoC(billable,proposed -> in_transit -> completed), created after the move was redirected
-
Create a billable journey from
AtoBfor 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":"BBBBBBBB-8ded-435c-b0c1-ffcade5f1bef" } } } } }' -
Start the original journey, changing its state from
proposedtoin_transitcurl --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" } } } } }' -
Cancel the original journey, changing its state from
in_transittocancelled(NB: although cancelled it is still billable)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:18:44.088Z", "recorded_at":"2021-05-07T11:18:44.088Z", "notes":"example note: lorem ipsum dolor sit amet", "details":{ }, "event_type":"JourneyCancel" }, "relationships":{ "eventable":{ "data":{ "type":"journeys", "id":"e73f6005-afec-41e2-bcaa-a9747b5af8e3" } } } } }' -
Create a new billable journey from
AtoCfor 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:38: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" } } } } }' -
Start the new journey, changing its state from
proposedtoin_transitcurl --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:43:44.088Z", "recorded_at":"2021-05-07T11:43:44.088Z", "notes":"example note: lorem ipsum dolor sit amet", "details":{ }, "event_type":"JourneyStart" }, "relationships":{ "eventable":{ "data":{ "type":"journeys", "id":"1a013dda-4142-487d-8e0c-9161fbdf65cc" } } } } }' -
Complete the new journey, changing its state from
in_progresstocompletedcurl --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:49:34.624Z", "recorded_at":"2021-05-07T11:49:34.624Z", "notes":"example note: lorem ipsum dolor sit amet", "details":{ }, "event_type":"JourneyComplete" }, "relationships":{ "eventable":{ "data":{ "type":"journeys", "id":"1a013dda-4142-487d-8e0c-9161fbdf65cc" } } } } }'