diff --git a/lib/stripe/subscriptions/subscription_schedule.ex b/lib/stripe/subscriptions/subscription_schedule.ex index 704ee722..658bf24d 100644 --- a/lib/stripe/subscriptions/subscription_schedule.ex +++ b/lib/stripe/subscriptions/subscription_schedule.ex @@ -7,19 +7,24 @@ defmodule Stripe.SubscriptionSchedule do use Stripe.Entity import Stripe.Request - @type plans :: %{ - plan: String.t(), + @type items :: %{ + billing_thresholds: Stripe.Types.collection_method_thresholds(), price: String.t(), - quantity: pos_integer + quantity: pos_integer, + tax_rates: [Stripe.TaxRate.t()], } @type phases :: %{ + collection_method: string | nil, + collection_method: string | nil, + coupon: string | nil, + default_payment_method: string | nil, + default_tax_rates: float | nil, application_fee_percent: float | nil, end_date: Stripe.timestamp(), start_date: Stripe.timestamp(), - tax_percent: float | nil, trial_end: Stripe.timestamp(), - plans: list(plans) + items: list(items) } @type default_settings :: %{ @@ -49,6 +54,7 @@ defmodule Stripe.SubscriptionSchedule do revision: String.t(), status: String.t(), subscription: Stripe.id() | Stripe.Subscription.t(), + test_clock: Stripe.id() | Stripe.Subscription.t(), customer: Stripe.id() | Stripe.Customer.t(), released_subscription: Stripe.id() | Stripe.Subscription.t() | nil, phases: list(phases) @@ -71,7 +77,8 @@ defmodule Stripe.SubscriptionSchedule do :livemode, :metadata, :end_behavior, - :revision + :revision, + :test_clock, ] @plural_endpoint "subscription_schedules" @@ -98,11 +105,12 @@ defmodule Stripe.SubscriptionSchedule do }, optional(:phases) => [ %{ - :plans => [ + :items => [ %{ - optional(:plan) => Stripe.id() | Stripe.Plan.t(), + optional(:billing_thresholds): Stripe.Types.collection_method_thresholds() optional(:price) => Stripe.id() | Stripe.Price.t(), - optional(:quantity) => non_neg_integer + optional(:quantity) => non_neg_integer, + optional(:tax_rates) => [Stripe.TaxRate.t()] } ], optional(:application_fee_percent) => non_neg_integer, @@ -110,7 +118,6 @@ defmodule Stripe.SubscriptionSchedule do optional(:end_date) => Stripe.timestamp(), optional(:iterations) => non_neg_integer, optional(:start_date) => Stripe.timestamp(), - optional(:tax_percent) => float, optional(:trial) => boolean(), optional(:trial_end) => Stripe.timestamp() } @@ -152,11 +159,12 @@ defmodule Stripe.SubscriptionSchedule do }, optional(:phases) => [ %{ - :plans => [ + :items => [ %{ - optional(:plan) => Stripe.id() | Stripe.Plan.t(), + optional(:billing_thresholds): Stripe.Types.collection_method_thresholds() | nil, optional(:price) => Stripe.id() | Stripe.Price.t(), optional(:quantity) => non_neg_integer + optional(:tax_rates) => [Stripe.TaxRate.t()] } ], optional(:application_fee_percent) => non_neg_integer, @@ -164,7 +172,6 @@ defmodule Stripe.SubscriptionSchedule do optional(:end_date) => Stripe.timestamp(), optional(:iterations) => non_neg_integer, optional(:start_date) => Stripe.timestamp(), - optional(:tax_percent) => float, optional(:trial) => boolean(), optional(:trial_end) => Stripe.timestamp() } diff --git a/test/stripe/subscriptions/subscription_schedule_test.exs b/test/stripe/subscriptions/subscription_schedule_test.exs index c9f4b9d4..d412030b 100644 --- a/test/stripe/subscriptions/subscription_schedule_test.exs +++ b/test/stripe/subscriptions/subscription_schedule_test.exs @@ -10,7 +10,6 @@ defmodule Stripe.SubscriptionScheduleTest do default_tax_rates: [], end_date: 1_557_566_037, start_date: 1_554_974_037, - tax_percent: 0 } ] } @@ -35,13 +34,11 @@ defmodule Stripe.SubscriptionScheduleTest do end_date: 1_557_566_037, items: [ %{ - plan: "some plan", quantity: 2, tax_rates: [] } ], start_date: 1_554_974_037, - tax_percent: 0 } ] } @@ -70,13 +67,11 @@ defmodule Stripe.SubscriptionScheduleTest do end_date: 1_557_566_037, items: [ %{ - plan: "some plan", quantity: 2, tax_rates: [] } ], start_date: 1_554_974_037, - tax_percent: 0 } ] }