stripe 6.0.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -2
  3. data/Makefile +1 -1
  4. data/OPENAPI_VERSION +1 -0
  5. data/README.md +1 -1
  6. data/VERSION +1 -1
  7. data/lib/data/ca-certificates.crt +1241 -1937
  8. data/lib/stripe/api_operations/create.rb +6 -2
  9. data/lib/stripe/api_operations/delete.rb +12 -7
  10. data/lib/stripe/api_operations/list.rb +6 -9
  11. data/lib/stripe/api_operations/nested_resource.rb +62 -34
  12. data/lib/stripe/api_operations/request.rb +10 -0
  13. data/lib/stripe/api_operations/save.rb +6 -3
  14. data/lib/stripe/api_operations/search.rb +6 -9
  15. data/lib/stripe/api_resource.rb +1 -1
  16. data/lib/stripe/api_resource_test_helpers.rb +2 -0
  17. data/lib/stripe/api_version.rb +8 -0
  18. data/lib/stripe/object_types.rb +11 -7
  19. data/lib/stripe/resources/account.rb +28 -8
  20. data/lib/stripe/resources/apps/secret.rb +31 -0
  21. data/lib/stripe/resources/card.rb +1 -3
  22. data/lib/stripe/resources/charge.rb +10 -3
  23. data/lib/stripe/resources/checkout/session.rb +27 -5
  24. data/lib/stripe/resources/credit_note.rb +24 -9
  25. data/lib/stripe/resources/customer.rb +104 -19
  26. data/lib/stripe/resources/dispute.rb +10 -3
  27. data/lib/stripe/resources/financial_connections/account.rb +40 -5
  28. data/lib/stripe/resources/identity/verification_session.rb +20 -5
  29. data/lib/stripe/resources/invoice.rb +64 -17
  30. data/lib/stripe/resources/issuing/authorization.rb +20 -5
  31. data/lib/stripe/resources/issuing/card.rb +78 -9
  32. data/lib/stripe/resources/issuing/dispute.rb +10 -3
  33. data/lib/stripe/resources/order.rb +40 -9
  34. data/lib/stripe/resources/payment_intent.rb +60 -13
  35. data/lib/stripe/resources/payment_link.rb +10 -3
  36. data/lib/stripe/resources/payment_method.rb +20 -5
  37. data/lib/stripe/resources/payout.rb +20 -5
  38. data/lib/stripe/resources/quote.rb +50 -11
  39. data/lib/stripe/resources/refund.rb +19 -5
  40. data/lib/stripe/resources/reporting/report_type.rb +0 -1
  41. data/lib/stripe/resources/review.rb +10 -3
  42. data/lib/stripe/resources/setup_intent.rb +30 -7
  43. data/lib/stripe/resources/source.rb +16 -6
  44. data/lib/stripe/resources/subscription.rb +52 -3
  45. data/lib/stripe/resources/subscription_item.rb +0 -7
  46. data/lib/stripe/resources/subscription_schedule.rb +20 -5
  47. data/lib/stripe/resources/terminal/reader.rb +49 -11
  48. data/lib/stripe/resources/test_helpers/test_clock.rb +10 -3
  49. data/lib/stripe/resources/topup.rb +10 -3
  50. data/lib/stripe/resources/transfer.rb +0 -11
  51. data/lib/stripe/resources/treasury/credit_reversal.rb +13 -0
  52. data/lib/stripe/resources/treasury/debit_reversal.rb +13 -0
  53. data/lib/stripe/resources/treasury/financial_account.rb +50 -0
  54. data/lib/stripe/resources/treasury/inbound_transfer.rb +93 -0
  55. data/lib/stripe/resources/treasury/outbound_payment.rb +93 -0
  56. data/lib/stripe/resources/treasury/outbound_transfer.rb +97 -0
  57. data/lib/stripe/resources/treasury/received_credit.rb +29 -0
  58. data/lib/stripe/resources/treasury/received_debit.rb +29 -0
  59. data/lib/stripe/resources/treasury/transaction.rb +12 -0
  60. data/lib/stripe/resources/treasury/transaction_entry.rb +16 -0
  61. data/lib/stripe/resources.rb +11 -7
  62. data/lib/stripe/util.rb +38 -3
  63. data/lib/stripe/version.rb +1 -1
  64. metadata +16 -8
  65. data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
  66. data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
  67. data/lib/stripe/resources/issuing/card_details.rb +0 -10
  68. data/lib/stripe/resources/recipient.rb +0 -14
  69. data/lib/stripe/resources/three_d_secure.rb +0 -14
@@ -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,16 @@ 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"]) }),
24
+ params: params,
25
+ opts: opts
26
+ )
27
+ end
28
+
29
+ def delete_discount(params = {}, opts = {})
30
+ request_stripe_object(
31
+ method: :delete,
32
+ path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(self["id"]) }),
30
33
  params: params,
31
34
  opts: opts
32
35
  )
@@ -35,13 +38,61 @@ module Stripe
35
38
  def list_payment_methods(params = {}, opts = {})
36
39
  request_stripe_object(
37
40
  method: :get,
38
- path: resource_url + "/payment_methods",
41
+ path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(self["id"]) }),
42
+ params: params,
43
+ opts: opts
44
+ )
45
+ end
46
+
47
+ def retrieve_payment_method(payment_method, params = {}, opts = {})
48
+ request_stripe_object(
49
+ method: :get,
50
+ path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(self["id"]), payment_method: CGI.escape(payment_method) }),
51
+ params: params,
52
+ opts: opts
53
+ )
54
+ end
55
+
56
+ def self.create_funding_instructions(customer, params = {}, opts = {})
57
+ request_stripe_object(
58
+ method: :post,
59
+ path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(customer) }),
60
+ params: params,
61
+ opts: opts
62
+ )
63
+ end
64
+
65
+ def self.delete_discount(customer, params = {}, opts = {})
66
+ request_stripe_object(
67
+ method: :delete,
68
+ path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(customer) }),
69
+ params: params,
70
+ opts: opts
71
+ )
72
+ end
73
+
74
+ def self.list_payment_methods(customer, params = {}, opts = {})
75
+ request_stripe_object(
76
+ method: :get,
77
+ path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(customer) }),
39
78
  params: params,
40
79
  opts: opts
41
80
  )
42
81
  end
43
82
 
44
- custom_method :delete_discount, http_verb: :delete, http_path: "discount"
83
+ def self.retrieve_payment_method(
84
+ customer,
85
+ payment_method,
86
+ params = {},
87
+ opts = {}
88
+ )
89
+ request_stripe_object(
90
+ method: :get,
91
+ path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }),
92
+ params: params,
93
+ opts: opts
94
+ )
95
+ end
45
96
 
46
97
  save_nested_resource :source
47
98
  nested_resource_class_methods :source,
@@ -53,16 +104,6 @@ module Stripe
53
104
  alias detach_source delete_source
54
105
  end
55
106
 
56
- # Deletes a discount associated with the customer.
57
- #
58
- # Returns the deleted discount. The customer object is not updated,
59
- # so you must call `refresh` on it to get a new version with the
60
- # discount removed.
61
- def delete_discount
62
- resp, opts = execute_resource_request(:delete, resource_url + "/discount")
63
- Util.convert_to_stripe_object(resp.data, opts)
64
- end
65
-
66
107
  def self.search(params = {}, opts = {})
67
108
  _search("/v1/customers/search", params, opts)
68
109
  end
@@ -70,5 +111,49 @@ module Stripe
70
111
  def self.search_auto_paging_each(params = {}, opts = {}, &blk)
71
112
  search(params, opts).auto_paging_each(&blk)
72
113
  end
114
+
115
+ def self.retrieve_cash_balance(customer, params = {}, opts = {})
116
+ request_stripe_object(
117
+ method: :get,
118
+ path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
119
+ params: params,
120
+ opts: opts
121
+ )
122
+ end
123
+
124
+ def self.update_cash_balance(customer, params = {}, opts = {})
125
+ request_stripe_object(
126
+ method: :post,
127
+ path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
128
+ params: params,
129
+ opts: opts
130
+ )
131
+ end
132
+
133
+ def test_helpers
134
+ TestHelpers.new(self)
135
+ end
136
+
137
+ class TestHelpers < APIResourceTestHelpers
138
+ RESOURCE_CLASS = Customer
139
+
140
+ def self.fund_cash_balance(customer, params = {}, opts = {})
141
+ request_stripe_object(
142
+ method: :post,
143
+ path: format("/v1/test_helpers/customers/%<customer>s/fund_cash_balance", { customer: CGI.escape(customer) }),
144
+ params: params,
145
+ opts: opts
146
+ )
147
+ end
148
+
149
+ def fund_cash_balance(params = {}, opts = {})
150
+ @resource.request_stripe_object(
151
+ method: :post,
152
+ path: format("/v1/test_helpers/customers/%<customer>s/fund_cash_balance", { customer: CGI.escape(@resource["id"]) }),
153
+ params: params,
154
+ opts: opts
155
+ )
156
+ end
157
+ end
73
158
  end
74
159
  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
  )
@@ -4,15 +4,23 @@
4
4
  module Stripe
5
5
  module FinancialConnections
6
6
  class Account < APIResource
7
- OBJECT_NAME = "financial_connections.account"
7
+ extend Stripe::APIOperations::List
8
8
 
9
- custom_method :disconnect, http_verb: :post
10
- custom_method :refresh_account, http_verb: :post, http_path: "refresh"
9
+ OBJECT_NAME = "financial_connections.account"
11
10
 
12
11
  def disconnect(params = {}, opts = {})
13
12
  request_stripe_object(
14
13
  method: :post,
15
- path: resource_url + "/disconnect",
14
+ path: format("/v1/financial_connections/accounts/%<account>s/disconnect", { account: CGI.escape(self["id"]) }),
15
+ params: params,
16
+ opts: opts
17
+ )
18
+ end
19
+
20
+ def list_owners(params = {}, opts = {})
21
+ request_stripe_object(
22
+ method: :get,
23
+ path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(self["id"]) }),
16
24
  params: params,
17
25
  opts: opts
18
26
  )
@@ -21,7 +29,34 @@ module Stripe
21
29
  def refresh_account(params = {}, opts = {})
22
30
  request_stripe_object(
23
31
  method: :post,
24
- 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) }),
25
60
  params: params,
26
61
  opts: opts
27
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,15 +10,84 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "issuing.card"
12
12
 
13
- custom_method :details, http_verb: :get
14
-
15
- def details(params = {}, opts = {})
16
- request_stripe_object(
17
- method: :get,
18
- path: resource_url + "/details",
19
- params: params,
20
- opts: opts
21
- )
13
+ def test_helpers
14
+ TestHelpers.new(self)
15
+ end
16
+
17
+ class TestHelpers < APIResourceTestHelpers
18
+ RESOURCE_CLASS = Card
19
+
20
+ def self.deliver_card(card, params = {}, opts = {})
21
+ request_stripe_object(
22
+ method: :post,
23
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/deliver", { card: CGI.escape(card) }),
24
+ params: params,
25
+ opts: opts
26
+ )
27
+ end
28
+
29
+ def self.fail_card(card, params = {}, opts = {})
30
+ request_stripe_object(
31
+ method: :post,
32
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/fail", { card: CGI.escape(card) }),
33
+ params: params,
34
+ opts: opts
35
+ )
36
+ end
37
+
38
+ def self.return_card(card, params = {}, opts = {})
39
+ request_stripe_object(
40
+ method: :post,
41
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/return", { card: CGI.escape(card) }),
42
+ params: params,
43
+ opts: opts
44
+ )
45
+ end
46
+
47
+ def self.ship_card(card, params = {}, opts = {})
48
+ request_stripe_object(
49
+ method: :post,
50
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/ship", { card: CGI.escape(card) }),
51
+ params: params,
52
+ opts: opts
53
+ )
54
+ end
55
+
56
+ def deliver_card(params = {}, opts = {})
57
+ @resource.request_stripe_object(
58
+ method: :post,
59
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/deliver", { card: CGI.escape(@resource["id"]) }),
60
+ params: params,
61
+ opts: opts
62
+ )
63
+ end
64
+
65
+ def fail_card(params = {}, opts = {})
66
+ @resource.request_stripe_object(
67
+ method: :post,
68
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/fail", { card: CGI.escape(@resource["id"]) }),
69
+ params: params,
70
+ opts: opts
71
+ )
72
+ end
73
+
74
+ def return_card(params = {}, opts = {})
75
+ @resource.request_stripe_object(
76
+ method: :post,
77
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/return", { card: CGI.escape(@resource["id"]) }),
78
+ params: params,
79
+ opts: opts
80
+ )
81
+ end
82
+
83
+ def ship_card(params = {}, opts = {})
84
+ @resource.request_stripe_object(
85
+ method: :post,
86
+ path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/ship", { card: CGI.escape(@resource["id"]) }),
87
+ params: params,
88
+ opts: opts
89
+ )
90
+ end
22
91
  end
23
92
  end
24
93
  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
  )