Skip to content

Commit

Permalink
Merge pull request #903 from duffelhq/fix-creation-type
Browse files Browse the repository at this point in the history
Corrects offer request creation slice type
  • Loading branch information
igorp1 authored Apr 3, 2024
2 parents 1d7168a + 2092c92 commit 548b3e2
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 53 deletions.
32 changes: 31 additions & 1 deletion src/booking/OfferRequests/OfferRequestsTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,37 @@ export interface CreateOfferRequest {
* up this offer request. One-way journeys can be expressed using one slice,
* whereas return trips will need two.
*/
slices: Omit<OfferRequestSlice, 'origin_type' | 'destination_type'>[]
slices: CreateOfferRequestSlice[]
}

export interface CreateOfferRequestSlice {
/**
* The 3-letter IATA code for the city or airport where this slice ends
* Example: "JFK"
*/
destination: string

/**
* The 3-letter IATA code for the city or airport where this slice starts
* Example: "LHR"
*/
origin: string

/**
* The ISO 8601 date on which the passengers want to depart
* Example: "2020-04-24"
*/
departure_date: string

/**
* The inclusive time range for the arrival of the slice
*/
arrival_time?: string | null

/**
* The inclusive time range for the departure of the slice
*/
departure_time?: string | null
}

export interface CreateOfferRequestQueryParameters {
Expand Down
28 changes: 2 additions & 26 deletions src/booking/OfferRequests/mockOfferRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,8 @@ import { CreateOfferRequest, OfferRequest } from '../../types'
export const mockCreateOfferRequest: CreateOfferRequest = {
slices: [
{
origin: {
iata_code: 'LHR',
type: 'airport',
name: 'Heathrow Airport',
longitude: -0.458118,
latitude: 51.470311,
id: 'arp_lhr_gb',
icao_code: 'EGLL',
iata_country_code: 'GB',
iata_city_code: 'LON',
time_zone: 'Europe/London',
city_name: 'London',
},
destination: {
iata_code: 'JFK',
type: 'airport',
time_zone: 'America/New_York',
name: 'John F. Kennedy International Airport',
longitude: -73.778519,
latitude: 40.640556,
id: 'arp_jfk_us',
icao_code: 'KJFK',
iata_country_code: 'US',
iata_city_code: 'NYC',
city_name: 'New York',
},
origin: 'LHR',
destination: 'JFK',
departure_date: '2020-04-24',
},
],
Expand Down
28 changes: 2 additions & 26 deletions src/booking/PartialOfferRequests/mockPartialOfferRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,8 @@ import { CreateOfferRequest, OfferRequest } from '../../types'
export const mockCreatePartialOfferRequest: CreateOfferRequest = {
slices: [
{
origin: {
iata_code: 'LHR',
type: 'airport',
name: 'Heathrow Airport',
longitude: -0.458118,
latitude: 51.470311,
id: 'arp_lhr_gb',
icao_code: 'EGLL',
iata_country_code: 'GB',
iata_city_code: 'LON',
time_zone: 'Europe/London',
city_name: 'London',
},
destination: {
iata_code: 'JFK',
type: 'airport',
time_zone: 'America/New_York',
name: 'John F. Kennedy International Airport',
longitude: -73.778519,
latitude: 40.640556,
id: 'arp_jfk_us',
icao_code: 'KJFK',
iata_country_code: 'US',
iata_city_code: 'NYC',
city_name: 'New York',
},
origin: 'LHR',
destination: 'JFK',
departure_date: '2020-04-24',
},
],
Expand Down

0 comments on commit 548b3e2

Please sign in to comment.