Skip to content

Commit 6928cb7

Browse files
authored
Merge pull request #1072 from duffelhq/igorp1/tsp-512-add-users-array-to-createorder-and-staysbookingpayload
Adds user related types to order and booking creation
2 parents 570dea2 + a10c678 commit 6928cb7

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

src/Stays/Bookings/Bookings.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const mockBookingParams: StaysBookingPayload = {
1717
metadata: {
1818
customer_reference_number: 'ABXYZZ53Z',
1919
},
20+
users: ['icu_00009htyDGjIfajdNBZRlw'],
2021
}
2122

2223
const duffel = new Duffel({ token: 'mockToken' })

src/Stays/Bookings/Bookings.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,23 @@ export interface StaysBookingPayload {
99
guests: Array<{
1010
given_name: string
1111
family_name: string
12+
/**
13+
* Creates an association between the guest and a previously created user.
14+
* This is intended to allow guests the ability to manage their own bookings.
15+
* @example ["icu_0000000000000000000000"]
16+
*/
17+
user_id?: string
1218
}>
1319
email: string
1420
phone_number: string
1521
accommodation_special_requests?: string
1622
payment?: { card_id: string } | { three_d_secure_session_id: string }
1723
metadata?: StaysBooking['metadata']
24+
/**
25+
* The ids of users that would be allowed to manage the booking.
26+
* @example ["icu_0000000000000000000000"]
27+
*/
28+
users?: string[]
1829
}
1930

2031
export class Bookings extends Resource {

src/Stays/mocks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ export const MOCK_CREATE_BOOKING_PAYLOAD: StaysBookingPayload = {
239239
240240
phone_number: '+44 07242242424',
241241
accommodation_special_requests: '',
242+
users: ['icu_00009htyDGjIfajdNBZRlw'],
242243
}
243244

244245
export const MOCK_QUOTE: StaysQuote = {

src/booking/Orders/OrdersTypes.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ export interface CreateOrderPassenger extends Omit<OrderPassenger, 'type'> {
213213
*/
214214
identity_documents?: OrderPassengerIdentityDocument[]
215215

216+
/**
217+
* Creates an association between the passenger and a previously created user.
218+
* This is intended to allow passengers the ability to manage their own orders.
219+
* @example "icu_0000000000000000000000"
220+
*/
221+
user_id?: string
222+
216223
/**
217224
* The passenger's email address
218225
* @example "[email protected]"
@@ -630,6 +637,12 @@ export interface CreateOrder {
630637
*/
631638
type: 'instant' | 'pay_later'
632639

640+
/**
641+
* The ids of users that would be allowed to manage the order.
642+
* @example ["icu_0000000000000000000000"]
643+
*/
644+
users?: string[]
645+
633646
/**
634647
* Metadata contains a set of key-value pairs that you can attach to an object. It can be useful for storing additional information about the object, in a structured format. Duffel does not use this information. You should not store sensitive information in this field.
635648
*

src/booking/Orders/mockOrders.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ export const mockCreateOrderRequest: CreateOrder = {
4040
family_name: 'Earhart',
4141
4242
born_on: '1987-07-24',
43+
user_id: 'icu_00009htyDGjIfajdNBZRlw',
4344
},
4445
],
46+
users: ['icu_00009htyDGjIfajdNBZRlw'],
4547
}
4648

4749
export const mockOrder: Order = {

0 commit comments

Comments
 (0)