lib/stripe/resources/invoice.rb in stripe-11.4.0.pre.beta.1 vs lib/stripe/resources/invoice.rb in stripe-11.6.0
- old
+ new
@@ -45,68 +45,12 @@
OBJECT_NAME = "invoice"
def self.object_name
"invoice"
end
- nested_resource_class_methods :payment, operations: %i[retrieve list]
+ nested_resource_class_methods :line, operations: %i[list]
- # Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
- def add_lines(params = {}, opts = {})
- request_stripe_object(
- method: :post,
- path: format("/v1/invoices/%<invoice>s/add_lines", { invoice: CGI.escape(self["id"]) }),
- params: params,
- opts: opts
- )
- end
-
- # Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
- def self.add_lines(invoice, params = {}, opts = {})
- request_stripe_object(
- method: :post,
- path: format("/v1/invoices/%<invoice>s/add_lines", { invoice: CGI.escape(invoice) }),
- params: params,
- opts: opts
- )
- end
-
- # Attaches a PaymentIntent to the invoice, adding it to the list of payments.
- # When the PaymentIntent's status changes to succeeded, the payment is credited
- # to the invoice, increasing its amount_paid. When the invoice is fully paid, the
- # invoice's status becomes paid.
- #
- # If the PaymentIntent's status is already succeeded when it is attached, it is
- # credited to the invoice immediately.
- #
- # Related guide: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create)
- 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
-
- # Attaches a PaymentIntent to the invoice, adding it to the list of payments.
- # When the PaymentIntent's status changes to succeeded, the payment is credited
- # to the invoice, increasing its amount_paid. When the invoice is fully paid, the
- # invoice's status becomes paid.
- #
- # If the PaymentIntent's status is already succeeded when it is attached, it is
- # credited to the invoice immediately.
- #
- # Related guide: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create)
- 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
-
# This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or <a href="#send_invoice">send](https://stripe.com/docs/api#finalize_invoice) the invoice to your customers.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/invoices", params: params, opts: opts)
end
@@ -219,30 +163,10 @@
params: params,
opts: opts
)
end
- # Removes multiple line items from an invoice. This is only possible when an invoice is still a draft.
- def remove_lines(params = {}, opts = {})
- request_stripe_object(
- method: :post,
- path: format("/v1/invoices/%<invoice>s/remove_lines", { invoice: CGI.escape(self["id"]) }),
- params: params,
- opts: opts
- )
- end
-
- # Removes multiple line items from an invoice. This is only possible when an invoice is still a draft.
- def self.remove_lines(invoice, params = {}, opts = {})
- request_stripe_object(
- method: :post,
- path: format("/v1/invoices/%<invoice>s/remove_lines", { invoice: CGI.escape(invoice) }),
- params: params,
- opts: opts
- )
- end
-
def self.search(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/invoices/search", params: params, opts: opts)
end
def self.search_auto_paging_each(params = {}, opts = {}, &blk)
@@ -292,29 +216,9 @@
# auto_advance=false.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<id>s", { id: CGI.escape(id) }),
- params: params,
- opts: opts
- )
- end
-
- # Updates multiple line items on an invoice. This is only possible when an invoice is still a draft.
- def update_lines(params = {}, opts = {})
- request_stripe_object(
- method: :post,
- path: format("/v1/invoices/%<invoice>s/update_lines", { invoice: CGI.escape(self["id"]) }),
- params: params,
- opts: opts
- )
- end
-
- # Updates multiple line items on an invoice. This is only possible when an invoice is still a draft.
- def self.update_lines(invoice, params = {}, opts = {})
- request_stripe_object(
- method: :post,
- path: format("/v1/invoices/%<invoice>s/update_lines", { invoice: CGI.escape(invoice) }),
params: params,
opts: opts
)
end