mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-07 00:05:33 -04:00
* Update generated code for v328 * Update generated code for v330 * Update generated code for v344 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
52 lines
1.3 KiB
Ruby
52 lines
1.3 KiB
Ruby
# File generated from our OpenAPI spec
|
|
# frozen_string_literal: true
|
|
|
|
module Stripe
|
|
# Issue a credit note to adjust an invoice's amount after the invoice is finalized.
|
|
#
|
|
# Related guide: [Credit notes](https://stripe.com/docs/billing/invoices/credit-notes)
|
|
class CreditNote < APIResource
|
|
extend Stripe::APIOperations::Create
|
|
extend Stripe::APIOperations::List
|
|
include Stripe::APIOperations::Save
|
|
|
|
OBJECT_NAME = "credit_note"
|
|
|
|
def void_credit_note(params = {}, opts = {})
|
|
request_stripe_object(
|
|
method: :post,
|
|
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(self["id"]) }),
|
|
params: params,
|
|
opts: opts
|
|
)
|
|
end
|
|
|
|
def self.list_preview_line_items(params = {}, opts = {})
|
|
request_stripe_object(
|
|
method: :get,
|
|
path: "/v1/credit_notes/preview/lines",
|
|
params: params,
|
|
opts: opts
|
|
)
|
|
end
|
|
|
|
def self.preview(params = {}, opts = {})
|
|
request_stripe_object(
|
|
method: :get,
|
|
path: "/v1/credit_notes/preview",
|
|
params: params,
|
|
opts: opts
|
|
)
|
|
end
|
|
|
|
def self.void_credit_note(id, params = {}, opts = {})
|
|
request_stripe_object(
|
|
method: :post,
|
|
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(id) }),
|
|
params: params,
|
|
opts: opts
|
|
)
|
|
end
|
|
end
|
|
end
|