using Bit.Core.Billing.Models; using Bit.Core.Entities; using Bit.Core.Models.Business; using Stripe; namespace Bit.Core.Billing.Services; public interface ISubscriberService { /// /// Cancels a subscriber's subscription while including user-provided feedback via the . /// If the flag is , /// this command sets the subscription's "cancel_at_end_of_period" property to . /// Otherwise, this command cancels the subscription immediately. /// /// The subscriber with the subscription to cancel. /// An DTO containing user-provided feedback on why they are cancelling the subscription. /// A flag indicating whether to cancel the subscription immediately or at the end of the subscription period. Task CancelSubscription( ISubscriber subscriber, OffboardingSurveyResponse offboardingSurveyResponse, bool cancelImmediately); /// /// Retrieves a Stripe using the 's property. /// /// The subscriber to retrieve the Stripe customer for. /// Optional parameters that can be passed to Stripe to expand or modify the customer. /// A Stripe . /// Thrown when the is . /// This method opts for returning rather than throwing exceptions, making it ideal for surfacing data from API endpoints. Task GetCustomer( ISubscriber subscriber, CustomerGetOptions customerGetOptions = null); /// /// Retrieves a Stripe using the 's property. /// /// The subscriber to retrieve the Stripe customer for. /// Optional parameters that can be passed to Stripe to expand or modify the customer. /// A Stripe . /// Thrown when the is . /// Thrown when the subscriber's is or empty. /// Thrown when the returned from Stripe's API is null. Task GetCustomerOrThrow( ISubscriber subscriber, CustomerGetOptions customerGetOptions = null); /// /// Retrieves a Stripe using the 's property. /// /// The subscriber to retrieve the Stripe subscription for. /// Optional parameters that can be passed to Stripe to expand or modify the subscription. /// A Stripe . /// Thrown when the is . /// This method opts for returning rather than throwing exceptions, making it ideal for surfacing data from API endpoints. Task GetSubscription( ISubscriber subscriber, SubscriptionGetOptions subscriptionGetOptions = null); /// /// Retrieves a Stripe using the 's property. /// /// The subscriber to retrieve the Stripe subscription for. /// Optional parameters that can be passed to Stripe to expand or modify the subscription. /// A Stripe . /// Thrown when the is . /// Thrown when the subscriber's is or empty. /// Thrown when the returned from Stripe's API is null. Task GetSubscriptionOrThrow( ISubscriber subscriber, SubscriptionGetOptions subscriptionGetOptions = null); /// /// Attempts to remove a subscriber's saved payment method. If the Stripe representing the /// contains a valid "btCustomerId" key in its property, /// this command will attempt to remove the Braintree . Otherwise, it will attempt to remove the /// Stripe . /// /// The subscriber to remove the saved payment method for. Task RemovePaymentMethod(ISubscriber subscriber); /// /// Retrieves a Stripe using the 's property. /// /// The subscriber to retrieve the Stripe customer for. /// A Stripe . /// Thrown when the is . /// This method opts for returning rather than throwing exceptions, making it ideal for surfacing data from API endpoints. Task GetTaxInformationAsync(ISubscriber subscriber); /// /// Retrieves a Stripe using the 's property. /// /// The subscriber to retrieve the Stripe customer for. /// A Stripe . /// Thrown when the is . /// This method opts for returning rather than throwing exceptions, making it ideal for surfacing data from API endpoints. Task GetPaymentMethodAsync(ISubscriber subscriber); }