stripe 13.0.2 → 13.1.0.pre.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1370 -654
  3. data/OPENAPI_VERSION +1 -1
  4. data/README.md +1 -1
  5. data/VERSION +1 -1
  6. data/examples/README.md +2 -7
  7. data/examples/meter_event_stream.rb +0 -10
  8. data/examples/new_example.rb +24 -0
  9. data/examples/{thinevent_webhook_handler.rb → stripe_webhook_handler.rb} +0 -11
  10. data/lib/stripe/api_resource.rb +1 -0
  11. data/lib/stripe/object_types.rb +19 -0
  12. data/lib/stripe/request_signing_authenticator.rb +79 -0
  13. data/lib/stripe/resources/account_notice.rb +32 -0
  14. data/lib/stripe/resources/billing/meter.rb +2 -0
  15. data/lib/stripe/resources/capital/financing_offer.rb +49 -0
  16. data/lib/stripe/resources/capital/financing_summary.rb +15 -0
  17. data/lib/stripe/resources/capital/financing_transaction.rb +27 -0
  18. data/lib/stripe/resources/financial_connections/account.rb +3 -0
  19. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +14 -0
  20. data/lib/stripe/resources/financial_connections/institution.rb +26 -0
  21. data/lib/stripe/resources/gift_cards/card.rb +59 -0
  22. data/lib/stripe/resources/gift_cards/transaction.rb +93 -0
  23. data/lib/stripe/resources/invoice.rb +81 -0
  24. data/lib/stripe/resources/invoice_payment.rb +12 -0
  25. data/lib/stripe/resources/issuing/card.rb +20 -0
  26. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +88 -0
  27. data/lib/stripe/resources/issuing/dispute_settlement_detail.rb +26 -0
  28. data/lib/stripe/resources/margin.rb +37 -0
  29. data/lib/stripe/resources/order.rb +120 -0
  30. data/lib/stripe/resources/payment_intent.rb +50 -0
  31. data/lib/stripe/resources/quote.rb +104 -0
  32. data/lib/stripe/resources/quote_preview_invoice.rb +43 -0
  33. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +11 -0
  34. data/lib/stripe/resources/subscription_schedule.rb +20 -0
  35. data/lib/stripe/resources/tax/association.rb +24 -0
  36. data/lib/stripe/resources/tax/form.rb +49 -0
  37. data/lib/stripe/resources/terminal/reader.rb +60 -0
  38. data/lib/stripe/resources/terminal/reader_collected_data.rb +14 -0
  39. data/lib/stripe/resources/usage_record_summary.rb +1 -0
  40. data/lib/stripe/resources/v2/billing/meter_event.rb +2 -2
  41. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +2 -2
  42. data/lib/stripe/resources/v2/billing/meter_event_session.rb +2 -2
  43. data/lib/stripe/resources.rb +18 -0
  44. data/lib/stripe/services/account_notice_service.rb +39 -0
  45. data/lib/stripe/services/capital/financing_offer_service.rb +42 -0
  46. data/lib/stripe/services/capital/financing_summary_service.rb +19 -0
  47. data/lib/stripe/services/capital/financing_transaction_service.rb +31 -0
  48. data/lib/stripe/services/capital_service.rb +15 -0
  49. data/lib/stripe/services/financial_connections/account_inferred_balance_service.rb +19 -0
  50. data/lib/stripe/services/financial_connections/account_service.rb +3 -1
  51. data/lib/stripe/services/financial_connections/institution_service.rb +30 -0
  52. data/lib/stripe/services/financial_connections_service.rb +2 -1
  53. data/lib/stripe/services/gift_cards/card_service.rb +63 -0
  54. data/lib/stripe/services/gift_cards/transaction_service.rb +74 -0
  55. data/lib/stripe/services/gift_cards_service.rb +14 -0
  56. data/lib/stripe/services/invoice_payment_service.rb +28 -0
  57. data/lib/stripe/services/invoice_service.rb +44 -1
  58. data/lib/stripe/services/issuing/credit_underwriting_record_service.rb +74 -0
  59. data/lib/stripe/services/issuing/dispute_settlement_detail_service.rb +30 -0
  60. data/lib/stripe/services/issuing_service.rb +4 -1
  61. data/lib/stripe/services/margin_service.rb +50 -0
  62. data/lib/stripe/services/order_line_item_service.rb +17 -0
  63. data/lib/stripe/services/order_service.rb +78 -0
  64. data/lib/stripe/services/payment_intent_service.rb +26 -0
  65. data/lib/stripe/services/quote_line_service.rb +17 -0
  66. data/lib/stripe/services/quote_preview_invoice_service.rb +17 -0
  67. data/lib/stripe/services/quote_preview_subscription_schedule_service.rb +17 -0
  68. data/lib/stripe/services/quote_service.rb +49 -1
  69. data/lib/stripe/services/subscription_schedule_service.rb +11 -0
  70. data/lib/stripe/services/tax/association_service.rb +19 -0
  71. data/lib/stripe/services/tax/form_service.rb +37 -0
  72. data/lib/stripe/services/tax_service.rb +3 -1
  73. data/lib/stripe/services/terminal/reader_collected_data_service.rb +19 -0
  74. data/lib/stripe/services/terminal/reader_service.rb +33 -0
  75. data/lib/stripe/services/terminal_service.rb +2 -1
  76. data/lib/stripe/services/test_helpers/issuing/card_service.rb +11 -0
  77. data/lib/stripe/services/v1_services.rb +6 -1
  78. data/lib/stripe/services.rb +22 -0
  79. data/lib/stripe/stripe_configuration.rb +3 -1
  80. data/lib/stripe/util.rb +7 -1
  81. data/lib/stripe/version.rb +1 -1
  82. data/lib/stripe.rb +45 -0
  83. metadata +47 -6
  84. data/examples/example_template.rb +0 -36
@@ -0,0 +1,74 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module GiftCards
6
+ class TransactionService < StripeService
7
+ # Cancel a gift card transaction
8
+ def cancel(id, params = {}, opts = {})
9
+ request(
10
+ method: :post,
11
+ path: format("/v1/gift_cards/transactions/%<id>s/cancel", { id: CGI.escape(id) }),
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Confirm a gift card transaction
19
+ def confirm(id, params = {}, opts = {})
20
+ request(
21
+ method: :post,
22
+ path: format("/v1/gift_cards/transactions/%<id>s/confirm", { id: CGI.escape(id) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Create a gift card transaction
30
+ def create(params = {}, opts = {})
31
+ request(
32
+ method: :post,
33
+ path: "/v1/gift_cards/transactions",
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+
40
+ # List gift card transactions for a gift card
41
+ def list(params = {}, opts = {})
42
+ request(
43
+ method: :get,
44
+ path: "/v1/gift_cards/transactions",
45
+ params: params,
46
+ opts: opts,
47
+ base_address: :api
48
+ )
49
+ end
50
+
51
+ # Retrieves the gift card transaction.
52
+ def retrieve(id, params = {}, opts = {})
53
+ request(
54
+ method: :get,
55
+ path: format("/v1/gift_cards/transactions/%<id>s", { id: CGI.escape(id) }),
56
+ params: params,
57
+ opts: opts,
58
+ base_address: :api
59
+ )
60
+ end
61
+
62
+ # Update a gift card transaction
63
+ def update(id, params = {}, opts = {})
64
+ request(
65
+ method: :post,
66
+ path: format("/v1/gift_cards/transactions/%<id>s", { id: CGI.escape(id) }),
67
+ params: params,
68
+ opts: opts,
69
+ base_address: :api
70
+ )
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,14 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class GiftCardsService < StripeService
6
+ attr_reader :cards, :transactions
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @cards = Stripe::GiftCards::CardService.new(@requestor)
11
+ @transactions = Stripe::GiftCards::TransactionService.new(@requestor)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,28 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class InvoicePaymentService < StripeService
6
+ # When retrieving an invoice, there is an includable payments property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of payments.
7
+ def list(invoice, params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: format("/v1/invoices/%<invoice>s/payments", { invoice: CGI.escape(invoice) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Retrieves the invoice payment with the given ID.
18
+ def retrieve(invoice, invoice_payment, params = {}, opts = {})
19
+ request(
20
+ method: :get,
21
+ path: format("/v1/invoices/%<invoice>s/payments/%<invoice_payment>s", { invoice: CGI.escape(invoice), invoice_payment: CGI.escape(invoice_payment) }),
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+ end
28
+ end
@@ -3,10 +3,11 @@
3
3
 
4
4
  module Stripe
5
5
  class InvoiceService < StripeService
6
- attr_reader :line_items, :upcoming_lines
6
+ attr_reader :payments, :line_items, :upcoming_lines
7
7
 
8
8
  def initialize(requestor)
9
9
  super(requestor)
10
+ @payments = Stripe::InvoicePaymentService.new(@requestor)
10
11
  @line_items = Stripe::InvoiceLineItemService.new(@requestor)
11
12
  @upcoming_lines = Stripe::InvoiceUpcomingLinesService.new(@requestor)
12
13
  end
@@ -22,6 +23,48 @@ module Stripe
22
23
  )
23
24
  end
24
25
 
26
+ # Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments.
27
+ #
28
+ # For Out of Band Payment, the payment is credited to the invoice immediately, increasing the amount_paid
29
+ # of the invoice and subsequently transitioning the status of the invoice to paid if necessary.
30
+ #
31
+ # For the PaymentIntent, when the PaymentIntent's status changes to succeeded, the payment is credited
32
+ # to the invoice, increasing its amount_paid. When the invoice is fully paid, the
33
+ # invoice's status becomes paid.
34
+ #
35
+ # If the PaymentIntent's status is already succeeded when it's attached, it's
36
+ # credited to the invoice immediately.
37
+ #
38
+ # See: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create) to learn more.
39
+ def attach_payment(invoice, params = {}, opts = {})
40
+ request(
41
+ method: :post,
42
+ path: format("/v1/invoices/%<invoice>s/attach_payment", { invoice: CGI.escape(invoice) }),
43
+ params: params,
44
+ opts: opts,
45
+ base_address: :api
46
+ )
47
+ end
48
+
49
+ # Attaches a PaymentIntent to the invoice, adding it to the list of payments.
50
+ # When the PaymentIntent's status changes to succeeded, the payment is credited
51
+ # to the invoice, increasing its amount_paid. When the invoice is fully paid, the
52
+ # invoice's status becomes paid.
53
+ #
54
+ # If the PaymentIntent's status is already succeeded when it is attached, it is
55
+ # credited to the invoice immediately.
56
+ #
57
+ # Related guide: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create)
58
+ def attach_payment_intent(invoice, params = {}, opts = {})
59
+ request(
60
+ method: :post,
61
+ path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(invoice) }),
62
+ params: params,
63
+ opts: opts,
64
+ base_address: :api
65
+ )
66
+ end
67
+
25
68
  # This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or <a href="#send_invoice">send](https://stripe.com/docs/api#finalize_invoice) the invoice to your customers.
26
69
  def create(params = {}, opts = {})
27
70
  request(method: :post, path: "/v1/invoices", params: params, opts: opts, base_address: :api)
@@ -0,0 +1,74 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Issuing
6
+ class CreditUnderwritingRecordService < StripeService
7
+ # Update a CreditUnderwritingRecord object to correct mistakes.
8
+ def correct(credit_underwriting_record, params = {}, opts = {})
9
+ request(
10
+ method: :post,
11
+ path: format("/v1/issuing/credit_underwriting_records/%<credit_underwriting_record>s/correct", { credit_underwriting_record: CGI.escape(credit_underwriting_record) }),
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Creates a CreditUnderwritingRecord object with information about a credit application submission.
19
+ def create_from_application(params = {}, opts = {})
20
+ request(
21
+ method: :post,
22
+ path: "/v1/issuing/credit_underwriting_records/create_from_application",
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Creates a CreditUnderwritingRecord object from an underwriting decision coming from a proactive review of an existing accountholder.
30
+ def create_from_proactive_review(params = {}, opts = {})
31
+ request(
32
+ method: :post,
33
+ path: "/v1/issuing/credit_underwriting_records/create_from_proactive_review",
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+
40
+ # Retrieves a list of CreditUnderwritingRecord objects. The objects are sorted in descending order by creation date, with the most-recently-created object appearing first.
41
+ def list(params = {}, opts = {})
42
+ request(
43
+ method: :get,
44
+ path: "/v1/issuing/credit_underwriting_records",
45
+ params: params,
46
+ opts: opts,
47
+ base_address: :api
48
+ )
49
+ end
50
+
51
+ # Update a CreditUnderwritingRecord object from a decision made on a credit application.
52
+ def report_decision(credit_underwriting_record, params = {}, opts = {})
53
+ request(
54
+ method: :post,
55
+ path: format("/v1/issuing/credit_underwriting_records/%<credit_underwriting_record>s/report_decision", { credit_underwriting_record: CGI.escape(credit_underwriting_record) }),
56
+ params: params,
57
+ opts: opts,
58
+ base_address: :api
59
+ )
60
+ end
61
+
62
+ # Retrieves a CreditUnderwritingRecord object.
63
+ def retrieve(credit_underwriting_record, params = {}, opts = {})
64
+ request(
65
+ method: :get,
66
+ path: format("/v1/issuing/credit_underwriting_records/%<credit_underwriting_record>s", { credit_underwriting_record: CGI.escape(credit_underwriting_record) }),
67
+ params: params,
68
+ opts: opts,
69
+ base_address: :api
70
+ )
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,30 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Issuing
6
+ class DisputeSettlementDetailService < StripeService
7
+ # Returns a list of Issuing DisputeSettlementDetail objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
8
+ def list(params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: "/v1/issuing/dispute_settlement_details",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Retrieves an Issuing DisputeSettlementDetail object.
19
+ def retrieve(dispute_settlement_detail, params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: format("/v1/issuing/dispute_settlement_details/%<dispute_settlement_detail>s", { dispute_settlement_detail: CGI.escape(dispute_settlement_detail) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
@@ -3,14 +3,17 @@
3
3
 
4
4
  module Stripe
5
5
  class IssuingService < StripeService
6
- attr_reader :authorizations, :cards, :cardholders, :disputes, :personalization_designs, :physical_bundles, :tokens, :transactions
6
+ attr_reader :authorizations, :cards, :cardholders, :credit_underwriting_records, :disputes, :dispute_settlement_details, :personalization_designs, :physical_bundles, :tokens, :transactions
7
7
 
8
8
  def initialize(requestor)
9
9
  super(requestor)
10
10
  @authorizations = Stripe::Issuing::AuthorizationService.new(@requestor)
11
11
  @cards = Stripe::Issuing::CardService.new(@requestor)
12
12
  @cardholders = Stripe::Issuing::CardholderService.new(@requestor)
13
+ @credit_underwriting_records = Stripe::Issuing::CreditUnderwritingRecordService
14
+ .new(@requestor)
13
15
  @disputes = Stripe::Issuing::DisputeService.new(@requestor)
16
+ @dispute_settlement_details = Stripe::Issuing::DisputeSettlementDetailService.new(@requestor)
14
17
  @personalization_designs = Stripe::Issuing::PersonalizationDesignService.new(@requestor)
15
18
  @physical_bundles = Stripe::Issuing::PhysicalBundleService.new(@requestor)
16
19
  @tokens = Stripe::Issuing::TokenService.new(@requestor)
@@ -0,0 +1,50 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class MarginService < StripeService
6
+ # Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount. A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.
7
+ def create(params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: "/v1/billing/margins",
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Retrieve a list of your margins.
18
+ def list(params = {}, opts = {})
19
+ request(
20
+ method: :get,
21
+ path: "/v1/billing/margins",
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+
28
+ # Retrieve a margin object with the given ID.
29
+ def retrieve(margin, params = {}, opts = {})
30
+ request(
31
+ method: :get,
32
+ path: format("/v1/billing/margins/%<margin>s", { margin: CGI.escape(margin) }),
33
+ params: params,
34
+ opts: opts,
35
+ base_address: :api
36
+ )
37
+ end
38
+
39
+ # Update the specified margin object. Certain fields of the margin object are not editable.
40
+ def update(margin, params = {}, opts = {})
41
+ request(
42
+ method: :post,
43
+ path: format("/v1/billing/margins/%<margin>s", { margin: CGI.escape(margin) }),
44
+ params: params,
45
+ opts: opts,
46
+ base_address: :api
47
+ )
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class OrderLineItemService < StripeService
6
+ # When retrieving an order, 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.
7
+ def list(id, params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: format("/v1/orders/%<id>s/line_items", { id: CGI.escape(id) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,78 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class OrderService < StripeService
6
+ attr_reader :line_items
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @line_items = Stripe::OrderLineItemService.new(@requestor)
11
+ end
12
+
13
+ # Cancels the order as well as the payment intent if one is attached.
14
+ def cancel(id, params = {}, opts = {})
15
+ request(
16
+ method: :post,
17
+ path: format("/v1/orders/%<id>s/cancel", { id: CGI.escape(id) }),
18
+ params: params,
19
+ opts: opts,
20
+ base_address: :api
21
+ )
22
+ end
23
+
24
+ # Creates a new open order object.
25
+ def create(params = {}, opts = {})
26
+ request(method: :post, path: "/v1/orders", params: params, opts: opts, base_address: :api)
27
+ end
28
+
29
+ # Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.
30
+ def list(params = {}, opts = {})
31
+ request(method: :get, path: "/v1/orders", params: params, opts: opts, base_address: :api)
32
+ end
33
+
34
+ # Reopens a submitted order.
35
+ def reopen(id, params = {}, opts = {})
36
+ request(
37
+ method: :post,
38
+ path: format("/v1/orders/%<id>s/reopen", { id: CGI.escape(id) }),
39
+ params: params,
40
+ opts: opts,
41
+ base_address: :api
42
+ )
43
+ end
44
+
45
+ # Retrieves the details of an existing order. Supply the unique order ID from either an order creation request or the order list, and Stripe will return the corresponding order information.
46
+ def retrieve(id, params = {}, opts = {})
47
+ request(
48
+ method: :get,
49
+ path: format("/v1/orders/%<id>s", { id: CGI.escape(id) }),
50
+ params: params,
51
+ opts: opts,
52
+ base_address: :api
53
+ )
54
+ end
55
+
56
+ # Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid. If the Order has an amount_total of 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be changed, unless the [reopen](https://stripe.com/docs/api#reopen_order) method is called.
57
+ def submit(id, params = {}, opts = {})
58
+ request(
59
+ method: :post,
60
+ path: format("/v1/orders/%<id>s/submit", { id: CGI.escape(id) }),
61
+ params: params,
62
+ opts: opts,
63
+ base_address: :api
64
+ )
65
+ end
66
+
67
+ # Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
68
+ def update(id, params = {}, opts = {})
69
+ request(
70
+ method: :post,
71
+ path: format("/v1/orders/%<id>s", { id: CGI.escape(id) }),
72
+ params: params,
73
+ opts: opts,
74
+ base_address: :api
75
+ )
76
+ end
77
+ end
78
+ end
@@ -99,6 +99,32 @@ module Stripe
99
99
  )
100
100
  end
101
101
 
102
+ # Perform a decremental authorization on an eligible
103
+ # [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
104
+ # PaymentIntent's status must be requires_capture and
105
+ # [decremental_authorization.status](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-decremental_authorization)
106
+ # must be available.
107
+ #
108
+ # Decremental authorizations decrease the authorized amount on your customer's card
109
+ # to the new, lower amount provided. A single PaymentIntent can call this endpoint multiple times to further decrease the authorized amount.
110
+ #
111
+ # After decrement, the PaymentIntent object
112
+ # returns with the updated
113
+ # [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
114
+ # The PaymentIntent will now be capturable up to the new authorized amount.
115
+ #
116
+ # Each PaymentIntent can have a maximum of 10 decremental or incremental authorization attempts, including declines.
117
+ # After it's fully captured, a PaymentIntent can no longer be decremented.
118
+ def decrement_authorization(intent, params = {}, opts = {})
119
+ request(
120
+ method: :post,
121
+ path: format("/v1/payment_intents/%<intent>s/decrement_authorization", { intent: CGI.escape(intent) }),
122
+ params: params,
123
+ opts: opts,
124
+ base_address: :api
125
+ )
126
+ end
127
+
102
128
  # Perform an incremental authorization on an eligible
103
129
  # [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
104
130
  # PaymentIntent's status must be requires_capture and
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class QuoteLineService < StripeService
6
+ # Retrieves a paginated list of lines for a quote. These lines describe changes that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
7
+ def list(quote, params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: format("/v1/quotes/%<quote>s/lines", { quote: CGI.escape(quote) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class QuotePreviewInvoiceService < StripeService
6
+ # Preview the invoices that would be generated by accepting the quote.
7
+ def list(quote, params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: format("/v1/quotes/%<quote>s/preview_invoices", { quote: CGI.escape(quote) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class QuotePreviewSubscriptionScheduleService < StripeService
6
+ # Preview the schedules that would be generated by accepting the quote
7
+ def list(quote, params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: format("/v1/quotes/%<quote>s/preview_subscription_schedules", { quote: CGI.escape(quote) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+ end
17
+ end
@@ -3,10 +3,14 @@
3
3
 
4
4
  module Stripe
5
5
  class QuoteService < StripeService
6
- attr_reader :line_items, :computed_upfront_line_items
6
+ attr_reader :preview_invoices, :preview_subscription_schedules, :lines, :line_items, :computed_upfront_line_items
7
7
 
8
8
  def initialize(requestor)
9
9
  super(requestor)
10
+ @preview_invoices = Stripe::QuotePreviewInvoiceService.new(@requestor)
11
+ @preview_subscription_schedules = Stripe::QuotePreviewSubscriptionScheduleService
12
+ .new(@requestor)
13
+ @lines = Stripe::QuoteLineService.new(@requestor)
10
14
  @line_items = Stripe::QuoteLineItemService.new(@requestor)
11
15
  @computed_upfront_line_items = Stripe::QuoteComputedUpfrontLineItemsService.new(@requestor)
12
16
  end
@@ -54,6 +58,39 @@ module Stripe
54
58
  request(method: :get, path: "/v1/quotes", params: params, opts: opts, base_address: :api)
55
59
  end
56
60
 
61
+ # Preview the invoice line items that would be generated by accepting the quote.
62
+ def list_preview_invoice_lines(quote, preview_invoice, params = {}, opts = {})
63
+ request(
64
+ method: :get,
65
+ path: format("/v1/quotes/%<quote>s/preview_invoices/%<preview_invoice>s/lines", { quote: CGI.escape(quote), preview_invoice: CGI.escape(preview_invoice) }),
66
+ params: params,
67
+ opts: opts,
68
+ base_address: :api
69
+ )
70
+ end
71
+
72
+ # Converts a stale quote to draft.
73
+ def mark_draft(quote, params = {}, opts = {})
74
+ request(
75
+ method: :post,
76
+ path: format("/v1/quotes/%<quote>s/mark_draft", { quote: CGI.escape(quote) }),
77
+ params: params,
78
+ opts: opts,
79
+ base_address: :api
80
+ )
81
+ end
82
+
83
+ # Converts a draft or open quote to stale.
84
+ def mark_stale(quote, params = {}, opts = {})
85
+ request(
86
+ method: :post,
87
+ path: format("/v1/quotes/%<quote>s/mark_stale", { quote: CGI.escape(quote) }),
88
+ params: params,
89
+ opts: opts,
90
+ base_address: :api
91
+ )
92
+ end
93
+
57
94
  # Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
58
95
  def pdf(quote, params = {}, opts = {}, &read_body_chunk_block)
59
96
  opts = { api_base: APIRequestor.active_requestor.config.uploads_base }.merge(opts)
@@ -67,6 +104,17 @@ module Stripe
67
104
  )
68
105
  end
69
106
 
107
+ # Recompute the upcoming invoice estimate for the quote.
108
+ def reestimate(quote, params = {}, opts = {})
109
+ request(
110
+ method: :post,
111
+ path: format("/v1/quotes/%<quote>s/reestimate", { quote: CGI.escape(quote) }),
112
+ params: params,
113
+ opts: opts,
114
+ base_address: :api
115
+ )
116
+ end
117
+
70
118
  # Retrieves the quote with the given ID.
71
119
  def retrieve(quote, params = {}, opts = {})
72
120
  request(
@@ -3,6 +3,17 @@
3
3
 
4
4
  module Stripe
5
5
  class SubscriptionScheduleService < StripeService
6
+ # Amends an existing subscription schedule.
7
+ def amend(schedule, params = {}, opts = {})
8
+ request(
9
+ method: :post,
10
+ path: format("/v1/subscription_schedules/%<schedule>s/amend", { schedule: CGI.escape(schedule) }),
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
6
17
  # Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
7
18
  def cancel(schedule, params = {}, opts = {})
8
19
  request(
@@ -0,0 +1,19 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Tax
6
+ class AssociationService < StripeService
7
+ # Finds a tax association object by PaymentIntent id.
8
+ def find(params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: "/v1/tax/associations/find",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+ end
18
+ end
19
+ end