Skip to content

Redirection after move commences, supplier at fault

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

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 A to B, redirected to C after the move starts where the supplier is not at fault
  • Journey from A to B (non-billable, proposed -> in_transit -> cancelled), created before the move was redirected
  • Journey from A to C (billable, proposed -> in_transit -> completed), created after the move was redirected
  1. Create a billable journey from A to B 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":"BBBBBBBB-8ded-435c-b0c1-ffcade5f1bef"
            }
          }
        }
      }
    }'
  2. Start the original journey, changing its state from proposed to in_transit

    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. Cancel the original journey, changing its state from in_transit to cancelled

    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"
            }
          }
        }
      }
    }'
  4. Update the original journey changing its billable flag from true to false

    curl --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
        }
      }
    }'
  5. Create a new 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: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"
            }
          }
        }
      }
    }'
  6. Start the new journey, changing its state from proposed to in_transit

    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: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"
            }
          }
        }
      }
    }'
  7. Complete the new 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: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"
            }
          }
        }
      }
    }'
Clone this wiki locally