stripe 4.18.1 → 5.42.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 +232 -1
- data/CODE_OF_CONDUCT.md +77 -0
- data/Gemfile +10 -16
- data/README.md +168 -63
- data/Rakefile +8 -7
- data/VERSION +1 -1
- data/lib/stripe/api_operations/create.rb +1 -1
- data/lib/stripe/api_operations/delete.rb +7 -3
- data/lib/stripe/api_operations/list.rb +1 -12
- data/lib/stripe/api_operations/nested_resource.rb +29 -26
- data/lib/stripe/api_operations/request.rb +82 -6
- data/lib/stripe/api_operations/save.rb +7 -4
- data/lib/stripe/api_resource.rb +27 -2
- data/lib/stripe/connection_manager.rb +200 -0
- data/lib/stripe/error_object.rb +93 -0
- data/lib/stripe/errors.rb +24 -3
- data/lib/stripe/instrumentation.rb +84 -0
- data/lib/stripe/list_object.rb +34 -5
- data/lib/stripe/multipart_encoder.rb +131 -0
- data/lib/stripe/oauth.rb +8 -6
- data/lib/stripe/object_types.rb +108 -0
- data/lib/stripe/{account.rb → resources/account.rb} +23 -26
- data/lib/stripe/{account_link.rb → resources/account_link.rb} +2 -1
- data/lib/stripe/{alipay_account.rb → resources/alipay_account.rb} +1 -1
- data/lib/stripe/{apple_pay_domain.rb → resources/apple_pay_domain.rb} +2 -1
- data/lib/stripe/resources/application_fee.rb +14 -0
- data/lib/stripe/{application_fee_refund.rb → resources/application_fee_refund.rb} +3 -2
- data/lib/stripe/{balance.rb → resources/balance.rb} +2 -1
- data/lib/stripe/{balance_transaction.rb → resources/balance_transaction.rb} +2 -5
- data/lib/stripe/{bank_account.rb → resources/bank_account.rb} +5 -6
- data/lib/stripe/{issuing/dispute.rb → resources/billing_portal/configuration.rb} +4 -3
- data/lib/stripe/{checkout → resources/billing_portal}/session.rb +3 -2
- data/lib/stripe/{bitcoin_receiver.rb → resources/bitcoin_receiver.rb} +5 -5
- data/lib/stripe/resources/bitcoin_transaction.rb +16 -0
- data/lib/stripe/{capability.rb → resources/capability.rb} +3 -2
- data/lib/stripe/{card.rb → resources/card.rb} +5 -7
- data/lib/stripe/resources/charge.rb +23 -0
- data/lib/stripe/resources/checkout/session.rb +27 -0
- data/lib/stripe/{country_spec.rb → resources/country_spec.rb} +2 -1
- data/lib/stripe/{coupon.rb → resources/coupon.rb} +2 -1
- 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/{discount.rb → resources/discount.rb} +2 -1
- data/lib/stripe/resources/dispute.rb +22 -0
- data/lib/stripe/{ephemeral_key.rb → resources/ephemeral_key.rb} +2 -1
- data/lib/stripe/{event.rb → resources/event.rb} +2 -1
- data/lib/stripe/{exchange_rate.rb → resources/exchange_rate.rb} +2 -1
- data/lib/stripe/{file.rb → resources/file.rb} +7 -12
- data/lib/stripe/{file_link.rb → resources/file_link.rb} +2 -1
- 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} +2 -1
- data/lib/stripe/{invoice_line_item.rb → resources/invoice_line_item.rb} +2 -1
- data/lib/stripe/{issuing → resources/issuing}/authorization.rb +14 -5
- data/lib/stripe/{issuing → resources/issuing}/card.rb +8 -3
- data/lib/stripe/resources/issuing/card_details.rb +10 -0
- data/lib/stripe/{issuing → resources/issuing}/cardholder.rb +2 -1
- data/lib/stripe/resources/issuing/dispute.rb +25 -0
- data/lib/stripe/{issuing → resources/issuing}/transaction.rb +2 -1
- data/lib/stripe/resources/line_item.rb +8 -0
- data/lib/stripe/{login_link.rb → resources/login_link.rb} +2 -1
- data/lib/stripe/resources/mandate.rb +8 -0
- data/lib/stripe/resources/order.rb +33 -0
- data/lib/stripe/{order_return.rb → resources/order_return.rb} +2 -1
- data/lib/stripe/resources/payment_intent.rb +43 -0
- data/lib/stripe/{payment_method.rb → resources/payment_method.rb} +14 -5
- data/lib/stripe/resources/payout.rb +33 -0
- data/lib/stripe/{person.rb → resources/person.rb} +2 -1
- data/lib/stripe/{plan.rb → resources/plan.rb} +2 -1
- data/lib/stripe/resources/price.rb +12 -0
- data/lib/stripe/{product.rb → resources/product.rb} +2 -1
- data/lib/stripe/resources/promotion_code.rb +12 -0
- data/lib/stripe/resources/quote.rb +105 -0
- data/lib/stripe/{radar → resources/radar}/early_fraud_warning.rb +2 -1
- data/lib/stripe/{radar → resources/radar}/value_list.rb +2 -1
- data/lib/stripe/{radar → resources/radar}/value_list_item.rb +2 -1
- data/lib/stripe/{recipient.rb → resources/recipient.rb} +2 -5
- data/lib/stripe/{recipient_transfer.rb → resources/recipient_transfer.rb} +1 -1
- data/lib/stripe/{refund.rb → resources/refund.rb} +2 -1
- data/lib/stripe/{reporting → resources/reporting}/report_run.rb +2 -1
- data/lib/stripe/{reporting → resources/reporting}/report_type.rb +2 -1
- data/lib/stripe/{reversal.rb → resources/reversal.rb} +4 -3
- data/lib/stripe/{review.rb → resources/review.rb} +8 -3
- data/lib/stripe/resources/setup_attempt.rb +10 -0
- data/lib/stripe/resources/setup_intent.rb +33 -0
- data/lib/stripe/resources/shipping_rate.rb +12 -0
- data/lib/stripe/{sigma → resources/sigma}/scheduled_query_run.rb +2 -1
- data/lib/stripe/{sku.rb → resources/sku.rb} +2 -1
- data/lib/stripe/{source.rb → resources/source.rb} +20 -15
- data/lib/stripe/{source_transaction.rb → resources/source_transaction.rb} +2 -1
- data/lib/stripe/{subscription.rb → resources/subscription.rb} +12 -11
- 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/{tax_id.rb → resources/tax_id.rb} +2 -1
- data/lib/stripe/{tax_rate.rb → resources/tax_rate.rb} +2 -1
- data/lib/stripe/{terminal → resources/terminal}/connection_token.rb +2 -1
- data/lib/stripe/{terminal → resources/terminal}/location.rb +2 -1
- data/lib/stripe/{terminal → resources/terminal}/reader.rb +2 -1
- data/lib/stripe/{three_d_secure.rb → resources/three_d_secure.rb} +2 -1
- data/lib/stripe/{token.rb → resources/token.rb} +2 -1
- data/lib/stripe/{topup.rb → resources/topup.rb} +8 -3
- data/lib/stripe/{transfer.rb → resources/transfer.rb} +9 -8
- data/lib/stripe/resources/usage_record.rb +8 -0
- data/lib/stripe/{usage_record_summary.rb → resources/usage_record_summary.rb} +2 -1
- data/lib/stripe/{webhook_endpoint.rb → resources/webhook_endpoint.rb} +2 -1
- data/lib/stripe/resources.rb +91 -0
- data/lib/stripe/stripe_client.rb +617 -243
- data/lib/stripe/stripe_configuration.rb +194 -0
- data/lib/stripe/stripe_object.rb +30 -25
- data/lib/stripe/stripe_response.rb +87 -27
- data/lib/stripe/util.rb +43 -103
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe/webhook.rb +39 -8
- data/lib/stripe.rb +41 -205
- data/stripe.gemspec +19 -5
- metadata +109 -287
- data/.editorconfig +0 -10
- data/.gitattributes +0 -4
- data/.github/ISSUE_TEMPLATE.md +0 -5
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -42
- data/.rubocop_todo.yml +0 -38
- data/.travis.yml +0 -43
- data/.vscode/extensions.json +0 -7
- data/.vscode/settings.json +0 -8
- data/lib/stripe/application_fee.rb +0 -24
- data/lib/stripe/bitcoin_transaction.rb +0 -15
- data/lib/stripe/charge.rb +0 -84
- data/lib/stripe/credit_note.rb +0 -18
- data/lib/stripe/customer.rb +0 -93
- data/lib/stripe/dispute.rb +0 -23
- data/lib/stripe/invoice.rb +0 -49
- data/lib/stripe/issuer_fraud_record.rb +0 -9
- data/lib/stripe/issuing/card_details.rb +0 -9
- data/lib/stripe/order.rb +0 -32
- data/lib/stripe/payment_intent.rb +0 -30
- data/lib/stripe/payout.rb +0 -24
- data/lib/stripe/subscription_item.rb +0 -18
- data/lib/stripe/subscription_schedule.rb +0 -35
- data/lib/stripe/subscription_schedule_revision.rb +0 -34
- data/lib/stripe/usage_record.rb +0 -23
- data/test/api_stub_helpers.rb +0 -1
- data/test/openapi/README.md +0 -9
- data/test/stripe/account_link_test.rb +0 -18
- data/test/stripe/account_test.rb +0 -428
- data/test/stripe/alipay_account_test.rb +0 -37
- data/test/stripe/api_operations_test.rb +0 -80
- data/test/stripe/api_resource_test.rb +0 -523
- data/test/stripe/apple_pay_domain_test.rb +0 -46
- data/test/stripe/application_fee_refund_test.rb +0 -37
- data/test/stripe/application_fee_test.rb +0 -58
- data/test/stripe/balance_test.rb +0 -13
- data/test/stripe/bank_account_test.rb +0 -36
- data/test/stripe/capability_test.rb +0 -45
- data/test/stripe/charge_test.rb +0 -80
- data/test/stripe/checkout/session_test.rb +0 -41
- data/test/stripe/country_spec_test.rb +0 -20
- data/test/stripe/coupon_test.rb +0 -61
- data/test/stripe/credit_note_test.rb +0 -61
- data/test/stripe/customer_card_test.rb +0 -42
- data/test/stripe/customer_test.rb +0 -226
- data/test/stripe/dispute_test.rb +0 -51
- data/test/stripe/ephemeral_key_test.rb +0 -93
- data/test/stripe/errors_test.rb +0 -20
- data/test/stripe/exchange_rate_test.rb +0 -20
- data/test/stripe/file_link_test.rb +0 -41
- data/test/stripe/file_test.rb +0 -97
- data/test/stripe/file_upload_test.rb +0 -79
- data/test/stripe/invoice_item_test.rb +0 -66
- data/test/stripe/invoice_line_item_test.rb +0 -8
- data/test/stripe/invoice_test.rb +0 -213
- data/test/stripe/issuer_fraud_record_test.rb +0 -20
- data/test/stripe/issuing/authorization_test.rb +0 -72
- data/test/stripe/issuing/card_test.rb +0 -62
- data/test/stripe/issuing/cardholder_test.rb +0 -53
- data/test/stripe/issuing/dispute_test.rb +0 -45
- data/test/stripe/issuing/transaction_test.rb +0 -48
- data/test/stripe/list_object_test.rb +0 -156
- data/test/stripe/login_link_test.rb +0 -37
- data/test/stripe/oauth_test.rb +0 -88
- data/test/stripe/order_return_test.rb +0 -21
- data/test/stripe/order_test.rb +0 -82
- data/test/stripe/payment_intent_test.rb +0 -107
- data/test/stripe/payment_method_test.rb +0 -84
- data/test/stripe/payout_test.rb +0 -57
- data/test/stripe/person_test.rb +0 -46
- data/test/stripe/plan_test.rb +0 -98
- data/test/stripe/product_test.rb +0 -59
- data/test/stripe/radar/early_fraud_warning_test.rb +0 -22
- data/test/stripe/radar/value_list_item_test.rb +0 -48
- data/test/stripe/radar/value_list_test.rb +0 -61
- data/test/stripe/recipient_test.rb +0 -62
- data/test/stripe/refund_test.rb +0 -39
- data/test/stripe/reporting/report_run_test.rb +0 -33
- data/test/stripe/reporting/report_type_test.rb +0 -22
- data/test/stripe/reversal_test.rb +0 -43
- data/test/stripe/review_test.rb +0 -27
- data/test/stripe/sigma/scheduled_query_run_test.rb +0 -22
- data/test/stripe/sku_test.rb +0 -60
- data/test/stripe/source_test.rb +0 -99
- data/test/stripe/source_transaction_test.rb +0 -19
- data/test/stripe/stripe_client_test.rb +0 -842
- data/test/stripe/stripe_object_test.rb +0 -525
- data/test/stripe/stripe_response_test.rb +0 -49
- data/test/stripe/subscription_item_test.rb +0 -63
- data/test/stripe/subscription_schedule_revision_test.rb +0 -37
- data/test/stripe/subscription_schedule_test.rb +0 -116
- data/test/stripe/subscription_test.rb +0 -80
- data/test/stripe/tax_id_test.rb +0 -31
- data/test/stripe/tax_rate_test.rb +0 -43
- data/test/stripe/terminal/connection_token_test.rb +0 -16
- data/test/stripe/terminal/location_test.rb +0 -68
- data/test/stripe/terminal/reader_test.rb +0 -62
- data/test/stripe/three_d_secure_test.rb +0 -23
- data/test/stripe/topup_test.rb +0 -62
- data/test/stripe/transfer_test.rb +0 -88
- data/test/stripe/usage_record_summary_test.rb +0 -19
- data/test/stripe/usage_record_test.rb +0 -28
- data/test/stripe/util_test.rb +0 -402
- data/test/stripe/webhook_endpoint_test.rb +0 -59
- data/test/stripe/webhook_test.rb +0 -96
- data/test/stripe_mock.rb +0 -77
- data/test/stripe_test.rb +0 -63
- data/test/test_data.rb +0 -61
- data/test/test_helper.rb +0 -71
@@ -1,523 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require ::File.expand_path("../test_helper", __dir__)
|
4
|
-
|
5
|
-
module Stripe
|
6
|
-
class ApiResourceTest < Test::Unit::TestCase
|
7
|
-
class NestedTestAPIResource < APIResource
|
8
|
-
save_nested_resource :external_account
|
9
|
-
end
|
10
|
-
|
11
|
-
context ".save_nested_resource" do
|
12
|
-
should "can have a scalar set" do
|
13
|
-
r = NestedTestAPIResource.new("test_resource")
|
14
|
-
r.external_account = "tok_123"
|
15
|
-
assert_equal "tok_123", r.external_account
|
16
|
-
end
|
17
|
-
|
18
|
-
should "set a flag if given an object source" do
|
19
|
-
r = NestedTestAPIResource.new("test_resource")
|
20
|
-
r.external_account = {
|
21
|
-
object: "card",
|
22
|
-
}
|
23
|
-
assert_equal true, r.external_account.save_with_parent
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
should "creating a new APIResource should not fetch over the network" do
|
28
|
-
Stripe::Customer.new("someid")
|
29
|
-
assert_not_requested :get, %r{#{Stripe.api_base}/.*}
|
30
|
-
end
|
31
|
-
|
32
|
-
should "creating a new APIResource from a hash should not fetch over the network" do
|
33
|
-
Stripe::Customer.construct_from(id: "somecustomer",
|
34
|
-
card: { id: "somecard", object: "card" },
|
35
|
-
object: "customer")
|
36
|
-
assert_not_requested :get, %r{#{Stripe.api_base}/.*}
|
37
|
-
end
|
38
|
-
|
39
|
-
should "setting an attribute should not cause a network request" do
|
40
|
-
c = Stripe::Customer.new("cus_123")
|
41
|
-
c.card = { id: "somecard", object: "card" }
|
42
|
-
assert_not_requested :get, %r{#{Stripe.api_base}/.*}
|
43
|
-
assert_not_requested :post, %r{#{Stripe.api_base}/.*}
|
44
|
-
end
|
45
|
-
|
46
|
-
should "accessing id should not issue a fetch" do
|
47
|
-
c = Stripe::Customer.new("cus_123")
|
48
|
-
c.id
|
49
|
-
assert_not_requested :get, %r{#{Stripe.api_base}/.*}
|
50
|
-
end
|
51
|
-
|
52
|
-
should "not specifying api credentials should raise an exception" do
|
53
|
-
Stripe.api_key = nil
|
54
|
-
assert_raises Stripe::AuthenticationError do
|
55
|
-
Stripe::Customer.new("cus_123").refresh
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
should "using a nil api key should raise an exception" do
|
60
|
-
assert_raises TypeError do
|
61
|
-
Stripe::Customer.list({}, nil)
|
62
|
-
end
|
63
|
-
assert_raises TypeError do
|
64
|
-
Stripe::Customer.list({}, api_key: nil)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
should "specifying api credentials containing whitespace should raise an exception" do
|
69
|
-
Stripe.api_key = "key "
|
70
|
-
assert_raises Stripe::AuthenticationError do
|
71
|
-
Stripe::Customer.new("cus_123").refresh
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
should "send expand on fetch properly" do
|
76
|
-
stub_request(:get, "#{Stripe.api_base}/v1/charges/ch_123")
|
77
|
-
.with(query: { "expand" => ["customer"] })
|
78
|
-
.to_return(body: JSON.generate(charge_fixture))
|
79
|
-
|
80
|
-
Stripe::Charge.retrieve(id: "ch_123", expand: [:customer])
|
81
|
-
end
|
82
|
-
|
83
|
-
should "preserve expand across refreshes" do
|
84
|
-
stub_request(:get, "#{Stripe.api_base}/v1/charges/ch_123")
|
85
|
-
.with(query: { "expand" => ["customer"] })
|
86
|
-
.to_return(body: JSON.generate(charge_fixture))
|
87
|
-
|
88
|
-
ch = Stripe::Charge.retrieve(id: "ch_123", expand: [:customer])
|
89
|
-
ch.refresh
|
90
|
-
end
|
91
|
-
|
92
|
-
should "send expand when fetching through ListObject" do
|
93
|
-
stub_request(:get, "#{Stripe.api_base}/v1/customers/cus_123")
|
94
|
-
.to_return(body: JSON.generate(customer_fixture))
|
95
|
-
|
96
|
-
stub_request(:get, "#{Stripe.api_base}/v1/customers/cus_123/sources/cc_test_card")
|
97
|
-
.with(query: { "expand" => ["customer"] })
|
98
|
-
.to_return(body: JSON.generate(customer_fixture))
|
99
|
-
|
100
|
-
customer = Stripe::Customer.retrieve("cus_123")
|
101
|
-
customer.sources.retrieve(id: "cc_test_card", expand: [:customer])
|
102
|
-
end
|
103
|
-
|
104
|
-
context "when specifying per-object credentials" do
|
105
|
-
context "with no global API key set" do
|
106
|
-
should "use the per-object credential when creating" do
|
107
|
-
stub_request(:post, "#{Stripe.api_base}/v1/charges")
|
108
|
-
.with(headers: { "Authorization" => "Bearer sk_test_local" })
|
109
|
-
.to_return(body: JSON.generate(charge_fixture))
|
110
|
-
|
111
|
-
Stripe::Charge.create({ source: "tok_visa" },
|
112
|
-
"sk_test_local")
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
context "with a global API key set" do
|
117
|
-
setup do
|
118
|
-
Stripe.api_key = "global"
|
119
|
-
end
|
120
|
-
|
121
|
-
teardown do
|
122
|
-
Stripe.api_key = nil
|
123
|
-
end
|
124
|
-
|
125
|
-
should "use the per-object credential when creating" do
|
126
|
-
stub_request(:post, "#{Stripe.api_base}/v1/charges")
|
127
|
-
.with(headers: { "Authorization" => "Bearer sk_test_local" })
|
128
|
-
.to_return(body: JSON.generate(charge_fixture))
|
129
|
-
|
130
|
-
Stripe::Charge.create({ source: "tok_visa" },
|
131
|
-
"sk_test_local")
|
132
|
-
end
|
133
|
-
|
134
|
-
should "use the per-object credential when retrieving and making other calls" do
|
135
|
-
stub_request(:get, "#{Stripe.api_base}/v1/charges/ch_123")
|
136
|
-
.with(headers: { "Authorization" => "Bearer sk_test_local" })
|
137
|
-
.to_return(body: JSON.generate(charge_fixture))
|
138
|
-
stub_request(:post, "#{Stripe.api_base}/v1/charges/ch_123/refunds")
|
139
|
-
.with(headers: { "Authorization" => "Bearer sk_test_local" })
|
140
|
-
.to_return(body: "{}")
|
141
|
-
|
142
|
-
ch = Stripe::Charge.retrieve("ch_123", "sk_test_local")
|
143
|
-
ch.refunds.create
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
context "with valid credentials" do
|
149
|
-
should "urlencode values in GET params" do
|
150
|
-
stub_request(:get, "#{Stripe.api_base}/v1/charges")
|
151
|
-
.with(query: { customer: "test customer" })
|
152
|
-
.to_return(body: JSON.generate(data: [charge_fixture]))
|
153
|
-
charges = Stripe::Charge.list(customer: "test customer").data
|
154
|
-
assert charges.is_a? Array
|
155
|
-
end
|
156
|
-
|
157
|
-
should "construct URL properly with base query parameters" do
|
158
|
-
stub_request(:get, "#{Stripe.api_base}/v1/charges")
|
159
|
-
.with(query: { customer: "cus_123" })
|
160
|
-
.to_return(body: JSON.generate(data: [charge_fixture],
|
161
|
-
url: "/v1/charges"))
|
162
|
-
charges = Stripe::Charge.list(customer: "cus_123")
|
163
|
-
|
164
|
-
stub_request(:get, "#{Stripe.api_base}/v1/charges")
|
165
|
-
.with(query: { customer: "cus_123", created: "123" })
|
166
|
-
.to_return(body: JSON.generate(data: [charge_fixture],
|
167
|
-
url: "/v1/charges"))
|
168
|
-
charges.list(created: 123)
|
169
|
-
end
|
170
|
-
|
171
|
-
should "setting a nil value for a param should exclude that param from the request" do
|
172
|
-
stub_request(:get, "#{Stripe.api_base}/v1/charges")
|
173
|
-
.with(query: { offset: 5, sad: false })
|
174
|
-
.to_return(body: JSON.generate(count: 1, data: [charge_fixture]))
|
175
|
-
Stripe::Charge.list(count: nil, offset: 5, sad: false)
|
176
|
-
|
177
|
-
stub_request(:post, "#{Stripe.api_base}/v1/charges")
|
178
|
-
.with(body: { "amount" => "50", "currency" => "usd" })
|
179
|
-
.to_return(body: JSON.generate(count: 1, data: [charge_fixture]))
|
180
|
-
Stripe::Charge.create(amount: 50, currency: "usd", card: { number: nil })
|
181
|
-
end
|
182
|
-
|
183
|
-
should "not trigger a warning if a known opt, such as idempotency_key, is in opts" do
|
184
|
-
stub_request(:post, "#{Stripe.api_base}/v1/charges")
|
185
|
-
.to_return(body: JSON.generate(charge_fixture))
|
186
|
-
old_stderr = $stderr
|
187
|
-
$stderr = StringIO.new
|
188
|
-
begin
|
189
|
-
Stripe::Charge.create({ amount: 100, currency: "usd", card: "sc_token" }, idempotency_key: "12345")
|
190
|
-
assert $stderr.string.empty?
|
191
|
-
ensure
|
192
|
-
$stderr = old_stderr
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
should "trigger a warning if a known opt, such as idempotency_key, is in params" do
|
197
|
-
stub_request(:post, "#{Stripe.api_base}/v1/charges")
|
198
|
-
.to_return(body: JSON.generate(charge_fixture))
|
199
|
-
old_stderr = $stderr
|
200
|
-
$stderr = StringIO.new
|
201
|
-
begin
|
202
|
-
Stripe::Charge.create(amount: 100, currency: "usd", card: "sc_token", idempotency_key: "12345")
|
203
|
-
assert_match Regexp.new("WARNING:"), $stderr.string
|
204
|
-
ensure
|
205
|
-
$stderr = old_stderr
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
should "requesting with a unicode ID should result in a request" do
|
210
|
-
stub_request(:get, "#{Stripe.api_base}/v1/customers/%E2%98%83")
|
211
|
-
.to_return(body: JSON.generate(make_missing_id_error), status: 404)
|
212
|
-
c = Stripe::Customer.new("☃")
|
213
|
-
assert_raises(Stripe::InvalidRequestError) { c.refresh }
|
214
|
-
end
|
215
|
-
|
216
|
-
should "requesting with no ID should result in an InvalidRequestError with no request" do
|
217
|
-
c = Stripe::Customer.new
|
218
|
-
assert_raises(Stripe::InvalidRequestError) { c.refresh }
|
219
|
-
end
|
220
|
-
|
221
|
-
should "making a GET request with parameters should have a query string and no body" do
|
222
|
-
stub_request(:get, "#{Stripe.api_base}/v1/charges")
|
223
|
-
.with(query: { limit: 1 })
|
224
|
-
.to_return(body: JSON.generate(data: [charge_fixture]))
|
225
|
-
Stripe::Charge.list(limit: 1)
|
226
|
-
end
|
227
|
-
|
228
|
-
should "making a POST request with parameters should have a body and no query string" do
|
229
|
-
stub_request(:post, "#{Stripe.api_base}/v1/charges")
|
230
|
-
.with(body: { "amount" => "100", "currency" => "usd", "card" => "sc_token" })
|
231
|
-
.to_return(body: JSON.generate(charge_fixture))
|
232
|
-
Stripe::Charge.create(amount: 100, currency: "usd", card: "sc_token")
|
233
|
-
end
|
234
|
-
|
235
|
-
should "loading an object should issue a GET request" do
|
236
|
-
stub_request(:get, "#{Stripe.api_base}/v1/charges/ch_123")
|
237
|
-
.to_return(body: JSON.generate(charge_fixture))
|
238
|
-
c = Stripe::Charge.new("ch_123")
|
239
|
-
c.refresh
|
240
|
-
end
|
241
|
-
|
242
|
-
should "using array accessors should be the same as the method interface" do
|
243
|
-
stub_request(:get, "#{Stripe.api_base}/v1/charges/ch_123")
|
244
|
-
.to_return(body: JSON.generate(charge_fixture))
|
245
|
-
c = Stripe::Charge.new("cus_123")
|
246
|
-
c.refresh
|
247
|
-
assert_equal c.created, c[:created]
|
248
|
-
assert_equal c.created, c["created"]
|
249
|
-
c["created"] = 12_345
|
250
|
-
assert_equal c.created, 12_345
|
251
|
-
end
|
252
|
-
|
253
|
-
should "accessing a property other than id or parent on an unfetched object should fetch it" do
|
254
|
-
stub_request(:get, "#{Stripe.api_base}/v1/charges")
|
255
|
-
.with(query: { customer: "cus_123" })
|
256
|
-
.to_return(body: JSON.generate(customer_fixture))
|
257
|
-
c = Stripe::Customer.new("cus_123")
|
258
|
-
c.charges
|
259
|
-
end
|
260
|
-
|
261
|
-
should "updating an object should issue a POST request with only the changed properties" do
|
262
|
-
stub_request(:post, "#{Stripe.api_base}/v1/customers/cus_123")
|
263
|
-
.with(body: { "description" => "another_mn" })
|
264
|
-
.to_return(body: JSON.generate(customer_fixture))
|
265
|
-
c = Stripe::Customer.construct_from(customer_fixture)
|
266
|
-
c.description = "another_mn"
|
267
|
-
c.save
|
268
|
-
end
|
269
|
-
|
270
|
-
should "updating should merge in returned properties" do
|
271
|
-
stub_request(:post, "#{Stripe.api_base}/v1/customers/cus_123")
|
272
|
-
.with(body: { "description" => "another_mn" })
|
273
|
-
.to_return(body: JSON.generate(customer_fixture))
|
274
|
-
c = Stripe::Customer.new("cus_123")
|
275
|
-
c.description = "another_mn"
|
276
|
-
c.save
|
277
|
-
assert_equal false, c.livemode
|
278
|
-
end
|
279
|
-
|
280
|
-
should "updating should fail if api_key is overwritten with nil" do
|
281
|
-
c = Stripe::Customer.new
|
282
|
-
assert_raises TypeError do
|
283
|
-
c.save({}, api_key: nil)
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
should "updating should use the supplied api_key" do
|
288
|
-
stub_request(:post, "#{Stripe.api_base}/v1/customers")
|
289
|
-
.with(headers: { "Authorization" => "Bearer sk_test_local" })
|
290
|
-
.to_return(body: JSON.generate(customer_fixture))
|
291
|
-
c = Stripe::Customer.new
|
292
|
-
c.save({}, api_key: "sk_test_local")
|
293
|
-
assert_equal false, c.livemode
|
294
|
-
end
|
295
|
-
|
296
|
-
should "deleting should send no props and result in an object that has no props other deleted" do
|
297
|
-
stub_request(:delete, "#{Stripe.api_base}/v1/customers/cus_123")
|
298
|
-
.to_return(body: JSON.generate("id" => "cus_123", "deleted" => true))
|
299
|
-
c = Stripe::Customer.construct_from(customer_fixture)
|
300
|
-
c.delete
|
301
|
-
end
|
302
|
-
|
303
|
-
should "loading all of an APIResource should return an array of recursively instantiated objects" do
|
304
|
-
stub_request(:get, "#{Stripe.api_base}/v1/charges")
|
305
|
-
.to_return(body: JSON.generate(data: [charge_fixture]))
|
306
|
-
charges = Stripe::Charge.list.data
|
307
|
-
assert charges.is_a? Array
|
308
|
-
assert charges[0].is_a? Stripe::Charge
|
309
|
-
assert charges[0].payment_method_details.is_a?(Stripe::StripeObject)
|
310
|
-
end
|
311
|
-
|
312
|
-
should "passing in a stripe_account header should pass it through on call" do
|
313
|
-
stub_request(:get, "#{Stripe.api_base}/v1/customers/cus_123")
|
314
|
-
.with(headers: { "Stripe-Account" => "acct_123" })
|
315
|
-
.to_return(body: JSON.generate(customer_fixture))
|
316
|
-
Stripe::Customer.retrieve("cus_123", stripe_account: "acct_123")
|
317
|
-
end
|
318
|
-
|
319
|
-
should "passing in a stripe_account header should pass it through on save" do
|
320
|
-
stub_request(:get, "#{Stripe.api_base}/v1/customers/cus_123")
|
321
|
-
.with(headers: { "Stripe-Account" => "acct_123" })
|
322
|
-
.to_return(body: JSON.generate(customer_fixture))
|
323
|
-
c = Stripe::Customer.retrieve("cus_123", stripe_account: "acct_123")
|
324
|
-
|
325
|
-
stub_request(:post, "#{Stripe.api_base}/v1/customers/cus_123")
|
326
|
-
.with(headers: { "Stripe-Account" => "acct_123" })
|
327
|
-
.to_return(body: JSON.generate(customer_fixture))
|
328
|
-
c.description = "FOO"
|
329
|
-
c.save
|
330
|
-
end
|
331
|
-
|
332
|
-
should "add key to nested objects" do
|
333
|
-
acct = Stripe::Account.construct_from(id: "myid",
|
334
|
-
legal_entity: {
|
335
|
-
size: "l",
|
336
|
-
score: 4,
|
337
|
-
height: 10,
|
338
|
-
})
|
339
|
-
|
340
|
-
stub_request(:post, "#{Stripe.api_base}/v1/accounts/myid")
|
341
|
-
.with(body: { legal_entity: { first_name: "Bob" } })
|
342
|
-
.to_return(body: JSON.generate("id" => "myid"))
|
343
|
-
|
344
|
-
acct.legal_entity.first_name = "Bob"
|
345
|
-
acct.save
|
346
|
-
end
|
347
|
-
|
348
|
-
should "save nothing if nothing changes" do
|
349
|
-
acct = Stripe::Account.construct_from(id: "acct_id",
|
350
|
-
metadata: {
|
351
|
-
key: "value",
|
352
|
-
})
|
353
|
-
|
354
|
-
stub_request(:post, "#{Stripe.api_base}/v1/accounts/acct_id")
|
355
|
-
.with(body: {})
|
356
|
-
.to_return(body: JSON.generate("id" => "acct_id"))
|
357
|
-
|
358
|
-
acct.save
|
359
|
-
end
|
360
|
-
|
361
|
-
should "not save nested API resources" do
|
362
|
-
ch = Stripe::Charge.construct_from(id: "ch_id",
|
363
|
-
customer: {
|
364
|
-
object: "customer",
|
365
|
-
id: "customer_id",
|
366
|
-
})
|
367
|
-
|
368
|
-
stub_request(:post, "#{Stripe.api_base}/v1/charges/ch_id")
|
369
|
-
.with(body: {})
|
370
|
-
.to_return(body: JSON.generate("id" => "ch_id"))
|
371
|
-
|
372
|
-
ch.customer.description = "Bob"
|
373
|
-
ch.save
|
374
|
-
end
|
375
|
-
|
376
|
-
should "correctly handle replaced nested objects" do
|
377
|
-
acct = Stripe::Account.construct_from(
|
378
|
-
id: "acct_123",
|
379
|
-
company: {
|
380
|
-
name: "company_name",
|
381
|
-
address: {
|
382
|
-
line1: "test",
|
383
|
-
city: "San Francisco",
|
384
|
-
},
|
385
|
-
}
|
386
|
-
)
|
387
|
-
|
388
|
-
stub_request(:post, "#{Stripe.api_base}/v1/accounts/acct_123")
|
389
|
-
.with(body: { company: { address: { line1: "Test2", city: "" } } })
|
390
|
-
.to_return(body: JSON.generate("id" => "my_id"))
|
391
|
-
|
392
|
-
acct.company.address = { line1: "Test2" }
|
393
|
-
acct.save
|
394
|
-
end
|
395
|
-
|
396
|
-
should "correctly handle array setting" do
|
397
|
-
acct = Stripe::Account.construct_from(id: "myid",
|
398
|
-
legal_entity: {})
|
399
|
-
|
400
|
-
stub_request(:post, "#{Stripe.api_base}/v1/accounts/myid")
|
401
|
-
.with(body: { legal_entity: { additional_owners: [{ first_name: "Bob" }] } })
|
402
|
-
.to_return(body: JSON.generate("id" => "myid"))
|
403
|
-
|
404
|
-
acct.legal_entity.additional_owners = [{ first_name: "Bob" }]
|
405
|
-
acct.save
|
406
|
-
end
|
407
|
-
|
408
|
-
should "correctly handle array insertion" do
|
409
|
-
acct = Stripe::Account.construct_from(id: "myid",
|
410
|
-
legal_entity: {
|
411
|
-
additional_owners: [],
|
412
|
-
})
|
413
|
-
|
414
|
-
# Note that this isn't a perfect check because we're using webmock's
|
415
|
-
# data decoding, which isn't aware of the Stripe array encoding that we
|
416
|
-
# use here.
|
417
|
-
stub_request(:post, "#{Stripe.api_base}/v1/accounts/myid")
|
418
|
-
.with(body: { legal_entity: { additional_owners: [{ first_name: "Bob" }] } })
|
419
|
-
.to_return(body: JSON.generate("id" => "myid"))
|
420
|
-
|
421
|
-
acct.legal_entity.additional_owners << { first_name: "Bob" }
|
422
|
-
acct.save
|
423
|
-
end
|
424
|
-
|
425
|
-
should "correctly handle array updates" do
|
426
|
-
acct = Stripe::Account.construct_from(id: "myid",
|
427
|
-
legal_entity: {
|
428
|
-
additional_owners: [{ first_name: "Bob" }, { first_name: "Jane" }],
|
429
|
-
})
|
430
|
-
|
431
|
-
# Note that this isn't a perfect check because we're using webmock's
|
432
|
-
# data decoding, which isn't aware of the Stripe array encoding that we
|
433
|
-
# use here.
|
434
|
-
stub_request(:post, "#{Stripe.api_base}/v1/accounts/myid")
|
435
|
-
.with(body: { legal_entity: { additional_owners: [{ first_name: "Janet" }] } })
|
436
|
-
.to_return(body: JSON.generate("id" => "myid"))
|
437
|
-
|
438
|
-
acct.legal_entity.additional_owners[1].first_name = "Janet"
|
439
|
-
acct.save
|
440
|
-
end
|
441
|
-
|
442
|
-
should "correctly handle array noops" do
|
443
|
-
acct = Stripe::Account.construct_from(id: "myid",
|
444
|
-
legal_entity: {
|
445
|
-
additional_owners: [{ first_name: "Bob" }],
|
446
|
-
},
|
447
|
-
currencies_supported: %w[usd cad])
|
448
|
-
|
449
|
-
stub_request(:post, "#{Stripe.api_base}/v1/accounts/myid")
|
450
|
-
.with(body: {})
|
451
|
-
.to_return(body: JSON.generate("id" => "myid"))
|
452
|
-
|
453
|
-
acct.save
|
454
|
-
end
|
455
|
-
|
456
|
-
should "correctly handle hash noops" do
|
457
|
-
acct = Stripe::Account.construct_from(id: "myid",
|
458
|
-
legal_entity: {
|
459
|
-
address: { line1: "1 Two Three" },
|
460
|
-
})
|
461
|
-
|
462
|
-
stub_request(:post, "#{Stripe.api_base}/v1/accounts/myid")
|
463
|
-
.with(body: {})
|
464
|
-
.to_return(body: JSON.generate("id" => "myid"))
|
465
|
-
|
466
|
-
acct.save
|
467
|
-
end
|
468
|
-
|
469
|
-
should "should create a new resource when an object without an id is saved" do
|
470
|
-
account = Stripe::Account.construct_from(id: nil,
|
471
|
-
display_name: nil)
|
472
|
-
|
473
|
-
stub_request(:post, "#{Stripe.api_base}/v1/accounts")
|
474
|
-
.with(body: { display_name: "stripe" })
|
475
|
-
.to_return(body: JSON.generate("id" => "acct_123"))
|
476
|
-
|
477
|
-
account.display_name = "stripe"
|
478
|
-
account.save
|
479
|
-
end
|
480
|
-
|
481
|
-
should "set attributes as part of save" do
|
482
|
-
account = Stripe::Account.construct_from(id: nil,
|
483
|
-
display_name: nil)
|
484
|
-
|
485
|
-
stub_request(:post, "#{Stripe.api_base}/v1/accounts")
|
486
|
-
.with(body: { display_name: "stripe", metadata: { key: "value" } })
|
487
|
-
.to_return(body: JSON.generate("id" => "acct_123"))
|
488
|
-
|
489
|
-
account.save(display_name: "stripe", metadata: { key: "value" })
|
490
|
-
end
|
491
|
-
end
|
492
|
-
|
493
|
-
@@fixtures = {} # rubocop:disable Style/ClassVars
|
494
|
-
setup do
|
495
|
-
if @@fixtures.empty?
|
496
|
-
cache_fixture(:charge) do
|
497
|
-
Charge.retrieve("ch_123")
|
498
|
-
end
|
499
|
-
cache_fixture(:customer) do
|
500
|
-
Customer.retrieve("cus_123")
|
501
|
-
end
|
502
|
-
end
|
503
|
-
end
|
504
|
-
|
505
|
-
private def charge_fixture
|
506
|
-
@@fixtures[:charge]
|
507
|
-
end
|
508
|
-
|
509
|
-
private def customer_fixture
|
510
|
-
@@fixtures[:customer]
|
511
|
-
end
|
512
|
-
|
513
|
-
# Expects to retrieve a fixture from stripe-mock (an API call should be
|
514
|
-
# included in the block to yield to) and does very simple memoization.
|
515
|
-
private def cache_fixture(key)
|
516
|
-
return @@fixtures[key] if @@fixtures.key?(key)
|
517
|
-
|
518
|
-
obj = yield
|
519
|
-
@@fixtures[key] = obj.instance_variable_get(:@values).freeze
|
520
|
-
@@fixtures[key]
|
521
|
-
end
|
522
|
-
end
|
523
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require ::File.expand_path("../test_helper", __dir__)
|
4
|
-
|
5
|
-
module Stripe
|
6
|
-
class ApplePayDomainTest < Test::Unit::TestCase
|
7
|
-
should "be listable" do
|
8
|
-
domains = Stripe::ApplePayDomain.list
|
9
|
-
assert_requested :get, "#{Stripe.api_base}/v1/apple_pay/domains"
|
10
|
-
assert domains.data.is_a?(Array)
|
11
|
-
assert domains.data[0].is_a?(Stripe::ApplePayDomain)
|
12
|
-
end
|
13
|
-
|
14
|
-
should "be retrievable" do
|
15
|
-
domain = Stripe::ApplePayDomain.retrieve("apwc_123")
|
16
|
-
assert_requested :get, "#{Stripe.api_base}/v1/apple_pay/domains/apwc_123"
|
17
|
-
assert domain.is_a?(Stripe::ApplePayDomain)
|
18
|
-
end
|
19
|
-
|
20
|
-
should "be creatable" do
|
21
|
-
domain = Stripe::ApplePayDomain.create(domain_name: "example.com")
|
22
|
-
assert_requested :post, "#{Stripe.api_base}/v1/apple_pay/domains"
|
23
|
-
assert domain.is_a?(Stripe::ApplePayDomain)
|
24
|
-
end
|
25
|
-
|
26
|
-
should "be deletable" do
|
27
|
-
end
|
28
|
-
|
29
|
-
context "#delete" do
|
30
|
-
should "be deletable" do
|
31
|
-
domain = Stripe::ApplePayDomain.retrieve("apwc_123")
|
32
|
-
domain = domain.delete
|
33
|
-
assert_requested :delete, "#{Stripe.api_base}/v1/apple_pay/domains/#{domain.id}"
|
34
|
-
assert domain.is_a?(Stripe::ApplePayDomain)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context ".delete" do
|
39
|
-
should "be deletable" do
|
40
|
-
domain = Stripe::ApplePayDomain.delete("apwc_123")
|
41
|
-
assert_requested :delete, "#{Stripe.api_base}/v1/apple_pay/domains/apwc_123"
|
42
|
-
assert domain.is_a?(Stripe::ApplePayDomain)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require ::File.expand_path("../test_helper", __dir__)
|
4
|
-
|
5
|
-
module Stripe
|
6
|
-
class ApplicationFeeRefundTest < Test::Unit::TestCase
|
7
|
-
setup do
|
8
|
-
@fee = Stripe::ApplicationFee.retrieve("fee_123")
|
9
|
-
end
|
10
|
-
|
11
|
-
should "be listable" do
|
12
|
-
refunds = @fee.refunds
|
13
|
-
|
14
|
-
# notably this *doesn't* make an API call
|
15
|
-
assert_not_requested :get,
|
16
|
-
"#{Stripe.api_base}/v1/application_fees/#{@fee.id}/refunds"
|
17
|
-
|
18
|
-
assert refunds.data.is_a?(Array)
|
19
|
-
assert refunds.first.is_a?(Stripe::ApplicationFeeRefund)
|
20
|
-
end
|
21
|
-
|
22
|
-
should "be creatable" do
|
23
|
-
refund = @fee.refunds.create
|
24
|
-
assert_requested :post,
|
25
|
-
"#{Stripe.api_base}/v1/application_fees/#{@fee.id}/refunds"
|
26
|
-
assert refund.is_a?(Stripe::ApplicationFeeRefund)
|
27
|
-
end
|
28
|
-
|
29
|
-
should "be saveable" do
|
30
|
-
refund = @fee.refunds.first
|
31
|
-
refund.metadata["key"] = "value"
|
32
|
-
refund.save
|
33
|
-
assert_requested :post,
|
34
|
-
"#{Stripe.api_base}/v1/application_fees/#{@fee.id}/refunds/#{refund.id}"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require ::File.expand_path("../test_helper", __dir__)
|
4
|
-
|
5
|
-
module Stripe
|
6
|
-
class ApplicationFeeTest < Test::Unit::TestCase
|
7
|
-
should "be listable" do
|
8
|
-
fees = Stripe::ApplicationFee.list
|
9
|
-
assert_requested :get, "#{Stripe.api_base}/v1/application_fees"
|
10
|
-
assert fees.data.is_a?(Array)
|
11
|
-
assert fees.data[0].is_a?(Stripe::ApplicationFee)
|
12
|
-
end
|
13
|
-
|
14
|
-
context "#create_refund" do
|
15
|
-
should "create a refund" do
|
16
|
-
refund = Stripe::ApplicationFee.create_refund(
|
17
|
-
"fee_123"
|
18
|
-
)
|
19
|
-
assert_requested :post, "#{Stripe.api_base}/v1/application_fees/fee_123/refunds"
|
20
|
-
assert refund.is_a?(Stripe::ApplicationFeeRefund)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context "#retrieve_refund" do
|
25
|
-
should "retrieve a refund" do
|
26
|
-
refund = Stripe::ApplicationFee.retrieve_refund(
|
27
|
-
"fee_123",
|
28
|
-
"fr_123"
|
29
|
-
)
|
30
|
-
assert_requested :get, "#{Stripe.api_base}/v1/application_fees/fee_123/refunds/fr_123"
|
31
|
-
assert refund.is_a?(Stripe::ApplicationFeeRefund)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context "#update_refund" do
|
36
|
-
should "update a refund" do
|
37
|
-
refund = Stripe::ApplicationFee.update_refund(
|
38
|
-
"fee_123",
|
39
|
-
"fr_123",
|
40
|
-
metadata: { foo: "bar" }
|
41
|
-
)
|
42
|
-
assert_requested :post, "#{Stripe.api_base}/v1/application_fees/fee_123/refunds/fr_123"
|
43
|
-
assert refund.is_a?(Stripe::ApplicationFeeRefund)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context "#list_refunds" do
|
48
|
-
should "list the application fee's refuns" do
|
49
|
-
refunds = Stripe::ApplicationFee.list_refunds(
|
50
|
-
"fee_123"
|
51
|
-
)
|
52
|
-
assert_requested :get, "#{Stripe.api_base}/v1/application_fees/fee_123/refunds"
|
53
|
-
assert refunds.is_a?(Stripe::ListObject)
|
54
|
-
assert refunds.data.is_a?(Array)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
data/test/stripe/balance_test.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require ::File.expand_path("../test_helper", __dir__)
|
4
|
-
|
5
|
-
module Stripe
|
6
|
-
class BalanceTest < Test::Unit::TestCase
|
7
|
-
should "be retrievable" do
|
8
|
-
balance = Stripe::Balance.retrieve
|
9
|
-
assert_requested :get, "#{Stripe.api_base}/v1/balance"
|
10
|
-
assert balance.is_a?(Stripe::Balance)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|