Skip to content
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

Update Card.create to use Stripe.Request.create #221

Merged
merged 1 commit into from Mar 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions lib/stripe/card.ex
Expand Up @@ -101,11 +101,8 @@ defmodule Stripe.Card do
@spec create(source, String.t, String.t, Keyword.t) :: {:ok, t} | {:error, Stripe.api_error_struct}
def create(owner_type, owner_id, token, opts \\ []) do
endpoint = endpoint_for_owner(owner_type, owner_id)

to_create_body(owner_type, token)
|> Util.map_keys_to_atoms()
|> Stripe.request(:post, endpoint, %{}, opts)
|> Stripe.Request.handle_result(__MODULE__)
changes = to_create_body(owner_type, token)
Stripe.Request.create(endpoint, changes, @schema, opts)
end

@spec to_create_body(source, String.t) :: map
Expand Down