stripe 10.1.0 → 12.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +215 -21
  3. data/Gemfile +6 -5
  4. data/Makefile +8 -1
  5. data/OPENAPI_VERSION +1 -1
  6. data/README.md +46 -14
  7. data/Rakefile +7 -5
  8. data/VERSION +1 -1
  9. data/{bin → exe}/stripe-console +1 -1
  10. data/lib/stripe/api_operations/nested_resource.rb +22 -2
  11. data/lib/stripe/api_operations/request.rb +22 -18
  12. data/lib/stripe/api_operations/save.rb +7 -9
  13. data/lib/stripe/api_operations/search.rb +5 -0
  14. data/lib/stripe/api_operations/singleton_save.rb +86 -0
  15. data/lib/stripe/api_resource.rb +13 -4
  16. data/lib/stripe/api_resource_test_helpers.rb +7 -3
  17. data/lib/stripe/api_version.rb +1 -1
  18. data/lib/stripe/connection_manager.rb +4 -6
  19. data/lib/stripe/errors.rb +3 -11
  20. data/lib/stripe/instrumentation.rb +5 -21
  21. data/lib/stripe/list_object.rb +3 -0
  22. data/lib/stripe/multipart_encoder.rb +7 -7
  23. data/lib/stripe/oauth.rb +6 -6
  24. data/lib/stripe/object_types.rb +135 -116
  25. data/lib/stripe/resources/account.rb +103 -25
  26. data/lib/stripe/resources/account_link.rb +8 -0
  27. data/lib/stripe/resources/account_session.rb +8 -0
  28. data/lib/stripe/resources/alipay_account.rb +1 -1
  29. data/lib/stripe/resources/apple_pay_domain.rb +43 -0
  30. data/lib/stripe/resources/application_fee.rb +8 -0
  31. data/lib/stripe/resources/application_fee_refund.rb +4 -2
  32. data/lib/stripe/resources/apps/secret.rb +15 -0
  33. data/lib/stripe/resources/balance.rb +3 -0
  34. data/lib/stripe/resources/balance_transaction.rb +15 -0
  35. data/lib/stripe/resources/bank_account.rb +49 -7
  36. data/lib/stripe/resources/billing/alert.rb +87 -0
  37. data/lib/stripe/resources/billing/meter.rb +83 -0
  38. data/lib/stripe/resources/billing/meter_event.rb +27 -0
  39. data/lib/stripe/resources/billing/meter_event_adjustment.rb +26 -0
  40. data/lib/stripe/resources/billing/meter_event_summary.rb +15 -0
  41. data/lib/stripe/resources/billing_portal/configuration.rb +33 -0
  42. data/lib/stripe/resources/billing_portal/session.rb +14 -1
  43. data/lib/stripe/resources/capability.rb +4 -2
  44. data/lib/stripe/resources/card.rb +28 -0
  45. data/lib/stripe/resources/cash_balance.rb +3 -0
  46. data/lib/stripe/resources/charge.rb +39 -1
  47. data/lib/stripe/resources/checkout/session.rb +47 -5
  48. data/lib/stripe/resources/climate/order.rb +67 -0
  49. data/lib/stripe/resources/climate/product.rb +27 -0
  50. data/lib/stripe/resources/climate/supplier.rb +26 -0
  51. data/lib/stripe/resources/confirmation_token.rb +39 -0
  52. data/lib/stripe/resources/country_spec.rb +8 -0
  53. data/lib/stripe/resources/coupon.rb +45 -0
  54. data/lib/stripe/resources/credit_note.rb +47 -7
  55. data/lib/stripe/resources/credit_note_line_item.rb +3 -0
  56. data/lib/stripe/resources/customer.rb +89 -26
  57. data/lib/stripe/resources/customer_balance_transaction.rb +3 -1
  58. data/lib/stripe/resources/customer_cash_balance_transaction.rb +3 -2
  59. data/lib/stripe/resources/customer_session.rb +29 -0
  60. data/lib/stripe/resources/discount.rb +3 -0
  61. data/lib/stripe/resources/dispute.rb +26 -0
  62. data/lib/stripe/resources/entitlements/active_entitlement.rb +26 -0
  63. data/lib/stripe/resources/entitlements/feature.rb +49 -0
  64. data/lib/stripe/resources/ephemeral_key.rb +23 -0
  65. data/lib/stripe/resources/event.rb +11 -3
  66. data/lib/stripe/resources/exchange_rate.rb +8 -0
  67. data/lib/stripe/resources/file.rb +29 -16
  68. data/lib/stripe/resources/file_link.rb +23 -0
  69. data/lib/stripe/resources/financial_connections/account.rb +66 -7
  70. data/lib/stripe/resources/financial_connections/account_owner.rb +3 -0
  71. data/lib/stripe/resources/financial_connections/account_ownership.rb +3 -0
  72. data/lib/stripe/resources/financial_connections/session.rb +13 -0
  73. data/lib/stripe/resources/financial_connections/transaction.rb +26 -0
  74. data/lib/stripe/resources/forwarding/request.rb +52 -0
  75. data/lib/stripe/resources/funding_instructions.rb +3 -0
  76. data/lib/stripe/resources/identity/verification_report.rb +14 -1
  77. data/lib/stripe/resources/identity/verification_session.rb +90 -4
  78. data/lib/stripe/resources/invoice.rb +170 -17
  79. data/lib/stripe/resources/invoice_item.rb +43 -0
  80. data/lib/stripe/resources/invoice_line_item.rb +21 -0
  81. data/lib/stripe/resources/invoice_rendering_template.rb +63 -0
  82. data/lib/stripe/resources/issuing/authorization.rb +88 -14
  83. data/lib/stripe/resources/issuing/card.rb +50 -16
  84. data/lib/stripe/resources/issuing/cardholder.rb +33 -0
  85. data/lib/stripe/resources/issuing/dispute.rb +35 -0
  86. data/lib/stripe/resources/issuing/personalization_design.rb +119 -0
  87. data/lib/stripe/resources/issuing/physical_bundle.rb +26 -0
  88. data/lib/stripe/resources/issuing/token.rb +18 -0
  89. data/lib/stripe/resources/issuing/transaction.rb +30 -0
  90. data/lib/stripe/resources/line_item.rb +3 -0
  91. data/lib/stripe/resources/login_link.rb +4 -1
  92. data/lib/stripe/resources/mandate.rb +3 -0
  93. data/lib/stripe/resources/payment_intent.rb +190 -25
  94. data/lib/stripe/resources/payment_link.rb +25 -0
  95. data/lib/stripe/resources/payment_method.rb +57 -4
  96. data/lib/stripe/resources/payment_method_configuration.rb +33 -0
  97. data/lib/stripe/resources/payment_method_domain.rb +46 -1
  98. data/lib/stripe/resources/payout.rb +39 -4
  99. data/lib/stripe/resources/person.rb +5 -4
  100. data/lib/stripe/resources/plan.rb +43 -0
  101. data/lib/stripe/resources/price.rb +24 -1
  102. data/lib/stripe/resources/product.rb +47 -1
  103. data/lib/stripe/resources/product_feature.rb +13 -0
  104. data/lib/stripe/resources/promotion_code.rb +23 -0
  105. data/lib/stripe/resources/quote.rb +67 -32
  106. data/lib/stripe/resources/radar/early_fraud_warning.rb +13 -0
  107. data/lib/stripe/resources/radar/value_list.rb +53 -0
  108. data/lib/stripe/resources/radar/value_list_item.rb +43 -0
  109. data/lib/stripe/resources/refund.rb +46 -0
  110. data/lib/stripe/resources/reporting/report_run.rb +23 -0
  111. data/lib/stripe/resources/reporting/report_type.rb +13 -0
  112. data/lib/stripe/resources/reversal.rb +5 -3
  113. data/lib/stripe/resources/review.rb +10 -0
  114. data/lib/stripe/resources/setup_attempt.rb +8 -0
  115. data/lib/stripe/resources/setup_intent.rb +72 -10
  116. data/lib/stripe/resources/shipping_rate.rb +23 -0
  117. data/lib/stripe/resources/sigma/scheduled_query_run.rb +13 -0
  118. data/lib/stripe/resources/source.rb +23 -1
  119. data/lib/stripe/resources/source_transaction.rb +3 -0
  120. data/lib/stripe/resources/subscription.rb +81 -13
  121. data/lib/stripe/resources/subscription_item.rb +54 -1
  122. data/lib/stripe/resources/subscription_schedule.rb +41 -4
  123. data/lib/stripe/resources/tax/calculation.rb +15 -0
  124. data/lib/stripe/resources/tax/calculation_line_item.rb +3 -0
  125. data/lib/stripe/resources/tax/registration.rb +35 -0
  126. data/lib/stripe/resources/tax/settings.rb +4 -2
  127. data/lib/stripe/resources/tax/transaction.rb +15 -8
  128. data/lib/stripe/resources/tax/transaction_line_item.rb +3 -0
  129. data/lib/stripe/resources/tax_code.rb +8 -0
  130. data/lib/stripe/resources/tax_id.rb +30 -12
  131. data/lib/stripe/resources/tax_rate.rb +23 -0
  132. data/lib/stripe/resources/terminal/configuration.rb +53 -0
  133. data/lib/stripe/resources/terminal/connection_token.rb +13 -0
  134. data/lib/stripe/resources/terminal/location.rb +54 -0
  135. data/lib/stripe/resources/terminal/reader.rb +80 -12
  136. data/lib/stripe/resources/test_helpers/test_clock.rb +45 -0
  137. data/lib/stripe/resources/token.rb +10 -1
  138. data/lib/stripe/resources/topup.rb +25 -0
  139. data/lib/stripe/resources/transfer.rb +26 -1
  140. data/lib/stripe/resources/treasury/credit_reversal.rb +23 -0
  141. data/lib/stripe/resources/treasury/debit_reversal.rb +23 -0
  142. data/lib/stripe/resources/treasury/financial_account.rb +42 -5
  143. data/lib/stripe/resources/treasury/financial_account_features.rb +3 -0
  144. data/lib/stripe/resources/treasury/inbound_transfer.rb +47 -11
  145. data/lib/stripe/resources/treasury/outbound_payment.rb +64 -8
  146. data/lib/stripe/resources/treasury/outbound_transfer.rb +64 -8
  147. data/lib/stripe/resources/treasury/received_credit.rb +17 -0
  148. data/lib/stripe/resources/treasury/received_debit.rb +17 -0
  149. data/lib/stripe/resources/treasury/transaction.rb +13 -0
  150. data/lib/stripe/resources/treasury/transaction_entry.rb +13 -0
  151. data/lib/stripe/resources/usage_record.rb +5 -0
  152. data/lib/stripe/resources/usage_record_summary.rb +3 -0
  153. data/lib/stripe/resources/webhook_endpoint.rb +55 -2
  154. data/lib/stripe/resources.rb +18 -0
  155. data/lib/stripe/search_result_object.rb +4 -1
  156. data/lib/stripe/singleton_api_resource.rb +20 -3
  157. data/lib/stripe/stripe_client.rb +61 -63
  158. data/lib/stripe/stripe_configuration.rb +13 -29
  159. data/lib/stripe/stripe_object.rb +23 -21
  160. data/lib/stripe/stripe_response.rb +1 -3
  161. data/lib/stripe/util.rb +13 -15
  162. data/lib/stripe/version.rb +1 -1
  163. data/lib/stripe.rb +26 -0
  164. data/stripe.gemspec +7 -4
  165. metadata +25 -5
@@ -14,6 +14,41 @@ module Stripe
14
14
  include Stripe::APIOperations::Save
15
15
 
16
16
  OBJECT_NAME = "tax.registration"
17
+ def self.object_name
18
+ "tax.registration"
19
+ end
20
+
21
+ # Creates a new Tax Registration object.
22
+ def self.create(params = {}, opts = {})
23
+ request_stripe_object(
24
+ method: :post,
25
+ path: "/v1/tax/registrations",
26
+ params: params,
27
+ opts: opts
28
+ )
29
+ end
30
+
31
+ # Returns a list of Tax Registration objects.
32
+ def self.list(filters = {}, opts = {})
33
+ request_stripe_object(
34
+ method: :get,
35
+ path: "/v1/tax/registrations",
36
+ params: filters,
37
+ opts: opts
38
+ )
39
+ end
40
+
41
+ # Updates an existing Tax Registration object.
42
+ #
43
+ # A registration cannot be deleted after it has been created. If you wish to end a registration you may do so by setting expires_at.
44
+ def self.update(id, params = {}, opts = {})
45
+ request_stripe_object(
46
+ method: :post,
47
+ path: format("/v1/tax/registrations/%<id>s", { id: CGI.escape(id) }),
48
+ params: params,
49
+ opts: opts
50
+ )
51
+ end
17
52
  end
18
53
  end
19
54
  end
@@ -7,9 +7,11 @@ module Stripe
7
7
  #
8
8
  # Related guide: [Using the Settings API](https://stripe.com/docs/tax/settings-api)
9
9
  class Settings < SingletonAPIResource
10
- include Stripe::APIOperations::Save
11
-
10
+ include Stripe::APIOperations::SingletonSave
12
11
  OBJECT_NAME = "tax.settings"
12
+ def self.object_name
13
+ "tax.settings"
14
+ end
13
15
  end
14
16
  end
15
17
  end
@@ -8,16 +8,11 @@ module Stripe
8
8
  # Related guide: [Calculate tax in your custom payment flow](https://stripe.com/docs/tax/custom#tax-transaction)
9
9
  class Transaction < APIResource
10
10
  OBJECT_NAME = "tax.transaction"
11
-
12
- def list_line_items(params = {}, opts = {})
13
- request_stripe_object(
14
- method: :get,
15
- path: format("/v1/tax/transactions/%<transaction>s/line_items", { transaction: CGI.escape(self["id"]) }),
16
- params: params,
17
- opts: opts
18
- )
11
+ def self.object_name
12
+ "tax.transaction"
19
13
  end
20
14
 
15
+ # Creates a Tax Transaction from a calculation, if that calculation hasn't expired. Calculations expire after 90 days.
21
16
  def self.create_from_calculation(params = {}, opts = {})
22
17
  request_stripe_object(
23
18
  method: :post,
@@ -27,6 +22,7 @@ module Stripe
27
22
  )
28
23
  end
29
24
 
25
+ # Partially or fully reverses a previously created Transaction.
30
26
  def self.create_reversal(params = {}, opts = {})
31
27
  request_stripe_object(
32
28
  method: :post,
@@ -36,6 +32,17 @@ module Stripe
36
32
  )
37
33
  end
38
34
 
35
+ # Retrieves the line items of a committed standalone transaction as a collection.
36
+ def list_line_items(params = {}, opts = {})
37
+ request_stripe_object(
38
+ method: :get,
39
+ path: format("/v1/tax/transactions/%<transaction>s/line_items", { transaction: CGI.escape(self["id"]) }),
40
+ params: params,
41
+ opts: opts
42
+ )
43
+ end
44
+
45
+ # Retrieves the line items of a committed standalone transaction as a collection.
39
46
  def self.list_line_items(transaction, params = {}, opts = {})
40
47
  request_stripe_object(
41
48
  method: :get,
@@ -5,6 +5,9 @@ module Stripe
5
5
  module Tax
6
6
  class TransactionLineItem < APIResource
7
7
  OBJECT_NAME = "tax.transaction_line_item"
8
+ def self.object_name
9
+ "tax.transaction_line_item"
10
+ end
8
11
  end
9
12
  end
10
13
  end
@@ -7,5 +7,13 @@ module Stripe
7
7
  extend Stripe::APIOperations::List
8
8
 
9
9
  OBJECT_NAME = "tax_code"
10
+ def self.object_name
11
+ "tax_code"
12
+ end
13
+
14
+ # A list of [all tax codes available](https://stripe.com/docs/tax/tax-categories) to add to Products in order to allow specific tax calculations.
15
+ def self.list(filters = {}, opts = {})
16
+ request_stripe_object(method: :get, path: "/v1/tax_codes", params: filters, opts: opts)
17
+ end
10
18
  end
11
19
  end
@@ -7,25 +7,43 @@ module Stripe
7
7
  #
8
8
  # Related guides: [Customer tax identification numbers](https://stripe.com/docs/billing/taxes/tax-ids), [Account tax IDs](https://stripe.com/docs/invoicing/connect#account-tax-ids)
9
9
  class TaxId < APIResource
10
+ extend Stripe::APIOperations::Create
10
11
  include Stripe::APIOperations::Delete
11
12
  extend Stripe::APIOperations::List
12
13
 
13
14
  OBJECT_NAME = "tax_id"
15
+ def self.object_name
16
+ "tax_id"
17
+ end
18
+
19
+ # Creates a new account or customer tax_id object.
20
+ def self.create(params = {}, opts = {})
21
+ request_stripe_object(method: :post, path: "/v1/tax_ids", params: params, opts: opts)
22
+ end
23
+
24
+ # Deletes an existing account or customer tax_id object.
25
+ def self.delete(id, params = {}, opts = {})
26
+ request_stripe_object(
27
+ method: :delete,
28
+ path: format("/v1/tax_ids/%<id>s", { id: CGI.escape(id) }),
29
+ params: params,
30
+ opts: opts
31
+ )
32
+ end
14
33
 
15
- def resource_url
16
- if !respond_to?(:customer) || customer.nil?
17
- raise NotImplementedError,
18
- "Tax IDs cannot be accessed without a customer ID."
19
- end
20
- "#{Customer.resource_url}/#{CGI.escape(customer)}/tax_ids" \
21
- "/#{CGI.escape(id)}"
34
+ # Deletes an existing account or customer tax_id object.
35
+ def delete(params = {}, opts = {})
36
+ request_stripe_object(
37
+ method: :delete,
38
+ path: format("/v1/tax_ids/%<id>s", { id: CGI.escape(self["id"]) }),
39
+ params: params,
40
+ opts: opts
41
+ )
22
42
  end
23
43
 
24
- def self.retrieve(_id, _opts = {})
25
- raise NotImplementedError,
26
- "Tax IDs cannot be retrieved without a customer ID. Retrieve a " \
27
- "tax ID using `Customer.retrieve_tax_id('customer_id', " \
28
- "'tax_id_id')`"
44
+ # Returns a list of tax IDs.
45
+ def self.list(filters = {}, opts = {})
46
+ request_stripe_object(method: :get, path: "/v1/tax_ids", params: filters, opts: opts)
29
47
  end
30
48
  end
31
49
  end
@@ -11,5 +11,28 @@ module Stripe
11
11
  include Stripe::APIOperations::Save
12
12
 
13
13
  OBJECT_NAME = "tax_rate"
14
+ def self.object_name
15
+ "tax_rate"
16
+ end
17
+
18
+ # Creates a new tax rate.
19
+ def self.create(params = {}, opts = {})
20
+ request_stripe_object(method: :post, path: "/v1/tax_rates", params: params, opts: opts)
21
+ end
22
+
23
+ # Returns a list of your tax rates. Tax rates are returned sorted by creation date, with the most recently created tax rates appearing first.
24
+ def self.list(filters = {}, opts = {})
25
+ request_stripe_object(method: :get, path: "/v1/tax_rates", params: filters, opts: opts)
26
+ end
27
+
28
+ # Updates an existing tax rate.
29
+ def self.update(id, params = {}, opts = {})
30
+ request_stripe_object(
31
+ method: :post,
32
+ path: format("/v1/tax_rates/%<id>s", { id: CGI.escape(id) }),
33
+ params: params,
34
+ opts: opts
35
+ )
36
+ end
14
37
  end
15
38
  end
@@ -11,6 +11,59 @@ module Stripe
11
11
  include Stripe::APIOperations::Save
12
12
 
13
13
  OBJECT_NAME = "terminal.configuration"
14
+ def self.object_name
15
+ "terminal.configuration"
16
+ end
17
+
18
+ # Creates a new Configuration object.
19
+ def self.create(params = {}, opts = {})
20
+ request_stripe_object(
21
+ method: :post,
22
+ path: "/v1/terminal/configurations",
23
+ params: params,
24
+ opts: opts
25
+ )
26
+ end
27
+
28
+ # Deletes a Configuration object.
29
+ def self.delete(id, params = {}, opts = {})
30
+ request_stripe_object(
31
+ method: :delete,
32
+ path: format("/v1/terminal/configurations/%<id>s", { id: CGI.escape(id) }),
33
+ params: params,
34
+ opts: opts
35
+ )
36
+ end
37
+
38
+ # Deletes a Configuration object.
39
+ def delete(params = {}, opts = {})
40
+ request_stripe_object(
41
+ method: :delete,
42
+ path: format("/v1/terminal/configurations/%<configuration>s", { configuration: CGI.escape(self["id"]) }),
43
+ params: params,
44
+ opts: opts
45
+ )
46
+ end
47
+
48
+ # Returns a list of Configuration objects.
49
+ def self.list(filters = {}, opts = {})
50
+ request_stripe_object(
51
+ method: :get,
52
+ path: "/v1/terminal/configurations",
53
+ params: filters,
54
+ opts: opts
55
+ )
56
+ end
57
+
58
+ # Updates a new Configuration object.
59
+ def self.update(id, params = {}, opts = {})
60
+ request_stripe_object(
61
+ method: :post,
62
+ path: format("/v1/terminal/configurations/%<id>s", { id: CGI.escape(id) }),
63
+ params: params,
64
+ opts: opts
65
+ )
66
+ end
14
67
  end
15
68
  end
16
69
  end
@@ -10,6 +10,19 @@ module Stripe
10
10
  extend Stripe::APIOperations::Create
11
11
 
12
12
  OBJECT_NAME = "terminal.connection_token"
13
+ def self.object_name
14
+ "terminal.connection_token"
15
+ end
16
+
17
+ # To connect to a reader the Stripe Terminal SDK needs to retrieve a short-lived connection token from Stripe, proxied through your server. On your backend, add an endpoint that creates and returns a connection token.
18
+ def self.create(params = {}, opts = {})
19
+ request_stripe_object(
20
+ method: :post,
21
+ path: "/v1/terminal/connection_tokens",
22
+ params: params,
23
+ opts: opts
24
+ )
25
+ end
13
26
  end
14
27
  end
15
28
  end
@@ -13,6 +13,60 @@ module Stripe
13
13
  include Stripe::APIOperations::Save
14
14
 
15
15
  OBJECT_NAME = "terminal.location"
16
+ def self.object_name
17
+ "terminal.location"
18
+ end
19
+
20
+ # Creates a new Location object.
21
+ # For further details, including which address fields are required in each country, see the [Manage locations](https://stripe.com/docs/terminal/fleet/locations) guide.
22
+ def self.create(params = {}, opts = {})
23
+ request_stripe_object(
24
+ method: :post,
25
+ path: "/v1/terminal/locations",
26
+ params: params,
27
+ opts: opts
28
+ )
29
+ end
30
+
31
+ # Deletes a Location object.
32
+ def self.delete(id, params = {}, opts = {})
33
+ request_stripe_object(
34
+ method: :delete,
35
+ path: format("/v1/terminal/locations/%<id>s", { id: CGI.escape(id) }),
36
+ params: params,
37
+ opts: opts
38
+ )
39
+ end
40
+
41
+ # Deletes a Location object.
42
+ def delete(params = {}, opts = {})
43
+ request_stripe_object(
44
+ method: :delete,
45
+ path: format("/v1/terminal/locations/%<location>s", { location: CGI.escape(self["id"]) }),
46
+ params: params,
47
+ opts: opts
48
+ )
49
+ end
50
+
51
+ # Returns a list of Location objects.
52
+ def self.list(filters = {}, opts = {})
53
+ request_stripe_object(
54
+ method: :get,
55
+ path: "/v1/terminal/locations",
56
+ params: filters,
57
+ opts: opts
58
+ )
59
+ end
60
+
61
+ # Updates a Location object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
62
+ def self.update(id, params = {}, opts = {})
63
+ request_stripe_object(
64
+ method: :post,
65
+ path: format("/v1/terminal/locations/%<id>s", { id: CGI.escape(id) }),
66
+ params: params,
67
+ opts: opts
68
+ )
69
+ end
16
70
  end
17
71
  end
18
72
  end
@@ -13,7 +13,11 @@ module Stripe
13
13
  include Stripe::APIOperations::Save
14
14
 
15
15
  OBJECT_NAME = "terminal.reader"
16
+ def self.object_name
17
+ "terminal.reader"
18
+ end
16
19
 
20
+ # Cancels the current reader action.
17
21
  def cancel_action(params = {}, opts = {})
18
22
  request_stripe_object(
19
23
  method: :post,
@@ -23,51 +27,67 @@ module Stripe
23
27
  )
24
28
  end
25
29
 
26
- def process_payment_intent(params = {}, opts = {})
30
+ # Cancels the current reader action.
31
+ def self.cancel_action(reader, params = {}, opts = {})
27
32
  request_stripe_object(
28
33
  method: :post,
29
- path: format("/v1/terminal/readers/%<reader>s/process_payment_intent", { reader: CGI.escape(self["id"]) }),
34
+ path: format("/v1/terminal/readers/%<reader>s/cancel_action", { reader: CGI.escape(reader) }),
30
35
  params: params,
31
36
  opts: opts
32
37
  )
33
38
  end
34
39
 
35
- def process_setup_intent(params = {}, opts = {})
40
+ # Creates a new Reader object.
41
+ def self.create(params = {}, opts = {})
36
42
  request_stripe_object(
37
43
  method: :post,
38
- path: format("/v1/terminal/readers/%<reader>s/process_setup_intent", { reader: CGI.escape(self["id"]) }),
44
+ path: "/v1/terminal/readers",
39
45
  params: params,
40
46
  opts: opts
41
47
  )
42
48
  end
43
49
 
44
- def refund_payment(params = {}, opts = {})
50
+ # Deletes a Reader object.
51
+ def self.delete(id, params = {}, opts = {})
45
52
  request_stripe_object(
46
- method: :post,
47
- path: format("/v1/terminal/readers/%<reader>s/refund_payment", { reader: CGI.escape(self["id"]) }),
53
+ method: :delete,
54
+ path: format("/v1/terminal/readers/%<id>s", { id: CGI.escape(id) }),
48
55
  params: params,
49
56
  opts: opts
50
57
  )
51
58
  end
52
59
 
53
- def set_reader_display(params = {}, opts = {})
60
+ # Deletes a Reader object.
61
+ def delete(params = {}, opts = {})
54
62
  request_stripe_object(
55
- method: :post,
56
- path: format("/v1/terminal/readers/%<reader>s/set_reader_display", { reader: CGI.escape(self["id"]) }),
63
+ method: :delete,
64
+ path: format("/v1/terminal/readers/%<reader>s", { reader: CGI.escape(self["id"]) }),
57
65
  params: params,
58
66
  opts: opts
59
67
  )
60
68
  end
61
69
 
62
- def self.cancel_action(reader, params = {}, opts = {})
70
+ # Returns a list of Reader objects.
71
+ def self.list(filters = {}, opts = {})
72
+ request_stripe_object(
73
+ method: :get,
74
+ path: "/v1/terminal/readers",
75
+ params: filters,
76
+ opts: opts
77
+ )
78
+ end
79
+
80
+ # Initiates a payment flow on a Reader.
81
+ def process_payment_intent(params = {}, opts = {})
63
82
  request_stripe_object(
64
83
  method: :post,
65
- path: format("/v1/terminal/readers/%<reader>s/cancel_action", { reader: CGI.escape(reader) }),
84
+ path: format("/v1/terminal/readers/%<reader>s/process_payment_intent", { reader: CGI.escape(self["id"]) }),
66
85
  params: params,
67
86
  opts: opts
68
87
  )
69
88
  end
70
89
 
90
+ # Initiates a payment flow on a Reader.
71
91
  def self.process_payment_intent(reader, params = {}, opts = {})
72
92
  request_stripe_object(
73
93
  method: :post,
@@ -77,6 +97,17 @@ module Stripe
77
97
  )
78
98
  end
79
99
 
100
+ # Initiates a setup intent flow on a Reader.
101
+ def process_setup_intent(params = {}, opts = {})
102
+ request_stripe_object(
103
+ method: :post,
104
+ path: format("/v1/terminal/readers/%<reader>s/process_setup_intent", { reader: CGI.escape(self["id"]) }),
105
+ params: params,
106
+ opts: opts
107
+ )
108
+ end
109
+
110
+ # Initiates a setup intent flow on a Reader.
80
111
  def self.process_setup_intent(reader, params = {}, opts = {})
81
112
  request_stripe_object(
82
113
  method: :post,
@@ -86,6 +117,17 @@ module Stripe
86
117
  )
87
118
  end
88
119
 
120
+ # Initiates a refund on a Reader
121
+ def refund_payment(params = {}, opts = {})
122
+ request_stripe_object(
123
+ method: :post,
124
+ path: format("/v1/terminal/readers/%<reader>s/refund_payment", { reader: CGI.escape(self["id"]) }),
125
+ params: params,
126
+ opts: opts
127
+ )
128
+ end
129
+
130
+ # Initiates a refund on a Reader
89
131
  def self.refund_payment(reader, params = {}, opts = {})
90
132
  request_stripe_object(
91
133
  method: :post,
@@ -95,6 +137,17 @@ module Stripe
95
137
  )
96
138
  end
97
139
 
140
+ # Sets reader display to show cart details.
141
+ def set_reader_display(params = {}, opts = {})
142
+ request_stripe_object(
143
+ method: :post,
144
+ path: format("/v1/terminal/readers/%<reader>s/set_reader_display", { reader: CGI.escape(self["id"]) }),
145
+ params: params,
146
+ opts: opts
147
+ )
148
+ end
149
+
150
+ # Sets reader display to show cart details.
98
151
  def self.set_reader_display(reader, params = {}, opts = {})
99
152
  request_stripe_object(
100
153
  method: :post,
@@ -104,13 +157,27 @@ module Stripe
104
157
  )
105
158
  end
106
159
 
160
+ # Updates a Reader object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
161
+ def self.update(id, params = {}, opts = {})
162
+ request_stripe_object(
163
+ method: :post,
164
+ path: format("/v1/terminal/readers/%<id>s", { id: CGI.escape(id) }),
165
+ params: params,
166
+ opts: opts
167
+ )
168
+ end
169
+
107
170
  def test_helpers
108
171
  TestHelpers.new(self)
109
172
  end
110
173
 
111
174
  class TestHelpers < APIResourceTestHelpers
112
175
  RESOURCE_CLASS = Reader
176
+ def self.resource_class
177
+ "Reader"
178
+ end
113
179
 
180
+ # Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction.
114
181
  def self.present_payment_method(reader, params = {}, opts = {})
115
182
  request_stripe_object(
116
183
  method: :post,
@@ -120,6 +187,7 @@ module Stripe
120
187
  )
121
188
  end
122
189
 
190
+ # Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction.
123
191
  def present_payment_method(params = {}, opts = {})
124
192
  @resource.request_stripe_object(
125
193
  method: :post,
@@ -12,7 +12,11 @@ module Stripe
12
12
  extend Stripe::APIOperations::List
13
13
 
14
14
  OBJECT_NAME = "test_helpers.test_clock"
15
+ def self.object_name
16
+ "test_helpers.test_clock"
17
+ end
15
18
 
19
+ # Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
16
20
  def advance(params = {}, opts = {})
17
21
  request_stripe_object(
18
22
  method: :post,
@@ -22,6 +26,7 @@ module Stripe
22
26
  )
23
27
  end
24
28
 
29
+ # Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
25
30
  def self.advance(test_clock, params = {}, opts = {})
26
31
  request_stripe_object(
27
32
  method: :post,
@@ -30,6 +35,46 @@ module Stripe
30
35
  opts: opts
31
36
  )
32
37
  end
38
+
39
+ # Creates a new test clock that can be attached to new customers and quotes.
40
+ def self.create(params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :post,
43
+ path: "/v1/test_helpers/test_clocks",
44
+ params: params,
45
+ opts: opts
46
+ )
47
+ end
48
+
49
+ # Deletes a test clock.
50
+ def self.delete(id, params = {}, opts = {})
51
+ request_stripe_object(
52
+ method: :delete,
53
+ path: format("/v1/test_helpers/test_clocks/%<id>s", { id: CGI.escape(id) }),
54
+ params: params,
55
+ opts: opts
56
+ )
57
+ end
58
+
59
+ # Deletes a test clock.
60
+ def delete(params = {}, opts = {})
61
+ request_stripe_object(
62
+ method: :delete,
63
+ path: format("/v1/test_helpers/test_clocks/%<test_clock>s", { test_clock: CGI.escape(self["id"]) }),
64
+ params: params,
65
+ opts: opts
66
+ )
67
+ end
68
+
69
+ # Returns a list of your test clocks.
70
+ def self.list(filters = {}, opts = {})
71
+ request_stripe_object(
72
+ method: :get,
73
+ path: "/v1/test_helpers/test_clocks",
74
+ params: filters,
75
+ opts: opts
76
+ )
77
+ end
33
78
  end
34
79
  end
35
80
  end
@@ -19,12 +19,21 @@ module Stripe
19
19
  #
20
20
  # You can't store or use tokens more than once. To store card or bank account
21
21
  # information for later use, create [Customer](https://stripe.com/docs/api#customers)
22
- # objects or [Custom accounts](https://stripe.com/docs/api#external_accounts).
22
+ # objects or [External accounts](https://stripe.com/api#external_accounts).
23
23
  # [Radar](https://stripe.com/docs/radar), our integrated solution for automatic fraud protection,
24
24
  # performs best with integrations that use client-side tokenization.
25
25
  class Token < APIResource
26
26
  extend Stripe::APIOperations::Create
27
27
 
28
28
  OBJECT_NAME = "token"
29
+ def self.object_name
30
+ "token"
31
+ end
32
+
33
+ # Creates a single-use token that represents a bank account's details.
34
+ # You can use this token with any API method in place of a bank account dictionary. You can only use this token once. To do so, attach it to a [connected account](https://stripe.com/docs/api#accounts) where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is application, which includes Custom accounts.
35
+ def self.create(params = {}, opts = {})
36
+ request_stripe_object(method: :post, path: "/v1/tokens", params: params, opts: opts)
37
+ end
29
38
  end
30
39
  end
@@ -13,7 +13,11 @@ module Stripe
13
13
  include Stripe::APIOperations::Save
14
14
 
15
15
  OBJECT_NAME = "topup"
16
+ def self.object_name
17
+ "topup"
18
+ end
16
19
 
20
+ # Cancels a top-up. Only pending top-ups can be canceled.
17
21
  def cancel(params = {}, opts = {})
18
22
  request_stripe_object(
19
23
  method: :post,
@@ -23,6 +27,7 @@ module Stripe
23
27
  )
24
28
  end
25
29
 
30
+ # Cancels a top-up. Only pending top-ups can be canceled.
26
31
  def self.cancel(topup, params = {}, opts = {})
27
32
  request_stripe_object(
28
33
  method: :post,
@@ -31,5 +36,25 @@ module Stripe
31
36
  opts: opts
32
37
  )
33
38
  end
39
+
40
+ # Top up the balance of an account
41
+ def self.create(params = {}, opts = {})
42
+ request_stripe_object(method: :post, path: "/v1/topups", params: params, opts: opts)
43
+ end
44
+
45
+ # Returns a list of top-ups.
46
+ def self.list(filters = {}, opts = {})
47
+ request_stripe_object(method: :get, path: "/v1/topups", params: filters, opts: opts)
48
+ end
49
+
50
+ # Updates the metadata of a top-up. Other top-up details are not editable by design.
51
+ def self.update(id, params = {}, opts = {})
52
+ request_stripe_object(
53
+ method: :post,
54
+ path: format("/v1/topups/%<id>s", { id: CGI.escape(id) }),
55
+ params: params,
56
+ opts: opts
57
+ )
58
+ end
34
59
  end
35
60
  end