Skip to content

Commit

Permalink
Merge pull request #885 from duffelhq/UXP-3345
Browse files Browse the repository at this point in the history
feat: add new NGS related types
  • Loading branch information
andrejak authored Feb 26, 2024
2 parents 83936a6 + d1ff8b3 commit 6455e1a
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 4 deletions.
106 changes: 103 additions & 3 deletions src/booking/Offers/OfferTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Airport,
PaginationMeta,
DuffelPassengerType,
OfferSliceConditions,
} from '../../types'

/**
Expand Down Expand Up @@ -403,12 +404,32 @@ export interface OfferSlice {
segments: OfferSliceSegment[]

/**
* The conditions associated with this slice, describing the kinds of modifications you can make post-booking and any penalties that will apply to those modifications.
* The conditions associated with this slice, describing the kinds of modifications you can make post-booking and any penalties that will apply to those modifications
* and also what perks shall be available to passengers when travelling.
* This condition is applied only to this slice and to all the passengers associated with this offer - for information at the offer level (e.g. "what happens if I want to change all the slices?") refer to the conditions at the top level.
* If a particular kind of modification is allowed, you may not always be able to take action through the Duffel API.
* In some cases, you may need to contact the Duffel support team or the airline directly.
*/
conditions: FlightsConditions
* Note that the perks associated with the slice are aggregated across passengers and segments and are intended to provide a brief summary of the passenger experience,
* however, the experience may not be consistent across all segments.
* As an example, priority boarding may be flagged as available but not available on all segments on the slice.
* See segment passenger conditions for a per-flight breakdown what is available to
* passengers if you require this level of granularity.
*/
conditions: OfferSliceConditions

/**
* A summary of the seat characteristics and extras available to passengers on the given slice.
* The shelf is calculated by Duffel and may be used to group similar slices across offers when building a shopping display.
* Note this value does not take into account any services that may be purchased in addition to the offer and should not be directly used
* in any offer ranking systems.
* Includes the following:
* - `"1"`: standard seating with limited extras.
* - `"2"`: standard seating with extras, i.e. carry-on baggage, advanced seat selection, priority boarding etc.
* - `"3"`: preferred seating, such as additional legroom, seat width or middle seat free
* - `"4"`: premium seating, additional legroom and recline. Situated in business class or higher.
* - `"5"`: deluxe seating, additional legroom and reclines to lie flat position. Situated in business class or higher.
*/
ngs_shelf: number
}

export interface OfferSliceSegment {
Expand Down Expand Up @@ -522,6 +543,17 @@ export interface OfferSliceSegmentStop {
duration: string
}

export type WiFiAmenityCost = 'free' | 'paid' | 'free or paid' | 'n/a'
export type SeatPitch = 'less' | 'more' | 'standard' | 'n/a'
export type SeatType =
| 'standard'
| 'extra_legroom'
| 'skycouch'
| 'recliner'
| 'angle_flat'
| 'full_flat'
| 'private_suite'

export interface OfferSliceSegmentPassenger {
/**
* The baggage allowances for the passenger on this segment included in the offer.
Expand Down Expand Up @@ -550,6 +582,74 @@ export interface OfferSliceSegmentPassenger {
* fare basis code is not available or the airline does not use fare basis codes.
*/
fare_basis_code: string

/**
* Data about the cabin that the passenger will be flying in for this segment
*/
cabin: {
/**
* The name of the cabin class
*/
name: CabinClass

/**
* TThe name that the marketing carrier uses to market this cabin class
*/
marketing_name: string

/**
* The amenities specific to this cabin class on this plane
*/
amenities: {
/**
* If Wi-Fi is available, information on its cost, availability, etc
*/
wifi: {
/**
* Whether Wi-Fi is available in this cabin
*/
available: boolean

/**
* The cost, if any, to use the Wi-Fi
*/
cost: WiFiAmenityCost
} | null

/**
* Information on the standard seat in this cabin class. Exceptions may apply, such as on exit rows.
*/
seat: {
/**
* The distance from a point on a seat to the seat front/behind it, in inches, or "n/a" if not available
*/
pitch: SeatPitch

/**
* A summary of the seat characteristics for the cabin.
* Includes the following:
* - `"standard"` - typical seating with regular legroom / recline
* - `"extra_legroom"` - typical seating with additional legroom
* - `"skycouch"` - a row of seats converted into a couch layout
* - `"recliner"` - seating with additional legroom and recline
* - `"angle_flat"` - seating with additional legroom and near flat recline
* - `"full_flat_pod"` - seating with full flat recline and enclosing privacy screens
* - `"private_suite"` - a full suite, typically including a bed and recliner seat
*/
type: SeatType
} | null

/**
* If power (AC and/or USB) is available, information on what is available
*/
power: {
/**
* Whether there is power available or not in this cabin
*/
available: boolean
} | null
}
} | null
}

export type BaggageType = 'carry_on' | 'checked'
Expand Down
13 changes: 13 additions & 0 deletions src/booking/Offers/mockOffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const mockOffer: Offer = {
tax_amount: '40.80',
slices: [
{
ngs_shelf: 1,
segments: [
{
passengers: [
Expand All @@ -23,6 +24,15 @@ export const mockOffer: Offer = {
},
],
fare_basis_code: 'KLWC10A',
cabin: {
name: 'economy',
marketing_name: 'Economy Basic',
amenities: {
wifi: null,
power: null,
seat: null,
},
},
},
],
origin_terminal: 'B',
Expand Down Expand Up @@ -144,6 +154,9 @@ export const mockOffer: Offer = {
penalty_amount: '100.00',
allowed: true,
},
advance_seat_selection: false,
priority_boarding: false,
priority_check_in: false,
},
},
],
Expand Down
13 changes: 13 additions & 0 deletions src/booking/Offers/mockPartialOffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const mockPartialOffer: Offer = {
tax_amount: '40.80',
slices: [
{
ngs_shelf: 1,
segments: [
{
passengers: [
Expand All @@ -23,6 +24,15 @@ export const mockPartialOffer: Offer = {
},
],
fare_basis_code: 'KLWC10A',
cabin: {
name: 'economy',
marketing_name: 'Economy Basic',
amenities: {
wifi: null,
power: null,
seat: null,
},
},
},
],
origin_terminal: 'B',
Expand Down Expand Up @@ -144,6 +154,9 @@ export const mockPartialOffer: Offer = {
penalty_amount: '100.00',
allowed: true,
},
advance_seat_selection: false,
priority_boarding: false,
priority_check_in: false,
},
},
],
Expand Down
4 changes: 3 additions & 1 deletion src/booking/Orders/mockOrders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,9 @@ export const mockOnHoldOrders: Order[] = [
iata_code: 'MIA',
},
},
conditions: { change_before_departure: null },
conditions: {
change_before_departure: null,
},
changeable: null,
},
],
Expand Down
28 changes: 28 additions & 0 deletions src/types/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,34 @@ export type FlightsConditions = {
} | null
}

/**
* The conditions associated with this offer, describing the kinds of modifications you can make post-booking and any penalties that will apply to those modifications.
* This information assumes the condition is applied to all of the slices and passengers associated with this offer - for information at the slice level (e.g. "what happens if I just want to change the first slice?") refer to the slices.
* If a particular kind of modification is allowed, you may not always be able to take action through the Duffel API.
* In some cases, you may need to contact the Duffel support team or the airline directly.
* Note that the perks associated with the slice are aggregated across passengers and segments and are intended to provide a brief summary of the passenger experience,
* however, the experience may not be consistent across all segments.
* As an example, priority boarding may be flagged as available but not available on all segments on the slice.
* See segment passenger conditions for a per-flight breakdown what is available to
* passengers if you require this level of granularity.
*/
export type OfferSliceConditions = FlightsConditions & {
/**
* Whether passengers are able to select a seat prior to check in.
*/
advance_seat_selection: boolean

/**
* Whether passengers are given preferential boarding over others passengers in their cabin.
*/
priority_boarding: boolean

/**
* Whether passengers are given access to a fast track lane during check in.
*/
priority_check_in: boolean
}

/**
* The type of payment you want to apply to the order.
* If you are an IATA agent with your own agreements with airlines, in some cases, you can pay using ARC/BSP cash by specifying `arc_bsp_cash`. Otherwise, you must pay using your Duffel account's balance by specifying `balance`.
Expand Down

0 comments on commit 6455e1a

Please sign in to comment.