Skip to content

Commit a0e32a4

Browse files
authored
Bring back invoice payments APIs (#1632)
1 parent 215625e commit a0e32a4

File tree

9 files changed

+408
-3
lines changed

9 files changed

+408
-3
lines changed

OPENAPI_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1868
1+
v1868

lib/stripe/resources/invoice_payment.rb

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ module Stripe
1111
# This resource and its endpoints allows you to easily track if a payment is associated with a specific invoice and
1212
# monitor the allocation details of the payments.
1313
class InvoicePayment < APIResource
14+
extend Stripe::APIOperations::List
15+
1416
OBJECT_NAME = "invoice_payment"
1517
def self.object_name
1618
"invoice_payment"
@@ -33,6 +35,55 @@ class StatusTransitions < Stripe::StripeObject
3335
# The time that the payment succeeded.
3436
attr_reader :paid_at
3537
end
38+
39+
class ListParams < Stripe::RequestParams
40+
class Payment < Stripe::RequestParams
41+
# Only return invoice payments associated by this payment intent ID.
42+
attr_accessor :payment_intent
43+
# Attribute for param field payment_record
44+
attr_accessor :payment_record
45+
# Only return invoice payments associated by this payment type.
46+
attr_accessor :type
47+
48+
def initialize(payment_intent: nil, payment_record: nil, type: nil)
49+
@payment_intent = payment_intent
50+
@payment_record = payment_record
51+
@type = type
52+
end
53+
end
54+
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
55+
attr_accessor :ending_before
56+
# Specifies which fields in the response should be expanded.
57+
attr_accessor :expand
58+
# The identifier of the invoice whose payments to return.
59+
attr_accessor :invoice
60+
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
61+
attr_accessor :limit
62+
# The payment details of the invoice payments to return.
63+
attr_accessor :payment
64+
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
65+
attr_accessor :starting_after
66+
# The status of the invoice payments to return.
67+
attr_accessor :status
68+
69+
def initialize(
70+
ending_before: nil,
71+
expand: nil,
72+
invoice: nil,
73+
limit: nil,
74+
payment: nil,
75+
starting_after: nil,
76+
status: nil
77+
)
78+
@ending_before = ending_before
79+
@expand = expand
80+
@invoice = invoice
81+
@limit = limit
82+
@payment = payment
83+
@starting_after = starting_after
84+
@status = status
85+
end
86+
end
3687
# Amount that was actually paid for this invoice, in cents (or local equivalent). This field is null until the payment is `paid`. This amount can be less than the `amount_requested` if the PaymentIntent’s `amount_received` is not sufficient to pay all of the invoices that it is attached to.
3788
attr_reader :amount_paid
3889
# Amount intended to be paid toward this invoice, in cents (or local equivalent)
@@ -57,5 +108,10 @@ class StatusTransitions < Stripe::StripeObject
57108
attr_reader :status
58109
# Attribute for field status_transitions
59110
attr_reader :status_transitions
111+
112+
# 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.
113+
def self.list(params = {}, opts = {})
114+
request_stripe_object(method: :get, path: "/v1/invoice_payments", params: params, opts: opts)
115+
end
60116
end
61117
end

lib/stripe/services.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
require "stripe/services/identity_service"
8383
require "stripe/services/invoice_item_service"
8484
require "stripe/services/invoice_line_item_service"
85+
require "stripe/services/invoice_payment_service"
8586
require "stripe/services/invoice_rendering_template_service"
8687
require "stripe/services/invoice_service"
8788
require "stripe/services/issuing/authorization_service"
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# File generated from our OpenAPI spec
2+
# frozen_string_literal: true
3+
4+
module Stripe
5+
class InvoicePaymentService < StripeService
6+
class ListParams < Stripe::RequestParams
7+
class Payment < Stripe::RequestParams
8+
# Only return invoice payments associated by this payment intent ID.
9+
attr_accessor :payment_intent
10+
# Attribute for param field payment_record
11+
attr_accessor :payment_record
12+
# Only return invoice payments associated by this payment type.
13+
attr_accessor :type
14+
15+
def initialize(payment_intent: nil, payment_record: nil, type: nil)
16+
@payment_intent = payment_intent
17+
@payment_record = payment_record
18+
@type = type
19+
end
20+
end
21+
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
22+
attr_accessor :ending_before
23+
# Specifies which fields in the response should be expanded.
24+
attr_accessor :expand
25+
# The identifier of the invoice whose payments to return.
26+
attr_accessor :invoice
27+
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
28+
attr_accessor :limit
29+
# The payment details of the invoice payments to return.
30+
attr_accessor :payment
31+
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
32+
attr_accessor :starting_after
33+
# The status of the invoice payments to return.
34+
attr_accessor :status
35+
36+
def initialize(
37+
ending_before: nil,
38+
expand: nil,
39+
invoice: nil,
40+
limit: nil,
41+
payment: nil,
42+
starting_after: nil,
43+
status: nil
44+
)
45+
@ending_before = ending_before
46+
@expand = expand
47+
@invoice = invoice
48+
@limit = limit
49+
@payment = payment
50+
@starting_after = starting_after
51+
@status = status
52+
end
53+
end
54+
55+
class RetrieveParams < Stripe::RequestParams
56+
# Specifies which fields in the response should be expanded.
57+
attr_accessor :expand
58+
59+
def initialize(expand: nil)
60+
@expand = expand
61+
end
62+
end
63+
64+
# 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.
65+
def list(params = {}, opts = {})
66+
request(
67+
method: :get,
68+
path: "/v1/invoice_payments",
69+
params: params,
70+
opts: opts,
71+
base_address: :api
72+
)
73+
end
74+
75+
# Retrieves the invoice payment with the given ID.
76+
def retrieve(invoice_payment, params = {}, opts = {})
77+
request(
78+
method: :get,
79+
path: format("/v1/invoice_payments/%<invoice_payment>s", { invoice_payment: CGI.escape(invoice_payment) }),
80+
params: params,
81+
opts: opts,
82+
base_address: :api
83+
)
84+
end
85+
end
86+
end

lib/stripe/services/v1_services.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Stripe
44
class V1Services < StripeService
55
# v1 accessors: The beginning of the section generated from our OpenAPI spec
66
attr_reader :accounts
7-
attr_reader :account_links, :account_notices, :account_sessions, :apple_pay_domains, :application_fees, :apps, :balance, :balance_settings, :balance_transactions, :billing, :billing_portal, :capital, :charges, :checkout, :climate, :confirmation_tokens, :test_helpers, :country_specs, :coupons, :credit_notes, :customers, :customer_sessions, :disputes, :entitlements, :ephemeral_keys, :events, :exchange_rates, :files, :file_links, :financial_connections, :forwarding, :fx_quotes, :identity, :invoices, :invoice_rendering_templates, :invoice_items, :issuing, :mandates, :margins, :orders, :payment_attempt_records, :payment_intents, :payment_links, :payment_methods, :payment_method_configurations, :payment_method_domains, :payment_records, :payouts, :plans, :prices, :privacy, :products, :promotion_codes, :quotes, :radar, :refunds, :reporting, :reviews, :sigma, :setup_attempts, :setup_intents, :shipping_rates, :sources, :subscriptions, :subscription_items, :subscription_schedules, :tax, :tax_codes, :tax_ids, :tax_rates, :terminal, :tokens, :topups, :transfers, :treasury, :webhook_endpoints, :external_accounts
7+
attr_reader :account_links, :account_notices, :account_sessions, :apple_pay_domains, :application_fees, :apps, :balance, :balance_settings, :balance_transactions, :billing, :billing_portal, :capital, :charges, :checkout, :climate, :confirmation_tokens, :test_helpers, :country_specs, :coupons, :credit_notes, :customers, :customer_sessions, :disputes, :entitlements, :ephemeral_keys, :events, :exchange_rates, :files, :file_links, :financial_connections, :forwarding, :fx_quotes, :identity, :invoices, :invoice_payments, :invoice_rendering_templates, :invoice_items, :issuing, :mandates, :margins, :orders, :payment_attempt_records, :payment_intents, :payment_links, :payment_methods, :payment_method_configurations, :payment_method_domains, :payment_records, :payouts, :plans, :prices, :privacy, :products, :promotion_codes, :quotes, :radar, :refunds, :reporting, :reviews, :sigma, :setup_attempts, :setup_intents, :shipping_rates, :sources, :subscriptions, :subscription_items, :subscription_schedules, :tax, :tax_codes, :tax_ids, :tax_rates, :terminal, :tokens, :topups, :transfers, :treasury, :webhook_endpoints, :external_accounts
88
# v1 accessors: The end of the section generated from our OpenAPI spec
99

1010
# OAuthService is manually maintained, as it has special behaviors
@@ -48,6 +48,7 @@ def initialize(requestor)
4848
@fx_quotes = Stripe::FxQuoteService.new(@requestor)
4949
@identity = Stripe::IdentityService.new(@requestor)
5050
@invoices = Stripe::InvoiceService.new(@requestor)
51+
@invoice_payments = Stripe::InvoicePaymentService.new(@requestor)
5152
@invoice_rendering_templates = Stripe::InvoiceRenderingTemplateService.new(@requestor)
5253
@invoice_items = Stripe::InvoiceItemService.new(@requestor)
5354
@issuing = Stripe::IssuingService.new(@requestor)

rbi/stripe.rbi

Lines changed: 130 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33808,6 +33808,61 @@ module Stripe
3380833808
# Attribute for field status_transitions
3380933809
sig { returns(StatusTransitions) }
3381033810
attr_reader :status_transitions
33811+
class ListParams < Stripe::RequestParams
33812+
class Payment < Stripe::RequestParams
33813+
# Only return invoice payments associated by this payment intent ID.
33814+
sig { returns(T.nilable(String)) }
33815+
attr_accessor :payment_intent
33816+
# Attribute for param field payment_record
33817+
sig { returns(T.nilable(String)) }
33818+
attr_accessor :payment_record
33819+
# Only return invoice payments associated by this payment type.
33820+
sig { returns(String) }
33821+
attr_accessor :type
33822+
sig {
33823+
params(payment_intent: T.nilable(String), payment_record: T.nilable(String), type: String).void
33824+
}
33825+
def initialize(payment_intent: nil, payment_record: nil, type: nil); end
33826+
end
33827+
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
33828+
sig { returns(T.nilable(String)) }
33829+
attr_accessor :ending_before
33830+
# Specifies which fields in the response should be expanded.
33831+
sig { returns(T.nilable(T::Array[String])) }
33832+
attr_accessor :expand
33833+
# The identifier of the invoice whose payments to return.
33834+
sig { returns(T.nilable(String)) }
33835+
attr_accessor :invoice
33836+
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
33837+
sig { returns(T.nilable(Integer)) }
33838+
attr_accessor :limit
33839+
# The payment details of the invoice payments to return.
33840+
sig { returns(T.nilable(::Stripe::InvoicePayment::ListParams::Payment)) }
33841+
attr_accessor :payment
33842+
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
33843+
sig { returns(T.nilable(String)) }
33844+
attr_accessor :starting_after
33845+
# The status of the invoice payments to return.
33846+
sig { returns(T.nilable(String)) }
33847+
attr_accessor :status
33848+
sig {
33849+
params(ending_before: T.nilable(String), expand: T.nilable(T::Array[String]), invoice: T.nilable(String), limit: T.nilable(Integer), payment: T.nilable(::Stripe::InvoicePayment::ListParams::Payment), starting_after: T.nilable(String), status: T.nilable(String)).void
33850+
}
33851+
def initialize(
33852+
ending_before: nil,
33853+
expand: nil,
33854+
invoice: nil,
33855+
limit: nil,
33856+
payment: nil,
33857+
starting_after: nil,
33858+
status: nil
33859+
); end
33860+
end
33861+
# 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.
33862+
sig {
33863+
params(params: T.any(::Stripe::InvoicePayment::ListParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(Stripe::ListObject)
33864+
}
33865+
def self.list(params = {}, opts = {}); end
3381133866
end
3381233867
end
3381333868
# typed: true
@@ -113216,6 +113271,7 @@ module Stripe
113216113271
attr_reader :fx_quotes
113217113272
attr_reader :identity
113218113273
attr_reader :invoices
113274+
attr_reader :invoice_payments
113219113275
attr_reader :invoice_rendering_templates
113220113276
attr_reader :invoice_items
113221113277
attr_reader :issuing
@@ -140413,6 +140469,79 @@ module Stripe
140413140469
end
140414140470
end
140415140471
# typed: true
140472+
module Stripe
140473+
class InvoicePaymentService < StripeService
140474+
class ListParams < Stripe::RequestParams
140475+
class Payment < Stripe::RequestParams
140476+
# Only return invoice payments associated by this payment intent ID.
140477+
sig { returns(T.nilable(String)) }
140478+
attr_accessor :payment_intent
140479+
# Attribute for param field payment_record
140480+
sig { returns(T.nilable(String)) }
140481+
attr_accessor :payment_record
140482+
# Only return invoice payments associated by this payment type.
140483+
sig { returns(String) }
140484+
attr_accessor :type
140485+
sig {
140486+
params(payment_intent: T.nilable(String), payment_record: T.nilable(String), type: String).void
140487+
}
140488+
def initialize(payment_intent: nil, payment_record: nil, type: nil); end
140489+
end
140490+
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
140491+
sig { returns(T.nilable(String)) }
140492+
attr_accessor :ending_before
140493+
# Specifies which fields in the response should be expanded.
140494+
sig { returns(T.nilable(T::Array[String])) }
140495+
attr_accessor :expand
140496+
# The identifier of the invoice whose payments to return.
140497+
sig { returns(T.nilable(String)) }
140498+
attr_accessor :invoice
140499+
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
140500+
sig { returns(T.nilable(Integer)) }
140501+
attr_accessor :limit
140502+
# The payment details of the invoice payments to return.
140503+
sig { returns(T.nilable(::Stripe::InvoicePaymentService::ListParams::Payment)) }
140504+
attr_accessor :payment
140505+
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
140506+
sig { returns(T.nilable(String)) }
140507+
attr_accessor :starting_after
140508+
# The status of the invoice payments to return.
140509+
sig { returns(T.nilable(String)) }
140510+
attr_accessor :status
140511+
sig {
140512+
params(ending_before: T.nilable(String), expand: T.nilable(T::Array[String]), invoice: T.nilable(String), limit: T.nilable(Integer), payment: T.nilable(::Stripe::InvoicePaymentService::ListParams::Payment), starting_after: T.nilable(String), status: T.nilable(String)).void
140513+
}
140514+
def initialize(
140515+
ending_before: nil,
140516+
expand: nil,
140517+
invoice: nil,
140518+
limit: nil,
140519+
payment: nil,
140520+
starting_after: nil,
140521+
status: nil
140522+
); end
140523+
end
140524+
class RetrieveParams < Stripe::RequestParams
140525+
# Specifies which fields in the response should be expanded.
140526+
sig { returns(T.nilable(T::Array[String])) }
140527+
attr_accessor :expand
140528+
sig { params(expand: T.nilable(T::Array[String])).void }
140529+
def initialize(expand: nil); end
140530+
end
140531+
# 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.
140532+
sig {
140533+
params(params: T.any(::Stripe::InvoicePaymentService::ListParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(Stripe::ListObject)
140534+
}
140535+
def list(params = {}, opts = {}); end
140536+
140537+
# Retrieves the invoice payment with the given ID.
140538+
sig {
140539+
params(invoice_payment: String, params: T.any(::Stripe::InvoicePaymentService::RetrieveParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(Stripe::InvoicePayment)
140540+
}
140541+
def retrieve(invoice_payment, params = {}, opts = {}); end
140542+
end
140543+
end
140544+
# typed: true
140416140545
module Stripe
140417140546
class InvoiceRenderingTemplateService < StripeService
140418140547
class ListParams < Stripe::RequestParams
@@ -199013,4 +199142,4 @@ module Stripe
199013199142
end
199014199143
end
199015199144
end
199016-
end
199145+
end

0 commit comments

Comments
 (0)