lib/stripe/resources/invoice.rb in stripe-10.2.0 vs lib/stripe/resources/invoice.rb in stripe-10.3.0.pre.beta.1

- old
+ new

@@ -38,13 +38,25 @@ extend Stripe::APIOperations::Create include Stripe::APIOperations::Delete extend Stripe::APIOperations::List extend Stripe::APIOperations::Search include Stripe::APIOperations::Save + extend Stripe::APIOperations::NestedResource OBJECT_NAME = "invoice" + nested_resource_class_methods :payment, operations: %i[retrieve list] + + def attach_payment_intent(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + def finalize_invoice(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(self["id"]) }), params: params, @@ -81,9 +93,18 @@ def void_invoice(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + + def self.attach_payment_intent(invoice, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(invoice) }), params: params, opts: opts ) end