Skip to content

Commit

Permalink
Merge pull request #1270 from stripe/latest-codegen-beta
Browse files Browse the repository at this point in the history
Update generated code for beta
  • Loading branch information
stripe-openapi[bot] authored Sep 15, 2023
2 parents c4bdddb + f97b214 commit fb6f536
Show file tree
Hide file tree
Showing 19 changed files with 524 additions and 312 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v515
v532
1 change: 1 addition & 0 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def self.object_names_to_classes
CashBalance::OBJECT_NAME => CashBalance,
Charge::OBJECT_NAME => Charge,
Checkout::Session::OBJECT_NAME => Checkout::Session,
ConfirmationToken::OBJECT_NAME => ConfirmationToken,
CountrySpec::OBJECT_NAME => CountrySpec,
Coupon::OBJECT_NAME => Coupon,
CreditNote::OBJECT_NAME => CreditNote,
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
require "stripe/resources/cash_balance"
require "stripe/resources/charge"
require "stripe/resources/checkout/session"
require "stripe/resources/confirmation_token"
require "stripe/resources/country_spec"
require "stripe/resources/coupon"
require "stripe/resources/credit_note"
Expand Down
3 changes: 1 addition & 2 deletions lib/stripe/resources/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class Account < APIResource
nested_resource_class_methods :capability,
operations: %i[retrieve update list],
resource_plural: "capabilities"
nested_resource_class_methods :person,
operations: %i[create retrieve update delete list]
nested_resource_class_methods :person, operations: %i[create retrieve update delete list]

def persons(params = {}, opts = {})
request_stripe_object(
Expand Down
3 changes: 1 addition & 2 deletions lib/stripe/resources/application_fee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class ApplicationFee < APIResource

OBJECT_NAME = "application_fee"

nested_resource_class_methods :refund,
operations: %i[create retrieve update list]
nested_resource_class_methods :refund, operations: %i[create retrieve update list]
end
end
2 changes: 1 addition & 1 deletion lib/stripe/resources/balance_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module Stripe
# Balance transactions represent funds moving through your Stripe account.
# They're created for every type of transaction that comes into or flows out of your Stripe account balance.
# Stripe creates them for every type of transaction that enters or leaves your Stripe account balance.
#
# Related guide: [Balance transaction types](https://stripe.com/docs/reports/balance-transaction-types)
class BalanceTransaction < APIResource
Expand Down
11 changes: 11 additions & 0 deletions lib/stripe/resources/confirmation_token.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
# ConfirmationTokens help transport client side data collected by Stripe JS over
# to your server for confirming a PaymentIntent or SetupIntent. If the confirmation
# is successful, values present on the ConfirmationToken are written onto the Intent.
class ConfirmationToken < APIResource
OBJECT_NAME = "confirmation_token"
end
end
18 changes: 5 additions & 13 deletions lib/stripe/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# frozen_string_literal: true

module Stripe
# This object represents a customer of your business. It lets you create recurring charges and track payments that belong to the same customer.
# This object represents a customer of your business. Use it to create recurring charges and track payments that belong to the same customer.
#
# Related guide: [Save a card during payment](https://stripe.com/docs/payments/save-during-payment)
class Customer < APIResource
Expand All @@ -15,12 +15,9 @@ class Customer < APIResource

OBJECT_NAME = "customer"

nested_resource_class_methods :balance_transaction,
operations: %i[create retrieve update list]
nested_resource_class_methods :cash_balance_transaction,
operations: %i[retrieve list]
nested_resource_class_methods :tax_id,
operations: %i[create retrieve delete list]
nested_resource_class_methods :balance_transaction, operations: %i[create retrieve update list]
nested_resource_class_methods :cash_balance_transaction, operations: %i[retrieve list]
nested_resource_class_methods :tax_id, operations: %i[create retrieve delete list]

def create_funding_instructions(params = {}, opts = {})
request_stripe_object(
Expand Down Expand Up @@ -85,12 +82,7 @@ def self.list_payment_methods(customer, params = {}, opts = {})
)
end

def self.retrieve_payment_method(
customer,
payment_method,
params = {},
opts = {}
)
def self.retrieve_payment_method(customer, payment_method, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }),
Expand Down
6 changes: 2 additions & 4 deletions lib/stripe/resources/dispute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

module Stripe
# A dispute occurs when a customer questions your charge with their card issuer.
# When this happens, you're given the opportunity to respond to the dispute with
# evidence that shows that the charge is legitimate. You can find more
# information about the dispute process in our [Disputes and
# Fraud](https://stripe.com/docs/disputes) documentation.
# When this happens, you have the opportunity to respond to the dispute with
# evidence that shows that the charge is legitimate.
#
# Related guide: [Disputes and fraud](https://stripe.com/docs/disputes)
class Dispute < APIResource
Expand Down
33 changes: 17 additions & 16 deletions lib/stripe/resources/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@ module Stripe
# Events are our way of letting you know when something interesting happens in
# your account. When an interesting event occurs, we create a new `Event`
# object. For example, when a charge succeeds, we create a `charge.succeeded`
# event; and when an invoice payment attempt fails, we create an
# `invoice.payment_failed` event. Note that many API requests may cause multiple
# events to be created. For example, if you create a new subscription for a
# customer, you will receive both a `customer.subscription.created` event and a
# event, and when an invoice payment attempt fails, we create an
# `invoice.payment_failed` event. Certain API requests might create multiple
# events. For example, if you create a new subscription for a
# customer, you receive both a `customer.subscription.created` event and a
# `charge.succeeded` event.
#
# Events occur when the state of another API resource changes. The state of that
# resource at the time of the change is embedded in the event's data field. For
# example, a `charge.succeeded` event will contain a charge, and an
# `invoice.payment_failed` event will contain an invoice.
# Events occur when the state of another API resource changes. The event's data
# field embeds the resource's state at the time of the change. For
# example, a `charge.succeeded` event contains a charge, and an
# `invoice.payment_failed` event contains an invoice.
#
# As with other API resources, you can use endpoints to retrieve an
# [individual event](https://stripe.com/docs/api#retrieve_event) or a [list of events](https://stripe.com/docs/api#list_events)
# from the API. We also have a separate
# [webhooks](http://en.wikipedia.org/wiki/Webhook) system for sending the
# `Event` objects directly to an endpoint on your server. Webhooks are managed
# in your
# [account settings](https://dashboard.stripe.com/account/webhooks),
# and our [Using Webhooks](https://stripe.com/docs/webhooks) guide will help you get set up.
# `Event` objects directly to an endpoint on your server. You can manage
# webhooks in your
# [account settings](https://dashboard.stripe.com/account/webhooks). Learn how
# to [listen for events]
# (/docs/webhooks) so that your integration can automatically trigger reactions.
#
# When using [Connect](https://stripe.com/docs/connect), you can also receive notifications of
# events that occur in connected accounts. For these events, there will be an
# When using [Connect](https://stripe.com/docs/connect), you can also receive event notifications
# that occur in connected accounts. For these events, there's an
# additional `account` attribute in the received `Event` object.
#
# **NOTE:** Right now, access to events through the [Retrieve Event API](https://stripe.com/docs/api#retrieve_event) is
# guaranteed only for 30 days.
# We only guarantee access to events through the [Retrieve Event API](https://stripe.com/docs/api#retrieve_event)
# for 30 days.
class Event < APIResource
extend Stripe::APIOperations::List

Expand Down
7 changes: 1 addition & 6 deletions lib/stripe/resources/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,7 @@ def self.send_invoice(invoice, params = {}, opts = {})
end

def self.upcoming(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/invoices/upcoming",
params: params,
opts: opts
)
request_stripe_object(method: :get, path: "/v1/invoices/upcoming", params: params, opts: opts)
end

def self.void_invoice(invoice, params = {}, opts = {})
Expand Down
89 changes: 89 additions & 0 deletions lib/stripe/resources/issuing/authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,95 @@ def self.decline(authorization, params = {}, opts = {})
opts: opts
)
end

def test_helpers
TestHelpers.new(self)
end

class TestHelpers < APIResourceTestHelpers
RESOURCE_CLASS = Authorization

def self.capture(authorization, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/capture", { authorization: CGI.escape(authorization) }),
params: params,
opts: opts
)
end

def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/test_helpers/issuing/authorizations",
params: params,
opts: opts
)
end

def self.expire(authorization, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/expire", { authorization: CGI.escape(authorization) }),
params: params,
opts: opts
)
end

def self.increment(authorization, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/increment", { authorization: CGI.escape(authorization) }),
params: params,
opts: opts
)
end

def self.reverse(authorization, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/reverse", { authorization: CGI.escape(authorization) }),
params: params,
opts: opts
)
end

def capture(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/capture", { authorization: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end

def expire(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/expire", { authorization: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end

def increment(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/increment", { authorization: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end

def reverse(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/reverse", { authorization: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end
end
end
end
end
19 changes: 19 additions & 0 deletions lib/stripe/resources/issuing/card_design.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Stripe
module Issuing
# A Card Design is a logical grouping of a Card Bundle, card logo, and carrier text that represents a product line.
class CardDesign < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save

Expand Down Expand Up @@ -35,6 +36,15 @@ def self.deactivate_testmode(card_design, params = {}, opts = {})
)
end

def self.reject_testmode(card_design, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/card_designs/%<card_design>s/status/reject", { card_design: CGI.escape(card_design) }),
params: params,
opts: opts
)
end

def activate_testmode(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
Expand All @@ -52,6 +62,15 @@ def deactivate_testmode(params = {}, opts = {})
opts: opts
)
end

def reject_testmode(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/card_designs/%<card_design>s/status/reject", { card_design: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end
end
end
end
Expand Down
44 changes: 44 additions & 0 deletions lib/stripe/resources/issuing/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,50 @@ class Transaction < APIResource
include Stripe::APIOperations::Save

OBJECT_NAME = "issuing.transaction"

def test_helpers
TestHelpers.new(self)
end

class TestHelpers < APIResourceTestHelpers
RESOURCE_CLASS = Transaction

def self.create_force_capture(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/test_helpers/issuing/transactions/create_force_capture",
params: params,
opts: opts
)
end

def self.create_unlinked_refund(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/test_helpers/issuing/transactions/create_unlinked_refund",
params: params,
opts: opts
)
end

def self.refund(transaction, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/transactions/%<transaction>s/refund", { transaction: CGI.escape(transaction) }),
params: params,
opts: opts
)
end

def refund(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/transactions/%<transaction>s/refund", { transaction: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end
end
end
end
end
10 changes: 2 additions & 8 deletions lib/stripe/resources/quote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class Quote < APIResource
OBJECT_NAME = "quote"

nested_resource_class_methods :preview_invoice, operations: %i[list]
nested_resource_class_methods :preview_subscription_schedule,
operations: %i[list]
nested_resource_class_methods :preview_subscription_schedule, operations: %i[list]

def accept(params = {}, opts = {})
request_stripe_object(
Expand Down Expand Up @@ -202,12 +201,7 @@ def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block)
)
end

def self.preview_invoice_lines(
quote,
preview_invoice,
params = {},
opts = {}
)
def self.preview_invoice_lines(quote, preview_invoice, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/quotes/%<quote>s/preview_invoices/%<preview_invoice>s/lines", { quote: CGI.escape(quote), preview_invoice: CGI.escape(preview_invoice) }),
Expand Down
3 changes: 1 addition & 2 deletions lib/stripe/resources/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class Source < APIResource

OBJECT_NAME = "source"

nested_resource_class_methods :source_transaction,
operations: %i[retrieve list]
nested_resource_class_methods :source_transaction, operations: %i[retrieve list]

def verify(params = {}, opts = {})
request_stripe_object(
Expand Down
Loading

0 comments on commit fb6f536

Please sign in to comment.