stripe 6.2.0 → 6.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -7
  3. data/Makefile +1 -1
  4. data/OPENAPI_VERSION +1 -1
  5. data/README.md +1 -1
  6. data/VERSION +1 -1
  7. data/lib/stripe/api_operations/create.rb +6 -2
  8. data/lib/stripe/api_operations/delete.rb +12 -7
  9. data/lib/stripe/api_operations/list.rb +6 -9
  10. data/lib/stripe/api_operations/nested_resource.rb +62 -34
  11. data/lib/stripe/api_operations/request.rb +10 -0
  12. data/lib/stripe/api_operations/save.rb +6 -3
  13. data/lib/stripe/api_operations/search.rb +6 -9
  14. data/lib/stripe/api_resource.rb +1 -1
  15. data/lib/stripe/api_version.rb +8 -0
  16. data/lib/stripe/resources/account.rb +28 -8
  17. data/lib/stripe/resources/apps/secret.rb +10 -12
  18. data/lib/stripe/resources/charge.rb +10 -3
  19. data/lib/stripe/resources/checkout/session.rb +10 -3
  20. data/lib/stripe/resources/credit_note.rb +22 -7
  21. data/lib/stripe/resources/customer.rb +94 -16
  22. data/lib/stripe/resources/dispute.rb +10 -3
  23. data/lib/stripe/resources/financial_connections/account.rb +30 -7
  24. data/lib/stripe/resources/identity/verification_session.rb +20 -5
  25. data/lib/stripe/resources/invoice.rb +62 -15
  26. data/lib/stripe/resources/issuing/authorization.rb +20 -5
  27. data/lib/stripe/resources/issuing/card.rb +90 -3
  28. data/lib/stripe/resources/issuing/dispute.rb +10 -3
  29. data/lib/stripe/resources/order.rb +40 -9
  30. data/lib/stripe/resources/payment_intent.rb +60 -13
  31. data/lib/stripe/resources/payment_link.rb +10 -3
  32. data/lib/stripe/resources/payment_method.rb +20 -5
  33. data/lib/stripe/resources/payout.rb +20 -5
  34. data/lib/stripe/resources/quote.rb +50 -11
  35. data/lib/stripe/resources/refund.rb +19 -5
  36. data/lib/stripe/resources/review.rb +10 -3
  37. data/lib/stripe/resources/setup_intent.rb +30 -7
  38. data/lib/stripe/resources/source.rb +16 -6
  39. data/lib/stripe/resources/subscription.rb +10 -3
  40. data/lib/stripe/resources/subscription_item.rb +6 -2
  41. data/lib/stripe/resources/subscription_schedule.rb +20 -5
  42. data/lib/stripe/resources/terminal/reader.rb +49 -11
  43. data/lib/stripe/resources/test_helpers/test_clock.rb +10 -3
  44. data/lib/stripe/resources/topup.rb +10 -3
  45. data/lib/stripe/resources/transfer.rb +10 -3
  46. data/lib/stripe/resources/treasury/financial_account.rb +20 -5
  47. data/lib/stripe/resources/treasury/inbound_transfer.rb +39 -9
  48. data/lib/stripe/resources/treasury/outbound_payment.rb +39 -9
  49. data/lib/stripe/resources/treasury/outbound_transfer.rb +43 -9
  50. data/lib/stripe/resources/treasury/received_credit.rb +5 -6
  51. data/lib/stripe/resources/treasury/received_debit.rb +5 -6
  52. data/lib/stripe/util.rb +38 -3
  53. data/lib/stripe/version.rb +1 -1
  54. metadata +3 -2
@@ -12,12 +12,6 @@ module Stripe
12
12
 
13
13
  OBJECT_NAME = "customer"
14
14
 
15
- custom_method :create_funding_instructions, http_verb: :post, http_path: "funding_instructions"
16
- custom_method :list_payment_methods, http_verb: :get, http_path: "payment_methods"
17
-
18
- nested_resource_class_methods :cash_balance,
19
- operations: %i[retrieve update],
20
- resource_plural: "cash_balance"
21
15
  nested_resource_class_methods :balance_transaction,
22
16
  operations: %i[create retrieve update list]
23
17
  nested_resource_class_methods :tax_id,
@@ -26,7 +20,7 @@ module Stripe
26
20
  def create_funding_instructions(params = {}, opts = {})
27
21
  request_stripe_object(
28
22
  method: :post,
29
- path: resource_url + "/funding_instructions",
23
+ path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(self["id"]) }),
30
24
  params: params,
31
25
  opts: opts
32
26
  )
@@ -35,7 +29,7 @@ module Stripe
35
29
  def list_payment_methods(params = {}, opts = {})
36
30
  request_stripe_object(
37
31
  method: :get,
38
- path: resource_url + "/payment_methods",
32
+ path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(self["id"]) }),
39
33
  params: params,
40
34
  opts: opts
41
35
  )
@@ -50,19 +44,36 @@ module Stripe
50
44
  )
51
45
  end
52
46
 
47
+ def self.create_funding_instructions(customer, params = {}, opts = {})
48
+ request_stripe_object(
49
+ method: :post,
50
+ path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(customer) }),
51
+ params: params,
52
+ opts: opts
53
+ )
54
+ end
55
+
56
+ def self.list_payment_methods(customer, params = {}, opts = {})
57
+ request_stripe_object(
58
+ method: :get,
59
+ path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(customer) }),
60
+ params: params,
61
+ opts: opts
62
+ )
63
+ end
64
+
53
65
  def self.retrieve_payment_method(
54
66
  customer,
55
67
  payment_method,
56
68
  params = {},
57
69
  opts = {}
58
70
  )
59
- resp, opts = execute_resource_request(
60
- :get,
61
- format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }),
62
- params,
63
- opts
71
+ request_stripe_object(
72
+ method: :get,
73
+ path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }),
74
+ params: params,
75
+ opts: opts
64
76
  )
65
- Util.convert_to_stripe_object(resp.data, opts)
66
77
  end
67
78
 
68
79
  custom_method :delete_discount, http_verb: :delete, http_path: "discount"
@@ -83,8 +94,11 @@ module Stripe
83
94
  # so you must call `refresh` on it to get a new version with the
84
95
  # discount removed.
85
96
  def delete_discount
86
- resp, opts = execute_resource_request(:delete, resource_url + "/discount")
87
- Util.convert_to_stripe_object(resp.data, opts)
97
+ request_stripe_object(
98
+ method: :delete,
99
+ path: resource_url + "/discount",
100
+ params: {}
101
+ )
88
102
  end
89
103
 
90
104
  def self.search(params = {}, opts = {})
@@ -94,5 +108,69 @@ module Stripe
94
108
  def self.search_auto_paging_each(params = {}, opts = {}, &blk)
95
109
  search(params, opts).auto_paging_each(&blk)
96
110
  end
111
+
112
+ def self.retrieve_cash_balance(
113
+ customer,
114
+ opts_or_unused_nested_id = nil,
115
+ opts = {}
116
+ )
117
+ # Support two call patterns for backwards compatibility.
118
+ # 1. Legacy: (nil unused nested_id, opts)
119
+ # 2. Fixed pattern: (opts)
120
+ if !opts_or_unused_nested_id.nil? && opts_or_unused_nested_id.class == Hash && opts.empty?
121
+ opts = opts_or_unused_nested_id
122
+ end
123
+ request_stripe_object(
124
+ method: :get,
125
+ path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
126
+ params: {},
127
+ opts: opts
128
+ )
129
+ end
130
+
131
+ def self.update_cash_balance(
132
+ customer,
133
+ unused_nested_id = nil,
134
+ params = {},
135
+ opts = {}
136
+ )
137
+ # Do not allow passing in a hash as the second argument, as we require a nil for compatibility reasons. We cannot differentiate from a legacy pattern (nil, params) and a modern pattern (nil for params, opts).
138
+ if !unused_nested_id.nil? && unused_nested_id.class == Hash
139
+ raise ArgumentError, "update_cash_balance requires the second argument always be nil for legacy reasons."
140
+ end
141
+
142
+ request_stripe_object(
143
+ method: :post,
144
+ path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
145
+ params: params,
146
+ opts: opts
147
+ )
148
+ end
149
+
150
+ def test_helpers
151
+ TestHelpers.new(self)
152
+ end
153
+
154
+ class TestHelpers < APIResourceTestHelpers
155
+ RESOURCE_CLASS = Customer
156
+
157
+ def self.fund_cash_balance(customer, params = {}, opts = {})
158
+ request_stripe_object(
159
+ method: :post,
160
+ path: format("/v1/test_helpers/customers/%<customer>s/fund_cash_balance", { customer: CGI.escape(customer) }),
161
+ params: params,
162
+ opts: opts
163
+ )
164
+ end
165
+
166
+ def fund_cash_balance(params = {}, opts = {})
167
+ @resource.request_stripe_object(
168
+ method: :post,
169
+ path: format("/v1/test_helpers/customers/%<customer>s/fund_cash_balance", { customer: CGI.escape(@resource["id"]) }),
170
+ params: params,
171
+ opts: opts
172
+ )
173
+ end
174
+ end
97
175
  end
98
176
  end
@@ -8,12 +8,19 @@ module Stripe
8
8
 
9
9
  OBJECT_NAME = "dispute"
10
10
 
11
- custom_method :close, http_verb: :post
12
-
13
11
  def close(params = {}, opts = {})
14
12
  request_stripe_object(
15
13
  method: :post,
16
- path: resource_url + "/close",
14
+ path: format("/v1/disputes/%<dispute>s/close", { dispute: CGI.escape(self["id"]) }),
15
+ params: params,
16
+ opts: opts
17
+ )
18
+ end
19
+
20
+ def self.close(dispute, params = {}, opts = {})
21
+ request_stripe_object(
22
+ method: :post,
23
+ path: format("/v1/disputes/%<dispute>s/close", { dispute: CGI.escape(dispute) }),
17
24
  params: params,
18
25
  opts: opts
19
26
  )
@@ -8,14 +8,10 @@ module Stripe
8
8
 
9
9
  OBJECT_NAME = "financial_connections.account"
10
10
 
11
- custom_method :disconnect, http_verb: :post
12
- custom_method :list_owners, http_verb: :get, http_path: "owners"
13
- custom_method :refresh_account, http_verb: :post, http_path: "refresh"
14
-
15
11
  def disconnect(params = {}, opts = {})
16
12
  request_stripe_object(
17
13
  method: :post,
18
- path: resource_url + "/disconnect",
14
+ path: format("/v1/financial_connections/accounts/%<account>s/disconnect", { account: CGI.escape(self["id"]) }),
19
15
  params: params,
20
16
  opts: opts
21
17
  )
@@ -24,7 +20,7 @@ module Stripe
24
20
  def list_owners(params = {}, opts = {})
25
21
  request_stripe_object(
26
22
  method: :get,
27
- path: resource_url + "/owners",
23
+ path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(self["id"]) }),
28
24
  params: params,
29
25
  opts: opts
30
26
  )
@@ -33,7 +29,34 @@ module Stripe
33
29
  def refresh_account(params = {}, opts = {})
34
30
  request_stripe_object(
35
31
  method: :post,
36
- path: resource_url + "/refresh",
32
+ path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(self["id"]) }),
33
+ params: params,
34
+ opts: opts
35
+ )
36
+ end
37
+
38
+ def self.disconnect(account, params = {}, opts = {})
39
+ request_stripe_object(
40
+ method: :post,
41
+ path: format("/v1/financial_connections/accounts/%<account>s/disconnect", { account: CGI.escape(account) }),
42
+ params: params,
43
+ opts: opts
44
+ )
45
+ end
46
+
47
+ def self.list_owners(account, params = {}, opts = {})
48
+ request_stripe_object(
49
+ method: :get,
50
+ path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(account) }),
51
+ params: params,
52
+ opts: opts
53
+ )
54
+ end
55
+
56
+ def self.refresh_account(account, params = {}, opts = {})
57
+ request_stripe_object(
58
+ method: :post,
59
+ path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(account) }),
37
60
  params: params,
38
61
  opts: opts
39
62
  )
@@ -10,13 +10,10 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "identity.verification_session"
12
12
 
13
- custom_method :cancel, http_verb: :post
14
- custom_method :redact, http_verb: :post
15
-
16
13
  def cancel(params = {}, opts = {})
17
14
  request_stripe_object(
18
15
  method: :post,
19
- path: resource_url + "/cancel",
16
+ path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(self["id"]) }),
20
17
  params: params,
21
18
  opts: opts
22
19
  )
@@ -25,7 +22,25 @@ module Stripe
25
22
  def redact(params = {}, opts = {})
26
23
  request_stripe_object(
27
24
  method: :post,
28
- path: resource_url + "/redact",
25
+ path: format("/v1/identity/verification_sessions/%<session>s/redact", { session: CGI.escape(self["id"]) }),
26
+ params: params,
27
+ opts: opts
28
+ )
29
+ end
30
+
31
+ def self.cancel(session, params = {}, opts = {})
32
+ request_stripe_object(
33
+ method: :post,
34
+ path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(session) }),
35
+ params: params,
36
+ opts: opts
37
+ )
38
+ end
39
+
40
+ def self.redact(session, params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :post,
43
+ path: format("/v1/identity/verification_sessions/%<session>s/redact", { session: CGI.escape(session) }),
29
44
  params: params,
30
45
  opts: opts
31
46
  )
@@ -11,16 +11,10 @@ module Stripe
11
11
 
12
12
  OBJECT_NAME = "invoice"
13
13
 
14
- custom_method :finalize_invoice, http_verb: :post, http_path: "finalize"
15
- custom_method :mark_uncollectible, http_verb: :post
16
- custom_method :pay, http_verb: :post
17
- custom_method :send_invoice, http_verb: :post, http_path: "send"
18
- custom_method :void_invoice, http_verb: :post, http_path: "void"
19
-
20
14
  def finalize_invoice(params = {}, opts = {})
21
15
  request_stripe_object(
22
16
  method: :post,
23
- path: resource_url + "/finalize",
17
+ path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(self["id"]) }),
24
18
  params: params,
25
19
  opts: opts
26
20
  )
@@ -29,7 +23,7 @@ module Stripe
29
23
  def mark_uncollectible(params = {}, opts = {})
30
24
  request_stripe_object(
31
25
  method: :post,
32
- path: resource_url + "/mark_uncollectible",
26
+ path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(self["id"]) }),
33
27
  params: params,
34
28
  opts: opts
35
29
  )
@@ -38,7 +32,7 @@ module Stripe
38
32
  def pay(params = {}, opts = {})
39
33
  request_stripe_object(
40
34
  method: :post,
41
- path: resource_url + "/pay",
35
+ path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(self["id"]) }),
42
36
  params: params,
43
37
  opts: opts
44
38
  )
@@ -47,7 +41,7 @@ module Stripe
47
41
  def send_invoice(params = {}, opts = {})
48
42
  request_stripe_object(
49
43
  method: :post,
50
- path: resource_url + "/send",
44
+ path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(self["id"]) }),
51
45
  params: params,
52
46
  opts: opts
53
47
  )
@@ -56,20 +50,73 @@ module Stripe
56
50
  def void_invoice(params = {}, opts = {})
57
51
  request_stripe_object(
58
52
  method: :post,
59
- path: resource_url + "/void",
53
+ path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(self["id"]) }),
54
+ params: params,
55
+ opts: opts
56
+ )
57
+ end
58
+
59
+ def self.finalize_invoice(invoice, params = {}, opts = {})
60
+ request_stripe_object(
61
+ method: :post,
62
+ path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(invoice) }),
63
+ params: params,
64
+ opts: opts
65
+ )
66
+ end
67
+
68
+ def self.mark_uncollectible(invoice, params = {}, opts = {})
69
+ request_stripe_object(
70
+ method: :post,
71
+ path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(invoice) }),
72
+ params: params,
73
+ opts: opts
74
+ )
75
+ end
76
+
77
+ def self.pay(invoice, params = {}, opts = {})
78
+ request_stripe_object(
79
+ method: :post,
80
+ path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(invoice) }),
81
+ params: params,
82
+ opts: opts
83
+ )
84
+ end
85
+
86
+ def self.send_invoice(invoice, params = {}, opts = {})
87
+ request_stripe_object(
88
+ method: :post,
89
+ path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(invoice) }),
90
+ params: params,
91
+ opts: opts
92
+ )
93
+ end
94
+
95
+ def self.void_invoice(invoice, params = {}, opts = {})
96
+ request_stripe_object(
97
+ method: :post,
98
+ path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(invoice) }),
60
99
  params: params,
61
100
  opts: opts
62
101
  )
63
102
  end
64
103
 
65
104
  def self.upcoming(params, opts = {})
66
- resp, opts = execute_resource_request(:get, resource_url + "/upcoming", params, opts)
67
- Util.convert_to_stripe_object(resp.data, opts)
105
+ request_stripe_object(
106
+ method: :get,
107
+ path: resource_url + "/upcoming",
108
+ params: params,
109
+ opts: opts
110
+ )
68
111
  end
69
112
 
70
113
  def self.list_upcoming_line_items(params, opts = {})
71
- resp, opts = execute_resource_request(:get, resource_url + "/upcoming/lines", params, opts)
72
- Util.convert_to_stripe_object(resp.data, opts)
114
+ request_stripe_object(
115
+ method: :get,
116
+ path: resource_url + "/upcoming/lines",
117
+ params: params,
118
+ opts: opts
119
+ )
73
120
  end
74
121
 
75
122
  def self.search(params = {}, opts = {})
@@ -9,13 +9,10 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "issuing.authorization"
11
11
 
12
- custom_method :approve, http_verb: :post
13
- custom_method :decline, http_verb: :post
14
-
15
12
  def approve(params = {}, opts = {})
16
13
  request_stripe_object(
17
14
  method: :post,
18
- path: resource_url + "/approve",
15
+ path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(self["id"]) }),
19
16
  params: params,
20
17
  opts: opts
21
18
  )
@@ -24,7 +21,25 @@ module Stripe
24
21
  def decline(params = {}, opts = {})
25
22
  request_stripe_object(
26
23
  method: :post,
27
- path: resource_url + "/decline",
24
+ path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(self["id"]) }),
25
+ params: params,
26
+ opts: opts
27
+ )
28
+ end
29
+
30
+ def self.approve(authorization, params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :post,
33
+ path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(authorization) }),
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ def self.decline(authorization, params = {}, opts = {})
40
+ request_stripe_object(
41
+ method: :post,
42
+ path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(authorization) }),
28
43
  params: params,
29
44
  opts: opts
30
45
  )
@@ -10,16 +10,103 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "issuing.card"
12
12
 
13
- custom_method :details, http_verb: :get
14
-
15
13
  def details(params = {}, opts = {})
16
14
  request_stripe_object(
17
15
  method: :get,
18
- path: resource_url + "/details",
16
+ path: format("/v1/issuing/cards/%<card>s/details", { card: CGI.escape(self["id"]) }),
17
+ params: params,
18
+ opts: opts
19
+ )
20
+ end
21
+
22
+ def self.details(card, params = {}, opts = {})
23
+ request_stripe_object(
24
+ method: :get,
25
+ path: format("/v1/issuing/cards/%<card>s/details", { card: CGI.escape(card) }),
19
26
  params: params,
20
27
  opts: opts
21
28
  )
22
29
  end
30
+
31
+ def test_helpers
32
+ TestHelpers.new(self)
33
+ end
34
+
35
+ class TestHelpers < APIResourceTestHelpers
36
+ RESOURCE_CLASS = Card
37
+
38
+ def self.deliver_card(card, params = {}, opts = {})
39
+ request_stripe_object(
40
+ method: :post,
41
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/deliver", { card: CGI.escape(card) }),
42
+ params: params,
43
+ opts: opts
44
+ )
45
+ end
46
+
47
+ def self.fail_card(card, params = {}, opts = {})
48
+ request_stripe_object(
49
+ method: :post,
50
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/fail", { card: CGI.escape(card) }),
51
+ params: params,
52
+ opts: opts
53
+ )
54
+ end
55
+
56
+ def self.return_card(card, params = {}, opts = {})
57
+ request_stripe_object(
58
+ method: :post,
59
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/return", { card: CGI.escape(card) }),
60
+ params: params,
61
+ opts: opts
62
+ )
63
+ end
64
+
65
+ def self.ship_card(card, params = {}, opts = {})
66
+ request_stripe_object(
67
+ method: :post,
68
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/ship", { card: CGI.escape(card) }),
69
+ params: params,
70
+ opts: opts
71
+ )
72
+ end
73
+
74
+ def deliver_card(params = {}, opts = {})
75
+ @resource.request_stripe_object(
76
+ method: :post,
77
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/deliver", { card: CGI.escape(@resource["id"]) }),
78
+ params: params,
79
+ opts: opts
80
+ )
81
+ end
82
+
83
+ def fail_card(params = {}, opts = {})
84
+ @resource.request_stripe_object(
85
+ method: :post,
86
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/fail", { card: CGI.escape(@resource["id"]) }),
87
+ params: params,
88
+ opts: opts
89
+ )
90
+ end
91
+
92
+ def return_card(params = {}, opts = {})
93
+ @resource.request_stripe_object(
94
+ method: :post,
95
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/return", { card: CGI.escape(@resource["id"]) }),
96
+ params: params,
97
+ opts: opts
98
+ )
99
+ end
100
+
101
+ def ship_card(params = {}, opts = {})
102
+ @resource.request_stripe_object(
103
+ method: :post,
104
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/ship", { card: CGI.escape(@resource["id"]) }),
105
+ params: params,
106
+ opts: opts
107
+ )
108
+ end
109
+ end
23
110
  end
24
111
  end
25
112
  end
@@ -10,12 +10,19 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "issuing.dispute"
12
12
 
13
- custom_method :submit, http_verb: :post
14
-
15
13
  def submit(params = {}, opts = {})
16
14
  request_stripe_object(
17
15
  method: :post,
18
- path: resource_url + "/submit",
16
+ path: format("/v1/issuing/disputes/%<dispute>s/submit", { dispute: CGI.escape(self["id"]) }),
17
+ params: params,
18
+ opts: opts
19
+ )
20
+ end
21
+
22
+ def self.submit(dispute, params = {}, opts = {})
23
+ request_stripe_object(
24
+ method: :post,
25
+ path: format("/v1/issuing/disputes/%<dispute>s/submit", { dispute: CGI.escape(dispute) }),
19
26
  params: params,
20
27
  opts: opts
21
28
  )
@@ -9,15 +9,10 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "order"
11
11
 
12
- custom_method :cancel, http_verb: :post
13
- custom_method :list_line_items, http_verb: :get, http_path: "line_items"
14
- custom_method :reopen, http_verb: :post
15
- custom_method :submit, http_verb: :post
16
-
17
12
  def cancel(params = {}, opts = {})
18
13
  request_stripe_object(
19
14
  method: :post,
20
- path: resource_url + "/cancel",
15
+ path: format("/v1/orders/%<id>s/cancel", { id: CGI.escape(self["id"]) }),
21
16
  params: params,
22
17
  opts: opts
23
18
  )
@@ -26,7 +21,7 @@ module Stripe
26
21
  def list_line_items(params = {}, opts = {})
27
22
  request_stripe_object(
28
23
  method: :get,
29
- path: resource_url + "/line_items",
24
+ path: format("/v1/orders/%<id>s/line_items", { id: CGI.escape(self["id"]) }),
30
25
  params: params,
31
26
  opts: opts
32
27
  )
@@ -35,7 +30,7 @@ module Stripe
35
30
  def reopen(params = {}, opts = {})
36
31
  request_stripe_object(
37
32
  method: :post,
38
- path: resource_url + "/reopen",
33
+ path: format("/v1/orders/%<id>s/reopen", { id: CGI.escape(self["id"]) }),
39
34
  params: params,
40
35
  opts: opts
41
36
  )
@@ -44,7 +39,43 @@ module Stripe
44
39
  def submit(params = {}, opts = {})
45
40
  request_stripe_object(
46
41
  method: :post,
47
- path: resource_url + "/submit",
42
+ path: format("/v1/orders/%<id>s/submit", { id: CGI.escape(self["id"]) }),
43
+ params: params,
44
+ opts: opts
45
+ )
46
+ end
47
+
48
+ def self.cancel(id, params = {}, opts = {})
49
+ request_stripe_object(
50
+ method: :post,
51
+ path: format("/v1/orders/%<id>s/cancel", { id: CGI.escape(id) }),
52
+ params: params,
53
+ opts: opts
54
+ )
55
+ end
56
+
57
+ def self.list_line_items(id, params = {}, opts = {})
58
+ request_stripe_object(
59
+ method: :get,
60
+ path: format("/v1/orders/%<id>s/line_items", { id: CGI.escape(id) }),
61
+ params: params,
62
+ opts: opts
63
+ )
64
+ end
65
+
66
+ def self.reopen(id, params = {}, opts = {})
67
+ request_stripe_object(
68
+ method: :post,
69
+ path: format("/v1/orders/%<id>s/reopen", { id: CGI.escape(id) }),
70
+ params: params,
71
+ opts: opts
72
+ )
73
+ end
74
+
75
+ def self.submit(id, params = {}, opts = {})
76
+ request_stripe_object(
77
+ method: :post,
78
+ path: format("/v1/orders/%<id>s/submit", { id: CGI.escape(id) }),
48
79
  params: params,
49
80
  opts: opts
50
81
  )