-
Notifications
You must be signed in to change notification settings - Fork 354
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
Add Stripe Issuing #493
Add Stripe Issuing #493
Conversation
@snewcomer here's my WIP merge request. I'm attempting to exercise the changes against the live API before I feel fully confident and would appreciate your eyes on the code as well. |
I've exercised these changes against Stripe's test environment and things appear to work as expected. I think it's good to go. |
- Issuing.Authorization - Issuing.Card - Issuing.CardDetails - Issuing.Cardholder - Issuing.Dispute - Issuing.Transaction
989583d
to
c4a9764
Compare
lib/stripe/types.ex
Outdated
@@ -12,6 +12,30 @@ defmodule Stripe.Types do | |||
state: String.t() | nil | |||
} | |||
|
|||
@type authorization_controls :: %{ |
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.
What if we inlined this in a Stripe.Issuing.Types
module? Unless you see this type used outside the Issuing scope?.
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.
Yeah, I noticed that pattern in some other instances. I'm happy to move the issuing-specific types into a separate module or inline them where appropriate.
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.
Yeah that might be good if you don't mind
@snewcomer I've moved the issuing types around per your suggestion. Let me know if there's anything else you see that I can improve. Thanks. |
@snewcomer any other feedback on this merge request? I'd love to get it merged before it gets stale. |
@jcartwright Feel free to merge master and CI should be g2g! |
@snewcomer CI seems to be failing CI to unformatted files outside of my merge request
Do you want me to format them in a separate MR? |
""" | ||
@spec retrieve(Stripe.id() | Stripe.Issuing.Card.t(), Stripe.options()) :: | ||
{:ok, t} | {:error, Stripe.Error.t()} | ||
def retrieve(id, opts \\ []) do |
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.
Is this the same as the retrieve endpoint in Stripe.Issuing.Card
? Is this module necessary?
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.
CardDetails is a nested resource used to retrieve the full sensitive details for an issued card. I treated it like a separate and distinct resource because the struct is very different from the Card resource used to manage issued cards.
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.
I see. In their example response, it looks like the response object contains most of what is in the Issuing.Card
struct. Am I missing something?
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.
There is some overlap, but the CardDetails has a Card child object and then the sensitive attributes for :cvc and :number. I'm open to suggestions if it makes more sense to define the CardDetails struct and a retrieve_card_details
function in the Card module. I see them as distinct structs but concede that it might be unnecessary to have a separate module.
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.
@jcartwright Well I guess I am curious - if we limit the attributes to just these few, then won't we be discarding all of them that may come in the response?
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.
All of the common attributes are in the CardDetails :card
child element, so they are not discarded but simply nested.
- add required params on Card.create, Cardholder.create, and Dispute.create functions - add atom enums to typespecs and params
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 looks really good! Lots of great work in here. 💯
Adding the Stripe Issuing objects:
https://stripe.com/docs/api/issuing/authorizations
https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.yaml