stripe 12.7.0.pre.beta.2 → 13.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +720 -1360
- data/OPENAPI_VERSION +1 -1
- data/README.md +4 -3
- data/VERSION +1 -1
- data/examples/README.md +11 -0
- data/examples/meter_event_stream.rb +47 -0
- data/examples/new_example.rb +24 -0
- data/examples/stripe_webhook_handler.rb +28 -0
- data/lib/stripe/api_operations/nested_resource.rb +1 -21
- data/lib/stripe/api_operations/request.rb +19 -70
- data/lib/stripe/api_operations/save.rb +4 -3
- data/lib/stripe/api_operations/singleton_save.rb +5 -2
- data/lib/stripe/api_requestor.rb +1131 -0
- data/lib/stripe/api_resource.rb +22 -14
- data/lib/stripe/api_version.rb +1 -2
- data/lib/stripe/connection_manager.rb +1 -1
- data/lib/stripe/errors.rb +8 -2
- data/lib/stripe/event_types.rb +14 -0
- data/lib/stripe/events/v1_billing_meter_error_report_triggered_event.rb +23 -0
- data/lib/stripe/events/v1_billing_meter_no_meter_found_event.rb +13 -0
- data/lib/stripe/list_object.rb +2 -3
- data/lib/stripe/oauth.rb +8 -15
- data/lib/stripe/object_types.rb +16 -20
- data/lib/stripe/request_options.rb +128 -0
- data/lib/stripe/resources/billing/credit_balance_summary.rb +14 -0
- data/lib/stripe/resources/billing/credit_balance_transaction.rb +26 -0
- data/lib/stripe/resources/billing/credit_grant.rb +88 -0
- data/lib/stripe/resources/customer.rb +2 -3
- data/lib/stripe/resources/file.rb +7 -5
- data/lib/stripe/resources/financial_connections/account.rb +0 -3
- data/lib/stripe/resources/invoice.rb +0 -81
- data/lib/stripe/resources/payment_intent.rb +0 -50
- data/lib/stripe/resources/quote.rb +4 -108
- data/lib/stripe/resources/source.rb +3 -2
- data/lib/stripe/resources/subscription.rb +6 -6
- data/lib/stripe/resources/subscription_schedule.rb +0 -20
- data/lib/stripe/resources/terminal/reader.rb +0 -60
- data/lib/stripe/resources/v2/billing/meter_event.rb +16 -0
- data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +15 -0
- data/lib/stripe/resources/v2/billing/meter_event_session.rb +15 -0
- data/lib/stripe/resources/v2/event.rb +13 -0
- data/lib/stripe/resources.rb +9 -18
- data/lib/stripe/search_result_object.rb +1 -1
- data/lib/stripe/services/account_capability_service.rb +39 -0
- data/lib/stripe/services/account_external_account_service.rb +68 -0
- data/lib/stripe/services/account_link_service.rb +17 -0
- data/lib/stripe/services/account_login_link_service.rb +19 -0
- data/lib/stripe/services/account_person_service.rb +61 -0
- data/lib/stripe/services/account_service.rb +100 -0
- data/lib/stripe/services/account_session_service.rb +17 -0
- data/lib/stripe/services/apple_pay_domain_service.rb +50 -0
- data/lib/stripe/services/application_fee_refund_service.rb +60 -0
- data/lib/stripe/services/application_fee_service.rb +35 -0
- data/lib/stripe/services/apps/secret_service.rb +52 -0
- data/lib/stripe/services/apps_service.rb +13 -0
- data/lib/stripe/services/balance_service.rb +12 -0
- data/lib/stripe/services/balance_transaction_service.rb +32 -0
- data/lib/stripe/services/billing/alert_service.rb +74 -0
- data/lib/stripe/services/billing/credit_balance_summary_service.rb +19 -0
- data/lib/stripe/services/billing/credit_balance_transaction_service.rb +30 -0
- data/lib/stripe/services/billing/credit_grant_service.rb +74 -0
- data/lib/stripe/services/billing/meter_event_adjustment_service.rb +19 -0
- data/lib/stripe/services/billing/meter_event_service.rb +19 -0
- data/lib/stripe/services/billing/meter_event_summary_service.rb +19 -0
- data/lib/stripe/services/billing/meter_service.rb +81 -0
- data/lib/stripe/services/billing_portal/configuration_service.rb +52 -0
- data/lib/stripe/services/billing_portal/session_service.rb +19 -0
- data/lib/stripe/services/billing_portal_service.rb +14 -0
- data/lib/stripe/services/billing_service.rb +20 -0
- data/lib/stripe/services/charge_service.rb +69 -0
- data/lib/stripe/services/checkout/session_line_item_service.rb +19 -0
- data/lib/stripe/services/checkout/session_service.rb +72 -0
- data/lib/stripe/services/checkout_service.rb +13 -0
- data/lib/stripe/services/climate/order_service.rb +68 -0
- data/lib/stripe/services/climate/product_service.rb +30 -0
- data/lib/stripe/services/climate/supplier_service.rb +30 -0
- data/lib/stripe/services/climate_service.rb +15 -0
- data/lib/stripe/services/confirmation_token_service.rb +17 -0
- data/lib/stripe/services/country_spec_service.rb +28 -0
- data/lib/stripe/services/coupon_service.rb +51 -0
- data/lib/stripe/services/credit_note_line_item_service.rb +17 -0
- data/lib/stripe/services/credit_note_preview_lines_service.rb +17 -0
- data/lib/stripe/services/credit_note_service.rb +93 -0
- data/lib/stripe/services/customer_balance_transaction_service.rb +50 -0
- data/lib/stripe/services/customer_cash_balance_service.rb +28 -0
- data/lib/stripe/services/customer_cash_balance_transaction_service.rb +28 -0
- data/lib/stripe/services/customer_funding_instructions_service.rb +19 -0
- data/lib/stripe/services/customer_payment_method_service.rb +28 -0
- data/lib/stripe/services/customer_payment_source_service.rb +76 -0
- data/lib/stripe/services/customer_service.rb +89 -0
- data/lib/stripe/services/customer_session_service.rb +17 -0
- data/lib/stripe/services/customer_tax_id_service.rb +50 -0
- data/lib/stripe/services/dispute_service.rb +48 -0
- data/lib/stripe/services/entitlements/active_entitlement_service.rb +30 -0
- data/lib/stripe/services/entitlements/feature_service.rb +52 -0
- data/lib/stripe/services/entitlements_service.rb +14 -0
- data/lib/stripe/services/ephemeral_key_service.rb +28 -0
- data/lib/stripe/services/event_service.rb +22 -0
- data/lib/stripe/services/exchange_rate_service.rb +28 -0
- data/lib/stripe/services/file_link_service.rb +38 -0
- data/lib/stripe/services/file_service.rb +35 -0
- data/lib/stripe/services/financial_connections/account_owner_service.rb +19 -0
- data/lib/stripe/services/financial_connections/account_service.rb +81 -0
- data/lib/stripe/services/financial_connections/session_service.rb +30 -0
- data/lib/stripe/services/financial_connections/transaction_service.rb +30 -0
- data/lib/stripe/services/financial_connections_service.rb +15 -0
- data/lib/stripe/services/forwarding/request_service.rb +41 -0
- data/lib/stripe/services/forwarding_service.rb +13 -0
- data/lib/stripe/services/identity/verification_report_service.rb +30 -0
- data/lib/stripe/services/identity/verification_session_service.rb +106 -0
- data/lib/stripe/services/identity_service.rb +14 -0
- data/lib/stripe/services/invoice_item_service.rb +61 -0
- data/lib/stripe/services/invoice_line_item_service.rb +31 -0
- data/lib/stripe/services/invoice_rendering_template_service.rb +50 -0
- data/lib/stripe/services/invoice_service.rb +202 -0
- data/lib/stripe/services/invoice_upcoming_lines_service.rb +17 -0
- data/lib/stripe/services/issuing/authorization_service.rb +65 -0
- data/lib/stripe/services/issuing/card_service.rb +52 -0
- data/lib/stripe/services/issuing/cardholder_service.rb +52 -0
- data/lib/stripe/services/issuing/dispute_service.rb +63 -0
- data/lib/stripe/services/issuing/personalization_design_service.rb +52 -0
- data/lib/stripe/services/issuing/physical_bundle_service.rb +30 -0
- data/lib/stripe/services/issuing/token_service.rb +41 -0
- data/lib/stripe/services/issuing/transaction_service.rb +41 -0
- data/lib/stripe/services/issuing_service.rb +20 -0
- data/lib/stripe/services/mandate_service.rb +17 -0
- data/lib/stripe/services/oauth_service.rb +63 -0
- data/lib/stripe/services/payment_intent_service.rb +204 -0
- data/lib/stripe/services/payment_link_line_item_service.rb +17 -0
- data/lib/stripe/services/payment_link_service.rb +57 -0
- data/lib/stripe/services/payment_method_configuration_service.rb +50 -0
- data/lib/stripe/services/payment_method_domain_service.rb +66 -0
- data/lib/stripe/services/payment_method_service.rb +86 -0
- data/lib/stripe/services/payout_service.rb +66 -0
- data/lib/stripe/services/plan_service.rb +49 -0
- data/lib/stripe/services/price_service.rb +52 -0
- data/lib/stripe/services/product_feature_service.rb +50 -0
- data/lib/stripe/services/product_service.rb +70 -0
- data/lib/stripe/services/promotion_code_service.rb +50 -0
- data/lib/stripe/services/quote_computed_upfront_line_items_service.rb +17 -0
- data/lib/stripe/services/quote_line_item_service.rb +17 -0
- data/lib/stripe/services/quote_service.rb +92 -0
- data/lib/stripe/services/radar/early_fraud_warning_service.rb +32 -0
- data/lib/stripe/services/radar/value_list_item_service.rb +52 -0
- data/lib/stripe/services/radar/value_list_service.rb +63 -0
- data/lib/stripe/services/radar_service.rb +15 -0
- data/lib/stripe/services/refund_service.rb +63 -0
- data/lib/stripe/services/reporting/report_run_service.rb +41 -0
- data/lib/stripe/services/reporting/report_type_service.rb +30 -0
- data/lib/stripe/services/reporting_service.rb +14 -0
- data/lib/stripe/services/review_service.rb +33 -0
- data/lib/stripe/services/setup_attempt_service.rb +17 -0
- data/lib/stripe/services/setup_intent_service.rb +105 -0
- data/lib/stripe/services/shipping_rate_service.rb +50 -0
- data/lib/stripe/services/sigma/scheduled_query_run_service.rb +30 -0
- data/lib/stripe/services/sigma_service.rb +13 -0
- data/lib/stripe/services/source_service.rb +64 -0
- data/lib/stripe/services/source_transaction_service.rb +17 -0
- data/lib/stripe/services/subscription_item_service.rb +69 -0
- data/lib/stripe/services/subscription_item_usage_record_service.rb +23 -0
- data/lib/stripe/services/subscription_item_usage_record_summary_service.rb +19 -0
- data/lib/stripe/services/subscription_schedule_service.rb +72 -0
- data/lib/stripe/services/subscription_service.rb +127 -0
- data/lib/stripe/services/tax/calculation_line_item_service.rb +19 -0
- data/lib/stripe/services/tax/calculation_service.rb +37 -0
- data/lib/stripe/services/tax/registration_service.rb +54 -0
- data/lib/stripe/services/tax/settings_service.rb +30 -0
- data/lib/stripe/services/tax/transaction_line_item_service.rb +19 -0
- data/lib/stripe/services/tax/transaction_service.rb +48 -0
- data/lib/stripe/services/tax_code_service.rb +22 -0
- data/lib/stripe/services/tax_id_service.rb +38 -0
- data/lib/stripe/services/tax_rate_service.rb +38 -0
- data/lib/stripe/services/tax_service.rb +16 -0
- data/lib/stripe/services/terminal/configuration_service.rb +63 -0
- data/lib/stripe/services/terminal/connection_token_service.rb +19 -0
- data/lib/stripe/services/terminal/location_service.rb +64 -0
- data/lib/stripe/services/terminal/reader_service.rb +118 -0
- data/lib/stripe/services/terminal_service.rb +16 -0
- data/lib/stripe/services/test_helpers/confirmation_token_service.rb +19 -0
- data/lib/stripe/services/test_helpers/customer_service.rb +19 -0
- data/lib/stripe/services/test_helpers/issuing/authorization_service.rb +76 -0
- data/lib/stripe/services/test_helpers/issuing/card_service.rb +54 -0
- data/lib/stripe/services/test_helpers/issuing/personalization_design_service.rb +43 -0
- data/lib/stripe/services/test_helpers/issuing/transaction_service.rb +43 -0
- data/lib/stripe/services/test_helpers/issuing_service.rb +19 -0
- data/lib/stripe/services/test_helpers/refund_service.rb +19 -0
- data/lib/stripe/services/test_helpers/terminal/reader_service.rb +21 -0
- data/lib/stripe/services/test_helpers/terminal_service.rb +15 -0
- data/lib/stripe/services/test_helpers/test_clock_service.rb +63 -0
- data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +43 -0
- data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +54 -0
- data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +54 -0
- data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +21 -0
- data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +21 -0
- data/lib/stripe/services/test_helpers/treasury_service.rb +19 -0
- data/lib/stripe/services/test_helpers_service.rb +19 -0
- data/lib/stripe/services/token_service.rb +23 -0
- data/lib/stripe/services/topup_service.rb +49 -0
- data/lib/stripe/services/transfer_reversal_service.rb +56 -0
- data/lib/stripe/services/transfer_service.rb +47 -0
- data/lib/stripe/services/treasury/credit_reversal_service.rb +41 -0
- data/lib/stripe/services/treasury/debit_reversal_service.rb +41 -0
- data/lib/stripe/services/treasury/financial_account_features_service.rb +30 -0
- data/lib/stripe/services/treasury/financial_account_service.rb +59 -0
- data/lib/stripe/services/treasury/inbound_transfer_service.rb +52 -0
- data/lib/stripe/services/treasury/outbound_payment_service.rb +52 -0
- data/lib/stripe/services/treasury/outbound_transfer_service.rb +52 -0
- data/lib/stripe/services/treasury/received_credit_service.rb +30 -0
- data/lib/stripe/services/treasury/received_debit_service.rb +30 -0
- data/lib/stripe/services/treasury/transaction_entry_service.rb +30 -0
- data/lib/stripe/services/treasury/transaction_service.rb +30 -0
- data/lib/stripe/services/treasury_service.rb +22 -0
- data/lib/stripe/services/v1_services.rb +89 -0
- data/lib/stripe/services/v2/billing/meter_event_adjustment_service.rb +21 -0
- data/lib/stripe/services/v2/billing/meter_event_service.rb +21 -0
- data/lib/stripe/services/v2/billing/meter_event_session_service.rb +21 -0
- data/lib/stripe/services/v2/billing/meter_event_stream_service.rb +23 -0
- data/lib/stripe/services/v2/billing_service.rb +18 -0
- data/lib/stripe/services/v2/core/event_service.rb +32 -0
- data/lib/stripe/services/v2/core_service.rb +15 -0
- data/lib/stripe/services/v2_services.rb +14 -0
- data/lib/stripe/services/webhook_endpoint_service.rb +61 -0
- data/lib/stripe/services.rb +181 -0
- data/lib/stripe/singleton_api_resource.rb +1 -18
- data/lib/stripe/stripe_client.rb +51 -1067
- data/lib/stripe/stripe_configuration.rb +32 -20
- data/lib/stripe/stripe_object.rb +37 -18
- data/lib/stripe/stripe_service.rb +32 -0
- data/lib/stripe/thin_event.rb +17 -0
- data/lib/stripe/util.rb +69 -46
- data/lib/stripe/v2_list_object.rb +84 -0
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe/webhook.rb +1 -1
- data/lib/stripe.rb +15 -54
- metadata +203 -23
- data/lib/stripe/request_signing_authenticator.rb +0 -79
- data/lib/stripe/resources/account_notice.rb +0 -32
- data/lib/stripe/resources/capital/financing_offer.rb +0 -49
- data/lib/stripe/resources/capital/financing_summary.rb +0 -15
- data/lib/stripe/resources/capital/financing_transaction.rb +0 -27
- data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +0 -14
- data/lib/stripe/resources/financial_connections/institution.rb +0 -26
- data/lib/stripe/resources/gift_cards/card.rb +0 -59
- data/lib/stripe/resources/gift_cards/transaction.rb +0 -93
- data/lib/stripe/resources/invoice_payment.rb +0 -12
- data/lib/stripe/resources/issuing/credit_underwriting_record.rb +0 -88
- data/lib/stripe/resources/issuing/dispute_settlement_detail.rb +0 -26
- data/lib/stripe/resources/margin.rb +0 -37
- data/lib/stripe/resources/order.rb +0 -120
- data/lib/stripe/resources/quote_preview_invoice.rb +0 -43
- data/lib/stripe/resources/quote_preview_subscription_schedule.rb +0 -11
- data/lib/stripe/resources/tax/association.rb +0 -24
- data/lib/stripe/resources/tax/form.rb +0 -49
- data/lib/stripe/resources/terminal/reader_collected_data.rb +0 -14
data/lib/stripe/api_resource.rb
CHANGED
@@ -25,6 +25,12 @@ module Stripe
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.resource_url
|
28
|
+
if name.include?("Stripe::V2")
|
29
|
+
raise NotImplementedError,
|
30
|
+
"V2 resources do not have a defined URL. Please use the StripeClient " \
|
31
|
+
"to make V2 requests"
|
32
|
+
end
|
33
|
+
|
28
34
|
if self == APIResource
|
29
35
|
raise NotImplementedError,
|
30
36
|
"APIResource is an abstract class. You should perform actions " \
|
@@ -87,33 +93,35 @@ module Stripe
|
|
87
93
|
end
|
88
94
|
|
89
95
|
def refresh
|
90
|
-
|
91
|
-
|
92
|
-
|
96
|
+
if self.class.name.include?("Stripe::V2")
|
97
|
+
raise NotImplementedError,
|
98
|
+
"It is not possible to refresh v2 objects. Please retrieve the object using the StripeClient instead."
|
99
|
+
end
|
100
|
+
|
101
|
+
@requestor.execute_request_initialize_from(:get, resource_url, :api, self, params: @retrieve_params)
|
93
102
|
end
|
94
103
|
|
95
104
|
def self.retrieve(id, opts = {})
|
105
|
+
if name.include?("Stripe::V2")
|
106
|
+
raise NotImplementedError,
|
107
|
+
"It is not possible to retrieve v2 objects on the resource. Please use the StripeClient instead."
|
108
|
+
end
|
109
|
+
|
96
110
|
opts = Util.normalize_opts(opts)
|
97
111
|
instance = new(id, opts)
|
98
112
|
instance.refresh
|
99
113
|
instance
|
100
114
|
end
|
101
115
|
|
102
|
-
def request_stripe_object(method:, path:, params:, opts: {})
|
103
|
-
|
104
|
-
|
105
|
-
# If we're getting back this thing, update; otherwise, instantiate.
|
106
|
-
if Util.object_name_matches_class?(resp.data[:object], self.class)
|
107
|
-
initialize_from(resp.data, opts, resp)
|
108
|
-
else
|
109
|
-
Util.convert_to_stripe_object_with_params(resp.data, params, opts, resp)
|
110
|
-
end
|
116
|
+
def request_stripe_object(method:, path:, params:, base_address: :api, opts: {})
|
117
|
+
APIRequestor.active_requestor.execute_request_initialize_from(method, path, base_address, self,
|
118
|
+
params: params, opts: opts)
|
111
119
|
end
|
112
120
|
|
113
|
-
protected def request_stream(method:, path:, params:, opts: {},
|
121
|
+
protected def request_stream(method:, path:, params:, base_address: :api, opts: {},
|
114
122
|
&read_body_chunk_block)
|
115
123
|
resp, = execute_resource_request_stream(
|
116
|
-
method, path, params, opts, &read_body_chunk_block
|
124
|
+
method, path, base_address, params, opts, &read_body_chunk_block
|
117
125
|
)
|
118
126
|
resp
|
119
127
|
end
|
data/lib/stripe/api_version.rb
CHANGED
@@ -12,7 +12,7 @@ module Stripe
|
|
12
12
|
class ConnectionManager
|
13
13
|
# Timestamp (in seconds procured from the system's monotonic clock)
|
14
14
|
# indicating when the connection manager last made a request. This is used
|
15
|
-
# by `
|
15
|
+
# by `APIRequestor` to determine whether a connection manager should be
|
16
16
|
# garbage collected or not.
|
17
17
|
attr_reader :last_used
|
18
18
|
attr_reader :config
|
data/lib/stripe/errors.rb
CHANGED
@@ -27,7 +27,8 @@ module Stripe
|
|
27
27
|
def construct_error_object
|
28
28
|
return nil if @json_body.nil? || !@json_body.key?(:error)
|
29
29
|
|
30
|
-
ErrorObject
|
30
|
+
# ErrorObject is shared between v1 and v2, so use original object_classes to find
|
31
|
+
ErrorObject.construct_from(@json_body[:error], {}, nil, :v1)
|
31
32
|
end
|
32
33
|
|
33
34
|
# Whether the error was the result of an idempotent replay, meaning that it
|
@@ -130,7 +131,7 @@ module Stripe
|
|
130
131
|
def construct_error_object
|
131
132
|
return nil if @json_body.nil?
|
132
133
|
|
133
|
-
OAuthErrorObject.construct_from(@json_body)
|
134
|
+
OAuthErrorObject.construct_from(@json_body, {}, nil, :v1)
|
134
135
|
end
|
135
136
|
end
|
136
137
|
|
@@ -166,4 +167,9 @@ module Stripe
|
|
166
167
|
class UnsupportedResponseTypeError < OAuthError
|
167
168
|
end
|
168
169
|
end
|
170
|
+
|
171
|
+
# class definitions: The beginning of the section generated from our OpenAPI spec
|
172
|
+
class TemporarySessionExpiredError < StripeError
|
173
|
+
end
|
174
|
+
# class definitions: The end of the section generated from our OpenAPI spec
|
169
175
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
module EventTypes
|
5
|
+
def self.thin_event_names_to_classes
|
6
|
+
{
|
7
|
+
# The beginning of the section generated from our OpenAPI spec
|
8
|
+
V1BillingMeterErrorReportTriggeredEvent.lookup_type => V1BillingMeterErrorReportTriggeredEvent,
|
9
|
+
V1BillingMeterNoMeterFoundEvent.lookup_type => V1BillingMeterNoMeterFoundEvent,
|
10
|
+
# The end of the section generated from our OpenAPI spec
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
# This event occurs when there are invalid async usage events for a given meter.
|
6
|
+
class V1BillingMeterErrorReportTriggeredEvent < Stripe::V2::Event
|
7
|
+
def self.lookup_type
|
8
|
+
"v1.billing.meter.error_report_triggered"
|
9
|
+
end
|
10
|
+
# There is additional data present for this event, accessible with the `data` property.
|
11
|
+
# See the Stripe API docs for more information.
|
12
|
+
|
13
|
+
# Retrieves the related object from the API. Make an API request on every call.
|
14
|
+
def fetch_related_object
|
15
|
+
_request(
|
16
|
+
method: :get,
|
17
|
+
path: related_object.url,
|
18
|
+
base_address: :api,
|
19
|
+
opts: { stripe_account: context }
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
# This event occurs when async usage events have missing or invalid meter ids.
|
6
|
+
class V1BillingMeterNoMeterFoundEvent < Stripe::V2::Event
|
7
|
+
def self.lookup_type
|
8
|
+
"v1.billing.meter.no_meter_found"
|
9
|
+
end
|
10
|
+
# There is additional data present for this event, accessible with the `data` property.
|
11
|
+
# See the Stripe API docs for more information.
|
12
|
+
end
|
13
|
+
end
|
data/lib/stripe/list_object.rb
CHANGED
@@ -21,7 +21,7 @@ module Stripe
|
|
21
21
|
# there isn't a next page in order to replicate the behavior of the API
|
22
22
|
# when it attempts to return a page beyond the last.
|
23
23
|
def self.empty_list(opts = {})
|
24
|
-
ListObject.construct_from({ data: [] }, opts)
|
24
|
+
ListObject.construct_from({ data: [] }, opts, nil, :v1)
|
25
25
|
end
|
26
26
|
|
27
27
|
def initialize(*args)
|
@@ -96,8 +96,7 @@ module Stripe
|
|
96
96
|
def retrieve(id, opts = {})
|
97
97
|
id, retrieve_params = Util.normalize_id(id)
|
98
98
|
url = "#{resource_url}/#{CGI.escape(id)}"
|
99
|
-
|
100
|
-
Util.convert_to_stripe_object(resp.data, opts)
|
99
|
+
execute_resource_request(:get, url, :api, retrieve_params, opts)
|
101
100
|
end
|
102
101
|
|
103
102
|
# Fetches the next page in the resource list (if there is one).
|
data/lib/stripe/oauth.rb
CHANGED
@@ -5,12 +5,10 @@ module Stripe
|
|
5
5
|
module OAuthOperations
|
6
6
|
extend APIOperations::Request::ClassMethods
|
7
7
|
|
8
|
-
def self.execute_resource_request(method, url, params, opts)
|
8
|
+
def self.execute_resource_request(method, url, base_address, params, opts)
|
9
9
|
opts = Util.normalize_opts(opts)
|
10
|
-
opts[:client] ||= opts[:client] || StripeClient.active_client
|
11
|
-
opts[:api_base] ||= opts[:client].config.connect_base
|
12
10
|
|
13
|
-
super(method, url, params, opts)
|
11
|
+
super(method, url, base_address, params, opts)
|
14
12
|
end
|
15
13
|
end
|
16
14
|
|
@@ -29,15 +27,14 @@ module Stripe
|
|
29
27
|
end
|
30
28
|
|
31
29
|
def self.authorize_url(params = {}, opts = {})
|
32
|
-
|
33
|
-
base = opts[:connect_base] || client.config.connect_base
|
30
|
+
base = opts[:connect_base] || APIRequestor.active_requestor.config.connect_base
|
34
31
|
|
35
32
|
path = "/oauth/authorize"
|
36
33
|
path = "/express" + path if opts[:express]
|
37
34
|
|
38
35
|
params[:client_id] = get_client_id(params)
|
39
36
|
params[:response_type] ||= "code"
|
40
|
-
query = Util.encode_parameters(params)
|
37
|
+
query = Util.encode_parameters(params, :v1)
|
41
38
|
|
42
39
|
"#{base}#{path}?#{query}"
|
43
40
|
end
|
@@ -45,21 +42,17 @@ module Stripe
|
|
45
42
|
def self.token(params = {}, opts = {})
|
46
43
|
opts = Util.normalize_opts(opts)
|
47
44
|
opts[:api_key] = params[:client_secret] if params[:client_secret]
|
48
|
-
|
49
|
-
:post, "/oauth/token", params, opts
|
45
|
+
OAuthOperations.execute_resource_request(
|
46
|
+
:post, "/oauth/token", :connect, params, opts
|
50
47
|
)
|
51
|
-
# This is just going to return a generic StripeObject, but that's okay
|
52
|
-
Util.convert_to_stripe_object(resp.data, opts)
|
53
48
|
end
|
54
49
|
|
55
50
|
def self.deauthorize(params = {}, opts = {})
|
56
51
|
opts = Util.normalize_opts(opts)
|
57
52
|
params[:client_id] = get_client_id(params)
|
58
|
-
|
59
|
-
:post, "/oauth/deauthorize", params, opts
|
53
|
+
OAuthOperations.execute_resource_request(
|
54
|
+
:post, "/oauth/deauthorize", :connect, params, opts
|
60
55
|
)
|
61
|
-
# This is just going to return a generic StripeObject, but that's okay
|
62
|
-
Util.convert_to_stripe_object(resp.data, opts)
|
63
56
|
end
|
64
57
|
end
|
65
58
|
end
|
data/lib/stripe/object_types.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# rubocop:disable Metrics/MethodLength
|
4
|
-
# rubocop:disable Metrics/AbcSize
|
5
4
|
|
6
5
|
module Stripe
|
7
6
|
module ObjectTypes
|
@@ -15,7 +14,6 @@ module Stripe
|
|
15
14
|
# object classes: The beginning of the section generated from our OpenAPI spec
|
16
15
|
Account.object_name => Account,
|
17
16
|
AccountLink.object_name => AccountLink,
|
18
|
-
AccountNotice.object_name => AccountNotice,
|
19
17
|
AccountSession.object_name => AccountSession,
|
20
18
|
ApplePayDomain.object_name => ApplePayDomain,
|
21
19
|
ApplicationFee.object_name => ApplicationFee,
|
@@ -25,6 +23,9 @@ module Stripe
|
|
25
23
|
BalanceTransaction.object_name => BalanceTransaction,
|
26
24
|
BankAccount.object_name => BankAccount,
|
27
25
|
Billing::Alert.object_name => Billing::Alert,
|
26
|
+
Billing::CreditBalanceSummary.object_name => Billing::CreditBalanceSummary,
|
27
|
+
Billing::CreditBalanceTransaction.object_name => Billing::CreditBalanceTransaction,
|
28
|
+
Billing::CreditGrant.object_name => Billing::CreditGrant,
|
28
29
|
Billing::Meter.object_name => Billing::Meter,
|
29
30
|
Billing::MeterEvent.object_name => Billing::MeterEvent,
|
30
31
|
Billing::MeterEventAdjustment.object_name => Billing::MeterEventAdjustment,
|
@@ -32,9 +33,6 @@ module Stripe
|
|
32
33
|
BillingPortal::Configuration.object_name => BillingPortal::Configuration,
|
33
34
|
BillingPortal::Session.object_name => BillingPortal::Session,
|
34
35
|
Capability.object_name => Capability,
|
35
|
-
Capital::FinancingOffer.object_name => Capital::FinancingOffer,
|
36
|
-
Capital::FinancingSummary.object_name => Capital::FinancingSummary,
|
37
|
-
Capital::FinancingTransaction.object_name => Capital::FinancingTransaction,
|
38
36
|
Card.object_name => Card,
|
39
37
|
CashBalance.object_name => CashBalance,
|
40
38
|
Charge.object_name => Charge,
|
@@ -61,30 +59,22 @@ module Stripe
|
|
61
59
|
File.object_name => File,
|
62
60
|
FileLink.object_name => FileLink,
|
63
61
|
FinancialConnections::Account.object_name => FinancialConnections::Account,
|
64
|
-
FinancialConnections::AccountInferredBalance.object_name =>
|
65
|
-
FinancialConnections::AccountInferredBalance,
|
66
62
|
FinancialConnections::AccountOwner.object_name => FinancialConnections::AccountOwner,
|
67
63
|
FinancialConnections::AccountOwnership.object_name => FinancialConnections::AccountOwnership,
|
68
|
-
FinancialConnections::Institution.object_name => FinancialConnections::Institution,
|
69
64
|
FinancialConnections::Session.object_name => FinancialConnections::Session,
|
70
65
|
FinancialConnections::Transaction.object_name => FinancialConnections::Transaction,
|
71
66
|
Forwarding::Request.object_name => Forwarding::Request,
|
72
67
|
FundingInstructions.object_name => FundingInstructions,
|
73
|
-
GiftCards::Card.object_name => GiftCards::Card,
|
74
|
-
GiftCards::Transaction.object_name => GiftCards::Transaction,
|
75
68
|
Identity::VerificationReport.object_name => Identity::VerificationReport,
|
76
69
|
Identity::VerificationSession.object_name => Identity::VerificationSession,
|
77
70
|
Invoice.object_name => Invoice,
|
78
71
|
InvoiceItem.object_name => InvoiceItem,
|
79
72
|
InvoiceLineItem.object_name => InvoiceLineItem,
|
80
|
-
InvoicePayment.object_name => InvoicePayment,
|
81
73
|
InvoiceRenderingTemplate.object_name => InvoiceRenderingTemplate,
|
82
74
|
Issuing::Authorization.object_name => Issuing::Authorization,
|
83
75
|
Issuing::Card.object_name => Issuing::Card,
|
84
76
|
Issuing::Cardholder.object_name => Issuing::Cardholder,
|
85
|
-
Issuing::CreditUnderwritingRecord.object_name => Issuing::CreditUnderwritingRecord,
|
86
77
|
Issuing::Dispute.object_name => Issuing::Dispute,
|
87
|
-
Issuing::DisputeSettlementDetail.object_name => Issuing::DisputeSettlementDetail,
|
88
78
|
Issuing::PersonalizationDesign.object_name => Issuing::PersonalizationDesign,
|
89
79
|
Issuing::PhysicalBundle.object_name => Issuing::PhysicalBundle,
|
90
80
|
Issuing::Token.object_name => Issuing::Token,
|
@@ -92,8 +82,6 @@ module Stripe
|
|
92
82
|
LineItem.object_name => LineItem,
|
93
83
|
LoginLink.object_name => LoginLink,
|
94
84
|
Mandate.object_name => Mandate,
|
95
|
-
Margin.object_name => Margin,
|
96
|
-
Order.object_name => Order,
|
97
85
|
PaymentIntent.object_name => PaymentIntent,
|
98
86
|
PaymentLink.object_name => PaymentLink,
|
99
87
|
PaymentMethod.object_name => PaymentMethod,
|
@@ -107,8 +95,6 @@ module Stripe
|
|
107
95
|
ProductFeature.object_name => ProductFeature,
|
108
96
|
PromotionCode.object_name => PromotionCode,
|
109
97
|
Quote.object_name => Quote,
|
110
|
-
QuotePreviewInvoice.object_name => QuotePreviewInvoice,
|
111
|
-
QuotePreviewSubscriptionSchedule.object_name => QuotePreviewSubscriptionSchedule,
|
112
98
|
Radar::EarlyFraudWarning.object_name => Radar::EarlyFraudWarning,
|
113
99
|
Radar::ValueList.object_name => Radar::ValueList,
|
114
100
|
Radar::ValueListItem.object_name => Radar::ValueListItem,
|
@@ -126,10 +112,8 @@ module Stripe
|
|
126
112
|
Subscription.object_name => Subscription,
|
127
113
|
SubscriptionItem.object_name => SubscriptionItem,
|
128
114
|
SubscriptionSchedule.object_name => SubscriptionSchedule,
|
129
|
-
Tax::Association.object_name => Tax::Association,
|
130
115
|
Tax::Calculation.object_name => Tax::Calculation,
|
131
116
|
Tax::CalculationLineItem.object_name => Tax::CalculationLineItem,
|
132
|
-
Tax::Form.object_name => Tax::Form,
|
133
117
|
Tax::Registration.object_name => Tax::Registration,
|
134
118
|
Tax::Settings.object_name => Tax::Settings,
|
135
119
|
Tax::Transaction.object_name => Tax::Transaction,
|
@@ -141,7 +125,6 @@ module Stripe
|
|
141
125
|
Terminal::ConnectionToken.object_name => Terminal::ConnectionToken,
|
142
126
|
Terminal::Location.object_name => Terminal::Location,
|
143
127
|
Terminal::Reader.object_name => Terminal::Reader,
|
144
|
-
Terminal::ReaderCollectedData.object_name => Terminal::ReaderCollectedData,
|
145
128
|
TestHelpers::TestClock.object_name => TestHelpers::TestClock,
|
146
129
|
Token.object_name => Token,
|
147
130
|
Topup.object_name => Topup,
|
@@ -163,6 +146,19 @@ module Stripe
|
|
163
146
|
# object classes: The end of the section generated from our OpenAPI spec
|
164
147
|
}
|
165
148
|
end
|
149
|
+
|
150
|
+
def self.v2_object_names_to_classes
|
151
|
+
{
|
152
|
+
V2::ListObject.object_name => V2::ListObject,
|
153
|
+
|
154
|
+
# v2 object classes: The beginning of the section generated from our OpenAPI spec
|
155
|
+
V2::Billing::MeterEvent.object_name => V2::Billing::MeterEvent,
|
156
|
+
V2::Billing::MeterEventAdjustment.object_name => V2::Billing::MeterEventAdjustment,
|
157
|
+
V2::Billing::MeterEventSession.object_name => V2::Billing::MeterEventSession,
|
158
|
+
V2::Event.object_name => V2::Event,
|
159
|
+
# v2 object classes: The end of the section generated from our OpenAPI spec
|
160
|
+
}
|
161
|
+
end
|
166
162
|
end
|
167
163
|
end
|
168
164
|
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# typed: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
# RequestOptions is a class that encapsulates configurable options
|
6
|
+
# for requests made to the Stripe API. It is used by the APIRequestor
|
7
|
+
# to set per-request options.
|
8
|
+
#
|
9
|
+
# For internal use only. Does not provide a stable API and may be broken
|
10
|
+
# with future non-major changes.
|
11
|
+
module RequestOptions
|
12
|
+
# Options that a user is allowed to specify.
|
13
|
+
OPTS_USER_SPECIFIED = Set[
|
14
|
+
:api_key,
|
15
|
+
:idempotency_key,
|
16
|
+
:stripe_account,
|
17
|
+
:stripe_context,
|
18
|
+
:stripe_version
|
19
|
+
].freeze
|
20
|
+
|
21
|
+
# Options that should be copyable from one StripeObject to another
|
22
|
+
# including options that may be internal.
|
23
|
+
OPTS_COPYABLE = (
|
24
|
+
OPTS_USER_SPECIFIED + Set[:api_base]
|
25
|
+
).freeze
|
26
|
+
|
27
|
+
# Options that should be persisted between API requests.
|
28
|
+
OPTS_PERSISTABLE = (
|
29
|
+
OPTS_USER_SPECIFIED - Set[:idempotency_key, :stripe_context]
|
30
|
+
).freeze
|
31
|
+
|
32
|
+
# Merges requestor options on a StripeConfiguration object
|
33
|
+
# with a per-request options hash, giving precedence
|
34
|
+
# to the per-request options. Expects StripeConfiguration and hash.
|
35
|
+
def self.merge_config_and_opts(config, req_opts)
|
36
|
+
# Raise an error if config is not a StripeConfiguration object
|
37
|
+
unless config.is_a?(StripeConfiguration)
|
38
|
+
raise ArgumentError, "config must be a Stripe::StripeConfiguration object"
|
39
|
+
end
|
40
|
+
|
41
|
+
merged_opts = {
|
42
|
+
api_key: req_opts[:api_key] || config.api_key,
|
43
|
+
idempotency_key: req_opts[:idempotency_key],
|
44
|
+
stripe_account: req_opts[:stripe_account] || config.stripe_account,
|
45
|
+
stripe_context: req_opts[:stripe_context] || config.stripe_context,
|
46
|
+
stripe_version: req_opts[:stripe_version] || config.api_version,
|
47
|
+
headers: req_opts[:headers] || {},
|
48
|
+
}
|
49
|
+
|
50
|
+
# Remove nil values from headers
|
51
|
+
merged_opts.delete_if { |_, v| v.nil? }
|
52
|
+
|
53
|
+
merged_opts
|
54
|
+
end
|
55
|
+
|
56
|
+
# Merges requestor options hash on a StripeObject
|
57
|
+
# with a per-request options hash, giving precedence
|
58
|
+
# to the per-request options. Returns the merged request options.
|
59
|
+
# Expects two hashes.
|
60
|
+
def self.combine_opts(object_opts, req_opts)
|
61
|
+
merged_opts = {
|
62
|
+
api_key: req_opts[:api_key] || object_opts[:api_key],
|
63
|
+
idempotency_key: req_opts[:idempotency_key],
|
64
|
+
stripe_account: req_opts[:stripe_account] || object_opts[:stripe_account],
|
65
|
+
stripe_context: req_opts[:stripe_context] || object_opts[:stripe_context],
|
66
|
+
stripe_version: req_opts[:stripe_version] || object_opts[:api_version],
|
67
|
+
}
|
68
|
+
|
69
|
+
# Remove nil values from headers
|
70
|
+
merged_opts.delete_if { |_, v| v.nil? }
|
71
|
+
|
72
|
+
merged_opts
|
73
|
+
end
|
74
|
+
|
75
|
+
# Extracts options from a user-provided hash, returning a new request options hash
|
76
|
+
# containing the recognized request options and a `headers` entry for the remaining options.
|
77
|
+
def self.extract_opts_from_hash(opts)
|
78
|
+
req_opts = {}
|
79
|
+
normalized_opts = Util.normalize_opts(opts.clone)
|
80
|
+
|
81
|
+
RequestOptions.error_on_non_string_user_opts(normalized_opts)
|
82
|
+
|
83
|
+
OPTS_USER_SPECIFIED.each do |opt|
|
84
|
+
req_opts[opt] = normalized_opts[opt] if normalized_opts.key?(opt)
|
85
|
+
normalized_opts.delete(opt)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Remaining user-provided opts should be treated as headers
|
89
|
+
req_opts[:headers] = Util.normalize_headers(normalized_opts) if normalized_opts.any?
|
90
|
+
|
91
|
+
req_opts
|
92
|
+
end
|
93
|
+
|
94
|
+
# Validates a normalized opts hash.
|
95
|
+
def self.error_on_non_string_user_opts(normalized_opts)
|
96
|
+
OPTS_USER_SPECIFIED.each do |opt|
|
97
|
+
next unless normalized_opts.key?(opt)
|
98
|
+
|
99
|
+
val = normalized_opts[opt]
|
100
|
+
next if val.nil?
|
101
|
+
next if val.is_a?(String)
|
102
|
+
|
103
|
+
raise ArgumentError,
|
104
|
+
"request option '#{opt}' should be a string value " \
|
105
|
+
"(was a #{val.class})"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Get options that persist between requests
|
110
|
+
def self.persistable(req_opts)
|
111
|
+
opts_to_persist = {}
|
112
|
+
|
113
|
+
# Hash#select returns an array before 1.9
|
114
|
+
req_opts.each do |k, v|
|
115
|
+
opts_to_persist[k] = v if RequestOptions::OPTS_PERSISTABLE.include?(k)
|
116
|
+
end
|
117
|
+
|
118
|
+
opts_to_persist
|
119
|
+
end
|
120
|
+
|
121
|
+
# Get options that are copyable from StripeObject to StripeObject
|
122
|
+
def self.copyable(req_opts)
|
123
|
+
req_opts.select do |k, _v|
|
124
|
+
RequestOptions::OPTS_COPYABLE.include?(k)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module Billing
|
6
|
+
# Indicates the credit balance for credits granted to a customer.
|
7
|
+
class CreditBalanceSummary < SingletonAPIResource
|
8
|
+
OBJECT_NAME = "billing.credit_balance_summary"
|
9
|
+
def self.object_name
|
10
|
+
"billing.credit_balance_summary"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module Billing
|
6
|
+
# A credit balance transaction is a resource representing a transaction (either a credit or a debit) against an existing credit grant.
|
7
|
+
class CreditBalanceTransaction < APIResource
|
8
|
+
extend Stripe::APIOperations::List
|
9
|
+
|
10
|
+
OBJECT_NAME = "billing.credit_balance_transaction"
|
11
|
+
def self.object_name
|
12
|
+
"billing.credit_balance_transaction"
|
13
|
+
end
|
14
|
+
|
15
|
+
# Retrieve a list of credit balance transactions
|
16
|
+
def self.list(filters = {}, opts = {})
|
17
|
+
request_stripe_object(
|
18
|
+
method: :get,
|
19
|
+
path: "/v1/billing/credit_balance_transactions",
|
20
|
+
params: filters,
|
21
|
+
opts: opts
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module Billing
|
6
|
+
# A credit grant is a resource that records a grant of some credit to a customer.
|
7
|
+
class CreditGrant < APIResource
|
8
|
+
extend Stripe::APIOperations::Create
|
9
|
+
extend Stripe::APIOperations::List
|
10
|
+
include Stripe::APIOperations::Save
|
11
|
+
|
12
|
+
OBJECT_NAME = "billing.credit_grant"
|
13
|
+
def self.object_name
|
14
|
+
"billing.credit_grant"
|
15
|
+
end
|
16
|
+
|
17
|
+
# Creates a credit grant
|
18
|
+
def self.create(params = {}, opts = {})
|
19
|
+
request_stripe_object(
|
20
|
+
method: :post,
|
21
|
+
path: "/v1/billing/credit_grants",
|
22
|
+
params: params,
|
23
|
+
opts: opts
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Expires a credit grant
|
28
|
+
def expire(params = {}, opts = {})
|
29
|
+
request_stripe_object(
|
30
|
+
method: :post,
|
31
|
+
path: format("/v1/billing/credit_grants/%<id>s/expire", { id: CGI.escape(self["id"]) }),
|
32
|
+
params: params,
|
33
|
+
opts: opts
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Expires a credit grant
|
38
|
+
def self.expire(id, params = {}, opts = {})
|
39
|
+
request_stripe_object(
|
40
|
+
method: :post,
|
41
|
+
path: format("/v1/billing/credit_grants/%<id>s/expire", { id: CGI.escape(id) }),
|
42
|
+
params: params,
|
43
|
+
opts: opts
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Retrieve a list of credit grants
|
48
|
+
def self.list(filters = {}, opts = {})
|
49
|
+
request_stripe_object(
|
50
|
+
method: :get,
|
51
|
+
path: "/v1/billing/credit_grants",
|
52
|
+
params: filters,
|
53
|
+
opts: opts
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Updates a credit grant
|
58
|
+
def self.update(id, params = {}, opts = {})
|
59
|
+
request_stripe_object(
|
60
|
+
method: :post,
|
61
|
+
path: format("/v1/billing/credit_grants/%<id>s", { id: CGI.escape(id) }),
|
62
|
+
params: params,
|
63
|
+
opts: opts
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Voids a credit grant
|
68
|
+
def void_grant(params = {}, opts = {})
|
69
|
+
request_stripe_object(
|
70
|
+
method: :post,
|
71
|
+
path: format("/v1/billing/credit_grants/%<id>s/void", { id: CGI.escape(self["id"]) }),
|
72
|
+
params: params,
|
73
|
+
opts: opts
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
# Voids a credit grant
|
78
|
+
def self.void_grant(id, params = {}, opts = {})
|
79
|
+
request_stripe_object(
|
80
|
+
method: :post,
|
81
|
+
path: format("/v1/billing/credit_grants/%<id>s/void", { id: CGI.escape(id) }),
|
82
|
+
params: params,
|
83
|
+
opts: opts
|
84
|
+
)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -2,9 +2,8 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
-
# This object represents a customer of your business. Use it to create recurring charges
|
6
|
-
#
|
7
|
-
# Related guide: [Save a card during payment](https://stripe.com/docs/payments/save-during-payment)
|
5
|
+
# This object represents a customer of your business. Use it to [create recurring charges](https://stripe.com/docs/invoicing/customer), [save payment](https://stripe.com/docs/payments/save-during-payment) and contact information,
|
6
|
+
# and track payments that belong to the same customer.
|
8
7
|
class Customer < APIResource
|
9
8
|
extend Stripe::APIOperations::Create
|
10
9
|
include Stripe::APIOperations::Delete
|
@@ -22,17 +22,19 @@ module Stripe
|
|
22
22
|
#
|
23
23
|
# All of Stripe's officially supported Client libraries support sending multipart/form-data.
|
24
24
|
def self.create(params = {}, opts = {})
|
25
|
-
config = opts[:client]&.config || Stripe.config
|
26
|
-
upload_base = config.uploads_base
|
27
|
-
opts = { api_base: upload_base }.merge(Util.normalize_opts(opts))
|
28
|
-
|
29
25
|
if params[:file] && !params[:file].is_a?(String) && !params[:file].respond_to?(:read)
|
30
26
|
raise ArgumentError, "file must respond to `#read`"
|
31
27
|
end
|
32
28
|
|
33
29
|
opts = { content_type: MultipartEncoder::MULTIPART_FORM_DATA }.merge(Util.normalize_opts(opts))
|
34
30
|
|
35
|
-
request_stripe_object(
|
31
|
+
request_stripe_object(
|
32
|
+
method: :post,
|
33
|
+
path: "/v1/files",
|
34
|
+
params: params,
|
35
|
+
opts: opts,
|
36
|
+
base_address: :files
|
37
|
+
)
|
36
38
|
end
|
37
39
|
|
38
40
|
# Returns a list of the files that your account has access to. Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top.
|