From 63c7bbe9377214ab92bd417150364e04aafb2d73 Mon Sep 17 00:00:00 2001 From: Jekri Preclaro Orlina Date: Thu, 25 Jan 2024 15:36:04 +0000 Subject: [PATCH 1/2] fix: apply Rate.available_payment_methods --- src/Stays/StaysTypes.ts | 6 +++++- src/Stays/mocks.ts | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Stays/StaysTypes.ts b/src/Stays/StaysTypes.ts index 17fb06a3..75817eb4 100644 --- a/src/Stays/StaysTypes.ts +++ b/src/Stays/StaysTypes.ts @@ -71,6 +71,8 @@ export type StaysLoyaltyProgramme = | 'global_hotel_alliance_discovery' | 'duffel_hotel_group_rewards' +export type StaysPaymentType = 'balance' | 'card' + export interface StaysRate { /** * The currency of the base_amount, as an ISO 4217 currency code. @@ -160,7 +162,9 @@ export interface StaysRate { /** * The method available for payment of this rate. A rate with the `balance` payment type will be paid for using your Duffel Balance, and a rate with the `card` payment type will be paid for with card details provided at time of booking. */ - payment_method: 'balance' | 'card' + payment_method: StaysPaymentType + + available_payment_methods: StaysPaymentType[] /** * The loyalty programme that this rate supports. diff --git a/src/Stays/mocks.ts b/src/Stays/mocks.ts index c1fb0b42..fd5b9da4 100644 --- a/src/Stays/mocks.ts +++ b/src/Stays/mocks.ts @@ -50,6 +50,7 @@ export const MOCK_ACCOMMODATION: StaysAccommodation = { cancellation_timeline: [], board_type: 'room_only', payment_method: 'balance', + available_payment_methods: ['balance'], quantity_available: 1, supported_loyalty_programme: null, source: 'duffel_hotel_group', @@ -81,6 +82,7 @@ export const MOCK_ACCOMMODATION: StaysAccommodation = { cancellation_timeline: [], board_type: 'room_only', payment_method: 'card', + available_payment_methods: ['card'], quantity_available: 1, supported_loyalty_programme: 'duffel_hotel_group_rewards', source: 'duffel_hotel_group', From 749ec4b70e51063b73fdeb83adfb18ac4eef8932 Mon Sep 17 00:00:00 2001 From: Jekri Preclaro Orlina Date: Thu, 25 Jan 2024 15:39:12 +0000 Subject: [PATCH 2/2] fix: add deprecation notices --- src/Stays/StaysTypes.ts | 11 +++++++++-- src/Stays/mocks.ts | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Stays/StaysTypes.ts b/src/Stays/StaysTypes.ts index 75817eb4..f2f18c64 100644 --- a/src/Stays/StaysTypes.ts +++ b/src/Stays/StaysTypes.ts @@ -160,10 +160,17 @@ export interface StaysRate { total_currency: string /** - * The method available for payment of this rate. A rate with the `balance` payment type will be paid for using your Duffel Balance, and a rate with the `card` payment type will be paid for with card details provided at time of booking. - */ + Deprecated. Refer to available_payment_methods instead. + */ payment_method: StaysPaymentType + /** + * The methods available for payment of this rate. + + A rate with the `balance` payment type can be paid for using your Duffel Balance. + + A rate with the `card` payment type can be paid for with card details provided at time of booking. + */ available_payment_methods: StaysPaymentType[] /** diff --git a/src/Stays/mocks.ts b/src/Stays/mocks.ts index fd5b9da4..cc142ac5 100644 --- a/src/Stays/mocks.ts +++ b/src/Stays/mocks.ts @@ -49,7 +49,7 @@ export const MOCK_ACCOMMODATION: StaysAccommodation = { fee_amount: '40.00', cancellation_timeline: [], board_type: 'room_only', - payment_method: 'balance', + payment_method: 'balance', // Deprecated. Refer to available_payment_methods instead. available_payment_methods: ['balance'], quantity_available: 1, supported_loyalty_programme: null, @@ -81,7 +81,7 @@ export const MOCK_ACCOMMODATION: StaysAccommodation = { fee_amount: '40.00', cancellation_timeline: [], board_type: 'room_only', - payment_method: 'card', + payment_method: 'card', // Deprecated. Refer to available_payment_methods instead. available_payment_methods: ['card'], quantity_available: 1, supported_loyalty_programme: 'duffel_hotel_group_rewards',