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
@@ -17,5 +17,48 @@ module Stripe
17
17
  include Stripe::APIOperations::Save
18
18
 
19
19
  OBJECT_NAME = "plan"
20
+ def self.object_name
21
+ "plan"
22
+ end
23
+
24
+ # You can now model subscriptions more flexibly using the [Prices API](https://stripe.com/docs/api#prices). It replaces the Plans API and is backwards compatible to simplify your migration.
25
+ def self.create(params = {}, opts = {})
26
+ request_stripe_object(method: :post, path: "/v1/plans", params: params, opts: opts)
27
+ end
28
+
29
+ # Deleting plans means new subscribers can't be added. Existing subscribers aren't affected.
30
+ def self.delete(id, params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :delete,
33
+ path: format("/v1/plans/%<id>s", { id: CGI.escape(id) }),
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ # Deleting plans means new subscribers can't be added. Existing subscribers aren't affected.
40
+ def delete(params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :delete,
43
+ path: format("/v1/plans/%<plan>s", { plan: CGI.escape(self["id"]) }),
44
+ params: params,
45
+ opts: opts
46
+ )
47
+ end
48
+
49
+ # Returns a list of your plans.
50
+ def self.list(filters = {}, opts = {})
51
+ request_stripe_object(method: :get, path: "/v1/plans", params: filters, opts: opts)
52
+ end
53
+
54
+ # Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan's ID, amount, currency, or billing cycle.
55
+ def self.update(id, params = {}, opts = {})
56
+ request_stripe_object(
57
+ method: :post,
58
+ path: format("/v1/plans/%<id>s", { id: CGI.escape(id) }),
59
+ params: params,
60
+ opts: opts
61
+ )
62
+ end
20
63
  end
21
64
  end
@@ -15,13 +15,36 @@ module Stripe
15
15
  include Stripe::APIOperations::Save
16
16
 
17
17
  OBJECT_NAME = "price"
18
+ def self.object_name
19
+ "price"
20
+ end
21
+
22
+ # Creates a new price for an existing product. The price can be recurring or one-time.
23
+ def self.create(params = {}, opts = {})
24
+ request_stripe_object(method: :post, path: "/v1/prices", params: params, opts: opts)
25
+ end
26
+
27
+ # Returns a list of your active prices, excluding [inline prices](https://stripe.com/docs/products-prices/pricing-models#inline-pricing). For the list of inactive prices, set active to false.
28
+ def self.list(filters = {}, opts = {})
29
+ request_stripe_object(method: :get, path: "/v1/prices", params: filters, opts: opts)
30
+ end
18
31
 
19
32
  def self.search(params = {}, opts = {})
20
- _search("/v1/prices/search", params, opts)
33
+ request_stripe_object(method: :get, path: "/v1/prices/search", params: params, opts: opts)
21
34
  end
22
35
 
23
36
  def self.search_auto_paging_each(params = {}, opts = {}, &blk)
24
37
  search(params, opts).auto_paging_each(&blk)
25
38
  end
39
+
40
+ # Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.
41
+ def self.update(id, params = {}, opts = {})
42
+ request_stripe_object(
43
+ method: :post,
44
+ path: format("/v1/prices/%<id>s", { id: CGI.escape(id) }),
45
+ params: params,
46
+ opts: opts
47
+ )
48
+ end
26
49
  end
27
50
  end
@@ -14,17 +14,63 @@ module Stripe
14
14
  extend Stripe::APIOperations::Create
15
15
  include Stripe::APIOperations::Delete
16
16
  extend Stripe::APIOperations::List
17
+ extend Stripe::APIOperations::NestedResource
17
18
  extend Stripe::APIOperations::Search
18
19
  include Stripe::APIOperations::Save
19
20
 
20
21
  OBJECT_NAME = "product"
22
+ def self.object_name
23
+ "product"
24
+ end
25
+
26
+ nested_resource_class_methods :feature, operations: %i[create retrieve delete list]
27
+
28
+ # Creates a new product object.
29
+ def self.create(params = {}, opts = {})
30
+ request_stripe_object(method: :post, path: "/v1/products", params: params, opts: opts)
31
+ end
32
+
33
+ # Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
34
+ def self.delete(id, params = {}, opts = {})
35
+ request_stripe_object(
36
+ method: :delete,
37
+ path: format("/v1/products/%<id>s", { id: CGI.escape(id) }),
38
+ params: params,
39
+ opts: opts
40
+ )
41
+ end
42
+
43
+ # Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
44
+ def delete(params = {}, opts = {})
45
+ request_stripe_object(
46
+ method: :delete,
47
+ path: format("/v1/products/%<id>s", { id: CGI.escape(self["id"]) }),
48
+ params: params,
49
+ opts: opts
50
+ )
51
+ end
52
+
53
+ # Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.
54
+ def self.list(filters = {}, opts = {})
55
+ request_stripe_object(method: :get, path: "/v1/products", params: filters, opts: opts)
56
+ end
21
57
 
22
58
  def self.search(params = {}, opts = {})
23
- _search("/v1/products/search", params, opts)
59
+ request_stripe_object(method: :get, path: "/v1/products/search", params: params, opts: opts)
24
60
  end
25
61
 
26
62
  def self.search_auto_paging_each(params = {}, opts = {}, &blk)
27
63
  search(params, opts).auto_paging_each(&blk)
28
64
  end
65
+
66
+ # Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
67
+ def self.update(id, params = {}, opts = {})
68
+ request_stripe_object(
69
+ method: :post,
70
+ path: format("/v1/products/%<id>s", { id: CGI.escape(id) }),
71
+ params: params,
72
+ opts: opts
73
+ )
74
+ end
29
75
  end
30
76
  end
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ # A product_feature represents an attachment between a feature and a product.
6
+ # When a product is purchased that has a feature attached, Stripe will create an entitlement to the feature for the purchasing customer.
7
+ class ProductFeature < APIResource
8
+ OBJECT_NAME = "product_feature"
9
+ def self.object_name
10
+ "product_feature"
11
+ end
12
+ end
13
+ end
@@ -10,5 +10,28 @@ module Stripe
10
10
  include Stripe::APIOperations::Save
11
11
 
12
12
  OBJECT_NAME = "promotion_code"
13
+ def self.object_name
14
+ "promotion_code"
15
+ end
16
+
17
+ # A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.
18
+ def self.create(params = {}, opts = {})
19
+ request_stripe_object(method: :post, path: "/v1/promotion_codes", params: params, opts: opts)
20
+ end
21
+
22
+ # Returns a list of your promotion codes.
23
+ def self.list(filters = {}, opts = {})
24
+ request_stripe_object(method: :get, path: "/v1/promotion_codes", params: filters, opts: opts)
25
+ end
26
+
27
+ # Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.
28
+ def self.update(id, params = {}, opts = {})
29
+ request_stripe_object(
30
+ method: :post,
31
+ path: format("/v1/promotion_codes/%<id>s", { id: CGI.escape(id) }),
32
+ params: params,
33
+ opts: opts
34
+ )
35
+ end
13
36
  end
14
37
  end
@@ -10,7 +10,11 @@ module Stripe
10
10
  include Stripe::APIOperations::Save
11
11
 
12
12
  OBJECT_NAME = "quote"
13
+ def self.object_name
14
+ "quote"
15
+ end
13
16
 
17
+ # Accepts the specified quote.
14
18
  def accept(params = {}, opts = {})
15
19
  request_stripe_object(
16
20
  method: :post,
@@ -20,90 +24,97 @@ module Stripe
20
24
  )
21
25
  end
22
26
 
23
- def cancel(params = {}, opts = {})
27
+ # Accepts the specified quote.
28
+ def self.accept(quote, params = {}, opts = {})
24
29
  request_stripe_object(
25
30
  method: :post,
26
- path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(self["id"]) }),
31
+ path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(quote) }),
27
32
  params: params,
28
33
  opts: opts
29
34
  )
30
35
  end
31
36
 
32
- def finalize_quote(params = {}, opts = {})
37
+ # Cancels the quote.
38
+ def cancel(params = {}, opts = {})
33
39
  request_stripe_object(
34
40
  method: :post,
35
- path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(self["id"]) }),
41
+ path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(self["id"]) }),
36
42
  params: params,
37
43
  opts: opts
38
44
  )
39
45
  end
40
46
 
41
- def list_computed_upfront_line_items(params = {}, opts = {})
47
+ # Cancels the quote.
48
+ def self.cancel(quote, params = {}, opts = {})
42
49
  request_stripe_object(
43
- method: :get,
44
- path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(self["id"]) }),
50
+ method: :post,
51
+ path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(quote) }),
45
52
  params: params,
46
53
  opts: opts
47
54
  )
48
55
  end
49
56
 
50
- def list_line_items(params = {}, opts = {})
51
- request_stripe_object(
52
- method: :get,
53
- path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(self["id"]) }),
54
- params: params,
55
- opts: opts
56
- )
57
+ # A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote).
58
+ def self.create(params = {}, opts = {})
59
+ request_stripe_object(method: :post, path: "/v1/quotes", params: params, opts: opts)
57
60
  end
58
61
 
59
- def pdf(params = {}, opts = {}, &read_body_chunk_block)
60
- config = opts[:client]&.config || Stripe.config
61
- opts = { api_base: config.uploads_base }.merge(opts)
62
- request_stream(
63
- method: :get,
64
- path: format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(self["id"]) }),
62
+ # Finalizes the quote.
63
+ def finalize_quote(params = {}, opts = {})
64
+ request_stripe_object(
65
+ method: :post,
66
+ path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(self["id"]) }),
65
67
  params: params,
66
- opts: opts,
67
- &read_body_chunk_block
68
+ opts: opts
68
69
  )
69
70
  end
70
71
 
71
- def self.accept(quote, params = {}, opts = {})
72
+ # Finalizes the quote.
73
+ def self.finalize_quote(quote, params = {}, opts = {})
72
74
  request_stripe_object(
73
75
  method: :post,
74
- path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(quote) }),
76
+ path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(quote) }),
75
77
  params: params,
76
78
  opts: opts
77
79
  )
78
80
  end
79
81
 
80
- def self.cancel(quote, params = {}, opts = {})
82
+ # Returns a list of your quotes.
83
+ def self.list(filters = {}, opts = {})
84
+ request_stripe_object(method: :get, path: "/v1/quotes", params: filters, opts: opts)
85
+ end
86
+
87
+ # When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
88
+ def list_computed_upfront_line_items(params = {}, opts = {})
81
89
  request_stripe_object(
82
- method: :post,
83
- path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(quote) }),
90
+ method: :get,
91
+ path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(self["id"]) }),
84
92
  params: params,
85
93
  opts: opts
86
94
  )
87
95
  end
88
96
 
89
- def self.finalize_quote(quote, params = {}, opts = {})
97
+ # When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
98
+ def self.list_computed_upfront_line_items(quote, params = {}, opts = {})
90
99
  request_stripe_object(
91
- method: :post,
92
- path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(quote) }),
100
+ method: :get,
101
+ path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(quote) }),
93
102
  params: params,
94
103
  opts: opts
95
104
  )
96
105
  end
97
106
 
98
- def self.list_computed_upfront_line_items(quote, params = {}, opts = {})
107
+ # When retrieving a quote, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
108
+ def list_line_items(params = {}, opts = {})
99
109
  request_stripe_object(
100
110
  method: :get,
101
- path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(quote) }),
111
+ path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(self["id"]) }),
102
112
  params: params,
103
113
  opts: opts
104
114
  )
105
115
  end
106
116
 
117
+ # When retrieving a quote, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
107
118
  def self.list_line_items(quote, params = {}, opts = {})
108
119
  request_stripe_object(
109
120
  method: :get,
@@ -113,6 +124,20 @@ module Stripe
113
124
  )
114
125
  end
115
126
 
127
+ # Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
128
+ def pdf(params = {}, opts = {}, &read_body_chunk_block)
129
+ config = opts[:client]&.config || Stripe.config
130
+ opts = { api_base: config.uploads_base }.merge(opts)
131
+ request_stream(
132
+ method: :get,
133
+ path: format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(self["id"]) }),
134
+ params: params,
135
+ opts: opts,
136
+ &read_body_chunk_block
137
+ )
138
+ end
139
+
140
+ # Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
116
141
  def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block)
117
142
  config = opts[:client]&.config || Stripe.config
118
143
  opts = { api_base: config.uploads_base }.merge(opts)
@@ -124,5 +149,15 @@ module Stripe
124
149
  &read_body_chunk_block
125
150
  )
126
151
  end
152
+
153
+ # A quote models prices and services for a customer.
154
+ def self.update(id, params = {}, opts = {})
155
+ request_stripe_object(
156
+ method: :post,
157
+ path: format("/v1/quotes/%<id>s", { id: CGI.escape(id) }),
158
+ params: params,
159
+ opts: opts
160
+ )
161
+ end
127
162
  end
128
163
  end
@@ -11,6 +11,19 @@ module Stripe
11
11
  extend Stripe::APIOperations::List
12
12
 
13
13
  OBJECT_NAME = "radar.early_fraud_warning"
14
+ def self.object_name
15
+ "radar.early_fraud_warning"
16
+ end
17
+
18
+ # Returns a list of early fraud warnings.
19
+ def self.list(filters = {}, opts = {})
20
+ request_stripe_object(
21
+ method: :get,
22
+ path: "/v1/radar/early_fraud_warnings",
23
+ params: filters,
24
+ opts: opts
25
+ )
26
+ end
14
27
  end
15
28
  end
16
29
  end
@@ -13,6 +13,59 @@ module Stripe
13
13
  include Stripe::APIOperations::Save
14
14
 
15
15
  OBJECT_NAME = "radar.value_list"
16
+ def self.object_name
17
+ "radar.value_list"
18
+ end
19
+
20
+ # Creates a new ValueList object, which can then be referenced in rules.
21
+ def self.create(params = {}, opts = {})
22
+ request_stripe_object(
23
+ method: :post,
24
+ path: "/v1/radar/value_lists",
25
+ params: params,
26
+ opts: opts
27
+ )
28
+ end
29
+
30
+ # Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
31
+ def self.delete(id, params = {}, opts = {})
32
+ request_stripe_object(
33
+ method: :delete,
34
+ path: format("/v1/radar/value_lists/%<id>s", { id: CGI.escape(id) }),
35
+ params: params,
36
+ opts: opts
37
+ )
38
+ end
39
+
40
+ # Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
41
+ def delete(params = {}, opts = {})
42
+ request_stripe_object(
43
+ method: :delete,
44
+ path: format("/v1/radar/value_lists/%<value_list>s", { value_list: CGI.escape(self["id"]) }),
45
+ params: params,
46
+ opts: opts
47
+ )
48
+ end
49
+
50
+ # Returns a list of ValueList objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
51
+ def self.list(filters = {}, opts = {})
52
+ request_stripe_object(
53
+ method: :get,
54
+ path: "/v1/radar/value_lists",
55
+ params: filters,
56
+ opts: opts
57
+ )
58
+ end
59
+
60
+ # Updates a ValueList object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Note that item_type is immutable.
61
+ def self.update(id, params = {}, opts = {})
62
+ request_stripe_object(
63
+ method: :post,
64
+ path: format("/v1/radar/value_lists/%<id>s", { id: CGI.escape(id) }),
65
+ params: params,
66
+ opts: opts
67
+ )
68
+ end
16
69
  end
17
70
  end
18
71
  end
@@ -12,6 +12,49 @@ module Stripe
12
12
  extend Stripe::APIOperations::List
13
13
 
14
14
  OBJECT_NAME = "radar.value_list_item"
15
+ def self.object_name
16
+ "radar.value_list_item"
17
+ end
18
+
19
+ # Creates a new ValueListItem object, which is added to the specified parent value list.
20
+ def self.create(params = {}, opts = {})
21
+ request_stripe_object(
22
+ method: :post,
23
+ path: "/v1/radar/value_list_items",
24
+ params: params,
25
+ opts: opts
26
+ )
27
+ end
28
+
29
+ # Deletes a ValueListItem object, removing it from its parent value list.
30
+ def self.delete(id, params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :delete,
33
+ path: format("/v1/radar/value_list_items/%<id>s", { id: CGI.escape(id) }),
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ # Deletes a ValueListItem object, removing it from its parent value list.
40
+ def delete(params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :delete,
43
+ path: format("/v1/radar/value_list_items/%<item>s", { item: CGI.escape(self["id"]) }),
44
+ params: params,
45
+ opts: opts
46
+ )
47
+ end
48
+
49
+ # Returns a list of ValueListItem objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
50
+ def self.list(filters = {}, opts = {})
51
+ request_stripe_object(
52
+ method: :get,
53
+ path: "/v1/radar/value_list_items",
54
+ params: filters,
55
+ opts: opts
56
+ )
57
+ end
15
58
  end
16
59
  end
17
60
  end
@@ -13,7 +13,13 @@ module Stripe
13
13
  include Stripe::APIOperations::Save
14
14
 
15
15
  OBJECT_NAME = "refund"
16
+ def self.object_name
17
+ "refund"
18
+ end
16
19
 
20
+ # Cancels a refund with a status of requires_action.
21
+ #
22
+ # You can't cancel refunds in other states. Only refunds for payment methods that require customer action can enter the requires_action state.
17
23
  def cancel(params = {}, opts = {})
18
24
  request_stripe_object(
19
25
  method: :post,
@@ -23,6 +29,9 @@ module Stripe
23
29
  )
24
30
  end
25
31
 
32
+ # Cancels a refund with a status of requires_action.
33
+ #
34
+ # You can't cancel refunds in other states. Only refunds for payment methods that require customer action can enter the requires_action state.
26
35
  def self.cancel(refund, params = {}, opts = {})
27
36
  request_stripe_object(
28
37
  method: :post,
@@ -32,13 +41,49 @@ module Stripe
32
41
  )
33
42
  end
34
43
 
44
+ # When you create a new refund, you must specify a Charge or a PaymentIntent object on which to create it.
45
+ #
46
+ # Creating a new refund will refund a charge that has previously been created but not yet refunded.
47
+ # Funds will be refunded to the credit or debit card that was originally charged.
48
+ #
49
+ # You can optionally refund only part of a charge.
50
+ # You can do so multiple times, until the entire charge has been refunded.
51
+ #
52
+ # Once entirely refunded, a charge can't be refunded again.
53
+ # This method will raise an error when called on an already-refunded charge,
54
+ # or when trying to refund more money than is left on a charge.
55
+ def self.create(params = {}, opts = {})
56
+ request_stripe_object(method: :post, path: "/v1/refunds", params: params, opts: opts)
57
+ end
58
+
59
+ # Returns a list of all refunds you created. We return the refunds in sorted order, with the most recent refunds appearing first. The 10 most recent refunds are always available by default on the Charge object.
60
+ def self.list(filters = {}, opts = {})
61
+ request_stripe_object(method: :get, path: "/v1/refunds", params: filters, opts: opts)
62
+ end
63
+
64
+ # Updates the refund that you specify by setting the values of the passed parameters. Any parameters that you don't provide remain unchanged.
65
+ #
66
+ # This request only accepts metadata as an argument.
67
+ def self.update(id, params = {}, opts = {})
68
+ request_stripe_object(
69
+ method: :post,
70
+ path: format("/v1/refunds/%<id>s", { id: CGI.escape(id) }),
71
+ params: params,
72
+ opts: opts
73
+ )
74
+ end
75
+
35
76
  def test_helpers
36
77
  TestHelpers.new(self)
37
78
  end
38
79
 
39
80
  class TestHelpers < APIResourceTestHelpers
40
81
  RESOURCE_CLASS = Refund
82
+ def self.resource_class
83
+ "Refund"
84
+ end
41
85
 
86
+ # Expire a refund with a status of requires_action.
42
87
  def self.expire(refund, params = {}, opts = {})
43
88
  request_stripe_object(
44
89
  method: :post,
@@ -48,6 +93,7 @@ module Stripe
48
93
  )
49
94
  end
50
95
 
96
+ # Expire a refund with a status of requires_action.
51
97
  def expire(params = {}, opts = {})
52
98
  @resource.request_stripe_object(
53
99
  method: :post,
@@ -16,6 +16,29 @@ module Stripe
16
16
  extend Stripe::APIOperations::List
17
17
 
18
18
  OBJECT_NAME = "reporting.report_run"
19
+ def self.object_name
20
+ "reporting.report_run"
21
+ end
22
+
23
+ # Creates a new object and begin running the report. (Certain report types require a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).)
24
+ def self.create(params = {}, opts = {})
25
+ request_stripe_object(
26
+ method: :post,
27
+ path: "/v1/reporting/report_runs",
28
+ params: params,
29
+ opts: opts
30
+ )
31
+ end
32
+
33
+ # Returns a list of Report Runs, with the most recent appearing first.
34
+ def self.list(filters = {}, opts = {})
35
+ request_stripe_object(
36
+ method: :get,
37
+ path: "/v1/reporting/report_runs",
38
+ params: filters,
39
+ opts: opts
40
+ )
41
+ end
19
42
  end
20
43
  end
21
44
  end
@@ -15,6 +15,19 @@ module Stripe
15
15
  extend Stripe::APIOperations::List
16
16
 
17
17
  OBJECT_NAME = "reporting.report_type"
18
+ def self.object_name
19
+ "reporting.report_type"
20
+ end
21
+
22
+ # Returns a full list of Report Types.
23
+ def self.list(filters = {}, opts = {})
24
+ request_stripe_object(
25
+ method: :get,
26
+ path: "/v1/reporting/report_types",
27
+ params: filters,
28
+ opts: opts
29
+ )
30
+ end
18
31
  end
19
32
  end
20
33
  end
@@ -14,16 +14,18 @@ module Stripe
14
14
  # transfer only if the destination account has enough balance to cover the
15
15
  # reversal.
16
16
  #
17
- # Related guide: [Reversing transfers](https://stripe.com/docs/connect/separate-charges-and-transfers#reversing-transfers)
17
+ # Related guide: [Reverse transfers](https://stripe.com/docs/connect/separate-charges-and-transfers#reverse-transfers)
18
18
  class Reversal < APIResource
19
- extend Stripe::APIOperations::List
20
19
  include Stripe::APIOperations::Save
21
20
 
22
21
  OBJECT_NAME = "transfer_reversal"
22
+ def self.object_name
23
+ "transfer_reversal"
24
+ end
23
25
 
24
26
  def resource_url
25
27
  "#{Transfer.resource_url}/#{CGI.escape(transfer)}/reversals" \
26
- "/#{CGI.escape(id)}"
28
+ "/#{CGI.escape(id)}"
27
29
  end
28
30
 
29
31
  def self.update(_id, _params = nil, _opts = nil)