stripe 5.39.0 → 10.1.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 +304 -0
- data/Gemfile +5 -2
- data/Makefile +13 -0
- data/OPENAPI_VERSION +1 -0
- data/README.md +40 -6
- data/VERSION +1 -1
- data/lib/data/ca-certificates.crt +1241 -1937
- data/lib/stripe/api_operations/create.rb +6 -2
- data/lib/stripe/api_operations/delete.rb +12 -7
- data/lib/stripe/api_operations/list.rb +6 -9
- data/lib/stripe/api_operations/nested_resource.rb +62 -34
- data/lib/stripe/api_operations/request.rb +10 -0
- data/lib/stripe/api_operations/save.rb +13 -3
- data/lib/stripe/api_operations/search.rb +16 -0
- data/lib/stripe/api_resource.rb +3 -18
- data/lib/stripe/api_resource_test_helpers.rb +49 -0
- data/lib/stripe/api_version.rb +8 -0
- data/lib/stripe/connection_manager.rb +22 -1
- data/lib/stripe/instrumentation.rb +45 -7
- data/lib/stripe/object_types.rb +35 -10
- data/lib/stripe/resources/account.rb +37 -11
- data/lib/stripe/resources/account_link.rb +4 -0
- data/lib/stripe/resources/account_session.rb +17 -0
- data/lib/stripe/resources/application_fee.rb +1 -2
- data/lib/stripe/resources/application_fee_refund.rb +5 -0
- data/lib/stripe/resources/apps/secret.rb +40 -0
- data/lib/stripe/resources/balance.rb +11 -0
- data/lib/stripe/resources/balance_transaction.rb +4 -0
- data/lib/stripe/resources/bank_account.rb +7 -0
- data/lib/stripe/resources/billing_portal/configuration.rb +1 -0
- data/lib/stripe/resources/billing_portal/session.rb +14 -0
- data/lib/stripe/resources/capability.rb +3 -0
- data/lib/stripe/resources/card.rb +6 -3
- data/lib/stripe/resources/cash_balance.rb +23 -0
- data/lib/stripe/resources/charge.rb +23 -3
- data/lib/stripe/resources/checkout/session.rb +49 -2
- data/lib/stripe/resources/country_spec.rb +6 -0
- data/lib/stripe/resources/coupon.rb +3 -0
- data/lib/stripe/resources/credit_note.rb +27 -9
- data/lib/stripe/resources/credit_note_line_item.rb +1 -0
- data/lib/stripe/resources/customer.rb +119 -15
- data/lib/stripe/resources/customer_balance_transaction.rb +6 -0
- data/lib/stripe/resources/customer_cash_balance_transaction.rb +14 -0
- data/lib/stripe/resources/discount.rb +5 -0
- data/lib/stripe/resources/dispute.rb +15 -3
- data/lib/stripe/resources/event.rb +30 -0
- data/lib/stripe/resources/exchange_rate.rb +26 -0
- data/lib/stripe/resources/file.rb +7 -0
- data/lib/stripe/resources/file_link.rb +3 -0
- data/lib/stripe/resources/financial_connections/account.rb +67 -0
- data/lib/stripe/resources/financial_connections/account_owner.rb +11 -0
- data/lib/stripe/resources/financial_connections/account_ownership.rb +11 -0
- data/lib/stripe/resources/financial_connections/session.rb +13 -0
- data/lib/stripe/resources/funding_instructions.rb +21 -0
- data/lib/stripe/resources/identity/verification_report.rb +11 -0
- data/lib/stripe/resources/identity/verification_session.rb +31 -5
- data/lib/stripe/resources/invoice.rb +100 -17
- data/lib/stripe/resources/invoice_item.rb +11 -0
- data/lib/stripe/resources/issuing/authorization.rb +114 -5
- data/lib/stripe/resources/issuing/card.rb +78 -8
- data/lib/stripe/resources/issuing/cardholder.rb +3 -0
- data/lib/stripe/resources/issuing/dispute.rb +13 -3
- data/lib/stripe/resources/issuing/token.rb +14 -0
- data/lib/stripe/resources/issuing/transaction.rb +49 -0
- data/lib/stripe/resources/line_item.rb +1 -0
- data/lib/stripe/resources/login_link.rb +1 -0
- data/lib/stripe/resources/mandate.rb +1 -0
- data/lib/stripe/resources/payment_intent.rb +103 -6
- data/lib/stripe/resources/payment_link.rb +35 -0
- data/lib/stripe/resources/payment_method.rb +25 -5
- data/lib/stripe/resources/payment_method_configuration.rb +26 -0
- data/lib/stripe/resources/payment_method_domain.rb +34 -0
- data/lib/stripe/resources/payout.rb +28 -5
- data/lib/stripe/resources/person.rb +6 -0
- data/lib/stripe/resources/plan.rb +8 -0
- data/lib/stripe/resources/price.rb +15 -0
- data/lib/stripe/resources/product.rb +17 -0
- data/lib/stripe/resources/promotion_code.rb +2 -0
- data/lib/stripe/resources/quote.rb +58 -35
- data/lib/stripe/resources/radar/early_fraud_warning.rb +4 -0
- data/lib/stripe/resources/radar/value_list.rb +3 -0
- data/lib/stripe/resources/radar/value_list_item.rb +3 -0
- data/lib/stripe/resources/refund.rb +49 -0
- data/lib/stripe/resources/reporting/report_run.rb +8 -0
- data/lib/stripe/resources/reporting/report_type.rb +8 -1
- data/lib/stripe/resources/reversal.rb +13 -0
- data/lib/stripe/resources/review.rb +14 -3
- data/lib/stripe/resources/setup_attempt.rb +4 -0
- data/lib/stripe/resources/setup_intent.rb +59 -5
- data/lib/stripe/resources/shipping_rate.rb +14 -0
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +4 -0
- data/lib/stripe/resources/source.rb +27 -8
- data/lib/stripe/resources/source_transaction.rb +5 -0
- data/lib/stripe/resources/subscription.rb +57 -3
- data/lib/stripe/resources/subscription_item.rb +2 -7
- data/lib/stripe/resources/subscription_schedule.rb +23 -5
- data/lib/stripe/resources/tax/calculation.rb +33 -0
- data/lib/stripe/resources/tax/calculation_line_item.rb +10 -0
- data/lib/stripe/resources/tax/registration.rb +19 -0
- data/lib/stripe/resources/tax/settings.rb +15 -0
- data/lib/stripe/resources/tax/transaction.rb +49 -0
- data/lib/stripe/resources/tax/transaction_line_item.rb +10 -0
- data/lib/stripe/resources/tax_code.rb +1 -0
- data/lib/stripe/resources/tax_id.rb +4 -0
- data/lib/stripe/resources/tax_rate.rb +3 -0
- data/lib/stripe/resources/terminal/configuration.rb +16 -0
- data/lib/stripe/resources/terminal/connection_token.rb +3 -0
- data/lib/stripe/resources/terminal/location.rb +3 -0
- data/lib/stripe/resources/terminal/reader.rb +119 -0
- data/lib/stripe/resources/test_helpers/test_clock.rb +35 -0
- data/lib/stripe/resources/token.rb +20 -0
- data/lib/stripe/resources/topup.rb +15 -3
- data/lib/stripe/resources/transfer.rb +11 -13
- data/lib/stripe/resources/treasury/credit_reversal.rb +14 -0
- data/lib/stripe/resources/treasury/debit_reversal.rb +14 -0
- data/lib/stripe/resources/treasury/financial_account.rb +52 -0
- data/lib/stripe/resources/treasury/financial_account_features.rb +12 -0
- data/lib/stripe/resources/treasury/inbound_transfer.rb +94 -0
- data/lib/stripe/resources/treasury/outbound_payment.rb +96 -0
- data/lib/stripe/resources/treasury/outbound_transfer.rb +96 -0
- data/lib/stripe/resources/treasury/received_credit.rb +30 -0
- data/lib/stripe/resources/treasury/received_debit.rb +30 -0
- data/lib/stripe/resources/treasury/transaction.rb +13 -0
- data/lib/stripe/resources/treasury/transaction_entry.rb +17 -0
- data/lib/stripe/resources/usage_record.rb +4 -0
- data/lib/stripe/resources/webhook_endpoint.rb +7 -0
- data/lib/stripe/resources.rb +33 -10
- data/lib/stripe/search_result_object.rb +86 -0
- data/lib/stripe/stripe_client.rb +37 -22
- data/lib/stripe/stripe_configuration.rb +5 -1
- data/lib/stripe/stripe_object.rb +2 -2
- data/lib/stripe/util.rb +85 -2
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe/webhook.rb +2 -1
- data/lib/stripe.rb +5 -1
- data/stripe.gemspec +3 -3
- metadata +45 -14
- data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
- data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
- data/lib/stripe/resources/issuing/card_details.rb +0 -9
- data/lib/stripe/resources/order.rb +0 -33
- data/lib/stripe/resources/order_return.rb +0 -10
- data/lib/stripe/resources/recipient.rb +0 -14
- data/lib/stripe/resources/sku.rb +0 -13
- data/lib/stripe/resources/three_d_secure.rb +0 -14
@@ -2,18 +2,30 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# A dispute occurs when a customer questions your charge with their card issuer.
|
6
|
+
# When this happens, you have the opportunity to respond to the dispute with
|
7
|
+
# evidence that shows that the charge is legitimate.
|
8
|
+
#
|
9
|
+
# Related guide: [Disputes and fraud](https://stripe.com/docs/disputes)
|
5
10
|
class Dispute < APIResource
|
6
11
|
extend Stripe::APIOperations::List
|
7
12
|
include Stripe::APIOperations::Save
|
8
13
|
|
9
14
|
OBJECT_NAME = "dispute"
|
10
15
|
|
11
|
-
custom_method :close, http_verb: :post
|
12
|
-
|
13
16
|
def close(params = {}, opts = {})
|
14
17
|
request_stripe_object(
|
15
18
|
method: :post,
|
16
|
-
path:
|
19
|
+
path: format("/v1/disputes/%<dispute>s/close", { dispute: CGI.escape(self["id"]) }),
|
20
|
+
params: params,
|
21
|
+
opts: opts
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.close(dispute, params = {}, opts = {})
|
26
|
+
request_stripe_object(
|
27
|
+
method: :post,
|
28
|
+
path: format("/v1/disputes/%<dispute>s/close", { dispute: CGI.escape(dispute) }),
|
17
29
|
params: params,
|
18
30
|
opts: opts
|
19
31
|
)
|
@@ -2,6 +2,36 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# Events are our way of letting you know when something interesting happens in
|
6
|
+
# your account. When an interesting event occurs, we create a new `Event`
|
7
|
+
# object. For example, when a charge succeeds, we create a `charge.succeeded`
|
8
|
+
# event, and when an invoice payment attempt fails, we create an
|
9
|
+
# `invoice.payment_failed` event. Certain API requests might create multiple
|
10
|
+
# events. For example, if you create a new subscription for a
|
11
|
+
# customer, you receive both a `customer.subscription.created` event and a
|
12
|
+
# `charge.succeeded` event.
|
13
|
+
#
|
14
|
+
# Events occur when the state of another API resource changes. The event's data
|
15
|
+
# field embeds the resource's state at the time of the change. For
|
16
|
+
# example, a `charge.succeeded` event contains a charge, and an
|
17
|
+
# `invoice.payment_failed` event contains an invoice.
|
18
|
+
#
|
19
|
+
# As with other API resources, you can use endpoints to retrieve an
|
20
|
+
# [individual event](https://stripe.com/docs/api#retrieve_event) or a [list of events](https://stripe.com/docs/api#list_events)
|
21
|
+
# from the API. We also have a separate
|
22
|
+
# [webhooks](http://en.wikipedia.org/wiki/Webhook) system for sending the
|
23
|
+
# `Event` objects directly to an endpoint on your server. You can manage
|
24
|
+
# webhooks in your
|
25
|
+
# [account settings](https://dashboard.stripe.com/account/webhooks). Learn how
|
26
|
+
# to [listen for events]
|
27
|
+
# (/docs/webhooks) so that your integration can automatically trigger reactions.
|
28
|
+
#
|
29
|
+
# When using [Connect](https://stripe.com/docs/connect), you can also receive event notifications
|
30
|
+
# that occur in connected accounts. For these events, there's an
|
31
|
+
# additional `account` attribute in the received `Event` object.
|
32
|
+
#
|
33
|
+
# We only guarantee access to events through the [Retrieve Event API](https://stripe.com/docs/api#retrieve_event)
|
34
|
+
# for 30 days.
|
5
35
|
class Event < APIResource
|
6
36
|
extend Stripe::APIOperations::List
|
7
37
|
|
@@ -2,6 +2,32 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# `ExchangeRate` objects allow you to determine the rates that Stripe is currently
|
6
|
+
# using to convert from one currency to another. Since this number is variable
|
7
|
+
# throughout the day, there are various reasons why you might want to know the current
|
8
|
+
# rate (for example, to dynamically price an item for a user with a default
|
9
|
+
# payment in a foreign currency).
|
10
|
+
#
|
11
|
+
# Please refer to our [Exchange Rates API](https://stripe.com/docs/fx-rates) guide for more details.
|
12
|
+
#
|
13
|
+
# *[Note: this integration path is supported but no longer recommended]* Additionally,
|
14
|
+
# you can guarantee that a charge is made with an exchange rate that you expect is
|
15
|
+
# current. To do so, you must pass in the exchange_rate to charges endpoints. If the
|
16
|
+
# value is no longer up to date, the charge won't go through. Please refer to our
|
17
|
+
# [Using with charges](https://stripe.com/docs/exchange-rates) guide for more details.
|
18
|
+
#
|
19
|
+
# -----
|
20
|
+
#
|
21
|
+
#
|
22
|
+
#
|
23
|
+
# *This Exchange Rates API is a Beta Service and is subject to Stripe's terms of service. You may use the API solely for the purpose of transacting on Stripe. For example, the API may be queried in order to:*
|
24
|
+
#
|
25
|
+
# - *localize prices for processing payments on Stripe*
|
26
|
+
# - *reconcile Stripe transactions*
|
27
|
+
# - *determine how much money to send to a connected account*
|
28
|
+
# - *determine app fees to charge a connected account*
|
29
|
+
#
|
30
|
+
# *Using this Exchange Rates API beta for any purpose other than to transact on Stripe is strictly prohibited and constitutes a violation of Stripe's terms of service.*
|
5
31
|
class ExchangeRate < APIResource
|
6
32
|
extend Stripe::APIOperations::List
|
7
33
|
|
@@ -2,6 +2,13 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# This object represents files hosted on Stripe's servers. You can upload
|
6
|
+
# files with the [create file](https://stripe.com/docs/api#create_file) request
|
7
|
+
# (for example, when uploading dispute evidence). Stripe also
|
8
|
+
# creates files independetly (for example, the results of a [Sigma scheduled
|
9
|
+
# query](https://stripe.com/docs/api#scheduled_queries)).
|
10
|
+
#
|
11
|
+
# Related guide: [File upload guide](https://stripe.com/docs/file-upload)
|
5
12
|
class File < APIResource
|
6
13
|
extend Stripe::APIOperations::Create
|
7
14
|
extend Stripe::APIOperations::List
|
@@ -2,6 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# To share the contents of a `File` object with non-Stripe users, you can
|
6
|
+
# create a `FileLink`. `FileLink`s contain a URL that you can use to
|
7
|
+
# retrieve the contents of the file without authentication.
|
5
8
|
class FileLink < APIResource
|
6
9
|
extend Stripe::APIOperations::Create
|
7
10
|
extend Stripe::APIOperations::List
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module FinancialConnections
|
6
|
+
# A Financial Connections Account represents an account that exists outside of Stripe, to which you have been granted some degree of access.
|
7
|
+
class Account < APIResource
|
8
|
+
extend Stripe::APIOperations::List
|
9
|
+
|
10
|
+
OBJECT_NAME = "financial_connections.account"
|
11
|
+
|
12
|
+
def disconnect(params = {}, opts = {})
|
13
|
+
request_stripe_object(
|
14
|
+
method: :post,
|
15
|
+
path: format("/v1/financial_connections/accounts/%<account>s/disconnect", { account: CGI.escape(self["id"]) }),
|
16
|
+
params: params,
|
17
|
+
opts: opts
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def list_owners(params = {}, opts = {})
|
22
|
+
request_stripe_object(
|
23
|
+
method: :get,
|
24
|
+
path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(self["id"]) }),
|
25
|
+
params: params,
|
26
|
+
opts: opts
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def refresh_account(params = {}, opts = {})
|
31
|
+
request_stripe_object(
|
32
|
+
method: :post,
|
33
|
+
path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(self["id"]) }),
|
34
|
+
params: params,
|
35
|
+
opts: opts
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.disconnect(account, params = {}, opts = {})
|
40
|
+
request_stripe_object(
|
41
|
+
method: :post,
|
42
|
+
path: format("/v1/financial_connections/accounts/%<account>s/disconnect", { account: CGI.escape(account) }),
|
43
|
+
params: params,
|
44
|
+
opts: opts
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.list_owners(account, params = {}, opts = {})
|
49
|
+
request_stripe_object(
|
50
|
+
method: :get,
|
51
|
+
path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(account) }),
|
52
|
+
params: params,
|
53
|
+
opts: opts
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.refresh_account(account, params = {}, opts = {})
|
58
|
+
request_stripe_object(
|
59
|
+
method: :post,
|
60
|
+
path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(account) }),
|
61
|
+
params: params,
|
62
|
+
opts: opts
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module FinancialConnections
|
6
|
+
# Describes an owner of an account.
|
7
|
+
class AccountOwner < StripeObject
|
8
|
+
OBJECT_NAME = "financial_connections.account_owner"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module FinancialConnections
|
6
|
+
# Describes a snapshot of the owners of an account at a particular point in time.
|
7
|
+
class AccountOwnership < StripeObject
|
8
|
+
OBJECT_NAME = "financial_connections.account_ownership"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module FinancialConnections
|
6
|
+
# A Financial Connections Session is the secure way to programmatically launch the client-side Stripe.js modal that lets your users link their accounts.
|
7
|
+
class Session < APIResource
|
8
|
+
extend Stripe::APIOperations::Create
|
9
|
+
|
10
|
+
OBJECT_NAME = "financial_connections.session"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
# Each customer has a [`balance`](https://stripe.com/docs/api/customers/object#customer_object-balance) that is
|
6
|
+
# automatically applied to future invoices and payments using the `customer_balance` payment method.
|
7
|
+
# Customers can fund this balance by initiating a bank transfer to any account in the
|
8
|
+
# `financial_addresses` field.
|
9
|
+
# Related guide: [Customer balance funding instructions](https://stripe.com/docs/payments/customer-balance/funding-instructions)
|
10
|
+
class FundingInstructions < APIResource
|
11
|
+
OBJECT_NAME = "funding_instructions"
|
12
|
+
|
13
|
+
def resource_url
|
14
|
+
if !respond_to?(:customer) || customer.nil?
|
15
|
+
raise NotImplementedError,
|
16
|
+
"FundingInstructions cannot be accessed without a customer ID."
|
17
|
+
end
|
18
|
+
"#{Customer.resource_url}/#{CGI.escape(customer)}/funding_instructions" "/#{CGI.escape(id)}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -3,6 +3,17 @@
|
|
3
3
|
|
4
4
|
module Stripe
|
5
5
|
module Identity
|
6
|
+
# A VerificationReport is the result of an attempt to collect and verify data from a user.
|
7
|
+
# The collection of verification checks performed is determined from the `type` and `options`
|
8
|
+
# parameters used. You can find the result of each verification check performed in the
|
9
|
+
# appropriate sub-resource: `document`, `id_number`, `selfie`.
|
10
|
+
#
|
11
|
+
# Each VerificationReport contains a copy of any data collected by the user as well as
|
12
|
+
# reference IDs which can be used to access collected images through the [FileUpload](https://stripe.com/docs/api/files)
|
13
|
+
# API. To configure and create VerificationReports, use the
|
14
|
+
# [VerificationSession](https://stripe.com/docs/api/identity/verification_sessions) API.
|
15
|
+
#
|
16
|
+
# Related guides: [Accessing verification results](https://stripe.com/docs/identity/verification-sessions#results).
|
6
17
|
class VerificationReport < APIResource
|
7
18
|
extend Stripe::APIOperations::List
|
8
19
|
|
@@ -3,6 +3,17 @@
|
|
3
3
|
|
4
4
|
module Stripe
|
5
5
|
module Identity
|
6
|
+
# A VerificationSession guides you through the process of collecting and verifying the identities
|
7
|
+
# of your users. It contains details about the type of verification, such as what [verification
|
8
|
+
# check](https://stripe.com/docs/identity/verification-checks) to perform. Only create one VerificationSession for
|
9
|
+
# each verification in your system.
|
10
|
+
#
|
11
|
+
# A VerificationSession transitions through [multiple
|
12
|
+
# statuses](https://stripe.com/docs/identity/how-sessions-work) throughout its lifetime as it progresses through
|
13
|
+
# the verification flow. The VerificationSession contains the user's verified data after
|
14
|
+
# verification checks are complete.
|
15
|
+
#
|
16
|
+
# Related guide: [The Verification Sessions API](https://stripe.com/docs/identity/verification-sessions)
|
6
17
|
class VerificationSession < APIResource
|
7
18
|
extend Stripe::APIOperations::Create
|
8
19
|
extend Stripe::APIOperations::List
|
@@ -10,13 +21,10 @@ module Stripe
|
|
10
21
|
|
11
22
|
OBJECT_NAME = "identity.verification_session"
|
12
23
|
|
13
|
-
custom_method :cancel, http_verb: :post
|
14
|
-
custom_method :redact, http_verb: :post
|
15
|
-
|
16
24
|
def cancel(params = {}, opts = {})
|
17
25
|
request_stripe_object(
|
18
26
|
method: :post,
|
19
|
-
path:
|
27
|
+
path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(self["id"]) }),
|
20
28
|
params: params,
|
21
29
|
opts: opts
|
22
30
|
)
|
@@ -25,7 +33,25 @@ module Stripe
|
|
25
33
|
def redact(params = {}, opts = {})
|
26
34
|
request_stripe_object(
|
27
35
|
method: :post,
|
28
|
-
path:
|
36
|
+
path: format("/v1/identity/verification_sessions/%<session>s/redact", { session: CGI.escape(self["id"]) }),
|
37
|
+
params: params,
|
38
|
+
opts: opts
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.cancel(session, params = {}, opts = {})
|
43
|
+
request_stripe_object(
|
44
|
+
method: :post,
|
45
|
+
path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(session) }),
|
46
|
+
params: params,
|
47
|
+
opts: opts
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.redact(session, params = {}, opts = {})
|
52
|
+
request_stripe_object(
|
53
|
+
method: :post,
|
54
|
+
path: format("/v1/identity/verification_sessions/%<session>s/redact", { session: CGI.escape(session) }),
|
29
55
|
params: params,
|
30
56
|
opts: opts
|
31
57
|
)
|
@@ -2,24 +2,51 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# Invoices are statements of amounts owed by a customer, and are either
|
6
|
+
# generated one-off, or generated periodically from a subscription.
|
7
|
+
#
|
8
|
+
# They contain [invoice items](https://stripe.com/docs/api#invoiceitems), and proration adjustments
|
9
|
+
# that may be caused by subscription upgrades/downgrades (if necessary).
|
10
|
+
#
|
11
|
+
# If your invoice is configured to be billed through automatic charges,
|
12
|
+
# Stripe automatically finalizes your invoice and attempts payment. Note
|
13
|
+
# that finalizing the invoice,
|
14
|
+
# [when automatic](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection), does
|
15
|
+
# not happen immediately as the invoice is created. Stripe waits
|
16
|
+
# until one hour after the last webhook was successfully sent (or the last
|
17
|
+
# webhook timed out after failing). If you (and the platforms you may have
|
18
|
+
# connected to) have no webhooks configured, Stripe waits one hour after
|
19
|
+
# creation to finalize the invoice.
|
20
|
+
#
|
21
|
+
# If your invoice is configured to be billed by sending an email, then based on your
|
22
|
+
# [email settings](https://dashboard.stripe.com/account/billing/automatic),
|
23
|
+
# Stripe will email the invoice to your customer and await payment. These
|
24
|
+
# emails can contain a link to a hosted page to pay the invoice.
|
25
|
+
#
|
26
|
+
# Stripe applies any customer credit on the account before determining the
|
27
|
+
# amount due for the invoice (i.e., the amount that will be actually
|
28
|
+
# charged). If the amount due for the invoice is less than Stripe's [minimum allowed charge
|
29
|
+
# per currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts), the
|
30
|
+
# invoice is automatically marked paid, and we add the amount due to the
|
31
|
+
# customer's credit balance which is applied to the next invoice.
|
32
|
+
#
|
33
|
+
# More details on the customer's credit balance are
|
34
|
+
# [here](https://stripe.com/docs/billing/customer/balance).
|
35
|
+
#
|
36
|
+
# Related guide: [Send invoices to customers](https://stripe.com/docs/billing/invoices/sending)
|
5
37
|
class Invoice < APIResource
|
6
38
|
extend Stripe::APIOperations::Create
|
7
39
|
include Stripe::APIOperations::Delete
|
8
40
|
extend Stripe::APIOperations::List
|
41
|
+
extend Stripe::APIOperations::Search
|
9
42
|
include Stripe::APIOperations::Save
|
10
43
|
|
11
44
|
OBJECT_NAME = "invoice"
|
12
45
|
|
13
|
-
custom_method :finalize_invoice, http_verb: :post, http_path: "finalize"
|
14
|
-
custom_method :mark_uncollectible, http_verb: :post
|
15
|
-
custom_method :pay, http_verb: :post
|
16
|
-
custom_method :send_invoice, http_verb: :post, http_path: "send"
|
17
|
-
custom_method :void_invoice, http_verb: :post, http_path: "void"
|
18
|
-
|
19
46
|
def finalize_invoice(params = {}, opts = {})
|
20
47
|
request_stripe_object(
|
21
48
|
method: :post,
|
22
|
-
path:
|
49
|
+
path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(self["id"]) }),
|
23
50
|
params: params,
|
24
51
|
opts: opts
|
25
52
|
)
|
@@ -28,7 +55,7 @@ module Stripe
|
|
28
55
|
def mark_uncollectible(params = {}, opts = {})
|
29
56
|
request_stripe_object(
|
30
57
|
method: :post,
|
31
|
-
path:
|
58
|
+
path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(self["id"]) }),
|
32
59
|
params: params,
|
33
60
|
opts: opts
|
34
61
|
)
|
@@ -37,7 +64,7 @@ module Stripe
|
|
37
64
|
def pay(params = {}, opts = {})
|
38
65
|
request_stripe_object(
|
39
66
|
method: :post,
|
40
|
-
path:
|
67
|
+
path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(self["id"]) }),
|
41
68
|
params: params,
|
42
69
|
opts: opts
|
43
70
|
)
|
@@ -46,7 +73,7 @@ module Stripe
|
|
46
73
|
def send_invoice(params = {}, opts = {})
|
47
74
|
request_stripe_object(
|
48
75
|
method: :post,
|
49
|
-
path:
|
76
|
+
path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(self["id"]) }),
|
50
77
|
params: params,
|
51
78
|
opts: opts
|
52
79
|
)
|
@@ -55,20 +82,76 @@ module Stripe
|
|
55
82
|
def void_invoice(params = {}, opts = {})
|
56
83
|
request_stripe_object(
|
57
84
|
method: :post,
|
58
|
-
path:
|
85
|
+
path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(self["id"]) }),
|
86
|
+
params: params,
|
87
|
+
opts: opts
|
88
|
+
)
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.finalize_invoice(invoice, params = {}, opts = {})
|
92
|
+
request_stripe_object(
|
93
|
+
method: :post,
|
94
|
+
path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(invoice) }),
|
95
|
+
params: params,
|
96
|
+
opts: opts
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.list_upcoming_line_items(params = {}, opts = {})
|
101
|
+
request_stripe_object(
|
102
|
+
method: :get,
|
103
|
+
path: "/v1/invoices/upcoming/lines",
|
104
|
+
params: params,
|
105
|
+
opts: opts
|
106
|
+
)
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.mark_uncollectible(invoice, params = {}, opts = {})
|
110
|
+
request_stripe_object(
|
111
|
+
method: :post,
|
112
|
+
path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(invoice) }),
|
113
|
+
params: params,
|
114
|
+
opts: opts
|
115
|
+
)
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.pay(invoice, params = {}, opts = {})
|
119
|
+
request_stripe_object(
|
120
|
+
method: :post,
|
121
|
+
path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(invoice) }),
|
122
|
+
params: params,
|
123
|
+
opts: opts
|
124
|
+
)
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.send_invoice(invoice, params = {}, opts = {})
|
128
|
+
request_stripe_object(
|
129
|
+
method: :post,
|
130
|
+
path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(invoice) }),
|
131
|
+
params: params,
|
132
|
+
opts: opts
|
133
|
+
)
|
134
|
+
end
|
135
|
+
|
136
|
+
def self.upcoming(params = {}, opts = {})
|
137
|
+
request_stripe_object(method: :get, path: "/v1/invoices/upcoming", params: params, opts: opts)
|
138
|
+
end
|
139
|
+
|
140
|
+
def self.void_invoice(invoice, params = {}, opts = {})
|
141
|
+
request_stripe_object(
|
142
|
+
method: :post,
|
143
|
+
path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(invoice) }),
|
59
144
|
params: params,
|
60
145
|
opts: opts
|
61
146
|
)
|
62
147
|
end
|
63
148
|
|
64
|
-
def self.
|
65
|
-
|
66
|
-
Util.convert_to_stripe_object(resp.data, opts)
|
149
|
+
def self.search(params = {}, opts = {})
|
150
|
+
_search("/v1/invoices/search", params, opts)
|
67
151
|
end
|
68
152
|
|
69
|
-
def self.
|
70
|
-
|
71
|
-
Util.convert_to_stripe_object(resp.data, opts)
|
153
|
+
def self.search_auto_paging_each(params = {}, opts = {}, &blk)
|
154
|
+
search(params, opts).auto_paging_each(&blk)
|
72
155
|
end
|
73
156
|
end
|
74
157
|
end
|
@@ -2,6 +2,17 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# Invoice Items represent the component lines of an [invoice](https://stripe.com/docs/api/invoices). An invoice item is added to an
|
6
|
+
# invoice by creating or updating it with an `invoice` field, at which point it will be included as
|
7
|
+
# [an invoice line item](https://stripe.com/docs/api/invoices/line_item) within
|
8
|
+
# [invoice.lines](https://stripe.com/docs/api/invoices/object#invoice_object-lines).
|
9
|
+
#
|
10
|
+
# Invoice Items can be created before you are ready to actually send the invoice. This can be particularly useful when combined
|
11
|
+
# with a [subscription](https://stripe.com/docs/api/subscriptions). Sometimes you want to add a charge or credit to a customer, but actually charge
|
12
|
+
# or credit the customer's card only at the end of a regular billing cycle. This is useful for combining several charges
|
13
|
+
# (to minimize per-transaction fees), or for having Stripe tabulate your usage-based billing totals.
|
14
|
+
#
|
15
|
+
# Related guides: [Integrate with the Invoicing API](https://stripe.com/docs/invoicing/integration), [Subscription Invoices](https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items).
|
5
16
|
class InvoiceItem < APIResource
|
6
17
|
extend Stripe::APIOperations::Create
|
7
18
|
include Stripe::APIOperations::Delete
|
@@ -3,19 +3,21 @@
|
|
3
3
|
|
4
4
|
module Stripe
|
5
5
|
module Issuing
|
6
|
+
# When an [issued card](https://stripe.com/docs/issuing) is used to make a purchase, an Issuing `Authorization`
|
7
|
+
# object is created. [Authorizations](https://stripe.com/docs/issuing/purchases/authorizations) must be approved for the
|
8
|
+
# purchase to be completed successfully.
|
9
|
+
#
|
10
|
+
# Related guide: [Issued card authorizations](https://stripe.com/docs/issuing/purchases/authorizations)
|
6
11
|
class Authorization < APIResource
|
7
12
|
extend Stripe::APIOperations::List
|
8
13
|
include Stripe::APIOperations::Save
|
9
14
|
|
10
15
|
OBJECT_NAME = "issuing.authorization"
|
11
16
|
|
12
|
-
custom_method :approve, http_verb: :post
|
13
|
-
custom_method :decline, http_verb: :post
|
14
|
-
|
15
17
|
def approve(params = {}, opts = {})
|
16
18
|
request_stripe_object(
|
17
19
|
method: :post,
|
18
|
-
path:
|
20
|
+
path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(self["id"]) }),
|
19
21
|
params: params,
|
20
22
|
opts: opts
|
21
23
|
)
|
@@ -24,11 +26,118 @@ module Stripe
|
|
24
26
|
def decline(params = {}, opts = {})
|
25
27
|
request_stripe_object(
|
26
28
|
method: :post,
|
27
|
-
path:
|
29
|
+
path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(self["id"]) }),
|
30
|
+
params: params,
|
31
|
+
opts: opts
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.approve(authorization, params = {}, opts = {})
|
36
|
+
request_stripe_object(
|
37
|
+
method: :post,
|
38
|
+
path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(authorization) }),
|
39
|
+
params: params,
|
40
|
+
opts: opts
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.decline(authorization, params = {}, opts = {})
|
45
|
+
request_stripe_object(
|
46
|
+
method: :post,
|
47
|
+
path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(authorization) }),
|
28
48
|
params: params,
|
29
49
|
opts: opts
|
30
50
|
)
|
31
51
|
end
|
52
|
+
|
53
|
+
def test_helpers
|
54
|
+
TestHelpers.new(self)
|
55
|
+
end
|
56
|
+
|
57
|
+
class TestHelpers < APIResourceTestHelpers
|
58
|
+
RESOURCE_CLASS = Authorization
|
59
|
+
|
60
|
+
def self.capture(authorization, params = {}, opts = {})
|
61
|
+
request_stripe_object(
|
62
|
+
method: :post,
|
63
|
+
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/capture", { authorization: CGI.escape(authorization) }),
|
64
|
+
params: params,
|
65
|
+
opts: opts
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.create(params = {}, opts = {})
|
70
|
+
request_stripe_object(
|
71
|
+
method: :post,
|
72
|
+
path: "/v1/test_helpers/issuing/authorizations",
|
73
|
+
params: params,
|
74
|
+
opts: opts
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.expire(authorization, params = {}, opts = {})
|
79
|
+
request_stripe_object(
|
80
|
+
method: :post,
|
81
|
+
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/expire", { authorization: CGI.escape(authorization) }),
|
82
|
+
params: params,
|
83
|
+
opts: opts
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.increment(authorization, params = {}, opts = {})
|
88
|
+
request_stripe_object(
|
89
|
+
method: :post,
|
90
|
+
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/increment", { authorization: CGI.escape(authorization) }),
|
91
|
+
params: params,
|
92
|
+
opts: opts
|
93
|
+
)
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.reverse(authorization, params = {}, opts = {})
|
97
|
+
request_stripe_object(
|
98
|
+
method: :post,
|
99
|
+
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/reverse", { authorization: CGI.escape(authorization) }),
|
100
|
+
params: params,
|
101
|
+
opts: opts
|
102
|
+
)
|
103
|
+
end
|
104
|
+
|
105
|
+
def capture(params = {}, opts = {})
|
106
|
+
@resource.request_stripe_object(
|
107
|
+
method: :post,
|
108
|
+
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/capture", { authorization: CGI.escape(@resource["id"]) }),
|
109
|
+
params: params,
|
110
|
+
opts: opts
|
111
|
+
)
|
112
|
+
end
|
113
|
+
|
114
|
+
def expire(params = {}, opts = {})
|
115
|
+
@resource.request_stripe_object(
|
116
|
+
method: :post,
|
117
|
+
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/expire", { authorization: CGI.escape(@resource["id"]) }),
|
118
|
+
params: params,
|
119
|
+
opts: opts
|
120
|
+
)
|
121
|
+
end
|
122
|
+
|
123
|
+
def increment(params = {}, opts = {})
|
124
|
+
@resource.request_stripe_object(
|
125
|
+
method: :post,
|
126
|
+
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/increment", { authorization: CGI.escape(@resource["id"]) }),
|
127
|
+
params: params,
|
128
|
+
opts: opts
|
129
|
+
)
|
130
|
+
end
|
131
|
+
|
132
|
+
def reverse(params = {}, opts = {})
|
133
|
+
@resource.request_stripe_object(
|
134
|
+
method: :post,
|
135
|
+
path: format("/v1/test_helpers/issuing/authorizations/%<authorization>s/reverse", { authorization: CGI.escape(@resource["id"]) }),
|
136
|
+
params: params,
|
137
|
+
opts: opts
|
138
|
+
)
|
139
|
+
end
|
140
|
+
end
|
32
141
|
end
|
33
142
|
end
|
34
143
|
end
|