stripe 4.18.1 → 4.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +3 -0
- data/README.md +9 -9
- data/VERSION +1 -1
- data/lib/stripe.rb +2 -75
- data/lib/stripe/object_types.rb +97 -0
- data/lib/stripe/resources.rb +78 -0
- data/lib/stripe/{account.rb → resources/account.rb} +13 -12
- data/lib/stripe/{account_link.rb → resources/account_link.rb} +0 -0
- data/lib/stripe/{alipay_account.rb → resources/alipay_account.rb} +0 -0
- data/lib/stripe/{apple_pay_domain.rb → resources/apple_pay_domain.rb} +0 -0
- data/lib/stripe/{application_fee.rb → resources/application_fee.rb} +0 -0
- data/lib/stripe/{application_fee_refund.rb → resources/application_fee_refund.rb} +0 -0
- data/lib/stripe/{balance.rb → resources/balance.rb} +0 -0
- data/lib/stripe/{balance_transaction.rb → resources/balance_transaction.rb} +0 -0
- data/lib/stripe/{bank_account.rb → resources/bank_account.rb} +2 -4
- data/lib/stripe/{bitcoin_receiver.rb → resources/bitcoin_receiver.rb} +3 -4
- data/lib/stripe/{bitcoin_transaction.rb → resources/bitcoin_transaction.rb} +0 -0
- data/lib/stripe/{capability.rb → resources/capability.rb} +0 -0
- data/lib/stripe/{card.rb → resources/card.rb} +3 -6
- data/lib/stripe/{charge.rb → resources/charge.rb} +0 -0
- data/lib/stripe/{checkout → resources/checkout}/session.rb +0 -0
- data/lib/stripe/{country_spec.rb → resources/country_spec.rb} +0 -0
- data/lib/stripe/{coupon.rb → resources/coupon.rb} +0 -0
- data/lib/stripe/{credit_note.rb → resources/credit_note.rb} +1 -1
- data/lib/stripe/{customer.rb → resources/customer.rb} +8 -5
- data/lib/stripe/resources/customer_balance_transaction.rb +30 -0
- data/lib/stripe/{discount.rb → resources/discount.rb} +0 -0
- data/lib/stripe/{dispute.rb → resources/dispute.rb} +1 -1
- data/lib/stripe/{ephemeral_key.rb → resources/ephemeral_key.rb} +0 -0
- data/lib/stripe/{event.rb → resources/event.rb} +0 -0
- data/lib/stripe/{exchange_rate.rb → resources/exchange_rate.rb} +0 -0
- data/lib/stripe/{file.rb → resources/file.rb} +4 -1
- data/lib/stripe/{file_link.rb → resources/file_link.rb} +0 -0
- data/lib/stripe/{invoice.rb → resources/invoice.rb} +6 -7
- data/lib/stripe/{invoice_item.rb → resources/invoice_item.rb} +0 -0
- data/lib/stripe/{invoice_line_item.rb → resources/invoice_line_item.rb} +0 -0
- data/lib/stripe/{issuer_fraud_record.rb → resources/issuer_fraud_record.rb} +0 -0
- data/lib/stripe/{issuing → resources/issuing}/authorization.rb +2 -2
- data/lib/stripe/{issuing → resources/issuing}/card.rb +0 -0
- data/lib/stripe/{issuing → resources/issuing}/card_details.rb +0 -0
- data/lib/stripe/{issuing → resources/issuing}/cardholder.rb +0 -0
- data/lib/stripe/{issuing → resources/issuing}/dispute.rb +0 -0
- data/lib/stripe/{issuing → resources/issuing}/transaction.rb +0 -0
- data/lib/stripe/{login_link.rb → resources/login_link.rb} +0 -0
- data/lib/stripe/{order.rb → resources/order.rb} +4 -4
- data/lib/stripe/{order_return.rb → resources/order_return.rb} +0 -0
- data/lib/stripe/{payment_intent.rb → resources/payment_intent.rb} +3 -3
- data/lib/stripe/{payment_method.rb → resources/payment_method.rb} +2 -2
- data/lib/stripe/{payout.rb → resources/payout.rb} +1 -1
- data/lib/stripe/{person.rb → resources/person.rb} +0 -0
- data/lib/stripe/{plan.rb → resources/plan.rb} +0 -0
- data/lib/stripe/{product.rb → resources/product.rb} +0 -0
- data/lib/stripe/{radar → resources/radar}/early_fraud_warning.rb +0 -0
- data/lib/stripe/{radar → resources/radar}/value_list.rb +0 -0
- data/lib/stripe/{radar → resources/radar}/value_list_item.rb +0 -0
- data/lib/stripe/{recipient.rb → resources/recipient.rb} +0 -0
- data/lib/stripe/{recipient_transfer.rb → resources/recipient_transfer.rb} +0 -0
- data/lib/stripe/{refund.rb → resources/refund.rb} +0 -0
- data/lib/stripe/{reporting → resources/reporting}/report_run.rb +0 -0
- data/lib/stripe/{reporting → resources/reporting}/report_type.rb +0 -0
- data/lib/stripe/{reversal.rb → resources/reversal.rb} +0 -0
- data/lib/stripe/{review.rb → resources/review.rb} +1 -1
- data/lib/stripe/{sigma → resources/sigma}/scheduled_query_run.rb +0 -0
- data/lib/stripe/{sku.rb → resources/sku.rb} +0 -0
- data/lib/stripe/{source.rb → resources/source.rb} +5 -5
- data/lib/stripe/{source_transaction.rb → resources/source_transaction.rb} +0 -0
- data/lib/stripe/{subscription.rb → resources/subscription.rb} +2 -2
- data/lib/stripe/{subscription_item.rb → resources/subscription_item.rb} +1 -2
- data/lib/stripe/{subscription_schedule.rb → resources/subscription_schedule.rb} +5 -8
- data/lib/stripe/{subscription_schedule_revision.rb → resources/subscription_schedule_revision.rb} +0 -0
- data/lib/stripe/{tax_id.rb → resources/tax_id.rb} +0 -0
- data/lib/stripe/{tax_rate.rb → resources/tax_rate.rb} +0 -0
- data/lib/stripe/{terminal → resources/terminal}/connection_token.rb +0 -0
- data/lib/stripe/{terminal → resources/terminal}/location.rb +0 -0
- data/lib/stripe/{terminal → resources/terminal}/reader.rb +0 -0
- data/lib/stripe/{three_d_secure.rb → resources/three_d_secure.rb} +0 -0
- data/lib/stripe/{token.rb → resources/token.rb} +0 -0
- data/lib/stripe/{topup.rb → resources/topup.rb} +1 -1
- data/lib/stripe/{transfer.rb → resources/transfer.rb} +4 -3
- data/lib/stripe/{usage_record.rb → resources/usage_record.rb} +0 -0
- data/lib/stripe/{usage_record_summary.rb → resources/usage_record_summary.rb} +0 -0
- data/lib/stripe/{webhook_endpoint.rb → resources/webhook_endpoint.rb} +0 -0
- data/lib/stripe/util.rb +2 -85
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/customer_balance_transaction_test.rb +37 -0
- data/test/stripe/customer_test.rb +43 -0
- data/test/test_helper.rb +1 -1
- metadata +82 -77
File without changes
|
File without changes
|
@@ -10,14 +10,11 @@ module Stripe
|
|
10
10
|
|
11
11
|
def resource_url
|
12
12
|
if respond_to?(:recipient) && !recipient.nil? && !recipient.empty?
|
13
|
-
"#{Recipient.resource_url}/#{CGI.escape(recipient)}/cards"
|
14
|
-
"/#{CGI.escape(id)}"
|
13
|
+
"#{Recipient.resource_url}/#{CGI.escape(recipient)}/cards/#{CGI.escape(id)}"
|
15
14
|
elsif respond_to?(:customer) && !customer.nil? && !customer.empty?
|
16
|
-
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources"
|
17
|
-
"/#{CGI.escape(id)}"
|
15
|
+
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
18
16
|
elsif respond_to?(:account) && !account.nil? && !account.empty?
|
19
|
-
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts"
|
20
|
-
"/#{CGI.escape(id)}"
|
17
|
+
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
|
21
18
|
end
|
22
19
|
end
|
23
20
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -4,20 +4,23 @@ module Stripe
|
|
4
4
|
class Customer < APIResource
|
5
5
|
extend Stripe::APIOperations::Create
|
6
6
|
include Stripe::APIOperations::Delete
|
7
|
-
include Stripe::APIOperations::Save
|
8
7
|
extend Stripe::APIOperations::List
|
8
|
+
include Stripe::APIOperations::Save
|
9
9
|
extend Stripe::APIOperations::NestedResource
|
10
10
|
|
11
11
|
OBJECT_NAME = "customer".freeze
|
12
12
|
|
13
|
+
nested_resource_class_methods :tax_id,
|
14
|
+
operations: %i[create retrieve delete list]
|
15
|
+
|
13
16
|
custom_method :delete_discount, http_verb: :delete, http_path: "discount"
|
14
17
|
|
15
18
|
save_nested_resource :source
|
16
19
|
nested_resource_class_methods :source,
|
17
|
-
operations: %i[create retrieve update delete
|
18
|
-
|
19
|
-
nested_resource_class_methods :
|
20
|
-
operations: %i[create retrieve
|
20
|
+
operations: %i[create retrieve update delete list]
|
21
|
+
|
22
|
+
nested_resource_class_methods :balance_transaction,
|
23
|
+
operations: %i[create retrieve update list]
|
21
24
|
|
22
25
|
# The API request for deleting a card or bank account and for detaching a
|
23
26
|
# source object are the same.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class CustomerBalanceTransaction < APIResource
|
5
|
+
extend Stripe::APIOperations::List
|
6
|
+
include Stripe::APIOperations::Save
|
7
|
+
|
8
|
+
OBJECT_NAME = "customer_balance_transaction".freeze
|
9
|
+
|
10
|
+
def resource_url
|
11
|
+
if !respond_to?(:customer) || customer.nil?
|
12
|
+
raise NotImplementedError,
|
13
|
+
"Customer Balance Transactions cannot be accessed without a customer ID."
|
14
|
+
end
|
15
|
+
"#{Customer.resource_url}/#{CGI.escape(customer)}/balance_transactions/#{CGI.escape(id)}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.retrieve(_id, _opts = {})
|
19
|
+
raise NotImplementedError,
|
20
|
+
"Customer Balance Transactions cannot be retrieved without a customer ID. " \
|
21
|
+
"Retrieve a Customer Balance Transaction using Customer.retrieve_balance_transaction('cus_123', 'cbtxn_123')"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.update(_id, _params = nil, _opts = nil)
|
25
|
+
raise NotImplementedError,
|
26
|
+
"Customer Balance Transactions cannot be retrieved without a customer ID. " \
|
27
|
+
"Update a Customer Balance Transaction using Customer.update_balance_transaction('cus_123', 'cbtxn_123', params)"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -5,11 +5,12 @@ module Stripe
|
|
5
5
|
extend Stripe::APIOperations::Create
|
6
6
|
extend Stripe::APIOperations::List
|
7
7
|
|
8
|
+
OBJECT_NAME = "file".freeze
|
9
|
+
|
8
10
|
# This resource can have two different object names. In latter API
|
9
11
|
# versions, only `file` is used, but since stripe-ruby may be used with
|
10
12
|
# any API version, we need to support deserializing the older
|
11
13
|
# `file_upload` object into the same class.
|
12
|
-
OBJECT_NAME = "file".freeze
|
13
14
|
OBJECT_NAME_ALT = "file_upload".freeze
|
14
15
|
|
15
16
|
def self.resource_url
|
@@ -35,7 +36,9 @@ module Stripe
|
|
35
36
|
super
|
36
37
|
end
|
37
38
|
end
|
39
|
+
end
|
38
40
|
|
41
|
+
module Stripe
|
39
42
|
# For backwards compatibility, the `File` class is aliased to `FileUpload`.
|
40
43
|
FileUpload = File
|
41
44
|
end
|
File without changes
|
@@ -17,28 +17,27 @@ module Stripe
|
|
17
17
|
|
18
18
|
def finalize_invoice(params = {}, opts = {})
|
19
19
|
resp, opts = request(:post, resource_url + "/finalize", params, opts)
|
20
|
-
|
20
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
21
21
|
end
|
22
22
|
|
23
23
|
def mark_uncollectible(params = {}, opts = {})
|
24
|
-
resp, opts = request(:post, resource_url + "/mark_uncollectible", params,
|
25
|
-
|
26
|
-
initialize_from(resp.data, opts)
|
24
|
+
resp, opts = request(:post, resource_url + "/mark_uncollectible", params, opts)
|
25
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
27
26
|
end
|
28
27
|
|
29
28
|
def pay(params = {}, opts = {})
|
30
29
|
resp, opts = request(:post, resource_url + "/pay", params, opts)
|
31
|
-
|
30
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
32
31
|
end
|
33
32
|
|
34
33
|
def send_invoice(params = {}, opts = {})
|
35
34
|
resp, opts = request(:post, resource_url + "/send", params, opts)
|
36
|
-
|
35
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
37
36
|
end
|
38
37
|
|
39
38
|
def void_invoice(params = {}, opts = {})
|
40
39
|
resp, opts = request(:post, resource_url + "/void", params, opts)
|
41
|
-
|
40
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
42
41
|
end
|
43
42
|
|
44
43
|
def self.upcoming(params, opts = {})
|
File without changes
|
File without changes
|
File without changes
|
@@ -13,12 +13,12 @@ module Stripe
|
|
13
13
|
|
14
14
|
def approve(params = {}, opts = {})
|
15
15
|
resp, opts = request(:post, resource_url + "/approve", params, opts)
|
16
|
-
|
16
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
17
17
|
end
|
18
18
|
|
19
19
|
def decline(params = {}, opts = {})
|
20
20
|
resp, opts = request(:post, resource_url + "/decline", params, opts)
|
21
|
-
|
21
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -12,12 +12,12 @@ module Stripe
|
|
12
12
|
custom_method :return_order, http_verb: :post, http_path: "returns"
|
13
13
|
|
14
14
|
def pay(params = {}, opts = {})
|
15
|
-
resp, opts = request(:post,
|
16
|
-
|
15
|
+
resp, opts = request(:post, resource_url + "/pay", params, opts)
|
16
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
17
17
|
end
|
18
18
|
|
19
|
-
def return_order(params, opts = {})
|
20
|
-
resp, opts = request(:post,
|
19
|
+
def return_order(params = {}, opts = {})
|
20
|
+
resp, opts = request(:post, resource_url + "/returns", params, opts)
|
21
21
|
Util.convert_to_stripe_object(resp.data, opts)
|
22
22
|
end
|
23
23
|
|
File without changes
|
@@ -14,17 +14,17 @@ module Stripe
|
|
14
14
|
|
15
15
|
def cancel(params = {}, opts = {})
|
16
16
|
resp, opts = request(:post, resource_url + "/cancel", params, opts)
|
17
|
-
|
17
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
18
18
|
end
|
19
19
|
|
20
20
|
def capture(params = {}, opts = {})
|
21
21
|
resp, opts = request(:post, resource_url + "/capture", params, opts)
|
22
|
-
|
22
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
23
23
|
end
|
24
24
|
|
25
25
|
def confirm(params = {}, opts = {})
|
26
26
|
resp, opts = request(:post, resource_url + "/confirm", params, opts)
|
27
|
-
|
27
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -13,12 +13,12 @@ module Stripe
|
|
13
13
|
|
14
14
|
def attach(params = {}, opts = {})
|
15
15
|
resp, opts = request(:post, resource_url + "/attach", params, opts)
|
16
|
-
|
16
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
17
17
|
end
|
18
18
|
|
19
19
|
def detach(params = {}, opts = {})
|
20
20
|
resp, opts = request(:post, resource_url + "/detach", params, opts)
|
21
|
-
|
21
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -9,6 +9,11 @@ module Stripe
|
|
9
9
|
|
10
10
|
custom_method :verify, http_verb: :post
|
11
11
|
|
12
|
+
def verify(params = {}, opts = {})
|
13
|
+
resp, opts = request(:post, resource_url + "/verify", params, opts)
|
14
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
15
|
+
end
|
16
|
+
|
12
17
|
def detach(params = {}, opts = {})
|
13
18
|
if !respond_to?(:customer) || customer.nil? || customer.empty?
|
14
19
|
raise NotImplementedError,
|
@@ -33,10 +38,5 @@ module Stripe
|
|
33
38
|
opts)
|
34
39
|
Util.convert_to_stripe_object(resp.data, opts)
|
35
40
|
end
|
36
|
-
|
37
|
-
def verify(params = {}, opts = {})
|
38
|
-
resp, opts = request(:post, resource_url + "/verify", params, opts)
|
39
|
-
initialize_from(resp.data, opts)
|
40
|
-
end
|
41
41
|
end
|
42
42
|
end
|
File without changes
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module Stripe
|
4
4
|
class Subscription < APIResource
|
5
|
-
extend Stripe::APIOperations::List
|
6
5
|
extend Stripe::APIOperations::Create
|
7
|
-
include Stripe::APIOperations::Save
|
8
6
|
include Stripe::APIOperations::Delete
|
7
|
+
extend Stripe::APIOperations::List
|
8
|
+
include Stripe::APIOperations::Save
|
9
9
|
|
10
10
|
OBJECT_NAME = "subscription".freeze
|
11
11
|
|
@@ -10,8 +10,7 @@ module Stripe
|
|
10
10
|
OBJECT_NAME = "subscription_item".freeze
|
11
11
|
|
12
12
|
def usage_record_summaries(params = {}, opts = {})
|
13
|
-
resp, opts = request(:get, resource_url + "/usage_record_summaries",
|
14
|
-
params, opts)
|
13
|
+
resp, opts = request(:get, resource_url + "/usage_record_summaries", params, opts)
|
15
14
|
Util.convert_to_stripe_object(resp.data, opts)
|
16
15
|
end
|
17
16
|
end
|
@@ -12,19 +12,16 @@ module Stripe
|
|
12
12
|
custom_method :cancel, http_verb: :post
|
13
13
|
custom_method :release, http_verb: :post
|
14
14
|
|
15
|
-
nested_resource_class_methods :revision,
|
16
|
-
operations: %i[retrieve list]
|
15
|
+
nested_resource_class_methods :revision, operations: %i[retrieve list]
|
17
16
|
|
18
17
|
def cancel(params = {}, opts = {})
|
19
|
-
|
20
|
-
resp, opts
|
21
|
-
initialize_from(resp.data, opts)
|
18
|
+
resp, opts = request(:post, resource_url + "/cancel", params, opts)
|
19
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
22
20
|
end
|
23
21
|
|
24
22
|
def release(params = {}, opts = {})
|
25
|
-
|
26
|
-
resp, opts
|
27
|
-
initialize_from(resp.data, opts)
|
23
|
+
resp, opts = request(:post, resource_url + "/release", params, opts)
|
24
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
28
25
|
end
|
29
26
|
|
30
27
|
def revisions(params = {}, opts = {})
|
data/lib/stripe/{subscription_schedule_revision.rb → resources/subscription_schedule_revision.rb}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -14,13 +14,14 @@ module Stripe
|
|
14
14
|
nested_resource_class_methods :reversal,
|
15
15
|
operations: %i[create retrieve update list]
|
16
16
|
|
17
|
-
def cancel
|
18
|
-
resp,
|
19
|
-
|
17
|
+
def cancel(params = {}, opts = {})
|
18
|
+
resp, opts = request(:post, resource_url + "/cancel", params, opts)
|
19
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
20
20
|
end
|
21
21
|
|
22
22
|
def cancel_url
|
23
23
|
resource_url + "/cancel"
|
24
24
|
end
|
25
|
+
deprecate :cancel_url, :none, 2019, 11
|
25
26
|
end
|
26
27
|
end
|