Skip to content

Latest commit

 

History

History
24 lines (22 loc) · 1.3 KB

refuelShip.md

File metadata and controls

24 lines (22 loc) · 1.3 KB

Refuel Ship

Success case

  • Receive a POST request in /ships/refuel
  • Validate required fields certificationDocument, amountOfFuel
  • Get the pilot in the repository
  • Check if pilot has enough credits
  • Get the ship in the repository
  • Check if the fuelLevel plus the amountOfFuel is less than the fuelCapacity
  • Update ship in the repository with fuelLevel plus amountOfFuel
  • Update pilot in the repository with your credits - fuelPrice
  • Update the reports in the repository with the transaction log
  • Returns 200 with updated amount of fuel of pilot ship

Exceptions

  • Returns 404 error if the endpoint not exists
  • Returns 400 if certificationDocument, amountOfFuel is not provided by the client
  • Returns 400 if pilot is not found in the repository
  • Returns 400 if the pilot does not have enough credits
  • Returns 400 if ship is not found in the repository
  • Returns 400 if the fuelLevel plus the amountOfFuel is greater than the fuelCapacity
  • Returns 500 if something unexpected happens when updating ship in the repository
  • Returns 500 if something unexpected happens when updating pilot in the repository
  • Returns 500 if something unexpected happens when updating reports in the repository