-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changed params for subscription to accept default payment method #592
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,7 +124,7 @@ defmodule Stripe.Subscription do | |
optional(:trial_from_plan) => boolean, | ||
optional(:trial_period_days) => non_neg_integer | ||
} | ||
def create(%{customer: _, items: _} = params, opts \\ []) do | ||
def create(params, opts \\ []) do | ||
new_request(opts) | ||
|> put_endpoint(@plural_endpoint) | ||
|> put_params(params) | ||
|
@@ -164,6 +164,7 @@ defmodule Stripe.Subscription do | |
optional(:items) => [ | ||
%{ | ||
:plan => Stripe.id() | Stripe.Plan.t(), | ||
optional(:id) => Stripe.id() | binary(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this documented anywhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's located here as an optional parameter It's also considered a required parameter when upgrading and downgrading a user subscription |
||
optional(:billing_methods) => map, | ||
optional(:metadata) => map, | ||
optional(:quantity) => non_neg_integer, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THis ensures that the create action is passed with a customer and items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we need this? It seems these two are required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I think it's necessary to provide it for the sake of keeping in line with the tutorial. If we'd like to figure out if the user has passed in a customer and items key, we can probably just use the
Map.has_key?(params, :customer)
and if it returns false, we throw an exception.