balanced 0.7.5 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.rbenv-version +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +1 -0
- data/balanced.gemspec +2 -2
- data/examples/bank_account_debits.rb +2 -1
- data/examples/customers.rb +8 -4
- data/examples/events_and_callbacks.rb +2 -1
- data/examples/examples.rb +6 -5
- data/examples/exception_handling.rb +2 -1
- data/lib/balanced/client.rb +3 -3
- data/lib/balanced/resources/account.rb +5 -3
- data/lib/balanced/resources/card.rb +3 -1
- data/lib/balanced/resources/credit.rb +12 -13
- data/lib/balanced/resources/customer.rb +1 -1
- data/lib/balanced/resources/debit.rb +1 -1
- data/lib/balanced/resources/resource.rb +83 -93
- data/lib/balanced/utils.rb +13 -4
- data/lib/balanced/version.rb +1 -1
- data/scenario.cache +299 -380
- data/scenarios/account_add_card/ruby.mako +3 -3
- data/scenarios/account_capture_hold/request.rb +1 -1
- data/scenarios/account_capture_hold/ruby.mako +1 -1
- data/scenarios/account_create/ruby.mako +1 -1
- data/scenarios/account_create_buyer/ruby.mako +2 -2
- data/scenarios/account_create_debit/request.rb +1 -1
- data/scenarios/account_create_debit/ruby.mako +1 -1
- data/scenarios/account_create_hold/request.rb +1 -1
- data/scenarios/account_create_hold/ruby.mako +1 -1
- data/scenarios/account_create_merchant/ruby.mako +3 -3
- data/scenarios/account_underwrite_business/ruby.mako +1 -1
- data/scenarios/account_underwrite_person/request.rb +1 -1
- data/scenarios/account_underwrite_person/ruby.mako +7 -7
- data/scenarios/bank_account_create/request.rb +1 -1
- data/scenarios/bank_account_create/ruby.mako +5 -5
- data/scenarios/bank_account_delete/ruby.mako +2 -2
- data/scenarios/bank_account_invalid_routing_number/ruby.mako +2 -8
- data/scenarios/bank_account_list/ruby.mako +1 -1
- data/scenarios/bank_account_show/ruby.mako +2 -2
- data/scenarios/bank_account_verification_create/ruby.mako +2 -2
- data/scenarios/bank_account_verification_show/ruby.mako +2 -2
- data/scenarios/bank_account_verification_update/ruby.mako +2 -2
- data/scenarios/callback_create/definition.rb +1 -1
- data/scenarios/callback_create/request.rb +1 -1
- data/scenarios/callback_create/ruby.mako +0 -11
- data/scenarios/callback_delete/definition.rb +1 -1
- data/scenarios/callback_delete/request.rb +1 -1
- data/scenarios/callback_delete/ruby.mako +0 -10
- data/scenarios/callback_list/definition.rb +1 -1
- data/scenarios/callback_list/ruby.mako +0 -10
- data/scenarios/callback_show/definition.rb +1 -1
- data/scenarios/callback_show/ruby.mako +0 -9
- data/scenarios/card_create/request.rb +2 -1
- data/scenarios/card_create/ruby.mako +6 -5
- data/scenarios/card_delete/ruby.mako +2 -2
- data/scenarios/card_invalidate/ruby.mako +2 -2
- data/scenarios/card_list/ruby.mako +1 -1
- data/scenarios/card_show/ruby.mako +2 -2
- data/scenarios/card_update/ruby.mako +2 -2
- data/scenarios/credit_bank_account_list/ruby.mako +2 -2
- data/scenarios/credit_create_existing_bank_account/ruby.mako +3 -3
- data/scenarios/credit_customer_list/ruby.mako +2 -2
- data/scenarios/credit_failed_state/request.rb +2 -2
- data/scenarios/credit_failed_state/ruby.mako +2 -5
- data/scenarios/credit_list/ruby.mako +1 -1
- data/scenarios/credit_paid_state/request.rb +2 -2
- data/scenarios/credit_paid_state/ruby.mako +2 -5
- data/scenarios/credit_pending_state/request.rb +2 -2
- data/scenarios/credit_pending_state/ruby.mako +2 -5
- data/scenarios/credit_show/ruby.mako +2 -2
- data/scenarios/customer_add_bank_account/ruby.mako +3 -3
- data/scenarios/customer_add_card/ruby.mako +3 -3
- data/scenarios/customer_capture_hold/request.rb +1 -1
- data/scenarios/customer_create/ruby.mako +1 -1
- data/scenarios/customer_create_debit/request.rb +1 -1
- data/scenarios/customer_create_debit/ruby.mako +3 -3
- data/scenarios/customer_create_hold/request.rb +1 -1
- data/scenarios/customer_create_hold/ruby.mako +1 -1
- data/scenarios/customer_credit/request.rb +1 -1
- data/scenarios/customer_credit/ruby.mako +2 -2
- data/scenarios/customer_delete/ruby.mako +1 -1
- data/scenarios/debit_create/ruby.mako +3 -3
- data/scenarios/debit_customer_list/ruby.mako +2 -2
- data/scenarios/debit_list/ruby.mako +1 -1
- data/scenarios/debit_refund/ruby.mako +2 -2
- data/scenarios/debit_show/ruby.mako +2 -2
- data/scenarios/debit_update/ruby.mako +2 -2
- data/scenarios/event_list/ruby.mako +1 -1
- data/scenarios/event_show/ruby.mako +2 -2
- data/scenarios/helpers.rb +1 -5
- data/scenarios/hold_capture/ruby.mako +4 -3
- data/scenarios/hold_create/request.rb +2 -2
- data/scenarios/hold_create/ruby.mako +6 -6
- data/scenarios/hold_customer_list/ruby.mako +2 -2
- data/scenarios/hold_list/ruby.mako +1 -1
- data/scenarios/hold_show/ruby.mako +2 -2
- data/scenarios/hold_update/ruby.mako +2 -2
- data/scenarios/hold_void/ruby.mako +2 -2
- data/scenarios/refund_create/ruby.mako +2 -2
- data/scenarios/refund_customer_list/ruby.mako +2 -2
- data/scenarios/refund_list/ruby.mako +1 -1
- data/scenarios/refund_show/ruby.mako +2 -2
- data/scenarios/refund_update/ruby.mako +2 -2
- data/scenarios/render.rb +1 -1
- data/scenarios/render_mako.rb +0 -1
- data/spec/balanced/error_spec.rb +4 -4
- data/spec/balanced/pager_spec.rb +7 -7
- data/spec/balanced/resources/account_spec.rb +51 -30
- data/spec/balanced/resources/bank_account_spec.rb +2 -2
- data/spec/balanced/resources/card_spec.rb +8 -8
- data/spec/balanced/resources/customer_spec.rb +11 -11
- data/spec/balanced/resources/hold_spec.rb +1 -1
- data/spec/balanced/resources/marketplace_spec.rb +12 -10
- data/spec/balanced/resources/resource_spec.rb +1 -1
- data/spec/scenarios_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +16 -15
- data/examples/customers-with-meta-example.rb +0 -141
@@ -55,7 +55,7 @@ describe Balanced::Customer, :vcr do
|
|
55
55
|
@card = Balanced::Card.new(
|
56
56
|
:card_number => "4111111111111111",
|
57
57
|
:expiration_month => "12",
|
58
|
-
:expiration_year => "2015"
|
58
|
+
:expiration_year => "2015"
|
59
59
|
)
|
60
60
|
@customer.add_card(@card)
|
61
61
|
end
|
@@ -70,7 +70,7 @@ describe Balanced::Customer, :vcr do
|
|
70
70
|
@card = @marketplace.create_card(
|
71
71
|
:card_number => "4111111111111111",
|
72
72
|
:expiration_month => "12",
|
73
|
-
:expiration_year => "2015"
|
73
|
+
:expiration_year => "2015"
|
74
74
|
).save
|
75
75
|
@customer.add_card(@card)
|
76
76
|
@customer_card_id = @customer.cards.first.id
|
@@ -90,7 +90,7 @@ describe Balanced::Customer, :vcr do
|
|
90
90
|
@card = @marketplace.create_card(
|
91
91
|
:card_number => "4111111111111111",
|
92
92
|
:expiration_month => "12",
|
93
|
-
:expiration_year => "2015"
|
93
|
+
:expiration_year => "2015"
|
94
94
|
).save
|
95
95
|
@customer.add_card(@card.uri)
|
96
96
|
@customer_card_id = @customer.cards.first.id
|
@@ -109,7 +109,7 @@ describe Balanced::Customer, :vcr do
|
|
109
109
|
@card_2 = @marketplace.create_card(
|
110
110
|
:card_number => "4111111111111111",
|
111
111
|
:expiration_month => "12",
|
112
|
-
:expiration_year => "2015"
|
112
|
+
:expiration_year => "2015"
|
113
113
|
).save
|
114
114
|
@card_2.unstore
|
115
115
|
end
|
@@ -214,7 +214,7 @@ describe Balanced::Customer, :vcr do
|
|
214
214
|
@card = @marketplace.create_card(
|
215
215
|
:card_number => "4111111111111111",
|
216
216
|
:expiration_month => "12",
|
217
|
-
:expiration_year => "2015"
|
217
|
+
:expiration_year => "2015"
|
218
218
|
).save
|
219
219
|
@customer.add_card(@card)
|
220
220
|
@customer.debit :amount => 1000
|
@@ -236,7 +236,7 @@ describe Balanced::Customer, :vcr do
|
|
236
236
|
@card = Balanced::Card.new(
|
237
237
|
:card_number => "4111111111111111",
|
238
238
|
:expiration_month => "12",
|
239
|
-
:expiration_year => "2015"
|
239
|
+
:expiration_year => "2015"
|
240
240
|
).save
|
241
241
|
@customer.add_card(@card)
|
242
242
|
@customer.add_bank_account(@bank_account)
|
@@ -246,9 +246,9 @@ describe Balanced::Customer, :vcr do
|
|
246
246
|
context "args passed by name via options hash" do
|
247
247
|
subject {
|
248
248
|
@customer.credit(
|
249
|
-
amount
|
250
|
-
description
|
251
|
-
meta
|
249
|
+
:amount => 1250,
|
250
|
+
:description => "description",
|
251
|
+
:meta => {}
|
252
252
|
)
|
253
253
|
}
|
254
254
|
|
@@ -264,7 +264,7 @@ describe Balanced::Customer, :vcr do
|
|
264
264
|
@card = @marketplace.create_card(
|
265
265
|
:card_number => "4111111111111111",
|
266
266
|
:expiration_month => "12",
|
267
|
-
:expiration_year => "2015"
|
267
|
+
:expiration_year => "2015"
|
268
268
|
).save
|
269
269
|
@customer.add_card(@card)
|
270
270
|
end
|
@@ -302,7 +302,7 @@ describe Balanced::Customer, :vcr do
|
|
302
302
|
expect {
|
303
303
|
Balanced::Customer.find(
|
304
304
|
:first,
|
305
|
-
email
|
305
|
+
:email => "balanced-ruby-issue-110@example.com")
|
306
306
|
}.to raise_error Balanced::Unauthorized
|
307
307
|
Balanced.configure(key)
|
308
308
|
end
|
@@ -21,9 +21,9 @@ describe Balanced::Marketplace, :vcr do
|
|
21
21
|
:postal_code => "94301",
|
22
22
|
:country => "USA",
|
23
23
|
:dob => "1842-01",
|
24
|
-
:phone_number => "+16505551234"
|
24
|
+
:phone_number => "+16505551234"
|
25
25
|
},
|
26
|
-
:bank_account_uri => @bank_account.uri
|
26
|
+
:bank_account_uri => @bank_account.uri
|
27
27
|
)
|
28
28
|
end
|
29
29
|
|
@@ -32,7 +32,7 @@ describe Balanced::Marketplace, :vcr do
|
|
32
32
|
bank_account = @marketplace.create_bank_account(
|
33
33
|
:name => "Jon Q.",
|
34
34
|
:account_number => "11111111111",
|
35
|
-
:bank_code => "123456789"
|
35
|
+
:bank_code => "123456789"
|
36
36
|
)
|
37
37
|
bank_account.should be_instance_of Balanced::BankAccount
|
38
38
|
Balanced.is_collection(bank_account.uri).should be_false
|
@@ -68,7 +68,7 @@ describe Balanced::Marketplace, :vcr do
|
|
68
68
|
card = @marketplace.create_card(
|
69
69
|
:card_number => "4111111111111111",
|
70
70
|
:expiration_month => "12",
|
71
|
-
:expiration_year => "2018"
|
71
|
+
:expiration_year => "2018"
|
72
72
|
)
|
73
73
|
card.should be_instance_of Balanced::Card
|
74
74
|
Balanced.is_collection(card.uri).should be_false
|
@@ -143,18 +143,19 @@ end
|
|
143
143
|
describe Balanced::Marketplace, '.marketplace_uri' do
|
144
144
|
context 'when invoking .my_marketplace', :vcr do
|
145
145
|
it 'sets the marketplace_id after the first call implicitly' do
|
146
|
-
|
147
146
|
Balanced.configure nil
|
148
147
|
Balanced.is_configured_with_api_key?.should be_false
|
149
|
-
|
150
|
-
Balanced::Marketplace.
|
148
|
+
|
149
|
+
Balanced::Marketplace.send(:class_variable_set, :@@marketplace_uri, nil)
|
150
|
+
Balanced::Marketplace.send(:class_variable_get, :@@marketplace_uri).should be_nil
|
151
151
|
|
152
152
|
api_key = Balanced::ApiKey.new.save
|
153
153
|
Balanced.configure api_key.secret
|
154
154
|
marketplace = Balanced::Marketplace.new.save
|
155
155
|
# creating the marketplace sets `Balanced::Marketplace.marketplace_uri`,
|
156
156
|
# it will never be unset.
|
157
|
-
|
157
|
+
|
158
|
+
Balanced::Marketplace.send(:class_variable_get, :@@marketplace_uri).should equal marketplace.uri
|
158
159
|
old_marketplace_uri = marketplace.uri
|
159
160
|
|
160
161
|
api_key = Balanced::ApiKey.new.save
|
@@ -162,8 +163,9 @@ describe Balanced::Marketplace, '.marketplace_uri' do
|
|
162
163
|
marketplace = Balanced::Marketplace.new.save
|
163
164
|
# creating the marketplace sets `Balanced::Marketplace.marketplace_uri`,
|
164
165
|
# it will never be unset.
|
165
|
-
|
166
|
-
Balanced::Marketplace.class_variable_get
|
166
|
+
|
167
|
+
Balanced::Marketplace.send(:class_variable_get, :@@marketplace_uri).should_not equal old_marketplace_uri
|
168
|
+
Balanced::Marketplace.send(:class_variable_get, :@@marketplace_uri).should equal marketplace.uri
|
167
169
|
end
|
168
170
|
end
|
169
171
|
|
@@ -21,7 +21,7 @@ end
|
|
21
21
|
describe Balanced::Resource, 'loading a resource and generating methods from the response body', :vcr do
|
22
22
|
before do
|
23
23
|
make_marketplace
|
24
|
-
@account = Balanced::Account.new(email
|
24
|
+
@account = Balanced::Account.new(:email => 'user@example.com', :name => 'John Doe').save
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'generates a predicate method' do
|
data/spec/scenarios_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: balanced
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mahmoud Abdelkader
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.8.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.8.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday_middleware
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.9.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.9.0
|
41
41
|
description: "Balanced is the payments platform for marketplaces.\n Integrate a
|
@@ -47,11 +47,12 @@ executables: []
|
|
47
47
|
extensions: []
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
-
-
|
51
|
-
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
50
|
+
- .gitignore
|
51
|
+
- .rbenv-version
|
52
|
+
- .rspec
|
53
|
+
- .ruby-gemset
|
54
|
+
- .ruby-version
|
55
|
+
- .travis.yml
|
55
56
|
- CONTRIBUTORS
|
56
57
|
- Gemfile
|
57
58
|
- Guardfile
|
@@ -70,7 +71,6 @@ files:
|
|
70
71
|
- doc/balanced_templates/default/onefile/html/setup.rb
|
71
72
|
- doc/balanced_templates/default/tags/html/index.erb
|
72
73
|
- examples/bank_account_debits.rb
|
73
|
-
- examples/customers-with-meta-example.rb
|
74
74
|
- examples/customers.rb
|
75
75
|
- examples/events_and_callbacks.rb
|
76
76
|
- examples/examples.rb
|
@@ -352,17 +352,17 @@ require_paths:
|
|
352
352
|
- lib
|
353
353
|
required_ruby_version: !ruby/object:Gem::Requirement
|
354
354
|
requirements:
|
355
|
-
- -
|
355
|
+
- - '>='
|
356
356
|
- !ruby/object:Gem::Version
|
357
357
|
version: '0'
|
358
358
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
359
359
|
requirements:
|
360
|
-
- -
|
360
|
+
- - '>='
|
361
361
|
- !ruby/object:Gem::Version
|
362
362
|
version: '0'
|
363
363
|
requirements: []
|
364
364
|
rubyforge_project:
|
365
|
-
rubygems_version: 2.
|
365
|
+
rubygems_version: 2.0.3
|
366
366
|
signing_key:
|
367
367
|
specification_version: 4
|
368
368
|
summary: Sign up on https://balancedpayments.com/
|
@@ -386,3 +386,4 @@ test_files:
|
|
386
386
|
- spec/scenarios_spec.rb
|
387
387
|
- spec/spec_helper.rb
|
388
388
|
- spec/utils_spec.rb
|
389
|
+
has_rdoc:
|
@@ -1,141 +0,0 @@
|
|
1
|
-
cwd = File.dirname(File.dirname(File.absolute_path(__FILE__)))
|
2
|
-
$:.unshift(cwd + "/lib")
|
3
|
-
require 'balanced'
|
4
|
-
require 'securerandom'
|
5
|
-
|
6
|
-
|
7
|
-
begin
|
8
|
-
Balanced::Card
|
9
|
-
rescue NameError
|
10
|
-
raise "wtf"
|
11
|
-
end
|
12
|
-
|
13
|
-
host = ENV.fetch('BALANCED_HOST') { nil }
|
14
|
-
options = {}
|
15
|
-
if host
|
16
|
-
options[:scheme] = 'http'
|
17
|
-
options[:host] = host
|
18
|
-
options[:port] = 5000
|
19
|
-
end
|
20
|
-
|
21
|
-
Balanced.configure(nil, options)
|
22
|
-
|
23
|
-
puts "create our new api key"
|
24
|
-
api_key = Balanced::ApiKey.new.save
|
25
|
-
puts "Our secret is: ", api_key.secret
|
26
|
-
secret = api_key.secret
|
27
|
-
|
28
|
-
puts "configure with our secret #{secret}"
|
29
|
-
Balanced.configure(secret)
|
30
|
-
|
31
|
-
puts "create our marketplace"
|
32
|
-
begin
|
33
|
-
marketplace = Balanced::Marketplace.new.save
|
34
|
-
rescue Balanced::Conflict => ex
|
35
|
-
marketplace = Balanced::Marketplace.mine
|
36
|
-
end
|
37
|
-
|
38
|
-
puts "create a customer"
|
39
|
-
|
40
|
-
uniq_id = ::SecureRandom.uuid
|
41
|
-
|
42
|
-
customer1 = Balanced::Customer.new(
|
43
|
-
:name => "Bill",
|
44
|
-
:email => "bill@bill.com",
|
45
|
-
:business_name => "Bill Inc.",
|
46
|
-
:ssn_last4 => "1234",
|
47
|
-
:address => {
|
48
|
-
:line1 => "1234 1st Street",
|
49
|
-
:city => "San Francisco",
|
50
|
-
:state => "CA"
|
51
|
-
},
|
52
|
-
:meta => {
|
53
|
-
:user_id => "MyUserID-#{uniq_id}-1"
|
54
|
-
}
|
55
|
-
).save
|
56
|
-
|
57
|
-
customer2 = Balanced::Customer.new(
|
58
|
-
:name => "Bill",
|
59
|
-
:email => "bill@bill.com",
|
60
|
-
:business_name => "Bill Inc.",
|
61
|
-
:ssn_last4 => "1234",
|
62
|
-
:address => {
|
63
|
-
:line1 => "1234 1st Street",
|
64
|
-
:city => "San Francisco",
|
65
|
-
:state => "CA"
|
66
|
-
},
|
67
|
-
:meta => {
|
68
|
-
:user_id => "MyUserID-#{uniq_id}-2"
|
69
|
-
}
|
70
|
-
).save
|
71
|
-
|
72
|
-
puts "our customer uri is #{customer1.uri}"
|
73
|
-
|
74
|
-
pager = Balanced::Pager.new(
|
75
|
-
marketplace.customers_uri,
|
76
|
-
{'meta.user_id' => "MyUserID-#{uniq_id}-1"}
|
77
|
-
)
|
78
|
-
customers = pager.all
|
79
|
-
raise "Wrong pager total" if customers.length != 1
|
80
|
-
customer = customers.first
|
81
|
-
raise "Wrong customer uri" if customer.uri != customer1.uri
|
82
|
-
|
83
|
-
puts "create a card and a bank account for our customer"
|
84
|
-
|
85
|
-
bank_account = Balanced::BankAccount.new(
|
86
|
-
:account_number => "1234567980",
|
87
|
-
:routing_number => "121000358",
|
88
|
-
:type => "CHECKING",
|
89
|
-
:name => "Jack Q Merchant"
|
90
|
-
).save
|
91
|
-
|
92
|
-
card = Balanced::Card.new(
|
93
|
-
:card_number => "4111111111111111",
|
94
|
-
:expiration_month => "12",
|
95
|
-
:expiration_year => "2015",
|
96
|
-
).save
|
97
|
-
|
98
|
-
puts "our bank account uri is #{bank_account.uri}"
|
99
|
-
puts "our card uri is #{card.uri}"
|
100
|
-
|
101
|
-
puts "associate the newly created bank account and card to our customer"
|
102
|
-
|
103
|
-
customer.add_card(card)
|
104
|
-
customer.add_bank_account(bank_account)
|
105
|
-
|
106
|
-
puts "check and make sure our customer now has a card and bank account listed"
|
107
|
-
|
108
|
-
raise "customer's cards should not be empty" unless customer.cards.any?
|
109
|
-
raise "customer's bank accounts should not be empty" unless customer.bank_accounts.any?
|
110
|
-
|
111
|
-
puts "create a debit on our customer"
|
112
|
-
|
113
|
-
customer.debit(
|
114
|
-
:amount => 5000,
|
115
|
-
:description => "new debit"
|
116
|
-
)
|
117
|
-
|
118
|
-
puts "check to make sure debit is added"
|
119
|
-
|
120
|
-
raise "customer should not have 0 debits" unless customer.debits.any?
|
121
|
-
raise "customer debit should be 5000" unless customer.debits.first.amount == 5000
|
122
|
-
|
123
|
-
puts "create a credit on our customer"
|
124
|
-
|
125
|
-
customer.credit(
|
126
|
-
:amount => 2500,
|
127
|
-
:description => "new credit"
|
128
|
-
)
|
129
|
-
|
130
|
-
puts "check to make sure credit is added"
|
131
|
-
|
132
|
-
raise "customer should not have 0 credits" unless customer.credits.any?
|
133
|
-
raise "customer should be 2500" unless customer.credits.first.amount == 2500
|
134
|
-
|
135
|
-
puts "check to see what is the active card for a customer"
|
136
|
-
|
137
|
-
raise "active card is incorrect" unless customer.active_card.id == card.id
|
138
|
-
|
139
|
-
puts "check to see what is the active bank_account for a customer"
|
140
|
-
|
141
|
-
raise "active bank account is incorrect" unless customer.active_bank_account.id == bank_account.id
|