Skip to content

Commit

Permalink
Merge pull request #876 from duffelhq/STAYS-1272/available-payment-me…
Browse files Browse the repository at this point in the history
…thods

Expose Rate.available_payment_methods
  • Loading branch information
jekku authored Jan 25, 2024
2 parents e52f755 + 749ec4b commit f08d3d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 13 additions & 2 deletions src/Stays/StaysTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -158,9 +160,18 @@ 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.
*/
payment_method: 'balance' | 'card'
available_payment_methods: StaysPaymentType[]

/**
* The loyalty programme that this rate supports.
Expand Down
6 changes: 4 additions & 2 deletions src/Stays/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ 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,
source: 'duffel_hotel_group',
Expand Down Expand Up @@ -80,7 +81,8 @@ 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',
source: 'duffel_hotel_group',
Expand Down

0 comments on commit f08d3d4

Please sign in to comment.