openpay 1.0.10 → 2.0.0b
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -1
- data/Gemfile +2 -2
- data/README.md +2 -2
- data/Rakefile +2 -1
- data/lib/version.rb +1 -1
- data/openpay.gemspec +6 -6
- data/test/Factories.rb +16 -16
- data/test/spec/bankaccounts_spec.rb +19 -18
- data/test/spec/cards_spec.rb +35 -37
- data/test/spec/charges_spec.rb +44 -67
- data/test/spec/customers_spec.rb +11 -12
- data/test/spec/exceptions_spec.rb +2 -20
- data/test/spec/fees_spec.rb +22 -18
- data/test/spec/openpayresource_spec.rb +2 -2
- data/test/spec/payouts_spec.rb +39 -44
- data/test/spec/plans_spec.rb +14 -10
- data/test/spec/subscriptions_spec.rb +37 -36
- data/test/spec/transfers_spec.rb +35 -31
- data/test/spec_helper.rb +7 -1
- metadata +50 -51
- data/test/spec/webhook_spec.rb +0 -104
data/test/spec/charges_spec.rb
CHANGED
@@ -25,17 +25,17 @@ describe Charges do
|
|
25
25
|
expect(@charges).to respond_to(meth)
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
describe '.create' do
|
30
30
|
|
31
31
|
it 'creates a new merchant charge using the card method using a pre-stored card' do
|
32
32
|
|
33
33
|
#create card
|
34
|
-
card_hash=
|
34
|
+
card_hash=FactoryBot.build(:valid_card)
|
35
35
|
card=@cards.create(card_hash)
|
36
36
|
|
37
37
|
#create charge attached to prev created card
|
38
|
-
charge_hash=
|
38
|
+
charge_hash=FactoryBot.build(:card_charge, source_id: card['id'], order_id: card['id'],amount: 101)
|
39
39
|
charge=@charges.create(charge_hash)
|
40
40
|
|
41
41
|
#perform check
|
@@ -50,15 +50,15 @@ describe Charges do
|
|
50
50
|
it 'creates a new customer charge using the card method using a pre-stored card' do
|
51
51
|
|
52
52
|
#create new customer
|
53
|
-
customer_hash=
|
53
|
+
customer_hash= FactoryBot.build(:customer)
|
54
54
|
customer=@customers.create(customer_hash)
|
55
55
|
|
56
56
|
#create customer card
|
57
|
-
card_hash=
|
57
|
+
card_hash=FactoryBot.build(:valid_card)
|
58
58
|
card=@cards.create(card_hash,customer['id'])
|
59
59
|
|
60
60
|
#create charge
|
61
|
-
charge_hash=
|
61
|
+
charge_hash=FactoryBot.build(:card_charge, source_id:card['id'],order_id: card['id'])
|
62
62
|
charge=@charges.create(charge_hash,customer['id'])
|
63
63
|
|
64
64
|
#perform check
|
@@ -71,30 +71,6 @@ describe Charges do
|
|
71
71
|
|
72
72
|
end
|
73
73
|
|
74
|
-
it 'creates a new customer charge using the bank_account method' do
|
75
|
-
|
76
|
-
#create new customer
|
77
|
-
customer_hash= FactoryGirl.build(:customer)
|
78
|
-
customer=@customers.create(customer_hash)
|
79
|
-
|
80
|
-
#create bank account
|
81
|
-
account_hash=FactoryGirl.build(:bank_account)
|
82
|
-
account=@bank_accounts.create(account_hash,customer['id'])
|
83
|
-
|
84
|
-
#create charge
|
85
|
-
charge_hash=FactoryGirl.build(:bank_charge, order_id: account['id'])
|
86
|
-
charge=@charges.create(charge_hash,customer['id'])
|
87
|
-
|
88
|
-
#perform check
|
89
|
-
stored_charge=@charges.get(charge['id'],customer['id'])
|
90
|
-
expect(stored_charge['amount']).to be_within(0.1).of(10000)
|
91
|
-
|
92
|
-
#clean up
|
93
|
-
@bank_accounts.delete(customer['id'],account['id'])
|
94
|
-
@customers.delete(customer['id'])
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
74
|
end
|
99
75
|
|
100
76
|
describe '.get' do
|
@@ -102,11 +78,11 @@ describe Charges do
|
|
102
78
|
it 'gets a merchant charge' do
|
103
79
|
|
104
80
|
#create card
|
105
|
-
card_hash=
|
81
|
+
card_hash=FactoryBot.build(:valid_card)
|
106
82
|
card=@cards.create(card_hash)
|
107
83
|
|
108
84
|
#create charge attached to prev created card
|
109
|
-
charge_hash=
|
85
|
+
charge_hash=FactoryBot.build(:card_charge, source_id: card['id'], order_id: card['id'],amount: 505)
|
110
86
|
charge=@charges.create(charge_hash)
|
111
87
|
|
112
88
|
#perform check
|
@@ -121,15 +97,15 @@ describe Charges do
|
|
121
97
|
it 'gets a customer charge' do
|
122
98
|
|
123
99
|
#create new customer
|
124
|
-
customer_hash=
|
100
|
+
customer_hash= FactoryBot.build(:customer)
|
125
101
|
customer=@customers.create(customer_hash)
|
126
102
|
|
127
103
|
#create customer card
|
128
|
-
card_hash=
|
104
|
+
card_hash=FactoryBot.build(:valid_card)
|
129
105
|
card=@cards.create(card_hash,customer['id'])
|
130
106
|
|
131
107
|
#create charge
|
132
|
-
charge_hash=
|
108
|
+
charge_hash=FactoryBot.build(:card_charge, source_id:card['id'],order_id: card['id'],amount: 4000)
|
133
109
|
charge=@charges.create(charge_hash,customer['id'])
|
134
110
|
|
135
111
|
#perform check
|
@@ -153,7 +129,7 @@ describe Charges do
|
|
153
129
|
|
154
130
|
it 'all customer charges' do
|
155
131
|
#create new customer
|
156
|
-
customer_hash=
|
132
|
+
customer_hash= FactoryBot.build(:customer)
|
157
133
|
customer=@customers.create(customer_hash)
|
158
134
|
|
159
135
|
expect(@charges.all(customer['id']).size).to be 0
|
@@ -168,15 +144,15 @@ describe Charges do
|
|
168
144
|
it 'captures a merchant card charge' do
|
169
145
|
|
170
146
|
#create new customer
|
171
|
-
customer_hash=
|
147
|
+
customer_hash= FactoryBot.build(:customer)
|
172
148
|
customer=@customers.create(customer_hash)
|
173
149
|
|
174
150
|
#create merchant card
|
175
|
-
card_hash=
|
151
|
+
card_hash=FactoryBot.build(:valid_card)
|
176
152
|
card=@cards.create(card_hash)
|
177
153
|
|
178
154
|
#create merchant charge
|
179
|
-
charge_hash=
|
155
|
+
charge_hash=FactoryBot.build(:card_charge, source_id:card['id'],order_id: card['id'],amount: 4000, capture:'false')
|
180
156
|
charge=@charges.create(charge_hash)
|
181
157
|
|
182
158
|
#capture merchant charge
|
@@ -190,15 +166,15 @@ describe Charges do
|
|
190
166
|
|
191
167
|
it 'captures a customer card charge' do
|
192
168
|
#create new customer
|
193
|
-
customer_hash=
|
169
|
+
customer_hash= FactoryBot.build(:customer)
|
194
170
|
customer=@customers.create(customer_hash)
|
195
171
|
|
196
172
|
#create customer card
|
197
|
-
card_hash=
|
173
|
+
card_hash=FactoryBot.build(:valid_card)
|
198
174
|
card=@cards.create(card_hash,customer['id'])
|
199
175
|
|
200
176
|
#create charge
|
201
|
-
charge_hash=
|
177
|
+
charge_hash=FactoryBot.build(:card_charge, source_id:card['id'],order_id: card['id'],amount: 4000,capture:'false')
|
202
178
|
charge=@charges.create(charge_hash,customer['id'])
|
203
179
|
|
204
180
|
#capture customer charge
|
@@ -217,15 +193,15 @@ describe Charges do
|
|
217
193
|
it 'confirms a capture on a merchant charge' do
|
218
194
|
|
219
195
|
#create new customer
|
220
|
-
customer_hash=
|
196
|
+
customer_hash= FactoryBot.build(:customer)
|
221
197
|
customer=@customers.create(customer_hash)
|
222
198
|
|
223
199
|
#create merchant card
|
224
|
-
card_hash=
|
200
|
+
card_hash=FactoryBot.build(:valid_card)
|
225
201
|
card=@cards.create(card_hash)
|
226
202
|
|
227
203
|
#create merchant charge
|
228
|
-
charge_hash=
|
204
|
+
charge_hash=FactoryBot.build(:card_charge, source_id:card['id'],order_id: card['id'],amount: 4000, capture:'false')
|
229
205
|
charge=@charges.create(charge_hash)
|
230
206
|
|
231
207
|
confirm_capture_options = { transaction_id: charge['id'], amount: 100 }
|
@@ -242,15 +218,15 @@ describe Charges do
|
|
242
218
|
|
243
219
|
it 'confirms a capture on a customer charge' do
|
244
220
|
|
245
|
-
customer_hash=
|
221
|
+
customer_hash= FactoryBot.build(:customer)
|
246
222
|
customer=@customers.create(customer_hash)
|
247
223
|
|
248
224
|
#create customer card
|
249
|
-
card_hash=
|
225
|
+
card_hash=FactoryBot.build(:valid_card)
|
250
226
|
card=@cards.create(card_hash,customer['id'])
|
251
227
|
|
252
228
|
#create charge
|
253
|
-
charge_hash=
|
229
|
+
charge_hash=FactoryBot.build(:card_charge, source_id:card['id'],order_id: card['id'],amount: 4000,capture:'false')
|
254
230
|
charge=@charges.create(charge_hash,customer['id'])
|
255
231
|
|
256
232
|
confirm_capture_options = { customer_id: customer['id'], transaction_id: charge['id'], amount: 100 }
|
@@ -272,15 +248,15 @@ describe Charges do
|
|
272
248
|
#Refunds apply only for card charges
|
273
249
|
it 'refunds an existing merchant charge' do
|
274
250
|
#create card
|
275
|
-
card_hash=
|
251
|
+
card_hash=FactoryBot.build(:valid_card)
|
276
252
|
card=@cards.create(card_hash)
|
277
253
|
|
278
254
|
#create charge attached to prev created card
|
279
|
-
charge_hash=
|
255
|
+
charge_hash=FactoryBot.build(:card_charge, source_id: card['id'], order_id: card['id'],amount: 505)
|
280
256
|
charge=@charges.create(charge_hash)
|
281
257
|
|
282
258
|
#creates refund_description
|
283
|
-
refund_description=
|
259
|
+
refund_description=FactoryBot.build(:refund_description)
|
284
260
|
expect(@charges.get(charge['id'])['refund']).to be nil
|
285
261
|
|
286
262
|
@charges.refund(charge['id'],refund_description)
|
@@ -290,35 +266,36 @@ describe Charges do
|
|
290
266
|
@cards.delete(card['id'])
|
291
267
|
|
292
268
|
end
|
293
|
-
|
269
|
+
|
294
270
|
it 'refunds an existing customer charge' do
|
295
271
|
#create new customer
|
296
|
-
customer_hash=
|
272
|
+
customer_hash= FactoryBot.build(:customer)
|
297
273
|
customer=@customers.create(customer_hash)
|
298
274
|
|
299
275
|
#create customer card
|
300
|
-
card_hash=
|
276
|
+
card_hash=FactoryBot.build(:valid_card)
|
301
277
|
card=@cards.create(card_hash,customer['id'])
|
302
278
|
|
303
279
|
#create charge
|
304
|
-
charge_hash=
|
280
|
+
charge_hash=FactoryBot.build(:card_charge, source_id:card['id'],order_id: card['id'],amount: 100)
|
305
281
|
charge=@charges.create(charge_hash,customer['id'])
|
306
282
|
|
307
283
|
#creates refund_description
|
308
|
-
refund_description=
|
309
|
-
|
284
|
+
refund_description=FactoryBot.build(:refund_description)
|
310
285
|
|
311
286
|
#perform check
|
312
287
|
expect(@charges.get(charge['id'],customer['id'])['refund']).to be nil
|
288
|
+
sleep(50)
|
313
289
|
@charges.refund(charge['id'],refund_description,customer['id'])
|
314
|
-
|
290
|
+
|
291
|
+
expect(@charges.get(charge['id'],customer['id'])['refund']['amount'] ).to be_within(0.1).of(100)
|
315
292
|
|
316
293
|
#clean up
|
317
294
|
@cards.delete(card['id'],customer['id'])
|
318
295
|
@customers.delete(customer['id'])
|
319
296
|
|
320
297
|
end
|
321
|
-
|
298
|
+
|
322
299
|
end
|
323
300
|
|
324
301
|
describe '.list' do
|
@@ -326,17 +303,17 @@ describe Charges do
|
|
326
303
|
it 'list customer charges' do
|
327
304
|
|
328
305
|
#create new customer
|
329
|
-
customer_hash=
|
306
|
+
customer_hash= FactoryBot.build(:customer)
|
330
307
|
customer=@customers.create(customer_hash)
|
331
308
|
|
332
309
|
#create customer card
|
333
|
-
card_hash=
|
310
|
+
card_hash=FactoryBot.build(:valid_card)
|
334
311
|
card=@cards.create(card_hash,customer['id'])
|
335
312
|
|
336
313
|
#create charge
|
337
|
-
charge_hash=
|
314
|
+
charge_hash=FactoryBot.build(:card_charge, source_id:card['id'],order_id: card['id'])
|
338
315
|
charge=@charges.create(charge_hash,customer['id'])
|
339
|
-
charge_hash=
|
316
|
+
charge_hash=FactoryBot.build(:card_charge, source_id:card['id'],order_id: card['id']+"1")
|
340
317
|
charge2=@charges.create(charge_hash,customer['id'])
|
341
318
|
|
342
319
|
#perform check
|
@@ -365,17 +342,17 @@ describe Charges do
|
|
365
342
|
it 'iterate over customer charges' do
|
366
343
|
|
367
344
|
#create new customer
|
368
|
-
customer_hash=
|
345
|
+
customer_hash= FactoryBot.build(:customer)
|
369
346
|
customer=@customers.create(customer_hash)
|
370
347
|
|
371
348
|
#create customer card
|
372
|
-
card_hash=
|
349
|
+
card_hash=FactoryBot.build(:valid_card)
|
373
350
|
card=@cards.create(card_hash,customer['id'])
|
374
351
|
|
375
352
|
#create charge
|
376
|
-
charge_hash=
|
353
|
+
charge_hash=FactoryBot.build(:card_charge, source_id:card['id'],order_id: card['id'],amount: 4)
|
377
354
|
@charges.create(charge_hash,customer['id'])
|
378
|
-
charge2_hash=
|
355
|
+
charge2_hash=FactoryBot.build(:card_charge, source_id:card['id'],order_id: card['id'+"2"],amount: 4)
|
379
356
|
|
380
357
|
@charges.create(charge2_hash,customer['id'])
|
381
358
|
|
data/test/spec/customers_spec.rb
CHANGED
@@ -35,7 +35,7 @@ describe Customers do
|
|
35
35
|
last_name='Perez'
|
36
36
|
|
37
37
|
#json as input
|
38
|
-
customer_json=
|
38
|
+
customer_json= FactoryBot.build(:customer, name: name, last_name: last_name).to_json
|
39
39
|
customer=@customers.create(customer_json)
|
40
40
|
|
41
41
|
#perform check
|
@@ -55,7 +55,7 @@ describe Customers do
|
|
55
55
|
@customers.delete(id)
|
56
56
|
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
it 'fails when passing invalid information' do
|
60
60
|
|
61
61
|
#check no errors
|
@@ -63,7 +63,7 @@ describe Customers do
|
|
63
63
|
|
64
64
|
#invalid email
|
65
65
|
email='foo'
|
66
|
-
customer_hash =
|
66
|
+
customer_hash = FactoryBot.build(:customer, email: email)
|
67
67
|
|
68
68
|
#perform check
|
69
69
|
expect { @customers.create(customer_hash) }.to raise_exception OpenpayTransactionException
|
@@ -71,9 +71,8 @@ describe Customers do
|
|
71
71
|
@customers.create(customer_hash)
|
72
72
|
rescue OpenpayTransactionException => e
|
73
73
|
expect(e.http_code).to be 400
|
74
|
-
expect(e.description).to match
|
74
|
+
expect(e.description).to match /'foo' is not a valid email address/
|
75
75
|
end
|
76
|
-
|
77
76
|
expect(@customers.errors?).to eq true
|
78
77
|
|
79
78
|
end
|
@@ -84,7 +83,7 @@ describe Customers do
|
|
84
83
|
|
85
84
|
it 'deletes an existing customer' do
|
86
85
|
#creates customer
|
87
|
-
customer_hash =
|
86
|
+
customer_hash = FactoryBot.build(:customer, name: :delete_me)
|
88
87
|
customer=@customers.create(customer_hash)
|
89
88
|
id=customer['id']
|
90
89
|
#delete customer
|
@@ -101,7 +100,7 @@ describe Customers do
|
|
101
100
|
|
102
101
|
#create customer
|
103
102
|
name='get_test'
|
104
|
-
customer_hash =
|
103
|
+
customer_hash = FactoryBot.build(:customer, name: name)
|
105
104
|
customer=@customers.create(customer_hash)
|
106
105
|
id=customer['id']
|
107
106
|
#perform check
|
@@ -126,14 +125,14 @@ describe Customers do
|
|
126
125
|
|
127
126
|
# creates customer
|
128
127
|
name='customer_update_test'
|
129
|
-
customer_hash =
|
128
|
+
customer_hash = FactoryBot.build(:customer, name: name)
|
130
129
|
|
131
130
|
customer=@customers.create(customer_hash)
|
132
131
|
id=customer['id']
|
133
132
|
|
134
133
|
#update customer
|
135
134
|
name='new_name'
|
136
|
-
customer_hash =
|
135
|
+
customer_hash = FactoryBot.build(:customer, name: name)
|
137
136
|
@customers.update(customer_hash, id)
|
138
137
|
#perform check
|
139
138
|
expect(@customers.get(id)['name']).to match name
|
@@ -150,7 +149,7 @@ describe Customers do
|
|
150
149
|
it 'list customers given the filter' do
|
151
150
|
# creates customer
|
152
151
|
name='customer_update_test'
|
153
|
-
customer_hash =
|
152
|
+
customer_hash = FactoryBot.build(:customer, name: name)
|
154
153
|
|
155
154
|
customer=@customers.create(customer_hash)
|
156
155
|
id=customer['id']
|
@@ -178,7 +177,7 @@ describe Customers do
|
|
178
177
|
|
179
178
|
# creates customer
|
180
179
|
name='customer_update_test'
|
181
|
-
customer_hash =
|
180
|
+
customer_hash = FactoryBot.build(:customer, name: name)
|
182
181
|
customer=@customers.create(customer_hash)
|
183
182
|
|
184
183
|
#performs check
|
@@ -197,7 +196,7 @@ describe Customers do
|
|
197
196
|
|
198
197
|
#create 5 customers
|
199
198
|
name='customer_update_test'
|
200
|
-
customer_hash =
|
199
|
+
customer_hash = FactoryBot.build(:customer, name: name)
|
201
200
|
5.times do
|
202
201
|
@customers.create(customer_hash)
|
203
202
|
end
|
@@ -34,7 +34,7 @@ describe 'Openpay Exceptions' do
|
|
34
34
|
it 'should fail when an invalid field-value is passed in *email' do
|
35
35
|
#invalid email format
|
36
36
|
email='foo'
|
37
|
-
customer_hash =
|
37
|
+
customer_hash = FactoryBot.build(:customer, email: email)
|
38
38
|
|
39
39
|
#perform checks
|
40
40
|
expect { @customers.create(customer_hash) }.to raise_exception OpenpayTransactionException
|
@@ -64,26 +64,8 @@ describe 'Openpay Exceptions' do
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
it 'fails when trying to create an existing card' do
|
68
|
-
|
69
|
-
#create customer
|
70
|
-
customers=@openpay.create(:customers)
|
71
|
-
customer_hash = FactoryGirl.build(:customer, name: 'Juan', last_name: 'Perez')
|
72
|
-
customer=customers.create(customer_hash)
|
73
|
-
#create card using json
|
74
|
-
card_json = FactoryGirl.build(:valid_card).to_json
|
75
|
-
card=@cards.create(card_json)
|
76
|
-
#perform check
|
77
|
-
expect { @cards.create(card_json) }.to raise_error(OpenpayTransactionException)
|
78
|
-
|
79
|
-
#cleanup
|
80
|
-
@customers.delete(customer['id'])
|
81
|
-
card_hash=JSON.parse card
|
82
|
-
@cards.delete card_hash['id']
|
83
|
-
end
|
84
|
-
|
85
67
|
it 'raise an OpenpayTransactionException when using an expired card' do
|
86
|
-
card_hash =
|
68
|
+
card_hash = FactoryBot.build(:expired_card)
|
87
69
|
expect { @cards.create(card_hash) }.to raise_error(OpenpayTransactionException)
|
88
70
|
begin
|
89
71
|
@cards.create(card_hash)
|
data/test/spec/fees_spec.rb
CHANGED
@@ -35,19 +35,19 @@ describe Fees do
|
|
35
35
|
#In order to create a fee a charge should exists
|
36
36
|
it 'creates a fee ' do
|
37
37
|
#create new customer
|
38
|
-
customer_hash=
|
38
|
+
customer_hash= FactoryBot.build(:customer)
|
39
39
|
customer=@customers.create(customer_hash)
|
40
40
|
|
41
41
|
#create customer card
|
42
|
-
card_hash=
|
42
|
+
card_hash=FactoryBot.build(:valid_card)
|
43
43
|
card=@cards.create(card_hash, customer['id'])
|
44
44
|
|
45
45
|
#create charge
|
46
|
-
charge_hash=
|
46
|
+
charge_hash=FactoryBot.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
|
47
47
|
@charges.create(charge_hash, customer['id'])
|
48
|
-
|
48
|
+
sleep(50)
|
49
49
|
#create customer fee
|
50
|
-
fee_hash =
|
50
|
+
fee_hash = FactoryBot.build(:fee, customer_id: customer['id'])
|
51
51
|
@fees.create(fee_hash)
|
52
52
|
|
53
53
|
#performs check
|
@@ -61,16 +61,17 @@ describe Fees do
|
|
61
61
|
|
62
62
|
it 'creates a fee using a json message' do
|
63
63
|
#create new customer
|
64
|
-
customer_hash=
|
64
|
+
customer_hash= FactoryBot.build(:customer)
|
65
65
|
customer=@customers.create(customer_hash)
|
66
66
|
|
67
67
|
#create customer card
|
68
|
-
card_hash=
|
68
|
+
card_hash=FactoryBot.build(:valid_card)
|
69
69
|
card=@cards.create(card_hash, customer['id'])
|
70
70
|
|
71
71
|
#create charge
|
72
|
-
charge_hash=
|
72
|
+
charge_hash=FactoryBot.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
|
73
73
|
@charges.create(charge_hash, customer['id'])
|
74
|
+
sleep(50)
|
74
75
|
|
75
76
|
#create customer fee using json
|
76
77
|
fee_json =%^{"customer_id":"#{customer['id']}","amount":"12.50","description":"Cobro de Comision"}^
|
@@ -90,29 +91,31 @@ describe Fees do
|
|
90
91
|
end
|
91
92
|
|
92
93
|
end
|
93
|
-
|
94
|
+
|
94
95
|
describe '.list' do
|
95
96
|
|
96
97
|
it 'list fees with a given filter' do
|
97
98
|
|
98
99
|
#create new customer
|
99
|
-
customer_hash=
|
100
|
+
customer_hash= FactoryBot.build(:customer)
|
100
101
|
customer=@customers.create(customer_hash)
|
101
102
|
|
102
103
|
#create customer card
|
103
|
-
card_hash=
|
104
|
+
card_hash=FactoryBot.build(:valid_card)
|
104
105
|
card=@cards.create(card_hash, customer['id'])
|
105
106
|
|
106
107
|
#create charge
|
107
|
-
charge_hash=
|
108
|
+
charge_hash=FactoryBot.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
|
108
109
|
@charges.create(charge_hash, customer['id'])
|
110
|
+
sleep(50)
|
109
111
|
|
110
112
|
#create customer fee
|
111
|
-
fee_hash =
|
113
|
+
fee_hash = FactoryBot.build(:fee, customer_id: customer['id'])
|
112
114
|
@fees.create(fee_hash)
|
115
|
+
sleep(50)
|
113
116
|
|
114
117
|
#create customer fee
|
115
|
-
fee_hash =
|
118
|
+
fee_hash = FactoryBot.build(:fee, customer_id: customer['id'])
|
116
119
|
@fees.create(fee_hash)
|
117
120
|
|
118
121
|
|
@@ -135,19 +138,20 @@ describe Fees do
|
|
135
138
|
it 'get all fees' do
|
136
139
|
|
137
140
|
#create new customer
|
138
|
-
customer_hash=
|
141
|
+
customer_hash= FactoryBot.build(:customer)
|
139
142
|
customer=@customers.create(customer_hash)
|
140
143
|
|
141
144
|
#create customer card
|
142
|
-
card_hash=
|
145
|
+
card_hash=FactoryBot.build(:valid_card)
|
143
146
|
card=@cards.create(card_hash, customer['id'])
|
144
147
|
|
145
148
|
#create charge
|
146
|
-
charge_hash=
|
149
|
+
charge_hash=FactoryBot.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
|
147
150
|
@charges.create(charge_hash, customer['id'])
|
151
|
+
sleep(50)
|
148
152
|
|
149
153
|
#create customer fee
|
150
|
-
fee_hash =
|
154
|
+
fee_hash = FactoryBot.build(:fee, customer_id: customer['id'])
|
151
155
|
@fees.create(fee_hash)
|
152
156
|
|
153
157
|
#performs check
|