-
Notifications
You must be signed in to change notification settings - Fork 352
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
Checkout Session retrieval and missing attributes #532
Conversation
@nbw Mind rebasing with master? Also stripe api version will be configurable in 2.5! |
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.
These are some welcome additions! Thank you!
@@ -66,13 +67,37 @@ defmodule Stripe.Session do | |||
@type t :: %__MODULE__{ | |||
:id => Stripe.id(), | |||
:object => String.t(), | |||
:livemode => boolean() | |||
:cancel_url => boolean(), | |||
:billing_address_collection => String.t(), |
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.
mind alpha ordering this?
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.
Done. Sorry, I followed the order in Stripe's docs. I sorted everything past object.
:customer_email => String.t(), | ||
:display_items => list(line_item), | ||
:livemode => boolean(), | ||
:locale => boolean(), |
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.
Looks like mode
was added - https://stripe.com/docs/api/checkout/sessions/object
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.
Done. Commit
lib/stripe/checkout/session.ex
Outdated
:payment_intent => String.t(), | ||
:payment_method_types => list(String.t()), | ||
:submit_type => String.t(), | ||
:subscription => String.t(), |
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.
r/String.t()/Stripe.id() | Stripe.Subscription.t() | nil,
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.
lib/stripe/checkout/session.ex
Outdated
:display_items => list(line_item), | ||
:livemode => boolean(), | ||
:locale => boolean(), | ||
:payment_intent => String.t(), |
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.
r/String.t()/Stripe.id() | Stripe.PaymentIntent.t() | nil,
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.
lib/stripe/checkout/session.ex
Outdated
:cancel_url => boolean(), | ||
:billing_address_collection => String.t(), | ||
:client_reference_id => String.t(), | ||
:customer => String.t(), |
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.
r/String.t()/Stripe.id() | Stripe.Customer.t() | nil
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.
Also add fallback defaults
Thanks. I rebased and implemented the requested changes. |
Lovely. thank you for the detailed commits! |
Summary
There are a number of attributes on the Sessions object that are missing. This PR adds any missing attributes mentioned in Stripe's docs.
There is also a retrieve endpoint that has since been added.
Tests
Added one test for Stripe.session.retrieve/2 following a pattern from
subscriptions_test.exs
.Note
When I used the retrieve endpoint in my own project I had to add the header:
Stripe-Version
:2019-05-16; checkout_sessions_beta=v1
Edit: looks like that's already passed: https://github.com/code-corps/stripity_stripe/blob/1510f7c384cd3b3f40939d28a15a5bcdfe300aed/lib/stripe/api.ex#L19