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

Fix for getting account by id #786

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 51 additions & 9 deletions lib/generated/account.ex
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ defmodule Stripe.Account do
)

(
@typedoc "The Kanji variation of the the individual's primary address (Japan only)."
@typedoc "The Kanji variation of the company's primary address (Japan only)."
@type address_kanji :: %{
optional(:city) => binary,
optional(:country) => binary,
Expand Down Expand Up @@ -216,8 +216,8 @@ defmodule Stripe.Account do
)

(
@typedoc "Settings specific to the account's use of the Card Issuing product."
@type card_issuing :: %{optional(:tos_acceptance) => tos_acceptance}
@typedoc "The card_issuing capability."
@type card_issuing :: %{optional(:requested) => boolean}
)

(
Expand Down Expand Up @@ -570,11 +570,12 @@ defmodule Stripe.Account do
)

(
@typedoc "Details on the account's acceptance of the Stripe Treasury Services Agreement."
@typedoc "Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance)."
@type tos_acceptance :: %{
optional(:date) => integer,
optional(:ip) => binary,
optional(:user_agent) => binary | binary
optional(:service_agreement) => binary,
optional(:user_agent) => binary
}
)

Expand All @@ -584,8 +585,8 @@ defmodule Stripe.Account do
)

(
@typedoc "The treasury capability."
@type treasury :: %{optional(:requested) => boolean}
@typedoc "Settings specific to the account's Treasury FinancialAccounts."
@type treasury :: %{optional(:tos_acceptance) => tos_acceptance}
)

(
Expand All @@ -611,9 +612,9 @@ defmodule Stripe.Account do

@doc "<p>Retrieves the details of an account.</p>\n\n#### Details\n\n * Method: `get`\n * Path: `/v1/account`\n"
(
@spec retrieve(params :: %{optional(:expand) => list(binary)}, opts :: Keyword.t()) ::
@spec show(params :: %{optional(:expand) => list(binary)}, opts :: Keyword.t()) ::
{:ok, Stripe.Account.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
def retrieve(params \\ %{}, opts \\ []) do
def show(params \\ %{}, opts \\ []) do
path = Stripe.OpenApi.Path.replace_path_params("/v1/account", [], [])

Stripe.Request.new_request(opts)
Expand All @@ -625,6 +626,47 @@ defmodule Stripe.Account do
)
)

(
nil

@doc "<p>Retrieves the details of an account.</p>\n\n#### Details\n\n * Method: `get`\n * Path: `/v1/accounts/{account}`\n"
(
@spec retrieve(
account :: binary(),
params :: %{optional(:expand) => list(binary)},
opts :: Keyword.t()
) :: {:ok, Stripe.Account.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
def retrieve(account, params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/accounts/{account}",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "account",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "account",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
}
],
[account]
)

Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:get)
|> Stripe.Request.make_request()
end
)
)

(
nil

Expand Down
147 changes: 143 additions & 4 deletions lib/generated/bank_account.ex
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ defmodule Stripe.BankAccount do
}
)

(
@typedoc "One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check."
@type bank_account_ownership_verification :: %{optional(:files) => list(binary)}
)

(
@typedoc "Documents that may be submitted to satisfy various informational requests."
@type documents :: %{
optional(:bank_account_ownership_verification) => bank_account_ownership_verification
}
)

(
@typedoc nil
@type owner :: %{
Expand All @@ -76,7 +88,7 @@ defmodule Stripe.BankAccount do

@doc "<p>Update a specified source for a given customer.</p>\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/customers/{customer}/sources/{id}`\n"
(
@spec update(
@spec update_source(
customer :: binary(),
id :: binary(),
params :: %{
Expand All @@ -100,7 +112,7 @@ defmodule Stripe.BankAccount do
{:ok, Stripe.Card.t() | Stripe.BankAccount.t() | Stripe.Source.t()}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def update(customer, id, params \\ %{}, opts \\ []) do
def update_source(customer, id, params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/customers/{customer}/sources/{id}",
Expand Down Expand Up @@ -149,7 +161,7 @@ defmodule Stripe.BankAccount do

@doc "<p>Delete a specified source for a given customer.</p>\n\n#### Details\n\n * Method: `delete`\n * Path: `/v1/customers/{customer}/sources/{id}`\n"
(
@spec delete(
@spec delete_source(
customer :: binary(),
id :: binary(),
params :: %{optional(:expand) => list(binary)},
Expand All @@ -158,7 +170,7 @@ defmodule Stripe.BankAccount do
{:ok, Stripe.PaymentSource.t() | Stripe.DeletedPaymentSource.t()}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def delete(customer, id, params \\ %{}, opts \\ []) do
def delete_source(customer, id, params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/customers/{customer}/sources/{id}",
Expand Down Expand Up @@ -256,4 +268,131 @@ defmodule Stripe.BankAccount do
end
)
)

(
nil

@doc "<p>Updates the metadata, account holder name, account holder type of a bank account belonging to a <a href=\"/docs/connect/custom-accounts\">Custom account</a>, and optionally sets it as the default for its currency. Other bank account details are not editable by design.</p>\n\n<p>You can re-enable a disabled bank account by performing an update call without providing any arguments or changes.</p>\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/accounts/{account}/external_accounts/{id}`\n"
(
@spec update_external_account(
account :: binary(),
id :: binary(),
params :: %{
optional(:account_holder_name) => binary,
optional(:account_holder_type) => :company | :individual,
optional(:account_type) => :checking | :futsu | :savings | :toza,
optional(:address_city) => binary,
optional(:address_country) => binary,
optional(:address_line1) => binary,
optional(:address_line2) => binary,
optional(:address_state) => binary,
optional(:address_zip) => binary,
optional(:default_for_currency) => boolean,
optional(:documents) => documents,
optional(:exp_month) => binary,
optional(:exp_year) => binary,
optional(:expand) => list(binary),
optional(:metadata) => %{optional(binary) => binary} | binary,
optional(:name) => binary
},
opts :: Keyword.t()
) ::
{:ok, Stripe.ExternalAccount.t()}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def update_external_account(account, id, params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/accounts/{account}/external_accounts/{id}",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "account",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "account",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
},
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "id",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "id",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
}
],
[account, id]
)

Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:post)
|> Stripe.Request.make_request()
end
)
)

(
nil

@doc "<p>Delete a specified external account for a given account.</p>\n\n#### Details\n\n * Method: `delete`\n * Path: `/v1/accounts/{account}/external_accounts/{id}`\n"
(
@spec delete_external_account(account :: binary(), id :: binary(), opts :: Keyword.t()) ::
{:ok, Stripe.DeletedExternalAccount.t()}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def delete_external_account(account, id, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/accounts/{account}/external_accounts/{id}",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "account",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "account",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
},
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "id",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "id",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
}
],
[account, id]
)

Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_method(:delete)
|> Stripe.Request.make_request()
end
)
)
end
Loading
Loading