# Cancellation

Refundability policies are returned when responding to a request for UTAs that has no filter or a filter for `"cancellation"`.

```json
// Use "ticket_attributes_filter" key in request body:
{
  "control": {
   "includes": [
     "uta"                                 // response should return UTAs
   ],
    "ticket_attributes_filter": [           // optional filter specifies the UTA
                                            // categories to be returned
        "cancellation",                     // include cancellation policies in the response
        // ...
    ],
    // ...
  }
// ...
}
```

<!--- embed src="./snippets/_cancellation_policy_consolidated.md" /--->
## Policy Types

| Field                    | Description                                                                                                                                |
|--------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| anytime                  | the cancellation policy conditions apply to the period both before and after departure                                                           |
| before_departure         | the cancellation policy conditions apply only to the period before departure                                                                     |
| after_departure          | the cancellation policy conditions apply only to the period after departure                                                                      |
| anytime_no_show          | (requires the `policies_extended_fields` feature) the cancellation policy no show conditions apply to the period both before and after departure |
| before_departure_no_show | (requires the `policies_extended_fields` feature) the cancellation policy no show conditions apply only to the period before departure           |
| after_departure_no_show  | (requires the `policies_extended_fields` feature) the cancellation policy no show conditions apply only to the period after departure            |

Each of the **Policy Types** has the following attributes:

### Response

| Attributes       | Type   | Description/Value                                                                                                               |
|------------------|--------|---------------------------------------------------------------------------------------------------------------------------------|
| headline         | string | headline, up to 40 characters                                                                                                   |
| description      | string | description, up to 140 characters                                                                                               |
| assessment\_code | string | possible values: `Neutral`, `Benefit`, `Fee`, `Restriction`                                                                     |
| fee              | object | See `Fee` object table                                                                                                          |
| travel\_portion  | string | Defines at which level of the travel the policy should be applied. Possible values: `R` (round trip), `T` (ticket), `B` (blank) |
| fee\_application | object | (requires `policy_fee_application` feature) Defines at which level of the travel the policy should be applied.                  |

### Fee Application

| Attributes  | Type   | Description/Value                                                                                          |
|-------------|--------|------------------------------------------------------------------------------------------------------------|
| application | number | fee application level from Category 31 and 33, shows as `0` when data is pulled from Category 16           |
| method      | string | possible values: `N` (not applicable), `A` (Pricing Unit), `B` (higher of Fare Component and Pricing Unit) |

### `Fee` object

| Attributes     | Type   | Description/Value                                                                                                                                                                                                                                                                                               |
|----------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| amount         | number | The fee amount for this policy in the selected currency.                                                                                                                                                                                                                                                        |
| currency\_code | string | The selected currency for the request. If this is not exclusively set, then POS will be taken into consideration.                                                                                                                                                                                               |
| percentage     | number | A percent of the base fare amount used for obtaining the charge amount. This may be returned in company with the `amount` field or on its own. When returned with the amount fee, then the headline states which field to choose depending on the policy (e.g., "whichever is higher" or "whichever is lower"). |
| higher_lower   | string | Identifies when to pick `percentage` value over `amount` value or vice versa. Possible return values are: `H` - Higher; `L` - Lower; `N` - No Application.                                                                                                                                                      |

<b>NOTE:</b> The `higher_lower` field should always be read to identify which field you should pick (i.e., `amount`
or `percentage`).<br><br>
In case of:<br>
`N` - You should always pick the `amount` since `percentage` should be zero.<br>
`H` - You should compare the calculated value of the base fare amount after applying `percentage` field with `amount`
and then pick whichever value is higher.<br>
`L` - You should compare the calculated value of the base fare amount after applying `percentage` field with `amount`
and then pick whichever value is lower.
