Redirection after move commences, supplier at fault - ministryofjustice/hmpps-book-secure-move-api GitHub Wiki
Move composed of a redirection plus a cancelled non-billable journey and a completed billable journey
Where redirection events occur due to a fault of the supplier, suppliers are not entitled to payment for the initial journey commenced (A to B) before the redirection event. Suppliers will be paid for the actual journey completed (A to C). The initial journey (A to B) should be marked as non-billable (when suppliers are at fault).
- Move from
AtoB, redirected toCafter the move starts where the supplier is not at fault - Journey from
AtoB(non-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_transittocancelledcurl --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" } } } } }' -
Update the original journey changing its billable flag from
truetofalsecurl --request PATCH \ --url /api/moves/{MOVE_ID}/journeys/e73f6005-afec-41e2-bcaa-a9747b5af8e3 \ --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":false } } }' -
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" } } } } }'