stripe 13.0.0 → 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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1372 -645
  3. data/OPENAPI_VERSION +1 -1
  4. data/VERSION +1 -1
  5. data/lib/stripe/object_types.rb +19 -0
  6. data/lib/stripe/request_signing_authenticator.rb +79 -0
  7. data/lib/stripe/resources/account_notice.rb +32 -0
  8. data/lib/stripe/resources/billing/meter.rb +2 -0
  9. data/lib/stripe/resources/capital/financing_offer.rb +49 -0
  10. data/lib/stripe/resources/capital/financing_summary.rb +15 -0
  11. data/lib/stripe/resources/capital/financing_transaction.rb +27 -0
  12. data/lib/stripe/resources/financial_connections/account.rb +3 -0
  13. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +14 -0
  14. data/lib/stripe/resources/financial_connections/institution.rb +26 -0
  15. data/lib/stripe/resources/gift_cards/card.rb +59 -0
  16. data/lib/stripe/resources/gift_cards/transaction.rb +93 -0
  17. data/lib/stripe/resources/invoice.rb +81 -0
  18. data/lib/stripe/resources/invoice_payment.rb +12 -0
  19. data/lib/stripe/resources/issuing/card.rb +20 -0
  20. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +88 -0
  21. data/lib/stripe/resources/issuing/dispute_settlement_detail.rb +26 -0
  22. data/lib/stripe/resources/margin.rb +37 -0
  23. data/lib/stripe/resources/order.rb +120 -0
  24. data/lib/stripe/resources/payment_intent.rb +50 -0
  25. data/lib/stripe/resources/quote.rb +104 -0
  26. data/lib/stripe/resources/quote_preview_invoice.rb +43 -0
  27. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +11 -0
  28. data/lib/stripe/resources/subscription_schedule.rb +20 -0
  29. data/lib/stripe/resources/tax/association.rb +24 -0
  30. data/lib/stripe/resources/tax/form.rb +49 -0
  31. data/lib/stripe/resources/terminal/reader.rb +60 -0
  32. data/lib/stripe/resources/terminal/reader_collected_data.rb +14 -0
  33. data/lib/stripe/resources/usage_record_summary.rb +1 -0
  34. data/lib/stripe/resources.rb +18 -0
  35. data/lib/stripe/services/account_notice_service.rb +39 -0
  36. data/lib/stripe/services/capital/financing_offer_service.rb +42 -0
  37. data/lib/stripe/services/capital/financing_summary_service.rb +19 -0
  38. data/lib/stripe/services/capital/financing_transaction_service.rb +31 -0
  39. data/lib/stripe/services/capital_service.rb +15 -0
  40. data/lib/stripe/services/financial_connections/account_inferred_balance_service.rb +19 -0
  41. data/lib/stripe/services/financial_connections/account_service.rb +3 -1
  42. data/lib/stripe/services/financial_connections/institution_service.rb +30 -0
  43. data/lib/stripe/services/financial_connections_service.rb +2 -1
  44. data/lib/stripe/services/gift_cards/card_service.rb +63 -0
  45. data/lib/stripe/services/gift_cards/transaction_service.rb +74 -0
  46. data/lib/stripe/services/gift_cards_service.rb +14 -0
  47. data/lib/stripe/services/invoice_payment_service.rb +28 -0
  48. data/lib/stripe/services/invoice_service.rb +44 -1
  49. data/lib/stripe/services/issuing/credit_underwriting_record_service.rb +74 -0
  50. data/lib/stripe/services/issuing/dispute_settlement_detail_service.rb +30 -0
  51. data/lib/stripe/services/issuing_service.rb +4 -1
  52. data/lib/stripe/services/margin_service.rb +50 -0
  53. data/lib/stripe/services/order_line_item_service.rb +17 -0
  54. data/lib/stripe/services/order_service.rb +78 -0
  55. data/lib/stripe/services/payment_intent_service.rb +26 -0
  56. data/lib/stripe/services/quote_line_service.rb +17 -0
  57. data/lib/stripe/services/quote_preview_invoice_service.rb +17 -0
  58. data/lib/stripe/services/quote_preview_subscription_schedule_service.rb +17 -0
  59. data/lib/stripe/services/quote_service.rb +49 -1
  60. data/lib/stripe/services/subscription_schedule_service.rb +11 -0
  61. data/lib/stripe/services/tax/association_service.rb +19 -0
  62. data/lib/stripe/services/tax/form_service.rb +37 -0
  63. data/lib/stripe/services/tax_service.rb +3 -1
  64. data/lib/stripe/services/terminal/reader_collected_data_service.rb +19 -0
  65. data/lib/stripe/services/terminal/reader_service.rb +33 -0
  66. data/lib/stripe/services/terminal_service.rb +2 -1
  67. data/lib/stripe/services/test_helpers/issuing/card_service.rb +11 -0
  68. data/lib/stripe/services/v1_services.rb +6 -1
  69. data/lib/stripe/services.rb +22 -0
  70. data/lib/stripe/stripe_configuration.rb +3 -1
  71. data/lib/stripe/util.rb +7 -1
  72. data/lib/stripe/version.rb +1 -1
  73. data/lib/stripe.rb +45 -0
  74. metadata +45 -4
@@ -37,6 +37,66 @@ module Stripe
37
37
  )
38
38
  end
39
39
 
40
+ # Initiates an input collection flow on a Reader.
41
+ def collect_inputs(params = {}, opts = {})
42
+ request_stripe_object(
43
+ method: :post,
44
+ path: format("/v1/terminal/readers/%<reader>s/collect_inputs", { reader: CGI.escape(self["id"]) }),
45
+ params: params,
46
+ opts: opts
47
+ )
48
+ end
49
+
50
+ # Initiates an input collection flow on a Reader.
51
+ def self.collect_inputs(reader, params = {}, opts = {})
52
+ request_stripe_object(
53
+ method: :post,
54
+ path: format("/v1/terminal/readers/%<reader>s/collect_inputs", { reader: CGI.escape(reader) }),
55
+ params: params,
56
+ opts: opts
57
+ )
58
+ end
59
+
60
+ # Initiates a payment flow on a Reader and updates the PaymentIntent with card details before manual confirmation.
61
+ def collect_payment_method(params = {}, opts = {})
62
+ request_stripe_object(
63
+ method: :post,
64
+ path: format("/v1/terminal/readers/%<reader>s/collect_payment_method", { reader: CGI.escape(self["id"]) }),
65
+ params: params,
66
+ opts: opts
67
+ )
68
+ end
69
+
70
+ # Initiates a payment flow on a Reader and updates the PaymentIntent with card details before manual confirmation.
71
+ def self.collect_payment_method(reader, params = {}, opts = {})
72
+ request_stripe_object(
73
+ method: :post,
74
+ path: format("/v1/terminal/readers/%<reader>s/collect_payment_method", { reader: CGI.escape(reader) }),
75
+ params: params,
76
+ opts: opts
77
+ )
78
+ end
79
+
80
+ # Finalizes a payment on a Reader.
81
+ def confirm_payment_intent(params = {}, opts = {})
82
+ request_stripe_object(
83
+ method: :post,
84
+ path: format("/v1/terminal/readers/%<reader>s/confirm_payment_intent", { reader: CGI.escape(self["id"]) }),
85
+ params: params,
86
+ opts: opts
87
+ )
88
+ end
89
+
90
+ # Finalizes a payment on a Reader.
91
+ def self.confirm_payment_intent(reader, params = {}, opts = {})
92
+ request_stripe_object(
93
+ method: :post,
94
+ path: format("/v1/terminal/readers/%<reader>s/confirm_payment_intent", { reader: CGI.escape(reader) }),
95
+ params: params,
96
+ opts: opts
97
+ )
98
+ end
99
+
40
100
  # Creates a new Reader object.
41
101
  def self.create(params = {}, opts = {})
42
102
  request_stripe_object(
@@ -0,0 +1,14 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Terminal
6
+ # Returns data collected by Terminal readers. This data is only stored for 24 hours.
7
+ class ReaderCollectedData < APIResource
8
+ OBJECT_NAME = "terminal.reader_collected_data"
9
+ def self.object_name
10
+ "terminal.reader_collected_data"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A usage record summary represents an aggregated view of how much usage was accrued for a subscription item within a subscription billing period.
5
6
  class UsageRecordSummary < StripeObject
6
7
  OBJECT_NAME = "usage_record_summary"
7
8
  def self.object_name
@@ -3,6 +3,7 @@
3
3
 
4
4
  require "stripe/resources/account"
5
5
  require "stripe/resources/account_link"
6
+ require "stripe/resources/account_notice"
6
7
  require "stripe/resources/account_session"
7
8
  require "stripe/resources/apple_pay_domain"
8
9
  require "stripe/resources/application_fee"
@@ -22,6 +23,9 @@ require "stripe/resources/billing/meter_event_summary"
22
23
  require "stripe/resources/billing_portal/configuration"
23
24
  require "stripe/resources/billing_portal/session"
24
25
  require "stripe/resources/capability"
26
+ require "stripe/resources/capital/financing_offer"
27
+ require "stripe/resources/capital/financing_summary"
28
+ require "stripe/resources/capital/financing_transaction"
25
29
  require "stripe/resources/card"
26
30
  require "stripe/resources/cash_balance"
27
31
  require "stripe/resources/charge"
@@ -48,22 +52,29 @@ require "stripe/resources/exchange_rate"
48
52
  require "stripe/resources/file"
49
53
  require "stripe/resources/file_link"
50
54
  require "stripe/resources/financial_connections/account"
55
+ require "stripe/resources/financial_connections/account_inferred_balance"
51
56
  require "stripe/resources/financial_connections/account_owner"
52
57
  require "stripe/resources/financial_connections/account_ownership"
58
+ require "stripe/resources/financial_connections/institution"
53
59
  require "stripe/resources/financial_connections/session"
54
60
  require "stripe/resources/financial_connections/transaction"
55
61
  require "stripe/resources/forwarding/request"
56
62
  require "stripe/resources/funding_instructions"
63
+ require "stripe/resources/gift_cards/card"
64
+ require "stripe/resources/gift_cards/transaction"
57
65
  require "stripe/resources/identity/verification_report"
58
66
  require "stripe/resources/identity/verification_session"
59
67
  require "stripe/resources/invoice"
60
68
  require "stripe/resources/invoice_item"
61
69
  require "stripe/resources/invoice_line_item"
70
+ require "stripe/resources/invoice_payment"
62
71
  require "stripe/resources/invoice_rendering_template"
63
72
  require "stripe/resources/issuing/authorization"
64
73
  require "stripe/resources/issuing/card"
65
74
  require "stripe/resources/issuing/cardholder"
75
+ require "stripe/resources/issuing/credit_underwriting_record"
66
76
  require "stripe/resources/issuing/dispute"
77
+ require "stripe/resources/issuing/dispute_settlement_detail"
67
78
  require "stripe/resources/issuing/personalization_design"
68
79
  require "stripe/resources/issuing/physical_bundle"
69
80
  require "stripe/resources/issuing/token"
@@ -71,6 +82,8 @@ require "stripe/resources/issuing/transaction"
71
82
  require "stripe/resources/line_item"
72
83
  require "stripe/resources/login_link"
73
84
  require "stripe/resources/mandate"
85
+ require "stripe/resources/margin"
86
+ require "stripe/resources/order"
74
87
  require "stripe/resources/payment_intent"
75
88
  require "stripe/resources/payment_link"
76
89
  require "stripe/resources/payment_method"
@@ -84,6 +97,8 @@ require "stripe/resources/product"
84
97
  require "stripe/resources/product_feature"
85
98
  require "stripe/resources/promotion_code"
86
99
  require "stripe/resources/quote"
100
+ require "stripe/resources/quote_preview_invoice"
101
+ require "stripe/resources/quote_preview_subscription_schedule"
87
102
  require "stripe/resources/radar/early_fraud_warning"
88
103
  require "stripe/resources/radar/value_list"
89
104
  require "stripe/resources/radar/value_list_item"
@@ -101,8 +116,10 @@ require "stripe/resources/source_transaction"
101
116
  require "stripe/resources/subscription"
102
117
  require "stripe/resources/subscription_item"
103
118
  require "stripe/resources/subscription_schedule"
119
+ require "stripe/resources/tax/association"
104
120
  require "stripe/resources/tax/calculation"
105
121
  require "stripe/resources/tax/calculation_line_item"
122
+ require "stripe/resources/tax/form"
106
123
  require "stripe/resources/tax/registration"
107
124
  require "stripe/resources/tax/settings"
108
125
  require "stripe/resources/tax/transaction"
@@ -114,6 +131,7 @@ require "stripe/resources/terminal/configuration"
114
131
  require "stripe/resources/terminal/connection_token"
115
132
  require "stripe/resources/terminal/location"
116
133
  require "stripe/resources/terminal/reader"
134
+ require "stripe/resources/terminal/reader_collected_data"
117
135
  require "stripe/resources/test_helpers/test_clock"
118
136
  require "stripe/resources/token"
119
137
  require "stripe/resources/topup"
@@ -0,0 +1,39 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class AccountNoticeService < StripeService
6
+ # Retrieves a list of AccountNotice objects. The objects are sorted in descending order by creation date, with the most-recently-created object appearing first.
7
+ def list(params = {}, opts = {})
8
+ request(
9
+ method: :get,
10
+ path: "/v1/account_notices",
11
+ params: params,
12
+ opts: opts,
13
+ base_address: :api
14
+ )
15
+ end
16
+
17
+ # Retrieves an AccountNotice object.
18
+ def retrieve(account_notice, params = {}, opts = {})
19
+ request(
20
+ method: :get,
21
+ path: format("/v1/account_notices/%<account_notice>s", { account_notice: CGI.escape(account_notice) }),
22
+ params: params,
23
+ opts: opts,
24
+ base_address: :api
25
+ )
26
+ end
27
+
28
+ # Updates an AccountNotice object.
29
+ def update(account_notice, params = {}, opts = {})
30
+ request(
31
+ method: :post,
32
+ path: format("/v1/account_notices/%<account_notice>s", { account_notice: CGI.escape(account_notice) }),
33
+ params: params,
34
+ opts: opts,
35
+ base_address: :api
36
+ )
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,42 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Capital
6
+ class FinancingOfferService < StripeService
7
+ # Retrieves the financing offers available for Connected accounts that belong to your platform.
8
+ def list(params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: "/v1/capital/financing_offers",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Acknowledges that platform has received and delivered the financing_offer to
19
+ # the intended merchant recipient.
20
+ def mark_delivered(financing_offer, params = {}, opts = {})
21
+ request(
22
+ method: :post,
23
+ path: format("/v1/capital/financing_offers/%<financing_offer>s/mark_delivered", { financing_offer: CGI.escape(financing_offer) }),
24
+ params: params,
25
+ opts: opts,
26
+ base_address: :api
27
+ )
28
+ end
29
+
30
+ # Get the details of the financing offer
31
+ def retrieve(financing_offer, params = {}, opts = {})
32
+ request(
33
+ method: :get,
34
+ path: format("/v1/capital/financing_offers/%<financing_offer>s", { financing_offer: CGI.escape(financing_offer) }),
35
+ params: params,
36
+ opts: opts,
37
+ base_address: :api
38
+ )
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,19 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Capital
6
+ class FinancingSummaryService < StripeService
7
+ # Retrieve the financing state for the account that was authenticated in the request.
8
+ def retrieve(params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: "/v1/capital/financing_summary",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,31 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Capital
6
+ class FinancingTransactionService < StripeService
7
+ # Returns a list of financing transactions. The transactions are returned in sorted order,
8
+ # with the most recent transactions appearing first.
9
+ def list(params = {}, opts = {})
10
+ request(
11
+ method: :get,
12
+ path: "/v1/capital/financing_transactions",
13
+ params: params,
14
+ opts: opts,
15
+ base_address: :api
16
+ )
17
+ end
18
+
19
+ # Retrieves a financing transaction for a financing offer.
20
+ def retrieve(financing_transaction, params = {}, opts = {})
21
+ request(
22
+ method: :get,
23
+ path: format("/v1/capital/financing_transactions/%<financing_transaction>s", { financing_transaction: CGI.escape(financing_transaction) }),
24
+ params: params,
25
+ opts: opts,
26
+ base_address: :api
27
+ )
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class CapitalService < StripeService
6
+ attr_reader :financing_offers, :financing_summary, :financing_transactions
7
+
8
+ def initialize(requestor)
9
+ super(requestor)
10
+ @financing_offers = Stripe::Capital::FinancingOfferService.new(@requestor)
11
+ @financing_summary = Stripe::Capital::FinancingSummaryService.new(@requestor)
12
+ @financing_transactions = Stripe::Capital::FinancingTransactionService.new(@requestor)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module FinancialConnections
6
+ class AccountInferredBalanceService < StripeService
7
+ # Lists the recorded inferred balances for a Financial Connections Account.
8
+ def list(account, params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: format("/v1/financial_connections/accounts/%<account>s/inferred_balances", { account: CGI.escape(account) }),
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+ end
18
+ end
19
+ end
@@ -4,10 +4,12 @@
4
4
  module Stripe
5
5
  module FinancialConnections
6
6
  class AccountService < StripeService
7
- attr_reader :owners
7
+ attr_reader :inferred_balances, :owners
8
8
 
9
9
  def initialize(requestor)
10
10
  super(requestor)
11
+ @inferred_balances = Stripe::FinancialConnections::AccountInferredBalanceService
12
+ .new(@requestor)
11
13
  @owners = Stripe::FinancialConnections::AccountOwnerService.new(@requestor)
12
14
  end
13
15
 
@@ -0,0 +1,30 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module FinancialConnections
6
+ class InstitutionService < StripeService
7
+ # Returns a list of Financial Connections Institution objects.
8
+ def list(params = {}, opts = {})
9
+ request(
10
+ method: :get,
11
+ path: "/v1/financial_connections/institutions",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # Retrieves the details of a Financial Connections Institution.
19
+ def retrieve(institution, params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: format("/v1/financial_connections/institutions/%<institution>s", { institution: CGI.escape(institution) }),
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
@@ -3,11 +3,12 @@
3
3
 
4
4
  module Stripe
5
5
  class FinancialConnectionsService < StripeService
6
- attr_reader :accounts, :sessions, :transactions
6
+ attr_reader :accounts, :institutions, :sessions, :transactions
7
7
 
8
8
  def initialize(requestor)
9
9
  super(requestor)
10
10
  @accounts = Stripe::FinancialConnections::AccountService.new(@requestor)
11
+ @institutions = Stripe::FinancialConnections::InstitutionService.new(@requestor)
11
12
  @sessions = Stripe::FinancialConnections::SessionService.new(@requestor)
12
13
  @transactions = Stripe::FinancialConnections::TransactionService.new(@requestor)
13
14
  end
@@ -0,0 +1,63 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module GiftCards
6
+ class CardService < StripeService
7
+ # Creates a new gift card object.
8
+ def create(params = {}, opts = {})
9
+ request(
10
+ method: :post,
11
+ path: "/v1/gift_cards/cards",
12
+ params: params,
13
+ opts: opts,
14
+ base_address: :api
15
+ )
16
+ end
17
+
18
+ # List gift cards for an account
19
+ def list(params = {}, opts = {})
20
+ request(
21
+ method: :get,
22
+ path: "/v1/gift_cards/cards",
23
+ params: params,
24
+ opts: opts,
25
+ base_address: :api
26
+ )
27
+ end
28
+
29
+ # Retrieve a gift card by id
30
+ def retrieve(id, params = {}, opts = {})
31
+ request(
32
+ method: :get,
33
+ path: format("/v1/gift_cards/cards/%<id>s", { id: CGI.escape(id) }),
34
+ params: params,
35
+ opts: opts,
36
+ base_address: :api
37
+ )
38
+ end
39
+
40
+ # Update a gift card
41
+ def update(id, params = {}, opts = {})
42
+ request(
43
+ method: :post,
44
+ path: format("/v1/gift_cards/cards/%<id>s", { id: CGI.escape(id) }),
45
+ params: params,
46
+ opts: opts,
47
+ base_address: :api
48
+ )
49
+ end
50
+
51
+ # Validates a gift card code, returning the matching gift card object if it exists.
52
+ def validate(params = {}, opts = {})
53
+ request(
54
+ method: :post,
55
+ path: "/v1/gift_cards/cards/validate",
56
+ params: params,
57
+ opts: opts,
58
+ base_address: :api
59
+ )
60
+ end
61
+ end
62
+ end
63
+ end
@@ -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)