-
Notifications
You must be signed in to change notification settings - Fork 356
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 Stripe version #483
Merged
Merged
Changes from 15 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ffe75ce
Update Stripe version
snewcomer 5b6edf1
Update API version to March 2019
snewcomer 785ed17
Update Charge struct
snewcomer 60a9ce4
Update PaymentIntent struct
snewcomer a839c49
Update Invoice struct
snewcomer ac53ec8
fix err
snewcomer 061933d
improve invoice and add finalize method
snewcomer c6e6418
Update Accounts object with new version
snewcomer 176c229
add persons
dnsbty 7dacea5
use latest stripe-mock version
dnsbty b8b7a90
Merge branch 'master' into sn/update-deps-2
snewcomer f757286
Merge pull request #2 from dnsbty/add-persons-to-snewcomer
snewcomer ac2e766
Merge branch 'master' into sn/update-deps-2
snewcomer 3be44e4
fix invoice finalize test
snewcomer b9fd082
format doc
snewcomer cb02614
Merge branch 'master' into sn/update-deps-2
snewcomer 793d610
Merge branch 'master' into sn/update-deps-2
snewcomer 99d34dc
fix charge object warnings
snewcomer ef6d03e
add missing invoice fields
snewcomer 9f81847
fix error
snewcomer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,18 +20,49 @@ defmodule Stripe.Account do | |
cvc_failure: boolean | ||
} | ||
|
||
@type legal_entity :: %{ | ||
additional_owners: [legal_entity_additional_owner] | nil, | ||
address: legal_entity_address, | ||
address_kana: legal_entity_japan_address | nil, | ||
address_kanji: legal_entity_japan_address | nil, | ||
@type requirements :: %{ | ||
current_deadline: Stripe.timestamp() | nil, | ||
currently_due: Stripe.List.t(String.t()) | nil, | ||
disabled_reason: String.t() | nil, | ||
eventually_due: Stripe.List.t(String.t()) | nil, | ||
past_due: Stripe.List.t(String.t()) | nil | ||
} | ||
|
||
@type settings :: %{ | ||
branding: map | nil, | ||
card_payments: map | nil, | ||
dashboard: map | nil, | ||
payments: map | nil, | ||
payouts: map | nil | ||
} | ||
|
||
@type company :: %{ | ||
address: Stripe.Types.address(), | ||
address_kana: Stripe.Types.japan_address() | nil, | ||
address_kanji: Stripe.Types.japan_address() | nil, | ||
directors_provided: boolean | nil, | ||
name: String.t() | nil, | ||
name_kana: String.t() | nil, | ||
name_kanji: String.t() | nil, | ||
owners_provided: boolean | nil, | ||
phone: String.t() | nil, | ||
tax_id_provided: boolean | nil, | ||
tax_id_registar: String.t(), | ||
vat_id_provided: boolean | nil | ||
} | ||
|
||
@type individual :: %{ | ||
additional_owners: [individual_additional_owner] | nil, | ||
address: Stripe.Types.address(), | ||
address_kana: Stripe.Types.japan_address() | nil, | ||
address_kanji: Stripe.Types.japan_address() | nil, | ||
business_name: String.t() | nil, | ||
business_name_kana: String.t() | nil, | ||
business_name_kanji: String.t() | nil, | ||
business_tax_id_provided: boolean, | ||
business_vat_id_provided: boolean, | ||
deleted: boolean | nil, | ||
dob: legal_entity_dob, | ||
dob: Stripe.Types.dob(), | ||
first_name: String.t() | nil, | ||
first_name_kana: String.t() | nil, | ||
first_name_kanji: String.t() | nil, | ||
|
@@ -40,52 +71,27 @@ defmodule Stripe.Account do | |
last_name_kana: String.t() | nil, | ||
last_name_kanji: String.t() | nil, | ||
maiden_name: String.t() | nil, | ||
personal_address: legal_entity_address, | ||
personal_address_kana: legal_entity_japan_address | nil, | ||
personal_address_kanji: legal_entity_japan_address | nil, | ||
personal_address: Stripe.Types.address(), | ||
personal_address_kana: Stripe.Types.japan_address() | nil, | ||
personal_address_kanji: Stripe.Types.japan_address() | nil, | ||
personal_id_number_provided: boolean, | ||
phone_number: String.t() | nil, | ||
ssn_last_4_provided: String.t(), | ||
tax_id_registar: String.t(), | ||
type: String.t() | nil, | ||
verification: legal_entity_verification | ||
verification: individual_verification | ||
} | ||
|
||
@type legal_entity_additional_owner :: %{ | ||
address: legal_entity_address, | ||
dob: legal_entity_dob, | ||
@type individual_additional_owner :: %{ | ||
address: Stripe.Types.address(), | ||
dob: Stripe.Types.dob(), | ||
first_name: String.t() | nil, | ||
last_name: String.t() | nil, | ||
maiden_name: String.t() | nil, | ||
verification: legal_entity_verification | ||
verification: individual_verification | ||
} | ||
|
||
@type legal_entity_address :: %{ | ||
city: String.t() | nil, | ||
country: String.t() | nil, | ||
line1: String.t() | nil, | ||
line2: String.t() | nil, | ||
postal_code: String.t() | nil, | ||
state: String.t() | nil | ||
} | ||
|
||
@type legal_entity_dob :: %{ | ||
day: 1..31 | nil, | ||
month: 1..12 | nil, | ||
year: pos_integer | nil | ||
} | ||
|
||
@type legal_entity_japan_address :: %{ | ||
city: String.t() | nil, | ||
country: String.t() | nil, | ||
line1: String.t() | nil, | ||
line2: String.t() | nil, | ||
postal_code: String.t() | nil, | ||
state: String.t() | nil, | ||
town: String.t() | nil | ||
} | ||
|
||
@type legal_entity_verification :: %{ | ||
@type individual_verification :: %{ | ||
details: String.t() | nil, | ||
details_code: String.t() | nil, | ||
document: Stripe.id() | Stripe.FileUpload.t() | nil, | ||
|
@@ -104,106 +110,97 @@ defmodule Stripe.Account do | |
fields_needed: [String.t()] | ||
} | ||
|
||
@type business_profile :: %{ | ||
mcc: String.t() | nil, | ||
name: String.t() | nil, | ||
product_description: String.t() | nil, | ||
support_address: %{ | ||
city: String.t() | nil, | ||
country: String.t() | nil, | ||
line1: String.t() | nil, | ||
line2: String.t() | nil, | ||
postal_code: String.t() | nil, | ||
state: String.t() | nil | ||
}, | ||
support_email: String.t() | nil, | ||
support_phone: String.t() | nil, | ||
support_url: String.t() | nil, | ||
url: String.t() | nil | ||
} | ||
|
||
@type capabilities :: %{ | ||
card_payments: String.t() | nil, | ||
legacy_payments: String.t() | nil, | ||
platform_payments: String.t() | nil | ||
} | ||
|
||
@type t :: %__MODULE__{ | ||
id: Stripe.id(), | ||
object: String.t(), | ||
business_logo: String.t() | nil, | ||
business_name: String.t() | nil, | ||
business_url: String.t() | nil, | ||
business_profile: business_profile | nil, | ||
business_type: String.t() | nil, | ||
capabilities: capabilities | nil, | ||
charges_enabled: boolean, | ||
created: Stripe.timestamp() | nil, | ||
company: company | nil, | ||
country: String.t(), | ||
debit_negative_balances: boolean, | ||
decline_charge_on: decline_charge_on, | ||
created: Stripe.timestamp() | nil, | ||
default_currency: String.t(), | ||
details_submitted: boolean, | ||
display_name: String.t() | nil, | ||
email: String.t() | nil, | ||
external_accounts: Stripe.List.t(Stripe.BankAccount.t() | Stripe.Card.t()), | ||
legal_entity: legal_entity, | ||
individual: individual | nil, | ||
metadata: Stripe.Types.metadata(), | ||
payout_schedule: Stripe.Types.transfer_schedule(), | ||
payout_statement_descriptor: String.t() | nil, | ||
payouts_enabled: boolean, | ||
product_description: String.t() | nil, | ||
statement_descriptor: String.t() | nil, | ||
support_email: String.t() | nil, | ||
support_phone: String.t() | nil, | ||
timezone: String.t() | nil, | ||
tos_acceptance: tos_acceptance, | ||
type: String.t(), | ||
verification: verification | ||
payouts_enabled: boolean | nil, | ||
requirements: requirements | nil, | ||
settings: settings | nil, | ||
tos_acceptance: tos_acceptance | nil, | ||
type: String.t() | ||
} | ||
|
||
defstruct [ | ||
:id, | ||
:object, | ||
:business_logo, | ||
:business_name, | ||
:business_url, | ||
:business_profile, | ||
:business_type, | ||
:capabilities, | ||
:charges_enabled, | ||
:company, | ||
:country, | ||
:created, | ||
:debit_negative_balances, | ||
:decline_charge_on, | ||
:default_currency, | ||
:deleted, | ||
:details_submitted, | ||
:display_name, | ||
:email, | ||
:external_accounts, | ||
:legal_entity, | ||
:individual, | ||
:metadata, | ||
:payout_schedule, | ||
:payout_statement_descriptor, | ||
:payouts_enabled, | ||
:product_description, | ||
:statement_descriptor, | ||
:support_email, | ||
:support_phone, | ||
:timezone, | ||
:requirements, | ||
:settings, | ||
:tos_acceptance, | ||
:transfers_enabled, | ||
:type, | ||
:verification | ||
:type | ||
] | ||
|
||
@singular_endpoint "account" | ||
@plural_endpoint "accounts" | ||
|
||
@type create_params :: %{ | ||
:type => String.t(), | ||
optional(:account_token) => String.t(), | ||
optional(:business_logo) => String.t(), | ||
optional(:business_name) => String.t(), | ||
optional(:business_primary_color) => String.t(), | ||
optional(:business_url) => String.t(), | ||
optional(:country) => String.t(), | ||
optional(:debit_negative_balances) => boolean, | ||
optional(:decline_charge_on) => decline_charge_on, | ||
optional(:default_currency) => String.t(), | ||
optional(:email) => String.t(), | ||
optional(:external_account) => String.t(), | ||
optional(:legal_entity) => legal_entity, | ||
optional(:metadata) => Stripe.Types.metadata(), | ||
optional(:payout_schedule) => Stripe.Types.transfer_schedule(), | ||
optional(:payout_statement_descriptor) => String.t(), | ||
optional(:product_description) => String.t(), | ||
optional(:statement_descriptor) => String.t(), | ||
optional(:support_email) => String.t(), | ||
optional(:support_phone) => String.t(), | ||
optional(:support_url) => String.t(), | ||
optional(:tos_acceptance) => tos_acceptance | ||
} | ||
|
||
@doc """ | ||
Create an account. | ||
""" | ||
@spec create(params, Stripe.options()) :: {:ok, t} | {:error, Stripe.Error.t()} | ||
when params: %{ | ||
:type => String.t(), | ||
optional(:country) => String.t(), | ||
optional(:account_token) => String.t(), | ||
optional(:business_profile) => business_profile, | ||
optional(:business_type) => String.t(), | ||
optional(:company) => company, | ||
optional(:email) => String.t(), | ||
optional(:type) => String.t() | ||
optional(:external_account) => String.t(), | ||
optional(:individual) => individual, | ||
optional(:metadata) => Stripe.Types.metadata(), | ||
optional(:requested_capabilities) => capabilities, | ||
optional(:settings) => settings, | ||
optional(:tos_acceptance) => tos_acceptance | ||
} | ||
def create(params, opts \\ []) do | ||
new_request(opts) | ||
|
@@ -240,55 +237,24 @@ defmodule Stripe.Account do | |
|> make_request() | ||
end | ||
|
||
@type update_params :: %{ | ||
optional(:account_token) => String.t(), | ||
optional(:business_logo) => String.t(), | ||
optional(:business_name) => String.t(), | ||
optional(:business_primary_color) => String.t(), | ||
optional(:business_url) => String.t(), | ||
optional(:country) => String.t(), | ||
optional(:debit_negative_balances) => boolean, | ||
optional(:decline_charge_on) => decline_charge_on, | ||
optional(:default_currency) => String.t(), | ||
optional(:email) => String.t(), | ||
optional(:external_account) => String.t(), | ||
optional(:legal_entity) => legal_entity, | ||
optional(:metadata) => Stripe.Types.metadata(), | ||
optional(:payout_schedule) => Stripe.Types.transfer_schedule(), | ||
optional(:payout_statement_descriptor) => String.t(), | ||
optional(:product_description) => String.t(), | ||
optional(:statement_descriptor) => String.t(), | ||
optional(:support_email) => String.t(), | ||
optional(:support_phone) => String.t(), | ||
optional(:support_url) => String.t(), | ||
optional(:tos_acceptance) => tos_acceptance | ||
} | ||
|
||
@doc """ | ||
Update an account. | ||
Takes the `id` and a map of changes. | ||
""" | ||
@spec update(Stripe.id() | t, params, Stripe.options()) :: {:ok, t} | {:error, Stripe.Error.t()} | ||
when params: %{ | ||
optional(:business_logo) => String.t(), | ||
optional(:business_name) => String.t(), | ||
optional(:business_primary_color) => String.t(), | ||
optional(:business_url) => String.t(), | ||
optional(:double_negative_balances) => boolean, | ||
optional(:decline_charge_on) => decline_charge_on, | ||
optional(:account_token) => String.t(), | ||
optional(:business_profile) => business_profile, | ||
optional(:business_type) => String.t(), | ||
optional(:company) => company, | ||
optional(:default_currency) => String.t(), | ||
optional(:email) => String.t(), | ||
optional(:external_accounts) => String.t(), | ||
optional(:legal_entity) => legal_entity, | ||
optional(:individual) => individual, | ||
optional(:metadata) => Stripe.Types.metadata(), | ||
optional(:payout_schedule) => Stripe.Types.transfer_schedule(), | ||
optional(:payout_statement_descriptor) => String.t(), | ||
optional(:product_description) => String.t(), | ||
optional(:statement_descriptor) => String.t(), | ||
optional(:support_phone) => String.t(), | ||
optional(:support_email) => String.t(), | ||
optional(:support_url) => String.t(), | ||
optional(:requested_capabilities) => capabilities, | ||
optional(:settings) => settings, | ||
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. major |
||
optional(:tos_acceptance) => tos_acceptance | ||
} | ||
def update(id, params, opts \\ []) do | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The
deleted
key seems to be missing hereThere 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.
Where do you see this? (just making sure we are both looking at the same documentation)
https://stripe.com/docs/api/accounts/object
https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.yaml
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.
Hmm, I ran the tests against the stripe-mock and got this warning
[warn] Extra keys were received but ignored when converting Stripe.Account: [:deleted]
But it seems the
deleted
is only added to the response in the test for theAccount.delete/2
function.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.
Seems
Account.delete/2
returns the deleted account but that is no more than this in JSONWe may need a different pattern to deal with deletes of this kind.