stripe 6.3.0 → 6.6.0.pre.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -3
  3. data/Makefile +1 -1
  4. data/OPENAPI_VERSION +1 -1
  5. data/VERSION +1 -1
  6. data/lib/stripe/api_operations/create.rb +6 -2
  7. data/lib/stripe/api_operations/delete.rb +12 -7
  8. data/lib/stripe/api_operations/list.rb +6 -9
  9. data/lib/stripe/api_operations/nested_resource.rb +62 -34
  10. data/lib/stripe/api_operations/request.rb +10 -0
  11. data/lib/stripe/api_operations/save.rb +6 -3
  12. data/lib/stripe/api_operations/search.rb +6 -9
  13. data/lib/stripe/api_resource.rb +1 -1
  14. data/lib/stripe/api_version.rb +8 -0
  15. data/lib/stripe/object_types.rb +1 -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 +24 -9
  21. data/lib/stripe/resources/customer.rb +67 -27
  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 +64 -17
  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/quote_phase.rb +28 -0
  36. data/lib/stripe/resources/refund.rb +19 -5
  37. data/lib/stripe/resources/review.rb +10 -3
  38. data/lib/stripe/resources/setup_intent.rb +30 -7
  39. data/lib/stripe/resources/source.rb +16 -6
  40. data/lib/stripe/resources/subscription.rb +10 -3
  41. data/lib/stripe/resources/subscription_item.rb +6 -2
  42. data/lib/stripe/resources/subscription_schedule.rb +37 -4
  43. data/lib/stripe/resources/terminal/reader.rb +49 -11
  44. data/lib/stripe/resources/test_helpers/test_clock.rb +10 -3
  45. data/lib/stripe/resources/topup.rb +10 -3
  46. data/lib/stripe/resources/transfer.rb +10 -3
  47. data/lib/stripe/resources/treasury/financial_account.rb +20 -5
  48. data/lib/stripe/resources/treasury/inbound_transfer.rb +39 -9
  49. data/lib/stripe/resources/treasury/outbound_payment.rb +39 -9
  50. data/lib/stripe/resources/treasury/outbound_transfer.rb +43 -9
  51. data/lib/stripe/resources/treasury/received_credit.rb +5 -6
  52. data/lib/stripe/resources/treasury/received_debit.rb +5 -6
  53. data/lib/stripe/resources.rb +1 -0
  54. data/lib/stripe/stripe_configuration.rb +2 -0
  55. data/lib/stripe/util.rb +38 -3
  56. data/lib/stripe/version.rb +1 -1
  57. data/lib/stripe.rb +1 -0
  58. metadata +6 -4
@@ -12,9 +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
15
  nested_resource_class_methods :balance_transaction,
19
16
  operations: %i[create retrieve update list]
20
17
  nested_resource_class_methods :tax_id,
@@ -23,7 +20,7 @@ module Stripe
23
20
  def create_funding_instructions(params = {}, opts = {})
24
21
  request_stripe_object(
25
22
  method: :post,
26
- path: resource_url + "/funding_instructions",
23
+ path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(self["id"]) }),
27
24
  params: params,
28
25
  opts: opts
29
26
  )
@@ -32,7 +29,7 @@ module Stripe
32
29
  def list_payment_methods(params = {}, opts = {})
33
30
  request_stripe_object(
34
31
  method: :get,
35
- path: resource_url + "/payment_methods",
32
+ path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(self["id"]) }),
36
33
  params: params,
37
34
  opts: opts
38
35
  )
@@ -47,23 +44,38 @@ module Stripe
47
44
  )
48
45
  end
49
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
+
50
65
  def self.retrieve_payment_method(
51
66
  customer,
52
67
  payment_method,
53
68
  params = {},
54
69
  opts = {}
55
70
  )
56
- resp, opts = execute_resource_request(
57
- :get,
58
- format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }),
59
- params,
60
- 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
61
76
  )
62
- Util.convert_to_stripe_object(resp.data, opts)
63
77
  end
64
78
 
65
- custom_method :delete_discount, http_verb: :delete, http_path: "discount"
66
-
67
79
  save_nested_resource :source
68
80
  nested_resource_class_methods :source,
69
81
  operations: %i[create retrieve update delete list]
@@ -73,6 +85,7 @@ module Stripe
73
85
  class << self
74
86
  alias detach_source delete_source
75
87
  end
88
+ custom_method :delete_discount, http_verb: :delete, http_path: "discount"
76
89
 
77
90
  # Deletes a discount associated with the customer.
78
91
  #
@@ -80,8 +93,11 @@ module Stripe
80
93
  # so you must call `refresh` on it to get a new version with the
81
94
  # discount removed.
82
95
  def delete_discount
83
- resp, opts = execute_resource_request(:delete, resource_url + "/discount")
84
- Util.convert_to_stripe_object(resp.data, opts)
96
+ request_stripe_object(
97
+ method: :delete,
98
+ path: resource_url + "/discount",
99
+ params: {}
100
+ )
85
101
  end
86
102
 
87
103
  def self.search(params = {}, opts = {})
@@ -103,13 +119,12 @@ module Stripe
103
119
  if !opts_or_unused_nested_id.nil? && opts_or_unused_nested_id.class == Hash && opts.empty?
104
120
  opts = opts_or_unused_nested_id
105
121
  end
106
- resp, opts = execute_resource_request(
107
- :get,
108
- format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
109
- {},
110
- opts
122
+ request_stripe_object(
123
+ method: :get,
124
+ path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
125
+ params: {},
126
+ opts: opts
111
127
  )
112
- Util.convert_to_stripe_object(resp.data, opts)
113
128
  end
114
129
 
115
130
  def self.update_cash_balance(
@@ -123,13 +138,38 @@ module Stripe
123
138
  raise ArgumentError, "update_cash_balance requires the second argument always be nil for legacy reasons."
124
139
  end
125
140
 
126
- resp, opts = execute_resource_request(
127
- :post,
128
- format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
129
- params,
130
- opts
141
+ request_stripe_object(
142
+ method: :post,
143
+ path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
144
+ params: params,
145
+ opts: opts
131
146
  )
132
- Util.convert_to_stripe_object(resp.data, opts)
147
+ end
148
+
149
+ def test_helpers
150
+ TestHelpers.new(self)
151
+ end
152
+
153
+ class TestHelpers < APIResourceTestHelpers
154
+ RESOURCE_CLASS = Customer
155
+
156
+ def self.fund_cash_balance(customer, params = {}, opts = {})
157
+ request_stripe_object(
158
+ method: :post,
159
+ path: format("/v1/test_helpers/customers/%<customer>s/fund_cash_balance", { customer: CGI.escape(customer) }),
160
+ params: params,
161
+ opts: opts
162
+ )
163
+ end
164
+
165
+ def fund_cash_balance(params = {}, opts = {})
166
+ @resource.request_stripe_object(
167
+ method: :post,
168
+ path: format("/v1/test_helpers/customers/%<customer>s/fund_cash_balance", { customer: CGI.escape(@resource["id"]) }),
169
+ params: params,
170
+ opts: opts
171
+ )
172
+ end
133
173
  end
134
174
  end
135
175
  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.list_upcoming_line_items(params = {}, opts = {})
69
+ request_stripe_object(
70
+ method: :get,
71
+ path: "/v1/invoices/upcoming/lines",
72
+ params: params,
73
+ opts: opts
74
+ )
75
+ end
76
+
77
+ def self.mark_uncollectible(invoice, params = {}, opts = {})
78
+ request_stripe_object(
79
+ method: :post,
80
+ path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(invoice) }),
81
+ params: params,
82
+ opts: opts
83
+ )
84
+ end
85
+
86
+ def self.pay(invoice, params = {}, opts = {})
87
+ request_stripe_object(
88
+ method: :post,
89
+ path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(invoice) }),
90
+ params: params,
91
+ opts: opts
92
+ )
93
+ end
94
+
95
+ def self.send_invoice(invoice, params = {}, opts = {})
96
+ request_stripe_object(
97
+ method: :post,
98
+ path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(invoice) }),
60
99
  params: params,
61
100
  opts: opts
62
101
  )
63
102
  end
64
103
 
65
- 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)
104
+ def self.upcoming(params = {}, opts = {})
105
+ request_stripe_object(
106
+ method: :get,
107
+ path: "/v1/invoices/upcoming",
108
+ params: params,
109
+ opts: opts
110
+ )
68
111
  end
69
112
 
70
- 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)
113
+ def self.void_invoice(invoice, params = {}, opts = {})
114
+ request_stripe_object(
115
+ method: :post,
116
+ path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(invoice) }),
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
  )