From 70dae52d5c091026b4ee5c077ccd9914bcbf774e Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 23:42:37 +0000 Subject: [PATCH] Update generated code for v1329 --- OPENAPI_VERSION | 2 +- lib/stripe/object_types.rb | 2 + lib/stripe/resources.rb | 2 + .../resources/payment_attempt_record.rb | 27 ++++ lib/stripe/resources/payment_record.rb | 115 ++++++++++++++++++ lib/stripe/services.rb | 2 + .../payment_attempt_record_service.rb | 28 +++++ lib/stripe/services/payment_record_service.rb | 78 ++++++++++++ lib/stripe/services/v1_services.rb | 4 +- 9 files changed, 258 insertions(+), 2 deletions(-) create mode 100644 lib/stripe/resources/payment_attempt_record.rb create mode 100644 lib/stripe/resources/payment_record.rb create mode 100644 lib/stripe/services/payment_attempt_record_service.rb create mode 100644 lib/stripe/services/payment_record_service.rb diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index a1ae6d88..954be9b7 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1321 \ No newline at end of file +v1329 \ No newline at end of file diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index affa86d4..fcc6fc28 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -97,11 +97,13 @@ module Stripe Mandate.object_name => Mandate, Margin.object_name => Margin, Order.object_name => Order, + PaymentAttemptRecord.object_name => PaymentAttemptRecord, PaymentIntent.object_name => PaymentIntent, PaymentLink.object_name => PaymentLink, PaymentMethod.object_name => PaymentMethod, PaymentMethodConfiguration.object_name => PaymentMethodConfiguration, PaymentMethodDomain.object_name => PaymentMethodDomain, + PaymentRecord.object_name => PaymentRecord, Payout.object_name => Payout, Person.object_name => Person, Plan.object_name => Plan, diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index 6761d5d3..58a12bcb 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -85,11 +85,13 @@ require "stripe/resources/login_link" require "stripe/resources/mandate" require "stripe/resources/margin" require "stripe/resources/order" +require "stripe/resources/payment_attempt_record" require "stripe/resources/payment_intent" require "stripe/resources/payment_link" require "stripe/resources/payment_method" require "stripe/resources/payment_method_configuration" require "stripe/resources/payment_method_domain" +require "stripe/resources/payment_record" require "stripe/resources/payout" require "stripe/resources/person" require "stripe/resources/plan" diff --git a/lib/stripe/resources/payment_attempt_record.rb b/lib/stripe/resources/payment_attempt_record.rb new file mode 100644 index 00000000..dc97cc8b --- /dev/null +++ b/lib/stripe/resources/payment_attempt_record.rb @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + # A Payment Attempt Record represents an individual attempt at making a payment, on or off Stripe. + # Each payment attempt tries to collect a fixed amount of money from a fixed customer and payment + # method. Payment Attempt Records are attached to Payment Records. Only one attempt per Payment Record + # can have guaranteed funds. + class PaymentAttemptRecord < APIResource + extend Stripe::APIOperations::List + + OBJECT_NAME = "payment_attempt_record" + def self.object_name + "payment_attempt_record" + end + + # List all the Payment Attempt Records attached to the specified Payment Record. + def self.list(filters = {}, opts = {}) + request_stripe_object( + method: :get, + path: "/v1/payment_attempt_records", + params: filters, + opts: opts + ) + end + end +end diff --git a/lib/stripe/resources/payment_record.rb b/lib/stripe/resources/payment_record.rb new file mode 100644 index 00000000..847a3f0a --- /dev/null +++ b/lib/stripe/resources/payment_record.rb @@ -0,0 +1,115 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + # A Payment Record is a resource that allows you to represent payments that occur on- or off-Stripe. + # For example, you can create a Payment Record to model a payment made on a different payment processor, + # in order to mark an Invoice as paid and a Subscription as active. Payment Records consist of one or + # more Payment Attempt Records, which represent individual attempts made on a payment network. + class PaymentRecord < APIResource + OBJECT_NAME = "payment_record" + def self.object_name + "payment_record" + end + + # Report a new Payment Record. You may report a Payment Record as it is + # initialized and later report updates through the other report_* methods, or report Payment + # Records in a terminal state directly, through this method. + def self.report_payment(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: "/v1/payment_records/report_payment", + params: params, + opts: opts + ) + end + + # Report a new payment attempt on the specified Payment Record. A new payment + # attempt can only be specified if all other payment attempts are canceled or failed. + def report_payment_attempt(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/payment_records/%s/report_payment_attempt", { id: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + + # Report a new payment attempt on the specified Payment Record. A new payment + # attempt can only be specified if all other payment attempts are canceled or failed. + def self.report_payment_attempt(id, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/payment_records/%s/report_payment_attempt", { id: CGI.escape(id) }), + params: params, + opts: opts + ) + end + + # Report that the most recent payment attempt on the specified Payment Record + # was canceled. + def report_payment_attempt_canceled(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/payment_records/%s/report_payment_attempt_canceled", { id: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + + # Report that the most recent payment attempt on the specified Payment Record + # was canceled. + def self.report_payment_attempt_canceled(id, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/payment_records/%s/report_payment_attempt_canceled", { id: CGI.escape(id) }), + params: params, + opts: opts + ) + end + + # Report that the most recent payment attempt on the specified Payment Record + # failed or errored. + def report_payment_attempt_failed(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/payment_records/%s/report_payment_attempt_failed", { id: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + + # Report that the most recent payment attempt on the specified Payment Record + # failed or errored. + def self.report_payment_attempt_failed(id, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/payment_records/%s/report_payment_attempt_failed", { id: CGI.escape(id) }), + params: params, + opts: opts + ) + end + + # Report that the most recent payment attempt on the specified Payment Record + # was guaranteed. + def report_payment_attempt_guaranteed(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/payment_records/%s/report_payment_attempt_guaranteed", { id: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + + # Report that the most recent payment attempt on the specified Payment Record + # was guaranteed. + def self.report_payment_attempt_guaranteed(id, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/payment_records/%s/report_payment_attempt_guaranteed", { id: CGI.escape(id) }), + params: params, + opts: opts + ) + end + end +end diff --git a/lib/stripe/services.rb b/lib/stripe/services.rb index e32f23b9..a92d1edb 100644 --- a/lib/stripe/services.rb +++ b/lib/stripe/services.rb @@ -101,12 +101,14 @@ require "stripe/services/mandate_service" require "stripe/services/margin_service" require "stripe/services/order_line_item_service" require "stripe/services/order_service" +require "stripe/services/payment_attempt_record_service" require "stripe/services/payment_intent_service" require "stripe/services/payment_link_line_item_service" require "stripe/services/payment_link_service" require "stripe/services/payment_method_configuration_service" require "stripe/services/payment_method_domain_service" require "stripe/services/payment_method_service" +require "stripe/services/payment_record_service" require "stripe/services/payout_service" require "stripe/services/plan_service" require "stripe/services/price_service" diff --git a/lib/stripe/services/payment_attempt_record_service.rb b/lib/stripe/services/payment_attempt_record_service.rb new file mode 100644 index 00000000..0d3749c2 --- /dev/null +++ b/lib/stripe/services/payment_attempt_record_service.rb @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + class PaymentAttemptRecordService < StripeService + # List all the Payment Attempt Records attached to the specified Payment Record. + def list(params = {}, opts = {}) + request( + method: :get, + path: "/v1/payment_attempt_records", + params: params, + opts: opts, + base_address: :api + ) + end + + # Retrieves a Payment Attempt Record with the given ID + def retrieve(id, params = {}, opts = {}) + request( + method: :get, + path: format("/v1/payment_attempt_records/%s", { id: CGI.escape(id) }), + params: params, + opts: opts, + base_address: :api + ) + end + end +end diff --git a/lib/stripe/services/payment_record_service.rb b/lib/stripe/services/payment_record_service.rb new file mode 100644 index 00000000..dd96f658 --- /dev/null +++ b/lib/stripe/services/payment_record_service.rb @@ -0,0 +1,78 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + class PaymentRecordService < StripeService + # Report a new Payment Record. You may report a Payment Record as it is + # initialized and later report updates through the other report_* methods, or report Payment + # Records in a terminal state directly, through this method. + def report_payment(params = {}, opts = {}) + request( + method: :post, + path: "/v1/payment_records/report_payment", + params: params, + opts: opts, + base_address: :api + ) + end + + # Report a new payment attempt on the specified Payment Record. A new payment + # attempt can only be specified if all other payment attempts are canceled or failed. + def report_payment_attempt(id, params = {}, opts = {}) + request( + method: :post, + path: format("/v1/payment_records/%s/report_payment_attempt", { id: CGI.escape(id) }), + params: params, + opts: opts, + base_address: :api + ) + end + + # Report that the most recent payment attempt on the specified Payment Record + # was canceled. + def report_payment_attempt_canceled(id, params = {}, opts = {}) + request( + method: :post, + path: format("/v1/payment_records/%s/report_payment_attempt_canceled", { id: CGI.escape(id) }), + params: params, + opts: opts, + base_address: :api + ) + end + + # Report that the most recent payment attempt on the specified Payment Record + # failed or errored. + def report_payment_attempt_failed(id, params = {}, opts = {}) + request( + method: :post, + path: format("/v1/payment_records/%s/report_payment_attempt_failed", { id: CGI.escape(id) }), + params: params, + opts: opts, + base_address: :api + ) + end + + # Report that the most recent payment attempt on the specified Payment Record + # was guaranteed. + def report_payment_attempt_guaranteed(id, params = {}, opts = {}) + request( + method: :post, + path: format("/v1/payment_records/%s/report_payment_attempt_guaranteed", { id: CGI.escape(id) }), + params: params, + opts: opts, + base_address: :api + ) + end + + # Retrieves a Payment Record with the given ID + def retrieve(id, params = {}, opts = {}) + request( + method: :get, + path: format("/v1/payment_records/%s", { id: CGI.escape(id) }), + params: params, + opts: opts, + base_address: :api + ) + end + end +end diff --git a/lib/stripe/services/v1_services.rb b/lib/stripe/services/v1_services.rb index 22bbf93d..1fb8857a 100644 --- a/lib/stripe/services/v1_services.rb +++ b/lib/stripe/services/v1_services.rb @@ -4,7 +4,7 @@ module Stripe class V1Services < StripeService # v1 accessors: The beginning of the section generated from our OpenAPI spec attr_reader :accounts - attr_reader :account_links, :account_notices, :account_sessions, :apple_pay_domains, :application_fees, :apps, :balance, :balance_transactions, :billing, :billing_portal, :capital, :charges, :checkout, :climate, :confirmation_tokens, :test_helpers, :country_specs, :coupons, :credit_notes, :customers, :customer_sessions, :disputes, :entitlements, :ephemeral_keys, :events, :exchange_rates, :files, :file_links, :financial_connections, :forwarding, :gift_cards, :identity, :invoices, :invoice_rendering_templates, :invoice_items, :issuing, :mandates, :margins, :orders, :payment_intents, :payment_links, :payment_methods, :payment_method_configurations, :payment_method_domains, :payouts, :plans, :prices, :products, :promotion_codes, :quotes, :radar, :refunds, :reporting, :reviews, :sigma, :setup_attempts, :setup_intents, :shipping_rates, :sources, :subscriptions, :subscription_items, :subscription_schedules, :tax, :tax_codes, :tax_ids, :tax_rates, :terminal, :tokens, :topups, :transfers, :treasury, :webhook_endpoints + attr_reader :account_links, :account_notices, :account_sessions, :apple_pay_domains, :application_fees, :apps, :balance, :balance_transactions, :billing, :billing_portal, :capital, :charges, :checkout, :climate, :confirmation_tokens, :test_helpers, :country_specs, :coupons, :credit_notes, :customers, :customer_sessions, :disputes, :entitlements, :ephemeral_keys, :events, :exchange_rates, :files, :file_links, :financial_connections, :forwarding, :gift_cards, :identity, :invoices, :invoice_rendering_templates, :invoice_items, :issuing, :mandates, :margins, :orders, :payment_attempt_records, :payment_intents, :payment_links, :payment_methods, :payment_method_configurations, :payment_method_domains, :payment_records, :payouts, :plans, :prices, :products, :promotion_codes, :quotes, :radar, :refunds, :reporting, :reviews, :sigma, :setup_attempts, :setup_intents, :shipping_rates, :sources, :subscriptions, :subscription_items, :subscription_schedules, :tax, :tax_codes, :tax_ids, :tax_rates, :terminal, :tokens, :topups, :transfers, :treasury, :webhook_endpoints # v1 accessors: The end of the section generated from our OpenAPI spec # OAuthService is manually maintained, as it has special behaviors @@ -53,11 +53,13 @@ module Stripe @mandates = Stripe::MandateService.new(@requestor) @margins = Stripe::MarginService.new(@requestor) @orders = Stripe::OrderService.new(@requestor) + @payment_attempt_records = Stripe::PaymentAttemptRecordService.new(@requestor) @payment_intents = Stripe::PaymentIntentService.new(@requestor) @payment_links = Stripe::PaymentLinkService.new(@requestor) @payment_methods = Stripe::PaymentMethodService.new(@requestor) @payment_method_configurations = Stripe::PaymentMethodConfigurationService.new(@requestor) @payment_method_domains = Stripe::PaymentMethodDomainService.new(@requestor) + @payment_records = Stripe::PaymentRecordService.new(@requestor) @payouts = Stripe::PayoutService.new(@requestor) @plans = Stripe::PlanService.new(@requestor) @prices = Stripe::PriceService.new(@requestor)