---
# System prepended metadata

title: Project report for iteration 3

---

# Project report for iteration 3

## State machine diagram
You can click on the following image to be able to zoom in and read the small text😃(GitHub does not include target attributes so I couldn't make it open in a new tab, you will need to press CTRL before clicking the image if you want to keep this one opened):

[![](https://github.com/F2021-ECSE223/ecse223-group-project-p6/blob/main/img/state%20machine%20iteration%203.png)](https://github.com/F2021-ECSE223/ecse223-group-project-p6/blob/main/img/state%20machine%20iteration%203.png)

## Transition documentation

### Assignment Status

`Assigned`
* **confirmPayment(String code)** <br/>
<code> <i>[validCode(code)]</i> </code><br/>
-> `Paid` Switch from Assigned to Paid if the member attempts to pay and has a valid authentication code. Saves the authentication code in the assignment.<br/><br/>
<code> <i>[!validCode(code)]</i> </code><br/>
-> `Assigned`  Stay in the Assigned state if the member attempts to pay but the autenthication code is invalid. Raises the error _"Invalid authorization code"_.<br/><br/>
* **cancelTrip()** <br/>
-> `Cancelled` Switch from Assigned to Cancelled if the member attempts to cancel. <br/><br/>

* **finishTrip()** <br/>
-> `Assigned` Stay in the Assigned state if the member attempts to finish the trip. Raises the error _"Cannot finish a trip which has not started"_.<br/><br/>

* **startTrip()** <br/>
-> `Banned` Switch from Assigned to Banned if the admin attempts to start the trip, because the member has not yet paid.<br/><br/>

***

`Paid`
* **startTrip()** <br/>
-> `Started` Switch from Paid to Started if the admin attempts to start the trip.<br/><br/>
* **confirmPayment()** <br/>
-> `Paid` Stay in the Paid state if the member attempts to pay for the trip. Raise the error _"Trip has already been paid for"_ <br/><br/>
* **cancelTrip()** <br/>
-> `Cancelled` Switch from Paid state to Cancelled state and refund 50% to member.<br/><br/>
* **finishTrip()** <br/>
-> `Paid` Stay in Paid state if member trip has not finished yet.<br/><br/>

***

`Started`
* **startTrip()** <br/>
-> `Finished` Switch from Started to Finished if the admin attempts to finish a trip.<br/><br/>
-> `Started`  Stay in the Started state if the member attempts to pay but the member has already paid for the trip. Raises the error _"Trip has already been paid for"_.<br/><br/>
-> `Cancelled`  Switch from Started to Cancelled state if the member attempts to start a trip that is cancelled. Raises the error _"Cannot start a trip which has been cancelled"_.<br/><br/>

***


`Finished`
* **cancelTrip()** <br/>
-> `Finished` Stay in Finished if the member attempts to cancel. Raise the error _"Cannot cancel a trip which has finished"_. <br/><br/>
* **confirmPayment()** <br/>
-> `Finished` Stay in Finished if the member is payment is rejected because trip is finished. Raises the error _"Cannot pay for a trip which has finished"_. <br/><br/>
* **startTrip()** <br/>
-> `Finished` Stay in Finished if the member try to start trip after trip is finished. Raises the error _"Cannot start a trip which has finished"_. <br/><br/>

***

`Cancelled`
* **startTrip()** <br/>
-> `Cancelled` Stay in Cancelled if the member attempt to start the trip after member have cancelled. Raises the error _"Cannot start a trip which has been cancelled"_.<br/><br/>
* **confirmPayment()** <br/>
-> `Cancelled`Stay in Cancelled if the member payment is rejected because trip is cancelled. Raises the error _"Cannot pay for a trip which has been cancelled"_.<br/><br/>
* **finishTrip()** <br/>
-> `Cancelled` Stay in Cancelled if the member try to cancel trip after trip is finished. Raises the error _"Cannot finish a trip which has been cancelled"_. <br/><br/>

***

`Banned`
* **cancelTrip()** <br/>
-> `Banned` Stay in Banned if the member attempts to cancel. Raises the error _"Cannot cancel the trip due to a ban"_. <br/><br/>
* **confirmPayment()** <br/>
-> `Banned` Stay in Banned if the member attempts to pay for a trip. Raises the error _"Cannot pay for the trip due to a ban"_. <br/><br/>
* **startTrip()** <br/>
-> `Banned` Stay in Banned if the admin attempts to start the trip. Raises the error _"Cannot start the trip due to a ban"_. <br/><br/>
* **finishTrip()** <br/>
-> `Banned` Stay in Banned if the member attempts to cancel the trip. Raises the error _"Cannot cancel the trip due to a ban"_. <br/><br/>