Skip to content

Commit

Permalink
chore: add manual mapping of operation func name (#852)
Browse files Browse the repository at this point in the history
  • Loading branch information
yordis authored Aug 22, 2024
1 parent 50ff9fc commit a98fa6d
Show file tree
Hide file tree
Showing 10 changed files with 761 additions and 47 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
CURRENT_VERSION := $(shell cat .latest-tag-stripe-openapi-sdk)

download-openapi-current:
@echo "Tag: $(CURRENT_VERSION)"
@echo "Downloading https://raw.githubusercontent.com/stripe/openapi/$(CURRENT_VERSION)/openapi/spec3.sdk.json to ./priv/openapi/spec3.sdk.json"
@curl -o ./priv/openapi/spec3.sdk.json https://raw.githubusercontent.com/stripe/openapi/$(CURRENT_VERSION)/openapi/spec3.sdk.json

generate:
mix stripe.generate
mix format

gen-changelog:
npx auto-changelog --unreleased

Expand Down
13 changes: 7 additions & 6 deletions lib/generated/account.ex
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ defmodule Stripe.Account do
)

(
@typedoc "The company's primary address."
@typedoc "The individual's primary address."
@type address :: %{
optional(:city) => binary,
optional(:country) => binary,
Expand Down Expand Up @@ -338,7 +338,7 @@ defmodule Stripe.Account do
)

(
@typedoc "An identifying document, either a passport or local ID card."
@typedoc "A document verifying the business."
@type document :: %{optional(:back) => binary, optional(:front) => binary}
)

Expand Down Expand Up @@ -583,11 +583,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 @@ -597,8 +598,8 @@ defmodule Stripe.Account do
)

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

(
Expand Down
10 changes: 9 additions & 1 deletion lib/generated/checkout__session.ex
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,15 @@ defmodule Stripe.Checkout.Session do

(
@typedoc nil
@type custom_fields :: %{optional(:name) => binary, optional(:value) => binary}
@type custom_fields :: %{
optional(:dropdown) => dropdown,
optional(:key) => binary,
optional(:label) => label,
optional(:numeric) => numeric,
optional(:optional) => boolean,
optional(:text) => text,
optional(:type) => :dropdown | :numeric | :text
}
)

(
Expand Down
28 changes: 11 additions & 17 deletions lib/generated/payment_intent.ex
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ defmodule Stripe.PaymentIntent do
)

(
@typedoc "If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method."
@typedoc nil
@type acss_debit :: %{
optional(:account_number) => binary,
optional(:institution_number) => binary,
optional(:transit_number) => binary
optional(:mandate_options) => mandate_options,
optional(:setup_future_usage) => :none | :off_session | :on_session,
optional(:verification_method) => :automatic | :instant | :microdeposits
}
)

(
@typedoc "Shipping address."
@typedoc nil
@type address :: %{
optional(:city) => binary,
optional(:country) => binary,
Expand Down Expand Up @@ -149,8 +149,8 @@ defmodule Stripe.PaymentIntent do
)

(
@typedoc nil
@type bacs_debit :: %{optional(:setup_future_usage) => :none | :off_session | :on_session}
@typedoc "If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account."
@type bacs_debit :: %{optional(:account_number) => binary, optional(:sort_code) => binary}
)

(
Expand Down Expand Up @@ -664,11 +664,8 @@ defmodule Stripe.PaymentIntent do
)

(
@typedoc nil
@type sepa_debit :: %{
optional(:mandate_options) => map(),
optional(:setup_future_usage) => :none | :off_session | :on_session
}
@typedoc "If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account."
@type sepa_debit :: %{optional(:iban) => binary}
)

(
Expand All @@ -683,11 +680,8 @@ defmodule Stripe.PaymentIntent do
)

(
@typedoc nil
@type sofort :: %{
optional(:preferred_language) => :de | :en | :es | :fr | :it | :nl | :pl,
optional(:setup_future_usage) => :none | :off_session
}
@typedoc "If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method."
@type sofort :: %{optional(:country) => :AT | :BE | :DE | :ES | :IT | :NL}
)

(
Expand Down
10 changes: 9 additions & 1 deletion lib/generated/payment_link.ex
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,15 @@ defmodule Stripe.PaymentLink do

(
@typedoc nil
@type custom_fields :: %{optional(:name) => binary, optional(:value) => binary}
@type custom_fields :: %{
optional(:dropdown) => dropdown,
optional(:key) => binary,
optional(:label) => label,
optional(:numeric) => numeric,
optional(:optional) => boolean,
optional(:text) => text,
optional(:type) => :dropdown | :numeric | :text
}
)

(
Expand Down
23 changes: 8 additions & 15 deletions lib/generated/setup_intent.ex
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,7 @@ defmodule Stripe.SetupIntent do

(
@typedoc "Additional fields for Mandate creation"
@type mandate_options :: %{
optional(:custom_mandate_url) => binary | binary,
optional(:default_for) => list(:invoice | :subscription),
optional(:interval_description) => binary,
optional(:payment_schedule) => :combined | :interval | :sporadic,
optional(:transaction_type) => :business | :personal
}
@type mandate_options :: %{optional(:collection_method) => :paper}
)

(
Expand Down Expand Up @@ -441,8 +435,8 @@ defmodule Stripe.SetupIntent do
)

(
@typedoc "If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options."
@type sepa_debit :: %{optional(:mandate_options) => map()}
@typedoc "If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account."
@type sepa_debit :: %{optional(:iban) => binary}
)

(
Expand All @@ -469,13 +463,12 @@ defmodule Stripe.SetupIntent do
)

(
@typedoc "If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method."
@typedoc "If this is a `us_bank_account` SetupIntent, this sub-hash contains details about the US bank account payment method options."
@type us_bank_account :: %{
optional(:account_holder_type) => :company | :individual,
optional(:account_number) => binary,
optional(:account_type) => :checking | :savings,
optional(:financial_connections_account) => binary,
optional(:routing_number) => binary
optional(:financial_connections) => financial_connections,
optional(:mandate_options) => mandate_options,
optional(:networks) => networks,
optional(:verification_method) => :automatic | :instant | :microdeposits
}
)

Expand Down
6 changes: 3 additions & 3 deletions lib/generated/token.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule Stripe.Token do
)

(
@typedoc "The company's primary address."
@typedoc "The person's address."
@type address :: %{
optional(:city) => binary,
optional(:country) => binary,
Expand All @@ -64,7 +64,7 @@ defmodule Stripe.Token do
)

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

(
@typedoc "An identifying document, either a passport or local ID card."
@typedoc "A document verifying the business."
@type document :: %{optional(:back) => binary, optional(:front) => binary}
)

Expand Down
2 changes: 1 addition & 1 deletion lib/mix/tasks/generate.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Mix.Tasks.Stripe.Generate do
@moduledoc "The hello mix task: `mix help hello`"
@moduledoc "The hello mix task: `mix stripe.generate`"
use Mix.Task

def run(_) do
Expand Down
Loading

0 comments on commit a98fa6d

Please sign in to comment.