interface DiscountsService {
    calculateDiscount(
        params: CalculateDiscountParams,
    ): Promise<BookingDiscount>;
    createTripCreditVoucher(
        voucher: TripCreditVoucherCreate,
    ): Promise<StripePromotionCode>;
    markCouponAsUsed(
        code: string,
        orderId: string,
    ): Promise<StripePromotionCode>;
    restoreCouponRedemption(
        code: string,
        orderId: string,
    ): Promise<StripePromotionCode>;
}

Methods

  • Calculates the discount amount and total due a given promotion code and a trip booking.

    Parameters

    • params: CalculateDiscountParams

      calculation parameters

      • code

        the promotion code to apply

      • totalSpotsBooked

        number of travelers the discount applies to

      • tripId

        ID of the trip to apply the discount to

      • travelerEmails

        optional array of traveler emails

    Returns Promise<BookingDiscount>

  • Will update a discount including when it was used and the orderId in which it was used. Will throw an error if not available

    Parameters

    • code: string

      discount code to mark as used

    • orderId: string

      orderId to include on discount for reference

    Returns Promise<StripePromotionCode>

  • Will restore the last use for a coupon This is the opposite to markCouponAsUsed

    Parameters

    • code: string

      discount code to restore

    • orderId: string

      orderId to include on discount for reference

    Returns Promise<StripePromotionCode>