/
invoice.rb
74 lines (64 loc) · 1.99 KB
/
invoice.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File generated from our OpenAPI spec
# 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 = execute_resource_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 = execute_resource_request(:get, resource_url + "/upcoming/lines", params, opts)
Util.convert_to_stripe_object(resp.data, opts)
end
end
end