Skip to content

Commit

Permalink
Add missing fields (beam-community#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenvanvliet authored and snewcomer committed Aug 27, 2019
1 parent 83ebc2f commit caa2d8d
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 8 deletions.
2 changes: 2 additions & 0 deletions lib/stripe/subscriptions/invoice.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ defmodule Stripe.Invoice do
billing: String.t() | nil,
billing_reason: String.t() | nil,
charge: Stripe.id() | Stripe.Charge.t() | nil,
collection_method: String.t(),
currency: String.t(),
customer_address: Stripe.Types.address() | nil,
customer_email: String.t() | nil,
Expand Down Expand Up @@ -116,6 +117,7 @@ defmodule Stripe.Invoice do
:billing_reason,
:charge,
:created,
:collection_method,
:customer_address,
:customer_email,
:customer_name,
Expand Down
16 changes: 12 additions & 4 deletions lib/stripe/subscriptions/invoiceitem.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ defmodule Stripe.Invoiceitem do
quantity: integer,
subscription: Stripe.id() | Stripe.Subscription.t() | nil,
subscription_item: Stripe.id() | Stripe.SubscriptionItem.t() | nil,
unit_amount: integer
tax_rates: list(Stripe.TaxRate.t()),
unit_amount: integer,
unit_amount_decimal: String.t()
}

defstruct [
Expand All @@ -53,7 +55,9 @@ defmodule Stripe.Invoiceitem do
:quantity,
:subscription,
:subscription_item,
:unit_amount
:tax_rates,
:unit_amount,
:unit_amount_decimal
]

@plural_endpoint "invoiceitems"
Expand All @@ -73,7 +77,9 @@ defmodule Stripe.Invoiceitem do
optional(:metadata) => Stripe.Types.metadata(),
optional(:quantity) => integer,
optional(:subscription) => Stripe.id() | Stripe.Subscription.t(),
optional(:unit_amount) => integer
optional(:tax_rates) => list(String.t()),
optional(:unit_amount) => integer,
optional(:unit_amount_decimal) => String.t()
}
| %{}
def create(params, opts \\ []) do
Expand Down Expand Up @@ -109,7 +115,9 @@ defmodule Stripe.Invoiceitem do
optional(:discountable) => boolean,
optional(:metadata) => Stripe.Types.metadata(),
optional(:quantity) => integer,
optional(:unit_amount) => integer
optional(:tax_rates) => list(String.t()),
optional(:unit_amount) => integer,
optional(:unit_amount_decimal) => String.t()
}
| %{}
def update(id, params, opts \\ []) do
Expand Down
3 changes: 3 additions & 0 deletions lib/stripe/subscriptions/plan.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ defmodule Stripe.Plan do
active: boolean,
aggregate_usage: String.t() | nil,
amount: non_neg_integer | nil,
amount_decimal: String.t() | nil,
billing_scheme: String.t() | nil,
created: Stripe.timestamp(),
currency: String.t(),
Expand All @@ -74,6 +75,7 @@ defmodule Stripe.Plan do
:active,
:aggregate_usage,
:amount,
:amount_decimal,
:billing_scheme,
:created,
:currency,
Expand Down Expand Up @@ -105,6 +107,7 @@ defmodule Stripe.Plan do
:product => Stripe.id() | Stripe.Product.t(),
optional(:id) => String.t(),
optional(:amount) => non_neg_integer,
optional(:amount_decimal) => String.t(),
optional(:active) => boolean,
optional(:billing_scheme) => String.t(),
optional(:interval_count) => pos_integer,
Expand Down
8 changes: 8 additions & 0 deletions lib/stripe/subscriptions/subscription.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ defmodule Stripe.Subscription do
billing: String.t() | nil,
billing_cycle_anchor: Stripe.timestamp() | nil,
billing_thresholds: Stripe.Types.subscription_billing_thresholds() | nil,
cancel_at: Stripe.timestamp() | nil,
cancel_at_period_end: boolean,
canceled_at: Stripe.timestamp() | nil,
collection_method: String.t(),
created: Stripe.timestamp(),
current_period_end: Stripe.timestamp() | nil,
current_period_start: Stripe.timestamp() | nil,
Expand Down Expand Up @@ -56,8 +58,10 @@ defmodule Stripe.Subscription do
:billing,
:billing_cycle_anchor,
:billing_thresholds,
:cancel_at,
:cancel_at_period_end,
:canceled_at,
:collection_method,
:created,
:current_period_end,
:current_period_start,
Expand Down Expand Up @@ -94,6 +98,8 @@ defmodule Stripe.Subscription do
optional(:application_fee_percent) => integer,
optional(:billing) => String.t(),
optional(:billing_cycle_anchor) => Stripe.timestamp(),
optional(:cancel_at) => Stripe.timestamp(),
optional(:collection_method) => String.t(),
optional(:coupon) => Stripe.id() | Stripe.Coupon.t(),
optional(:days_until_due) => non_neg_integer,
optional(:items) => [
Expand Down Expand Up @@ -139,7 +145,9 @@ defmodule Stripe.Subscription do
optional(:application_fee_percent) => float,
optional(:billing) => String.t(),
optional(:billing_cycle_anchor) => Stripe.timestamp(),
optional(:cancel_at) => Stripe.timestamp(),
optional(:cancel_at_period_end) => boolean(),
optional(:collection_method) => String.t(),
optional(:coupon) => Stripe.id() | Stripe.Coupon.t(),
optional(:days_until_due) => non_neg_integer,
optional(:items) => [
Expand Down
12 changes: 8 additions & 4 deletions lib/stripe/subscriptions/subscription_item.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ defmodule Stripe.SubscriptionItem do
metadata: Stripe.Types.metadata(),
plan: Stripe.Plan.t(),
quantity: non_neg_integer,
subscription: Stripe.id() | Stripe.Subscription.t() | nil
subscription: Stripe.id() | Stripe.Subscription.t() | nil,
tax_rates: list(Stripe.TaxRate.t())
}

defstruct [
Expand All @@ -29,7 +30,8 @@ defmodule Stripe.SubscriptionItem do
:metadata,
:plan,
:quantity,
:subscription
:subscription,
:tax_rates
]

@plural_endpoint "subscription_items"
Expand All @@ -44,7 +46,8 @@ defmodule Stripe.SubscriptionItem do
optional(:metadata) => Stripe.Types.metadata(),
optional(:prorate) => boolean,
optional(:proration_date) => Stripe.timestamp(),
optional(:quantity) => float
optional(:quantity) => float,
optional(:tax_rates) => list(String.t())
}
def create(%{plan: _, subscription: _} = params, opts \\ []) do
new_request(opts)
Expand Down Expand Up @@ -77,7 +80,8 @@ defmodule Stripe.SubscriptionItem do
optional(:plan) => Stripe.id() | Stripe.Plan.t(),
optional(:prorate) => boolean,
optional(:proration_date) => Stripe.timestamp(),
optional(:quantity) => float
optional(:quantity) => float,
optional(:tax_rates) => list(String.t())
}
def update(id, params, opts \\ []) do
new_request(opts)
Expand Down
8 changes: 8 additions & 0 deletions lib/stripe/subscriptions/subscription_schedule.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ defmodule Stripe.SubscriptionSchedule do
created: Stripe.timestamp(),
canceled_at: Stripe.timestamp() | nil,
released_at: Stripe.timestamp() | nil,
collection_method: String.t(),
completed_at: Stripe.timestamp() | nil,
livemode: boolean,
metadata: Stripe.Types.metadata(),
Expand All @@ -45,6 +46,7 @@ defmodule Stripe.SubscriptionSchedule do
subscription: Stripe.id() | Stripe.Subscription.t(),
customer: Stripe.id() | Stripe.Customer.t(),
released_subscription: Stripe.id() | Stripe.Subscription.t() | nil,
default_payment_method: Stripe.id() | Stripe.PaymentMethod.t(),
phases: list(phases)
}

Expand All @@ -55,9 +57,11 @@ defmodule Stripe.SubscriptionSchedule do
:billing_thresholds,
:created,
:canceled_at,
:collection_method,
:completed_at,
:current_phase,
:customer,
:default_payment_method,
:phases,
:released_at,
:released_subscription,
Expand Down Expand Up @@ -86,10 +90,12 @@ defmodule Stripe.SubscriptionSchedule do
when params: %{
optional(:customer) => Stripe.id(),
optional(:billing) => String.t(),
optional(:collection_method) => String.t(),
optional(:from_subscription) => Stripe.id(),
optional(:invoice_settings) => %{
optional(:days_until_due) => non_neg_integer
},
optional(:default_payment_method) => Stripe.id(),
optional(:phases) => [
%{
:plans => [
Expand Down Expand Up @@ -141,9 +147,11 @@ defmodule Stripe.SubscriptionSchedule do
@spec update(Stripe.id() | t, params, Stripe.options()) :: {:ok, t} | {:error, Stripe.Error.t()}
when params: %{
optional(:billing) => String.t(),
optional(:collection_method) => String.t(),
optional(:invoice_settings) => %{
optional(:days_until_due) => non_neg_integer
},
optional(:default_payment_method) => Stripe.id(),
optional(:phases) => [
%{
:plans => [
Expand Down

0 comments on commit caa2d8d

Please sign in to comment.