Skip to content

Commit

Permalink
Update services based on v665 of Stripe OpenApi SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow committed Nov 16, 2023
1 parent c831e9f commit 2b569da
Show file tree
Hide file tree
Showing 10 changed files with 801 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .latest-tag-stripe-openapi-sdk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v659
v665
24 changes: 13 additions & 11 deletions lib/generated/account.ex
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ defmodule Stripe.Account do
)

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

(
@typedoc "The card_payments capability."
@type card_payments :: %{optional(:requested) => boolean}
@typedoc "Settings specific to card charging on the account."
@type card_payments :: %{
optional(:decline_on) => decline_on,
optional(:statement_descriptor_prefix) => binary,
optional(:statement_descriptor_prefix_kana) => binary | binary,
optional(:statement_descriptor_prefix_kanji) => binary | binary
}
)

(
Expand Down Expand Up @@ -333,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 @@ -591,8 +596,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 All @@ -601,11 +606,8 @@ defmodule Stripe.Account do
)

(
@typedoc "The individual's verification document information."
@type verification :: %{
optional(:additional_document) => additional_document,
optional(:document) => document
}
@typedoc "Information on the verification state of the company."
@type verification :: %{optional(:document) => document}
)

(
Expand Down
7 changes: 2 additions & 5 deletions lib/generated/checkout__session.ex
Original file line number Diff line number Diff line change
Expand Up @@ -956,11 +956,8 @@ defmodule Stripe.Checkout.Session do
)

(
@typedoc "If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges."
@type transfer_data :: %{
optional(:amount_percent) => number,
optional(:destination) => binary
}
@typedoc "The parameters used to automatically create a Transfer when the payment succeeds.\nFor more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts)."
@type transfer_data :: %{optional(:amount) => integer, optional(:destination) => binary}
)

(
Expand Down
10 changes: 10 additions & 0 deletions lib/generated/credit_note.ex
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ defmodule Stripe.CreditNote do
optional(:description) => binary,
optional(:invoice_line_item) => binary,
optional(:quantity) => integer,
optional(:tax_amounts) => list(tax_amounts) | binary,
optional(:tax_rates) => list(binary) | binary,
optional(:type) => :custom_line_item | :invoice_line_item,
optional(:unit_amount) => integer,
Expand All @@ -90,6 +91,15 @@ defmodule Stripe.CreditNote do
@type shipping_cost :: %{optional(:shipping_rate) => binary}
)

(
@typedoc nil
@type tax_amounts :: %{
optional(:amount) => integer,
optional(:tax_rate) => binary,
optional(:taxable_amount) => integer
}
)

(
nil

Expand Down
4 changes: 3 additions & 1 deletion lib/generated/issuing__transaction.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ defmodule Stripe.Issuing.Transaction do
:merchant_currency,
:merchant_data,
:metadata,
:network_data,
:object,
:purchase_details,
:token,
Expand All @@ -27,7 +28,7 @@ defmodule Stripe.Issuing.Transaction do
:wallet
]

@typedoc "The `issuing.transaction` type.\n\n * `amount` The transaction amount, which will be reflected in your balance. This amount is in your currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).\n * `amount_details` Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).\n * `authorization` The `Authorization` object that led to this transaction.\n * `balance_transaction` ID of the [balance transaction](https://stripe.com/docs/api/balance_transactions) associated with this transaction.\n * `card` The card used to make this transaction.\n * `cardholder` The cardholder to whom this transaction belongs.\n * `created` Time at which the object was created. Measured in seconds since the Unix epoch.\n * `currency` Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).\n * `dispute` If you've disputed the transaction, the ID of the dispute.\n * `id` Unique identifier for the object.\n * `livemode` Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.\n * `merchant_amount` The amount that the merchant will receive, denominated in `merchant_currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). It will be different from `amount` if the merchant is taking payment in a different currency.\n * `merchant_currency` The currency with which the merchant is taking payment.\n * `merchant_data` \n * `metadata` Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.\n * `object` String representing the object's type. Objects of the same type share the same value.\n * `purchase_details` Additional purchase information that is optionally provided by the merchant.\n * `token` [Token](https://stripe.com/docs/api/issuing/tokens/object) object used for this transaction. If a network token was not used for this transaction, this field will be null.\n * `treasury` [Treasury](https://stripe.com/docs/api/treasury) details related to this transaction if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts\n * `type` The nature of the transaction.\n * `wallet` The digital wallet used for this transaction. One of `apple_pay`, `google_pay`, or `samsung_pay`.\n"
@typedoc "The `issuing.transaction` type.\n\n * `amount` The transaction amount, which will be reflected in your balance. This amount is in your currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).\n * `amount_details` Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).\n * `authorization` The `Authorization` object that led to this transaction.\n * `balance_transaction` ID of the [balance transaction](https://stripe.com/docs/api/balance_transactions) associated with this transaction.\n * `card` The card used to make this transaction.\n * `cardholder` The cardholder to whom this transaction belongs.\n * `created` Time at which the object was created. Measured in seconds since the Unix epoch.\n * `currency` Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).\n * `dispute` If you've disputed the transaction, the ID of the dispute.\n * `id` Unique identifier for the object.\n * `livemode` Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.\n * `merchant_amount` The amount that the merchant will receive, denominated in `merchant_currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). It will be different from `amount` if the merchant is taking payment in a different currency.\n * `merchant_currency` The currency with which the merchant is taking payment.\n * `merchant_data` \n * `metadata` Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.\n * `network_data` Details about the transaction, such as processing dates, set by the card network.\n * `object` String representing the object's type. Objects of the same type share the same value.\n * `purchase_details` Additional purchase information that is optionally provided by the merchant.\n * `token` [Token](https://stripe.com/docs/api/issuing/tokens/object) object used for this transaction. If a network token was not used for this transaction, this field will be null.\n * `treasury` [Treasury](https://stripe.com/docs/api/treasury) details related to this transaction if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts\n * `type` The nature of the transaction.\n * `wallet` The digital wallet used for this transaction. One of `apple_pay`, `google_pay`, or `samsung_pay`.\n"
@type t :: %__MODULE__{
amount: integer,
amount_details: term | nil,
Expand All @@ -44,6 +45,7 @@ defmodule Stripe.Issuing.Transaction do
merchant_currency: binary,
merchant_data: term,
metadata: term,
network_data: term | nil,
object: binary,
purchase_details: term | nil,
token: (binary | Stripe.Issuing.Token.t()) | nil,
Expand Down
137 changes: 137 additions & 0 deletions lib/generated/line_item.ex
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,75 @@ defmodule Stripe.LineItem do
}
)

(
@typedoc nil
@type discounts :: %{optional(:coupon) => binary, optional(:discount) => binary}
)

(
@typedoc "The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details."
@type period :: %{optional(:end) => integer, optional(:start) => integer}
)

(
@typedoc "Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline."
@type price_data :: %{
optional(:currency) => binary,
optional(:product) => binary,
optional(:product_data) => product_data,
optional(:tax_behavior) => :exclusive | :inclusive | :unspecified,
optional(:unit_amount) => integer,
optional(:unit_amount_decimal) => binary
}
)

(
@typedoc "Data used to generate a new product object inline. One of `product` or `product_data` is required."
@type product_data :: %{
optional(:description) => binary,
optional(:images) => list(binary),
optional(:metadata) => %{optional(binary) => binary},
optional(:name) => binary,
optional(:tax_code) => binary
}
)

(
@typedoc nil
@type tax_amounts :: %{
optional(:amount) => integer,
optional(:tax_rate_data) => tax_rate_data,
optional(:taxable_amount) => integer
}
)

(
@typedoc "Data to find or create a TaxRate object.\n\nStripe automatically creates or reuses a TaxRate object for each tax amount. If the `tax_rate_data` exactly matches a previous value, Stripe will reuse the TaxRate object. TaxRate objects created automatically by Stripe are immediately archived, do not appear in the line item’s `tax_rates`, and cannot be directly added to invoices, payments, or line items."
@type tax_rate_data :: %{
optional(:country) => binary,
optional(:description) => binary,
optional(:display_name) => binary,
optional(:inclusive) => boolean,
optional(:jurisdiction) => binary,
optional(:percentage) => number,
optional(:state) => binary,
optional(:tax_type) =>
:amusement_tax
| :communications_tax
| :gst
| :hst
| :igst
| :jct
| :lease_tax
| :pst
| :qst
| :rst
| :sales_tax
| :service_tax
| :vat
}
)

(
nil

Expand Down Expand Up @@ -106,4 +175,72 @@ defmodule Stripe.LineItem do
end
)
)

(
nil

@doc "<p>Updates an invoice’s line item. Some fields, such as <code>tax_amounts</code>, only live on the invoice line item,\nso they can only be updated through this endpoint. Other fields, such as <code>amount</code>, live on both the invoice\nitem and the invoice line item, so updates on this endpoint will propagate to the invoice item as well.\nUpdating an invoice’s line item is only possible before the invoice is finalized.</p>\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/invoices/{invoice}/lines/{line_item_id}`\n"
(
@spec update(
invoice :: binary(),
line_item_id :: binary(),
params :: %{
optional(:amount) => integer,
optional(:description) => binary,
optional(:discountable) => boolean,
optional(:discounts) => list(discounts) | binary,
optional(:expand) => list(binary),
optional(:metadata) => %{optional(binary) => binary} | binary,
optional(:period) => period,
optional(:price) => binary,
optional(:price_data) => price_data,
optional(:quantity) => integer,
optional(:tax_amounts) => list(tax_amounts) | binary,
optional(:tax_rates) => list(binary) | binary
},
opts :: Keyword.t()
) :: {:ok, Stripe.LineItem.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
def update(invoice, line_item_id, params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/invoices/{invoice}/lines/{line_item_id}",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "invoice",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "invoice",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
},
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "line_item_id",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "line_item_id",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
}
],
[invoice, line_item_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
)
)
end
Loading

0 comments on commit 2b569da

Please sign in to comment.