Sha256: 2379470d5dcdd4c36332d13c33dc6733d3de5074aaff56c4c167608f8a422c81

Contents?: true

Size: 1.91 KB

Versions: 28

Compression:

Stored size: 1.91 KB

Contents

# frozen_string_literal: true

module Stripe
  class Invoice < APIResource
    extend Stripe::APIOperations::Create
    include Stripe::APIOperations::Delete
    extend Stripe::APIOperations::List
    include Stripe::APIOperations::Save

    OBJECT_NAME = "invoice"

    custom_method :finalize_invoice, http_verb: :post, http_path: "finalize"
    custom_method :mark_uncollectible, http_verb: :post
    custom_method :pay, http_verb: :post
    custom_method :send_invoice, http_verb: :post, http_path: "send"
    custom_method :void_invoice, http_verb: :post, http_path: "void"

    def finalize_invoice(params = {}, opts = {})
      request_stripe_object(
        method: :post,
        path: resource_url + "/finalize",
        params: params,
        opts: opts
      )
    end

    def mark_uncollectible(params = {}, opts = {})
      request_stripe_object(
        method: :post,
        path: resource_url + "/mark_uncollectible",
        params: params,
        opts: opts
      )
    end

    def pay(params = {}, opts = {})
      request_stripe_object(
        method: :post,
        path: resource_url + "/pay",
        params: params,
        opts: opts
      )
    end

    def send_invoice(params = {}, opts = {})
      request_stripe_object(
        method: :post,
        path: resource_url + "/send",
        params: params,
        opts: opts
      )
    end

    def void_invoice(params = {}, opts = {})
      request_stripe_object(
        method: :post,
        path: resource_url + "/void",
        params: params,
        opts: opts
      )
    end

    def self.upcoming(params, opts = {})
      resp, opts = request(:get, resource_url + "/upcoming", params, opts)
      Util.convert_to_stripe_object(resp.data, opts)
    end

    def self.list_upcoming_line_items(params, opts = {})
      resp, opts = request(:get, resource_url + "/upcoming/lines", params, opts)
      Util.convert_to_stripe_object(resp.data, opts)
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
stripe-5.22.0 lib/stripe/resources/invoice.rb
stripe-5.21.0 lib/stripe/resources/invoice.rb
stripe-5.20.0 lib/stripe/resources/invoice.rb
stripe-5.19.0 lib/stripe/resources/invoice.rb
stripe-5.18.0 lib/stripe/resources/invoice.rb
stripe-5.17.0 lib/stripe/resources/invoice.rb
stripe-5.16.0 lib/stripe/resources/invoice.rb
stripe-5.15.0 lib/stripe/resources/invoice.rb
stripe-5.14.0 lib/stripe/resources/invoice.rb
stripe-5.13.0 lib/stripe/resources/invoice.rb
stripe-5.12.1 lib/stripe/resources/invoice.rb
stripe-5.12.0 lib/stripe/resources/invoice.rb
stripe-5.11.0 lib/stripe/resources/invoice.rb
stripe-5.10.0 lib/stripe/resources/invoice.rb
stripe-5.9.0 lib/stripe/resources/invoice.rb
stripe-5.8.0 lib/stripe/resources/invoice.rb
stripe-5.7.1 lib/stripe/resources/invoice.rb
stripe-5.7.0 lib/stripe/resources/invoice.rb
stripe-5.6.0 lib/stripe/resources/invoice.rb
stripe-5.5.0 lib/stripe/resources/invoice.rb