stripe 3.8.2 → 5.45.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +424 -1
- data/CODE_OF_CONDUCT.md +77 -0
- data/Gemfile +15 -20
- data/README.md +201 -58
- data/Rakefile +12 -9
- data/VERSION +1 -1
- data/bin/stripe-console +3 -1
- data/lib/stripe/api_operations/create.rb +3 -1
- data/lib/stripe/api_operations/delete.rb +30 -2
- data/lib/stripe/api_operations/list.rb +3 -12
- data/lib/stripe/api_operations/nested_resource.rb +40 -28
- data/lib/stripe/api_operations/request.rb +83 -9
- data/lib/stripe/api_operations/save.rb +19 -7
- data/lib/stripe/api_resource.rb +65 -4
- data/lib/stripe/connection_manager.rb +200 -0
- data/lib/stripe/error_object.rb +93 -0
- data/lib/stripe/errors.rb +47 -19
- data/lib/stripe/instrumentation.rb +84 -0
- data/lib/stripe/list_object.rb +43 -7
- data/lib/stripe/multipart_encoder.rb +131 -0
- data/lib/stripe/oauth.rb +14 -7
- data/lib/stripe/object_types.rb +110 -0
- data/lib/stripe/{account.rb → resources/account.rb} +60 -28
- data/lib/stripe/resources/account_link.rb +10 -0
- data/lib/stripe/resources/alipay_account.rb +34 -0
- data/lib/stripe/{apple_pay_domain.rb → resources/apple_pay_domain.rb} +4 -1
- data/lib/stripe/resources/application_fee.rb +14 -0
- data/lib/stripe/resources/application_fee_refund.rb +31 -0
- data/lib/stripe/resources/balance.rb +8 -0
- data/lib/stripe/resources/balance_transaction.rb +10 -0
- data/lib/stripe/resources/bank_account.rb +43 -0
- data/lib/stripe/resources/billing_portal/configuration.rb +14 -0
- data/lib/stripe/resources/billing_portal/session.rb +12 -0
- data/lib/stripe/{bitcoin_receiver.rb → resources/bitcoin_receiver.rb} +6 -6
- data/lib/stripe/resources/bitcoin_transaction.rb +16 -0
- data/lib/stripe/resources/capability.rb +34 -0
- data/lib/stripe/{card.rb → resources/card.rb} +15 -4
- data/lib/stripe/resources/charge.rb +23 -0
- data/lib/stripe/resources/checkout/session.rb +27 -0
- data/lib/stripe/resources/country_spec.rb +10 -0
- data/lib/stripe/{coupon.rb → resources/coupon.rb} +5 -2
- data/lib/stripe/resources/credit_note.rb +33 -0
- data/lib/stripe/resources/credit_note_line_item.rb +8 -0
- data/lib/stripe/resources/customer.rb +52 -0
- data/lib/stripe/resources/customer_balance_transaction.rb +31 -0
- data/lib/stripe/resources/discount.rb +8 -0
- data/lib/stripe/resources/dispute.rb +22 -0
- data/lib/stripe/resources/ephemeral_key.rb +20 -0
- data/lib/stripe/resources/event.rb +10 -0
- data/lib/stripe/resources/exchange_rate.rb +10 -0
- data/lib/stripe/resources/file.rb +36 -0
- data/lib/stripe/resources/file_link.rb +12 -0
- data/lib/stripe/resources/identity/verification_report.rb +12 -0
- data/lib/stripe/resources/identity/verification_session.rb +35 -0
- data/lib/stripe/resources/invoice.rb +74 -0
- data/lib/stripe/{invoice_item.rb → resources/invoice_item.rb} +5 -2
- data/lib/stripe/resources/invoice_line_item.rb +8 -0
- data/lib/stripe/resources/issuing/authorization.rb +34 -0
- data/lib/stripe/resources/issuing/card.rb +25 -0
- data/lib/stripe/resources/issuing/card_details.rb +10 -0
- data/lib/stripe/resources/issuing/cardholder.rb +14 -0
- data/lib/stripe/resources/issuing/dispute.rb +25 -0
- data/lib/stripe/resources/issuing/transaction.rb +13 -0
- data/lib/stripe/resources/line_item.rb +8 -0
- data/lib/stripe/resources/login_link.rb +15 -0
- data/lib/stripe/resources/mandate.rb +8 -0
- data/lib/stripe/resources/order.rb +33 -0
- data/lib/stripe/resources/order_return.rb +10 -0
- data/lib/stripe/resources/payment_intent.rb +53 -0
- data/lib/stripe/resources/payment_link.rb +23 -0
- data/lib/stripe/resources/payment_method.rb +33 -0
- data/lib/stripe/resources/payout.rb +33 -0
- data/lib/stripe/resources/person.rb +32 -0
- data/lib/stripe/{plan.rb → resources/plan.rb} +4 -1
- data/lib/stripe/resources/price.rb +12 -0
- data/lib/stripe/{product.rb → resources/product.rb} +6 -3
- data/lib/stripe/resources/promotion_code.rb +12 -0
- data/lib/stripe/resources/quote.rb +105 -0
- data/lib/stripe/resources/radar/early_fraud_warning.rb +12 -0
- data/lib/stripe/resources/radar/value_list.rb +15 -0
- data/lib/stripe/resources/radar/value_list_item.rb +14 -0
- data/lib/stripe/{recipient.rb → resources/recipient.rb} +5 -6
- data/lib/stripe/resources/recipient_transfer.rb +7 -0
- data/lib/stripe/{refund.rb → resources/refund.rb} +4 -1
- data/lib/stripe/resources/reporting/report_run.rb +13 -0
- data/lib/stripe/resources/reporting/report_type.rb +13 -0
- data/lib/stripe/resources/reversal.rb +30 -0
- data/lib/stripe/resources/review.rb +21 -0
- data/lib/stripe/resources/setup_attempt.rb +10 -0
- data/lib/stripe/resources/setup_intent.rb +43 -0
- data/lib/stripe/resources/shipping_rate.rb +12 -0
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +16 -0
- data/lib/stripe/{sku.rb → resources/sku.rb} +6 -3
- data/lib/stripe/resources/source.rb +47 -0
- data/lib/stripe/resources/source_transaction.rb +8 -0
- data/lib/stripe/resources/subscription.rb +26 -0
- data/lib/stripe/resources/subscription_item.rb +26 -0
- data/lib/stripe/resources/subscription_schedule.rb +33 -0
- data/lib/stripe/resources/tax_code.rb +10 -0
- data/lib/stripe/resources/tax_id.rb +27 -0
- data/lib/stripe/resources/tax_rate.rb +12 -0
- data/lib/stripe/resources/terminal/connection_token.rb +12 -0
- data/lib/stripe/resources/terminal/location.rb +15 -0
- data/lib/stripe/resources/terminal/reader.rb +15 -0
- data/lib/stripe/resources/test_helpers/test_clock.rb +25 -0
- data/lib/stripe/{three_d_secure.rb → resources/three_d_secure.rb} +4 -1
- data/lib/stripe/resources/token.rb +10 -0
- data/lib/stripe/resources/topup.rb +23 -0
- data/lib/stripe/resources/transfer.rb +27 -0
- data/lib/stripe/resources/usage_record.rb +8 -0
- data/lib/stripe/resources/usage_record_summary.rb +8 -0
- data/lib/stripe/resources/webhook_endpoint.rb +13 -0
- data/lib/stripe/resources.rb +93 -0
- data/lib/stripe/singleton_api_resource.rb +8 -2
- data/lib/stripe/stripe_client.rb +712 -233
- data/lib/stripe/stripe_configuration.rb +194 -0
- data/lib/stripe/stripe_object.rb +180 -67
- data/lib/stripe/stripe_response.rb +89 -27
- data/lib/stripe/util.rb +87 -168
- data/lib/stripe/version.rb +3 -1
- data/lib/stripe/webhook.rb +45 -10
- data/lib/stripe.rb +47 -160
- data/stripe.gemspec +27 -8
- metadata +112 -178
- data/.gitattributes +0 -4
- data/.github/ISSUE_TEMPLATE.md +0 -5
- data/.gitignore +0 -6
- data/.rubocop.yml +0 -20
- data/.rubocop_todo.yml +0 -60
- data/.travis.yml +0 -38
- data/lib/stripe/alipay_account.rb +0 -25
- data/lib/stripe/application_fee.rb +0 -25
- data/lib/stripe/application_fee_refund.rb +0 -20
- data/lib/stripe/balance.rb +0 -5
- data/lib/stripe/balance_transaction.rb +0 -11
- data/lib/stripe/bank_account.rb +0 -30
- data/lib/stripe/bitcoin_transaction.rb +0 -13
- data/lib/stripe/charge.rb +0 -82
- data/lib/stripe/country_spec.rb +0 -11
- data/lib/stripe/customer.rb +0 -88
- data/lib/stripe/dispute.rb +0 -17
- data/lib/stripe/ephemeral_key.rb +0 -18
- data/lib/stripe/event.rb +0 -7
- data/lib/stripe/exchange_rate.rb +0 -11
- data/lib/stripe/file_upload.rb +0 -35
- data/lib/stripe/invoice.rb +0 -30
- data/lib/stripe/invoice_line_item.rb +0 -5
- data/lib/stripe/login_link.rb +0 -9
- data/lib/stripe/order.rb +0 -35
- data/lib/stripe/order_return.rb +0 -11
- data/lib/stripe/payout.rb +0 -18
- data/lib/stripe/recipient_transfer.rb +0 -5
- data/lib/stripe/reversal.rb +0 -20
- data/lib/stripe/source.rb +0 -36
- data/lib/stripe/source_transaction.rb +0 -5
- data/lib/stripe/subscription.rb +0 -43
- data/lib/stripe/subscription_item.rb +0 -14
- data/lib/stripe/token.rb +0 -7
- data/lib/stripe/transfer.rb +0 -21
- data/test/api_stub_helpers.rb +0 -0
- data/test/stripe/account_external_accounts_operations_test.rb +0 -66
- data/test/stripe/account_login_links_operations_test.rb +0 -19
- data/test/stripe/account_test.rb +0 -190
- data/test/stripe/alipay_account_test.rb +0 -35
- data/test/stripe/api_operations_test.rb +0 -76
- data/test/stripe/api_resource_test.rb +0 -522
- data/test/stripe/apple_pay_domain_test.rb +0 -31
- data/test/stripe/application_fee_refund_test.rb +0 -35
- data/test/stripe/application_fee_refunds_operations_test.rb +0 -54
- data/test/stripe/application_fee_test.rb +0 -12
- data/test/stripe/balance_test.rb +0 -11
- data/test/stripe/bank_account_test.rb +0 -34
- data/test/stripe/charge_test.rb +0 -57
- data/test/stripe/country_spec_test.rb +0 -18
- data/test/stripe/coupon_test.rb +0 -42
- data/test/stripe/customer_card_test.rb +0 -42
- data/test/stripe/customer_sources_operations_test.rb +0 -66
- data/test/stripe/customer_test.rb +0 -113
- data/test/stripe/dispute_test.rb +0 -40
- data/test/stripe/ephemeral_key_test.rb +0 -84
- data/test/stripe/errors_test.rb +0 -18
- data/test/stripe/exchange_rate_test.rb +0 -18
- data/test/stripe/file_upload_test.rb +0 -83
- data/test/stripe/invoice_item_test.rb +0 -53
- data/test/stripe/invoice_line_item_test.rb +0 -6
- data/test/stripe/invoice_test.rb +0 -111
- data/test/stripe/list_object_test.rb +0 -154
- data/test/stripe/login_link_test.rb +0 -35
- data/test/stripe/oauth_test.rb +0 -77
- data/test/stripe/order_return_test.rb +0 -19
- data/test/stripe/order_test.rb +0 -57
- data/test/stripe/payout_test.rb +0 -48
- data/test/stripe/plan_test.rb +0 -50
- data/test/stripe/product_test.rb +0 -45
- data/test/stripe/recipient_test.rb +0 -47
- data/test/stripe/refund_test.rb +0 -37
- data/test/stripe/reversal_test.rb +0 -41
- data/test/stripe/sku_test.rb +0 -48
- data/test/stripe/source_test.rb +0 -84
- data/test/stripe/source_transaction_test.rb +0 -28
- data/test/stripe/stripe_client_test.rb +0 -728
- data/test/stripe/stripe_object_test.rb +0 -448
- data/test/stripe/stripe_response_test.rb +0 -47
- data/test/stripe/subscription_item_test.rb +0 -52
- data/test/stripe/subscription_test.rb +0 -104
- data/test/stripe/three_d_secure_test.rb +0 -21
- data/test/stripe/transfer_reversals_operations_test.rb +0 -55
- data/test/stripe/transfer_test.rb +0 -41
- data/test/stripe/util_test.rb +0 -432
- data/test/stripe/webhook_test.rb +0 -94
- data/test/stripe_test.rb +0 -59
- data/test/test_data.rb +0 -59
- data/test/test_helper.rb +0 -60
data/.rubocop.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
|
-
|
3
|
-
AllCops:
|
4
|
-
DisplayCopNames: true
|
5
|
-
TargetRubyVersion: 2.0
|
6
|
-
|
7
|
-
Layout/CaseIndentation:
|
8
|
-
EnforcedStyle: end
|
9
|
-
|
10
|
-
Layout/IndentArray:
|
11
|
-
EnforcedStyle: consistent
|
12
|
-
|
13
|
-
Layout/IndentHash:
|
14
|
-
EnforcedStyle: consistent
|
15
|
-
|
16
|
-
Style/StringLiterals:
|
17
|
-
EnforcedStyle: double_quotes
|
18
|
-
|
19
|
-
Style/TrailingCommaInLiteral:
|
20
|
-
EnforcedStyleForMultiline: consistent_comma
|
data/.rubocop_todo.yml
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2017-10-30 14:39:50 +0100 using RuboCop version 0.50.0.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 19
|
10
|
-
Metrics/AbcSize:
|
11
|
-
Max: 49
|
12
|
-
|
13
|
-
# Offense count: 27
|
14
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
15
|
-
Metrics/BlockLength:
|
16
|
-
Max: 455
|
17
|
-
|
18
|
-
# Offense count: 8
|
19
|
-
# Configuration parameters: CountComments.
|
20
|
-
Metrics/ClassLength:
|
21
|
-
Max: 583
|
22
|
-
|
23
|
-
# Offense count: 10
|
24
|
-
Metrics/CyclomaticComplexity:
|
25
|
-
Max: 13
|
26
|
-
|
27
|
-
# Offense count: 257
|
28
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
29
|
-
# URISchemes: http, https
|
30
|
-
Metrics/LineLength:
|
31
|
-
Max: 310
|
32
|
-
|
33
|
-
# Offense count: 32
|
34
|
-
# Configuration parameters: CountComments.
|
35
|
-
Metrics/MethodLength:
|
36
|
-
Max: 47
|
37
|
-
|
38
|
-
# Offense count: 1
|
39
|
-
# Configuration parameters: CountComments.
|
40
|
-
Metrics/ModuleLength:
|
41
|
-
Max: 304
|
42
|
-
|
43
|
-
# Offense count: 5
|
44
|
-
# Configuration parameters: CountKeywordArgs.
|
45
|
-
Metrics/ParameterLists:
|
46
|
-
Max: 7
|
47
|
-
|
48
|
-
# Offense count: 5
|
49
|
-
Metrics/PerceivedComplexity:
|
50
|
-
Max: 15
|
51
|
-
|
52
|
-
# Offense count: 2
|
53
|
-
Style/ClassVars:
|
54
|
-
Exclude:
|
55
|
-
- 'lib/stripe/stripe_object.rb'
|
56
|
-
- 'test/stripe/api_resource_test.rb'
|
57
|
-
|
58
|
-
# Offense count: 52
|
59
|
-
Style/Documentation:
|
60
|
-
Enabled: false
|
data/.travis.yml
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
rvm:
|
4
|
-
- 2.0.0
|
5
|
-
- 2.1
|
6
|
-
- 2.2
|
7
|
-
- 2.3.0
|
8
|
-
- 2.4.0
|
9
|
-
- jruby-9.0.5.0
|
10
|
-
|
11
|
-
notifications:
|
12
|
-
email:
|
13
|
-
on_success: never
|
14
|
-
|
15
|
-
sudo: false
|
16
|
-
|
17
|
-
env:
|
18
|
-
global:
|
19
|
-
- STRIPE_MOCK_VERSION=0.4.0
|
20
|
-
|
21
|
-
cache:
|
22
|
-
directories:
|
23
|
-
- stripe-mock
|
24
|
-
|
25
|
-
before_install:
|
26
|
-
# Unpack and start stripe-mock so that the test suite can talk to it
|
27
|
-
- |
|
28
|
-
if [ ! -d "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" ]; then
|
29
|
-
mkdir -p stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/
|
30
|
-
curl -L "https://github.com/stripe/stripe-mock/releases/download/v${STRIPE_MOCK_VERSION}/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -o "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz"
|
31
|
-
tar -zxf "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -C "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/"
|
32
|
-
fi
|
33
|
-
- |
|
34
|
-
stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/stripe-mock > /dev/null &
|
35
|
-
STRIPE_MOCK_PID=$!
|
36
|
-
|
37
|
-
script:
|
38
|
-
- bundle exec rake
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class AlipayAccount < APIResource
|
3
|
-
include Stripe::APIOperations::Save
|
4
|
-
include Stripe::APIOperations::Delete
|
5
|
-
|
6
|
-
OBJECT_NAME = "alipay_account".freeze
|
7
|
-
|
8
|
-
def resource_url
|
9
|
-
if !respond_to?(:customer) || customer.nil?
|
10
|
-
raise NotImplementedError,
|
11
|
-
"Alipay accounts cannot be accessed without a customer ID."
|
12
|
-
end
|
13
|
-
|
14
|
-
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.update(_id, _params = nil, _opts = nil)
|
18
|
-
raise NotImplementedError, "Alipay accounts cannot be updated without a customer ID. Update an Alipay account by `a = customer.sources.retrieve('alipay_account_id'); a.save`"
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.retrieve(_id, _opts = nil)
|
22
|
-
raise NotImplementedError, "Alipay accounts cannot be retrieved without a customer ID. Retrieve an Alipay account using customer.sources.retrieve('alipay_account_id')"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class ApplicationFee < APIResource
|
3
|
-
extend Stripe::APIOperations::List
|
4
|
-
extend Stripe::APIOperations::NestedResource
|
5
|
-
|
6
|
-
OBJECT_NAME = "application_fee".freeze
|
7
|
-
|
8
|
-
nested_resource_class_methods :refund, operations: %i[create retrieve update list]
|
9
|
-
|
10
|
-
def self.resource_url
|
11
|
-
"/v1/application_fees"
|
12
|
-
end
|
13
|
-
|
14
|
-
# If you don't need access to an updated fee object after the refund, it's
|
15
|
-
# more performant to just call `fee.refunds.create` directly.
|
16
|
-
def refund(params = {}, opts = {})
|
17
|
-
refunds.create(params, opts)
|
18
|
-
|
19
|
-
# now that a refund has been created, we expect the state of this object
|
20
|
-
# to change as well (i.e. `refunded` will now be `true`) so refresh it
|
21
|
-
# from the server
|
22
|
-
refresh
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class ApplicationFeeRefund < APIResource
|
3
|
-
include Stripe::APIOperations::Save
|
4
|
-
extend Stripe::APIOperations::List
|
5
|
-
|
6
|
-
OBJECT_NAME = "fee_refund".freeze
|
7
|
-
|
8
|
-
def resource_url
|
9
|
-
"#{ApplicationFee.resource_url}/#{CGI.escape(fee)}/refunds/#{CGI.escape(id)}"
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.update(_id, _params = nil, _opts = nil)
|
13
|
-
raise NotImplementedError, "Refunds cannot be updated without an application fee ID. Update a refund by using `a = appfee.refunds.retrieve('refund_id'); a.save`"
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.retrieve(_id, _api_key = nil)
|
17
|
-
raise NotImplementedError, "Refunds cannot be retrieved without an application fee ID. Retrieve a refund using appfee.refunds.retrieve('refund_id')"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/stripe/balance.rb
DELETED
data/lib/stripe/bank_account.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class BankAccount < APIResource
|
3
|
-
include Stripe::APIOperations::Save
|
4
|
-
include Stripe::APIOperations::Delete
|
5
|
-
extend Stripe::APIOperations::List
|
6
|
-
|
7
|
-
OBJECT_NAME = "bank_account".freeze
|
8
|
-
|
9
|
-
def verify(params = {}, opts = {})
|
10
|
-
resp, opts = request(:post, resource_url + "/verify", params, opts)
|
11
|
-
initialize_from(resp.data, opts)
|
12
|
-
end
|
13
|
-
|
14
|
-
def resource_url
|
15
|
-
if respond_to?(:customer)
|
16
|
-
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
17
|
-
elsif respond_to?(:account)
|
18
|
-
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.update(_id, _params = nil, _opts = nil)
|
23
|
-
raise NotImplementedError, "Bank accounts cannot be updated without an account ID. Update a bank account by using `a = account.external_accounts.retrieve('card_id'); a.save`"
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.retrieve(_id, _opts = nil)
|
27
|
-
raise NotImplementedError, "Bank accounts cannot be retrieved without an account ID. Retrieve a bank account using account.external_accounts.retrieve('card_id')"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class BitcoinTransaction < APIResource
|
3
|
-
# Directly retrieving BitcoinTransactions is deprecated. Please use the
|
4
|
-
# Sources API instead: https://stripe.com/docs/sources/bitcoin
|
5
|
-
extend Stripe::APIOperations::List
|
6
|
-
|
7
|
-
OBJECT_NAME = "bitcoin_transaction".freeze
|
8
|
-
|
9
|
-
def self.resource_url
|
10
|
-
"/v1/bitcoin/transactions"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/lib/stripe/charge.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class Charge < APIResource
|
3
|
-
extend Stripe::APIOperations::List
|
4
|
-
extend Stripe::APIOperations::Create
|
5
|
-
include Stripe::APIOperations::Save
|
6
|
-
|
7
|
-
OBJECT_NAME = "charge".freeze
|
8
|
-
|
9
|
-
def refund(params = {}, opts = {})
|
10
|
-
# Old versions of charge objects included a `refunds` field that was just
|
11
|
-
# a vanilla array instead of a Stripe list object.
|
12
|
-
#
|
13
|
-
# Where possible, we'd still like to use the new refund endpoint (thus
|
14
|
-
# `self.refunds.create`), but detect the old API version by looking for
|
15
|
-
# an `Array` and fall back to the old refund URL if necessary so as to
|
16
|
-
# maintain internal compatibility.
|
17
|
-
if refunds.is_a?(Array)
|
18
|
-
resp, opts = request(:post, refund_url, params, opts)
|
19
|
-
initialize_from(resp.data, opts)
|
20
|
-
else
|
21
|
-
refunds.create(params, opts)
|
22
|
-
|
23
|
-
# now that a refund has been created, we expect the state of this object
|
24
|
-
# to change as well (i.e. `refunded` will now be `true`) so refresh it
|
25
|
-
# from the server
|
26
|
-
refresh
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def capture(params = {}, opts = {})
|
31
|
-
resp, opts = request(:post, capture_url, params, opts)
|
32
|
-
initialize_from(resp.data, opts)
|
33
|
-
end
|
34
|
-
|
35
|
-
def update_dispute(params = {}, opts = {})
|
36
|
-
resp, opts = request(:post, dispute_url, params, opts)
|
37
|
-
initialize_from({ dispute: resp.data }, opts, true)
|
38
|
-
dispute
|
39
|
-
end
|
40
|
-
|
41
|
-
def close_dispute(params = {}, opts = {})
|
42
|
-
resp, opts = request(:post, close_dispute_url, params, opts)
|
43
|
-
initialize_from(resp.data, opts)
|
44
|
-
end
|
45
|
-
|
46
|
-
def mark_as_fraudulent
|
47
|
-
params = {
|
48
|
-
fraud_details: { user_report: "fraudulent" },
|
49
|
-
}
|
50
|
-
resp, opts = request(:post, resource_url, params)
|
51
|
-
initialize_from(resp.data, opts)
|
52
|
-
end
|
53
|
-
|
54
|
-
def mark_as_safe
|
55
|
-
params = {
|
56
|
-
fraud_details: { user_report: "safe" },
|
57
|
-
}
|
58
|
-
resp, opts = request(:post, resource_url, params)
|
59
|
-
initialize_from(resp.data, opts)
|
60
|
-
end
|
61
|
-
|
62
|
-
private
|
63
|
-
|
64
|
-
def capture_url
|
65
|
-
resource_url + "/capture"
|
66
|
-
end
|
67
|
-
|
68
|
-
def dispute_url
|
69
|
-
resource_url + "/dispute"
|
70
|
-
end
|
71
|
-
|
72
|
-
def close_dispute_url
|
73
|
-
resource_url + "/dispute/close"
|
74
|
-
end
|
75
|
-
|
76
|
-
# Note that this is actually the *old* refund URL and its use is no longer
|
77
|
-
# preferred.
|
78
|
-
def refund_url
|
79
|
-
resource_url + "/refund"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
data/lib/stripe/country_spec.rb
DELETED
data/lib/stripe/customer.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class Customer < APIResource
|
3
|
-
extend Stripe::APIOperations::Create
|
4
|
-
include Stripe::APIOperations::Delete
|
5
|
-
include Stripe::APIOperations::Save
|
6
|
-
extend Stripe::APIOperations::List
|
7
|
-
extend Stripe::APIOperations::NestedResource
|
8
|
-
|
9
|
-
OBJECT_NAME = "customer".freeze
|
10
|
-
|
11
|
-
save_nested_resource :source
|
12
|
-
nested_resource_class_methods :source,
|
13
|
-
operations: %i[create retrieve update delete list]
|
14
|
-
|
15
|
-
# The API request for deleting a card or bank account and for detaching a
|
16
|
-
# source object are the same.
|
17
|
-
class << self
|
18
|
-
alias detach_source delete_source
|
19
|
-
end
|
20
|
-
|
21
|
-
def add_invoice_item(params, opts = {})
|
22
|
-
opts = @opts.merge(Util.normalize_opts(opts))
|
23
|
-
InvoiceItem.create(params.merge(customer: id), opts)
|
24
|
-
end
|
25
|
-
|
26
|
-
def invoices(params = {}, opts = {})
|
27
|
-
opts = @opts.merge(Util.normalize_opts(opts))
|
28
|
-
Invoice.all(params.merge(customer: id), opts)
|
29
|
-
end
|
30
|
-
|
31
|
-
def invoice_items(params = {}, opts = {})
|
32
|
-
opts = @opts.merge(Util.normalize_opts(opts))
|
33
|
-
InvoiceItem.all(params.merge(customer: id), opts)
|
34
|
-
end
|
35
|
-
|
36
|
-
def upcoming_invoice(params = {}, opts = {})
|
37
|
-
opts = @opts.merge(Util.normalize_opts(opts))
|
38
|
-
Invoice.upcoming(params.merge(customer: id), opts)
|
39
|
-
end
|
40
|
-
|
41
|
-
def charges(params = {}, opts = {})
|
42
|
-
opts = @opts.merge(Util.normalize_opts(opts))
|
43
|
-
Charge.all(params.merge(customer: id), opts)
|
44
|
-
end
|
45
|
-
|
46
|
-
def create_upcoming_invoice(params = {}, opts = {})
|
47
|
-
opts = @opts.merge(Util.normalize_opts(opts))
|
48
|
-
Invoice.create(params.merge(customer: id), opts)
|
49
|
-
end
|
50
|
-
|
51
|
-
def cancel_subscription(params = {}, opts = {})
|
52
|
-
resp, opts = request(:delete, subscription_url, params, opts)
|
53
|
-
initialize_from({ subscription: resp.data }, opts, true)
|
54
|
-
subscription
|
55
|
-
end
|
56
|
-
|
57
|
-
def update_subscription(params = {}, opts = {})
|
58
|
-
resp, opts = request(:post, subscription_url, params, opts)
|
59
|
-
initialize_from({ subscription: resp.data }, opts, true)
|
60
|
-
subscription
|
61
|
-
end
|
62
|
-
|
63
|
-
def create_subscription(params = {}, opts = {})
|
64
|
-
resp, opts = request(:post, subscriptions_url, params, opts)
|
65
|
-
initialize_from({ subscription: resp.data }, opts, true)
|
66
|
-
subscription
|
67
|
-
end
|
68
|
-
|
69
|
-
def delete_discount
|
70
|
-
_, opts = request(:delete, discount_url)
|
71
|
-
initialize_from({ discount: nil }, opts, true)
|
72
|
-
end
|
73
|
-
|
74
|
-
private
|
75
|
-
|
76
|
-
def discount_url
|
77
|
-
resource_url + "/discount"
|
78
|
-
end
|
79
|
-
|
80
|
-
def subscription_url
|
81
|
-
resource_url + "/subscription"
|
82
|
-
end
|
83
|
-
|
84
|
-
def subscriptions_url
|
85
|
-
resource_url + "/subscriptions"
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
data/lib/stripe/dispute.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class Dispute < APIResource
|
3
|
-
extend Stripe::APIOperations::List
|
4
|
-
include Stripe::APIOperations::Save
|
5
|
-
|
6
|
-
OBJECT_NAME = "dispute".freeze
|
7
|
-
|
8
|
-
def close(params = {}, opts = {})
|
9
|
-
resp, opts = request(:post, close_url, params, opts)
|
10
|
-
initialize_from(resp.data, opts)
|
11
|
-
end
|
12
|
-
|
13
|
-
def close_url
|
14
|
-
resource_url + "/close"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/lib/stripe/ephemeral_key.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class EphemeralKey < APIResource
|
3
|
-
extend Stripe::APIOperations::Create
|
4
|
-
include Stripe::APIOperations::Delete
|
5
|
-
|
6
|
-
OBJECT_NAME = "ephemeral_key".freeze
|
7
|
-
|
8
|
-
def self.resource_url
|
9
|
-
"/v1/ephemeral_keys"
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.create(params = {}, opts = {})
|
13
|
-
opts = Util.normalize_opts(opts)
|
14
|
-
raise ArgumentError, "stripe_version must be specified to create an ephemeral key" unless opts[:stripe_version]
|
15
|
-
super
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/stripe/event.rb
DELETED
data/lib/stripe/exchange_rate.rb
DELETED
data/lib/stripe/file_upload.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require "tempfile"
|
2
|
-
|
3
|
-
module Stripe
|
4
|
-
class FileUpload < APIResource
|
5
|
-
extend Stripe::APIOperations::Create
|
6
|
-
extend Stripe::APIOperations::List
|
7
|
-
|
8
|
-
OBJECT_NAME = "file_upload".freeze
|
9
|
-
|
10
|
-
def self.resource_url
|
11
|
-
"/v1/files"
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.request(method, url, params = {}, opts = {})
|
15
|
-
opts = {
|
16
|
-
api_base: Stripe.uploads_base,
|
17
|
-
}.merge(Util.normalize_opts(opts))
|
18
|
-
super
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.create(params = {}, opts = {})
|
22
|
-
# rest-client would accept a vanilla `File` for upload, but Faraday does
|
23
|
-
# not. Support the old API by wrapping a `File` with an `UploadIO` object
|
24
|
-
# if we're given one.
|
25
|
-
if params[:file] && [File, Tempfile].any? { |klass| params[:file].is_a?(klass) }
|
26
|
-
params[:file] = Faraday::UploadIO.new(params[:file], nil)
|
27
|
-
end
|
28
|
-
|
29
|
-
opts = {
|
30
|
-
content_type: "multipart/form-data",
|
31
|
-
}.merge(Util.normalize_opts(opts))
|
32
|
-
super
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
data/lib/stripe/invoice.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class Invoice < APIResource
|
3
|
-
extend Stripe::APIOperations::List
|
4
|
-
include Stripe::APIOperations::Save
|
5
|
-
extend Stripe::APIOperations::Create
|
6
|
-
|
7
|
-
OBJECT_NAME = "invoice".freeze
|
8
|
-
|
9
|
-
def self.upcoming(params, opts = {})
|
10
|
-
params[:subscription_items] = Util.array_to_hash(params[:subscription_items]) if params[:subscription_items]
|
11
|
-
resp, opts = request(:get, upcoming_url, params, opts)
|
12
|
-
Util.convert_to_stripe_object(resp.data, opts)
|
13
|
-
end
|
14
|
-
|
15
|
-
def pay(params = {}, opts = {})
|
16
|
-
resp, opts = request(:post, pay_url, params, opts)
|
17
|
-
initialize_from(resp.data, opts)
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.upcoming_url
|
21
|
-
resource_url + "/upcoming"
|
22
|
-
end
|
23
|
-
private_class_method :upcoming_url
|
24
|
-
|
25
|
-
def pay_url
|
26
|
-
resource_url + "/pay"
|
27
|
-
end
|
28
|
-
private :pay_url
|
29
|
-
end
|
30
|
-
end
|
data/lib/stripe/login_link.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class LoginLink < APIResource
|
3
|
-
OBJECT_NAME = "login_link".freeze
|
4
|
-
|
5
|
-
def self.retrieve(_id, _opts = nil)
|
6
|
-
raise NotImplementedError, "Login links do not have IDs and cannot be retrieved. They can only be created using accounts.login_links.create"
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
data/lib/stripe/order.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class Order < APIResource
|
3
|
-
extend Stripe::APIOperations::List
|
4
|
-
extend Stripe::APIOperations::Create
|
5
|
-
include Stripe::APIOperations::Save
|
6
|
-
|
7
|
-
OBJECT_NAME = "order".freeze
|
8
|
-
|
9
|
-
def pay(params, opts = {})
|
10
|
-
resp, opts = request(:post, pay_url, params, opts)
|
11
|
-
initialize_from(resp.data, opts)
|
12
|
-
end
|
13
|
-
|
14
|
-
def return_order(params, opts = {})
|
15
|
-
params[:items] = Util.array_to_hash(params[:items]) if params[:items]
|
16
|
-
resp, opts = request(:post, returns_url, params, opts)
|
17
|
-
Util.convert_to_stripe_object(resp.data, opts)
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.create(params = {}, opts = {})
|
21
|
-
params[:items] = Util.array_to_hash(params[:items]) if params[:items]
|
22
|
-
super(params, opts)
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def pay_url
|
28
|
-
resource_url + "/pay"
|
29
|
-
end
|
30
|
-
|
31
|
-
def returns_url
|
32
|
-
resource_url + "/returns"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
data/lib/stripe/order_return.rb
DELETED
data/lib/stripe/payout.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class Payout < APIResource
|
3
|
-
extend Stripe::APIOperations::List
|
4
|
-
extend Stripe::APIOperations::Create
|
5
|
-
include Stripe::APIOperations::Save
|
6
|
-
|
7
|
-
OBJECT_NAME = "payout".freeze
|
8
|
-
|
9
|
-
def cancel
|
10
|
-
resp, api_key = request(:post, cancel_url)
|
11
|
-
initialize_from(resp.data, api_key)
|
12
|
-
end
|
13
|
-
|
14
|
-
def cancel_url
|
15
|
-
resource_url + "/cancel"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/stripe/reversal.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class Reversal < APIResource
|
3
|
-
extend Stripe::APIOperations::List
|
4
|
-
include Stripe::APIOperations::Save
|
5
|
-
|
6
|
-
OBJECT_NAME = "transfer_reversal".freeze
|
7
|
-
|
8
|
-
def resource_url
|
9
|
-
"#{Transfer.resource_url}/#{CGI.escape(transfer)}/reversals/#{CGI.escape(id)}"
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.update(_id, _params = nil, _opts = nil)
|
13
|
-
raise NotImplementedError, "Reversals cannot be updated without a transfer ID. Update a reversal using `r = transfer.reversals.retrieve('reversal_id'); r.save`"
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.retrieve(_id, _opts = {})
|
17
|
-
raise NotImplementedError, "Reversals cannot be retrieved without a transfer ID. Retrieve a reversal using transfer.reversals.retrieve('reversal_id')"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|