Skip to content

Commit

Permalink
Upgrade to 2018-11-08 Stripe API (beam-community#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer authored Jan 18, 2019
1 parent 0edafb8 commit 6aae1e8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The actively developed line of releases is `2.x.x` and is contained within the `
------------ | -------------
`2.0.x` | `2018-02-28`
`2.1.x - 2.2.x` | `2018-05-21`
`master` | `2018-08-23`
`master` | `2018-11-08`

# Documentation

Expand Down
2 changes: 1 addition & 1 deletion lib/stripe/api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule Stripe.API do
@typep http_failure :: {:error, term}

@pool_name __MODULE__
@api_version "2018-08-23"
@api_version "2018-11-08"

@doc """
In config.exs your implicit or expicit configuration is:
Expand Down
18 changes: 9 additions & 9 deletions lib/stripe/converter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ defmodule Stripe.Converter do
dispute
event
external_account
file_upload
file
invoice
invoiceitem
line_item
Expand Down Expand Up @@ -78,16 +78,16 @@ defmodule Stripe.Converter do
processed_map =
struct_keys
|> Enum.reduce(%{}, fn key, acc ->
string_key = to_string(key)
string_key = to_string(key)

converted_value =
case string_key do
string_key when string_key in @no_convert_maps -> Map.get(value, string_key)
_ -> Map.get(value, string_key) |> convert_value()
end
converted_value =
case string_key do
string_key when string_key in @no_convert_maps -> Map.get(value, string_key)
_ -> Map.get(value, string_key) |> convert_value()
end

Map.put(acc, key, converted_value)
end)
Map.put(acc, key, converted_value)
end)
|> module.__from_json__()

struct(module, processed_map)
Expand Down
2 changes: 1 addition & 1 deletion lib/stripe/core_resources/file_upload.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule Stripe.FileUpload do
- Retrieve a file
- List all files
Stripe API reference: https://stripe.com/docs/api#file_uploads
Stripe API reference: https://stripe.com/docs/api/files
"""

use Stripe.Entity
Expand Down
4 changes: 1 addition & 3 deletions lib/stripe/subscriptions/invoice.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ defmodule Stripe.Invoice do
billing: String.t() | nil,
billing_reason: String.t() | nil,
charge: Stripe.id() | Stripe.Charge.t() | nil,
closed: boolean,
currency: String.t(),
custom_fields: custom_fields() | nil,
customer: Stripe.id() | Stripe.Customer.t(),
Expand Down Expand Up @@ -89,7 +88,6 @@ defmodule Stripe.Invoice do
:billing,
:billing_reason,
:charge,
:closed,
:currency,
:custom_fields,
:customer,
Expand Down Expand Up @@ -176,7 +174,7 @@ defmodule Stripe.Invoice do
when params:
%{
optional(:application_fee) => integer,
optional(:closed) => boolean,
optional(:auto_advance) => boolean,
optional(:days_until_due) => integer,
optional(:default_source) => String.t(),
optional(:description) => String.t(),
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/util.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ defmodule Stripe.Util do
def atomize_key(k), do: k

@spec object_name_to_module(String.t()) :: module
def object_name_to_module("file"), do: object_name_to_module("file_upload")
def object_name_to_module(object_name) do
module_name =
object_name
Expand Down
2 changes: 1 addition & 1 deletion test/stripe/util_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule Stripe.UtilTest do
assert object_name_to_module("dispute") == Stripe.Dispute
assert object_name_to_module("event") == Stripe.Event
assert object_name_to_module("external_account") == Stripe.ExternalAccount
assert object_name_to_module("file_upload") == Stripe.FileUpload
assert object_name_to_module("file") == Stripe.FileUpload
assert object_name_to_module("invoice") == Stripe.Invoice
assert object_name_to_module("invoiceitem") == Stripe.Invoiceitem
assert object_name_to_module("line_item") == Stripe.LineItem
Expand Down

0 comments on commit 6aae1e8

Please sign in to comment.