Skip to content

Commit

Permalink
Merge pull request #898 from duffelhq/fix-orq-types
Browse files Browse the repository at this point in the history
fix: orq origin & destination types are objects, not strings
  • Loading branch information
andrejak authored Mar 25, 2024
2 parents cb75914 + 76dffcb commit 2393d8f
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/booking/OfferRequests/OfferRequestsTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export interface OfferRequestSlice {
/**
* The city or airport the passengers want to travel to
*/
destination: Place | string
destination: Place

/**
* The city or airport the passengers want to depart from
*/
origin: Place | string
origin: Place

/**
* The type of the origin
Expand Down
28 changes: 26 additions & 2 deletions src/booking/OfferRequests/mockOfferRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,32 @@ import { CreateOfferRequest, OfferRequest } from '../../types'
export const mockCreateOfferRequest: CreateOfferRequest = {
slices: [
{
origin: 'LHR',
destination: 'JFK',
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',
},
departure_date: '2020-04-24',
},
],
Expand Down
2 changes: 1 addition & 1 deletion src/booking/Orders/OrdersTypes.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Airport } from '@duffel/api/types'
import {
Aircraft,
Airline,
AirlineInitiatedChange,
Airport,
CabinClass,
DuffelPassengerGender,
DuffelPassengerTitle,
Expand Down
4 changes: 0 additions & 4 deletions src/booking/Orders/mockOrders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ export const mockOnHoldOrders: Order[] = [
],
origin_terminal: null,
origin: {
type: 'airport',
time_zone: 'America/Indiana/Indianapolis',
name: 'Indianapolis International Airport',
longitude: -86.295526,
Expand Down Expand Up @@ -331,7 +330,6 @@ export const mockOnHoldOrders: Order[] = [
distance: null,
destination_terminal: null,
destination: {
type: 'airport',
time_zone: 'America/New_York',
name: 'Miami International Airport',
longitude: -80.288826,
Expand Down Expand Up @@ -466,7 +464,6 @@ export const mockOnHoldOrders: Order[] = [
],
origin_terminal: null,
origin: {
type: 'airport',
time_zone: 'America/Indiana/Indianapolis',
name: 'Indianapolis International Airport',
longitude: -86.295526,
Expand Down Expand Up @@ -501,7 +498,6 @@ export const mockOnHoldOrders: Order[] = [
distance: null,
destination_terminal: null,
destination: {
type: 'airport',
time_zone: 'America/New_York',
name: 'Miami International Airport',
longitude: -80.288826,
Expand Down
28 changes: 26 additions & 2 deletions src/booking/PartialOfferRequests/mockPartialOfferRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,32 @@ import { CreateOfferRequest, OfferRequest } from '../../types'
export const mockCreatePartialOfferRequest: CreateOfferRequest = {
slices: [
{
origin: 'LHR',
destination: 'JFK',
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',
},
departure_date: '2020-04-24',
},
],
Expand Down

0 comments on commit 2393d8f

Please sign in to comment.