stripe 1.18.0 → 1.30.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +11 -1
  4. data/History.txt +98 -0
  5. data/README.rdoc +19 -10
  6. data/VERSION +1 -1
  7. data/lib/stripe/account.rb +46 -4
  8. data/lib/stripe/api_operations/create.rb +3 -10
  9. data/lib/stripe/api_operations/delete.rb +4 -4
  10. data/lib/stripe/api_operations/list.rb +17 -9
  11. data/lib/stripe/api_operations/request.rb +41 -0
  12. data/lib/stripe/api_operations/update.rb +41 -40
  13. data/lib/stripe/api_resource.rb +7 -4
  14. data/lib/stripe/application_fee.rb +3 -4
  15. data/lib/stripe/application_fee_refund.rb +1 -1
  16. data/lib/stripe/balance_transaction.rb +1 -1
  17. data/lib/stripe/bank_account.rb +19 -0
  18. data/lib/stripe/bitcoin_receiver.rb +12 -2
  19. data/lib/stripe/bitcoin_transaction.rb +5 -0
  20. data/lib/stripe/card.rb +6 -4
  21. data/lib/stripe/charge.rb +14 -22
  22. data/lib/stripe/coupon.rb +2 -2
  23. data/lib/stripe/customer.rb +24 -26
  24. data/lib/stripe/dispute.rb +16 -0
  25. data/lib/stripe/errors/card_error.rb +3 -2
  26. data/lib/stripe/errors/invalid_request_error.rb +3 -2
  27. data/lib/stripe/errors/rate_limit_error.rb +4 -0
  28. data/lib/stripe/errors/stripe_error.rb +8 -2
  29. data/lib/stripe/event.rb +1 -1
  30. data/lib/stripe/file_upload.rb +12 -22
  31. data/lib/stripe/invoice.rb +8 -8
  32. data/lib/stripe/invoice_item.rb +2 -2
  33. data/lib/stripe/list_object.rb +77 -13
  34. data/lib/stripe/order.rb +19 -0
  35. data/lib/stripe/plan.rb +2 -2
  36. data/lib/stripe/product.rb +16 -0
  37. data/lib/stripe/recipient.rb +2 -2
  38. data/lib/stripe/refund.rb +2 -9
  39. data/lib/stripe/reversal.rb +14 -0
  40. data/lib/stripe/singleton_api_resource.rb +2 -2
  41. data/lib/stripe/sku.rb +8 -0
  42. data/lib/stripe/stripe_object.rb +232 -46
  43. data/lib/stripe/subscription.rb +3 -3
  44. data/lib/stripe/token.rb +1 -1
  45. data/lib/stripe/transfer.rb +3 -3
  46. data/lib/stripe/util.rb +64 -21
  47. data/lib/stripe/version.rb +1 -1
  48. data/lib/stripe.rb +102 -67
  49. data/stripe.gemspec +0 -2
  50. data/test/stripe/account_test.rb +135 -6
  51. data/test/stripe/api_resource_test.rb +326 -42
  52. data/test/stripe/application_fee_refund_test.rb +6 -6
  53. data/test/stripe/application_fee_test.rb +3 -3
  54. data/test/stripe/balance_test.rb +11 -0
  55. data/test/stripe/bitcoin_receiver_test.rb +30 -7
  56. data/test/stripe/bitcoin_transaction_test.rb +29 -0
  57. data/test/stripe/charge_refund_test.rb +55 -0
  58. data/test/stripe/charge_test.rb +32 -13
  59. data/test/stripe/coupon_test.rb +3 -3
  60. data/test/stripe/customer_card_test.rb +20 -14
  61. data/test/stripe/customer_test.rb +15 -15
  62. data/test/stripe/dispute_test.rb +45 -0
  63. data/test/stripe/file_upload_test.rb +17 -6
  64. data/test/stripe/invoice_test.rb +18 -4
  65. data/test/stripe/list_object_test.rb +126 -2
  66. data/test/stripe/metadata_test.rb +28 -13
  67. data/test/stripe/order_test.rb +52 -0
  68. data/test/stripe/product_test.rb +41 -0
  69. data/test/stripe/recipient_card_test.rb +9 -9
  70. data/test/stripe/refund_test.rb +23 -15
  71. data/test/stripe/reversal_test.rb +47 -0
  72. data/test/stripe/sku_test.rb +24 -0
  73. data/test/stripe/stripe_object_test.rb +67 -6
  74. data/test/stripe/subscription_test.rb +13 -13
  75. data/test/stripe/transfer_test.rb +4 -4
  76. data/test/stripe/util_test.rb +45 -29
  77. data/test/stripe_test.rb +16 -0
  78. data/test/test_data.rb +273 -66
  79. metadata +47 -76
  80. data/lib/stripe/certificate_blacklist.rb +0 -55
  81. data/test/stripe/certificate_blacklist_test.rb +0 -18
data/test/test_data.rb CHANGED
@@ -1,17 +1,30 @@
1
1
  module Stripe
2
2
  module TestData
3
- def test_response(body, code=200)
3
+ def make_response(body, code=200)
4
4
  # When an exception is raised, restclient clobbers method_missing. Hence we
5
5
  # can't just use the stubs interface.
6
6
  body = JSON.generate(body) if !(body.kind_of? String)
7
7
  m = mock
8
- m.instance_variable_set('@stripe_values', { :body => body, :code => code })
8
+ m.instance_variable_set('@stripe_values', {
9
+ :body => body,
10
+ :code => code,
11
+ :headers => {},
12
+ })
9
13
  def m.body; @stripe_values[:body]; end
10
14
  def m.code; @stripe_values[:code]; end
15
+ def m.headers; @stripe_values[:headers]; end
11
16
  m
12
17
  end
13
18
 
14
- def test_balance(params={})
19
+ def make_account(params={})
20
+ {
21
+ :charges_enabled => false,
22
+ :details_submitted => false,
23
+ :email => "test+bindings@stripe.com",
24
+ }.merge(params)
25
+ end
26
+
27
+ def make_balance(params={})
15
28
  {
16
29
  :pending => [
17
30
  {:amount => 12345, :currency => "usd"}
@@ -24,7 +37,7 @@ module Stripe
24
37
  }.merge(params)
25
38
  end
26
39
 
27
- def test_balance_transaction(params={})
40
+ def make_balance_transaction(params={})
28
41
  {
29
42
  :amount => 100,
30
43
  :net => 41,
@@ -39,15 +52,15 @@ module Stripe
39
52
  }.merge(params)
40
53
  end
41
54
 
42
- def test_balance_transaction_array
55
+ def make_balance_transaction_array
43
56
  {
44
- :data => [test_balance_transaction, test_balance_transaction, test_balance_transaction],
57
+ :data => [make_balance_transaction, make_balance_transaction, make_balance_transaction],
45
58
  :object => "list",
46
59
  :url => "/v1/balance/history"
47
60
  }
48
61
  end
49
62
 
50
- def test_application_fee(params={})
63
+ def make_application_fee(params={})
51
64
  id = params[:id] || 'fee_test_fee'
52
65
  {
53
66
  :refunded => false,
@@ -59,12 +72,12 @@ module Stripe
59
72
  :livemode => false,
60
73
  :currency => "usd",
61
74
  :object => "application_fee",
62
- :refunds => test_application_fee_refund_array(id),
75
+ :refunds => make_application_fee_refund_array(id),
63
76
  :created => 1304114826
64
77
  }.merge(params)
65
78
  end
66
79
 
67
- def test_application_fee_refund(params = {})
80
+ def make_application_fee_refund(params = {})
68
81
  {
69
82
  :object => 'fee_refund',
70
83
  :amount => 30,
@@ -76,23 +89,23 @@ module Stripe
76
89
  }.merge(params)
77
90
  end
78
91
 
79
- def test_application_fee_array
92
+ def make_application_fee_array
80
93
  {
81
- :data => [test_application_fee, test_application_fee, test_application_fee],
94
+ :data => [make_application_fee, make_application_fee, make_application_fee],
82
95
  :object => 'list',
83
96
  :url => '/v1/application_fees'
84
97
  }
85
98
  end
86
99
 
87
- def test_application_fee_refund_array(fee_id)
100
+ def make_application_fee_refund_array(fee_id)
88
101
  {
89
- :data => [test_application_fee_refund, test_application_fee_refund, test_application_fee_refund],
102
+ :data => [make_application_fee_refund, make_application_fee_refund, make_application_fee_refund],
90
103
  :object => 'list',
91
104
  :url => '/v1/application_fees/' + fee_id + '/refunds'
92
105
  }
93
106
  end
94
107
 
95
- def test_customer(params={})
108
+ def make_customer(params={})
96
109
  id = params[:id] || 'c_test_customer'
97
110
  {
98
111
  :subscription_history => [],
@@ -103,21 +116,21 @@ module Stripe
103
116
  :id => id,
104
117
  :default_card => "cc_test_card",
105
118
  :created => 1304114758,
106
- :cards => test_card_array(id),
119
+ :sources => make_customer_card_array(id),
107
120
  :metadata => {},
108
- :subscriptions => test_subscription_array(id)
121
+ :subscriptions => make_subscription_array(id)
109
122
  }.merge(params)
110
123
  end
111
124
 
112
- def test_customer_array
125
+ def make_customer_array
113
126
  {
114
- :data => [test_customer, test_customer, test_customer],
127
+ :data => [make_customer, make_customer, make_customer],
115
128
  :object => 'list',
116
129
  :url => '/v1/customers'
117
130
  }
118
131
  end
119
132
 
120
- def test_charge(params={})
133
+ def make_charge(params={})
121
134
  id = params[:id] || 'ch_test_charge'
122
135
  {
123
136
  :refunded => false,
@@ -138,28 +151,61 @@ module Stripe
138
151
  :currency => "usd",
139
152
  :object => "charge",
140
153
  :created => 1304114826,
141
- :refunds => test_refund_array(id),
154
+ :refunds => make_refund_array(id),
142
155
  :metadata => {}
143
156
  }.merge(params)
144
157
  end
145
158
 
146
- def test_charge_array
159
+ def make_charge_array
147
160
  {
148
- :data => [test_charge, test_charge, test_charge],
161
+ :data => [make_charge, make_charge, make_charge],
149
162
  :object => 'list',
150
163
  :url => '/v1/charges'
151
164
  }
152
165
  end
153
166
 
154
- def test_card_array(customer_id)
167
+
168
+ def make_dispute(params={})
169
+ id = params[:id] || 'dp_test_dispute'
170
+ {
171
+ :id => id,
172
+ :charge => "ch_test_charge",
173
+ :amount => 500,
174
+ :created => 1304114758,
175
+ :status => 'needs_response',
176
+ :livemode => false,
177
+ :currency => 'usd',
178
+ :object => 'dispute',
179
+ :reason => 'fraudulent',
180
+ :evidence => {},
181
+ }.merge(params)
182
+ end
183
+
184
+ def make_dispute_array
185
+ {
186
+ :data => [make_dispute, make_dispute, make_dispute],
187
+ :object => 'list',
188
+ :url => '/v1/disputes'
189
+ }
190
+ end
191
+
192
+ def make_recipient_card_array(recipient_id)
193
+ {
194
+ :data => [make_card, make_card, make_card],
195
+ :object => 'list',
196
+ :url => '/v1/recipients/' + recipient_id + '/cards'
197
+ }
198
+ end
199
+
200
+ def make_customer_card_array(customer_id)
155
201
  {
156
- :data => [test_card, test_card, test_card],
202
+ :data => [make_card, make_card, make_card],
157
203
  :object => 'list',
158
- :url => '/v1/customers/' + customer_id + '/cards'
204
+ :url => '/v1/customers/' + customer_id + '/sources'
159
205
  }
160
206
  end
161
207
 
162
- def test_card(params={})
208
+ def make_card(params={})
163
209
  {
164
210
  :type => "Visa",
165
211
  :last4 => "4242",
@@ -172,7 +218,7 @@ module Stripe
172
218
  }.merge(params)
173
219
  end
174
220
 
175
- def test_coupon(params={})
221
+ def make_coupon(params={})
176
222
  {
177
223
  :duration => 'repeating',
178
224
  :duration_in_months => 3,
@@ -183,7 +229,7 @@ module Stripe
183
229
  }.merge(params)
184
230
  end
185
231
 
186
- def test_file(params={})
232
+ def make_file(params={})
187
233
  {
188
234
  :object => "file_upload",
189
235
  :id => "fil_test_file",
@@ -195,16 +241,16 @@ module Stripe
195
241
  }
196
242
  end
197
243
 
198
- def test_file_array
244
+ def make_file_array
199
245
  {
200
- :data => [test_file, test_file, test_file],
246
+ :data => [make_file, make_file, make_file],
201
247
  :object => 'list',
202
248
  :url => '/v1/files'
203
249
  }
204
250
  end
205
251
 
206
252
  #FIXME nested overrides would be better than hardcoding plan_id
207
- def test_subscription(params = {})
253
+ def make_subscription(params = {})
208
254
  plan = params.delete(:plan) || 'gold'
209
255
  {
210
256
  :current_period_end => 1308681468,
@@ -226,7 +272,7 @@ module Stripe
226
272
  }.merge(params)
227
273
  end
228
274
 
229
- def test_refund(params = {})
275
+ def make_refund(params = {})
230
276
  {
231
277
  :object => 'refund',
232
278
  :amount => 30,
@@ -238,24 +284,33 @@ module Stripe
238
284
  }.merge(params)
239
285
  end
240
286
 
241
- def test_subscription_array(customer_id)
287
+ def make_subscription_array(customer_id)
242
288
  {
243
- :data => [test_subscription, test_subscription, test_subscription],
289
+ :data => [make_subscription, make_subscription, make_subscription],
244
290
  :object => 'list',
245
291
  :url => '/v1/customers/' + customer_id + '/subscriptions'
246
292
  }
247
293
  end
248
294
 
249
- def test_refund_array(charge_id)
295
+ def make_refund_array(charge=nil)
296
+ p = charge ? {:charge => charge} : {}
297
+
250
298
  {
251
- :data => [test_refund, test_refund, test_refund],
299
+ :data => [make_refund(p), make_refund(p), make_refund(p)],
252
300
  :object => 'list',
253
- :url => '/v1/charges/' + charge_id + '/refunds'
301
+ :url => charge ? "/v1/charges/#{charge}/refunds" : '/v1/refunds'
254
302
  }
255
303
  end
256
304
 
305
+ def make_reversal_array(transfer_id)
306
+ {
307
+ :data => [make_reversal, make_reversal, make_reversal],
308
+ :object => 'list',
309
+ :url => '/v1/transfers/' + transfer_id + '/reversals'
310
+ }
311
+ end
257
312
 
258
- def test_invoice
313
+ def make_invoice
259
314
  {
260
315
  :id => 'in_test_invoice',
261
316
  :object => 'invoice',
@@ -268,10 +323,11 @@ module Stripe
268
323
  :customer => 'c_test_customer',
269
324
  :date => 1349738950,
270
325
  :lines => {
271
- "invoiceitems" => [
326
+ :object => 'list',
327
+ :data => [
272
328
  {
273
329
  :id => 'ii_test_invoice_item',
274
- :object => '',
330
+ :object => 'invoiceitem',
275
331
  :livemode => false,
276
332
  :amount => 1000,
277
333
  :currency => 'usd',
@@ -291,12 +347,12 @@ module Stripe
291
347
  :charge => nil,
292
348
  :discount => nil,
293
349
  :ending_balance => nil,
294
- :next_payemnt_attempt => 1349825350,
350
+ :next_payment_attempt => 1349825350,
295
351
  }
296
352
  end
297
353
 
298
- def test_paid_invoice
299
- test_invoice.merge({
354
+ def make_paid_invoice
355
+ make_invoice.merge({
300
356
  :attempt_count => 1,
301
357
  :attempted => true,
302
358
  :closed => true,
@@ -307,15 +363,15 @@ module Stripe
307
363
  })
308
364
  end
309
365
 
310
- def test_invoice_customer_array
366
+ def make_invoice_customer_array
311
367
  {
312
- :data => [test_invoice],
368
+ :data => [make_invoice],
313
369
  :object => 'list',
314
370
  :url => '/v1/invoices?customer=test_customer'
315
371
  }
316
372
  end
317
373
 
318
- def test_recipient(params={})
374
+ def make_recipient(params={})
319
375
  id = params[:id] || 'rp_test_recipient'
320
376
  {
321
377
  :name => "Stripe User",
@@ -323,7 +379,7 @@ module Stripe
323
379
  :livemode => false,
324
380
  :object => "recipient",
325
381
  :id => "rp_test_recipient",
326
- :cards => test_card_array(id),
382
+ :cards => make_recipient_card_array(id),
327
383
  :default_card => "debit_test_card",
328
384
  :active_account => {
329
385
  :last4 => "6789",
@@ -337,15 +393,15 @@ module Stripe
337
393
  }.merge(params)
338
394
  end
339
395
 
340
- def test_recipient_array
396
+ def make_recipient_array
341
397
  {
342
- :data => [test_recipient, test_recipient, test_recipient],
398
+ :data => [make_recipient, make_recipient, make_recipient],
343
399
  :object => 'list',
344
400
  :url => '/v1/recipients'
345
401
  }
346
402
  end
347
403
 
348
- def test_transfer(params={})
404
+ def make_transfer(params={})
349
405
  {
350
406
  :status => 'pending',
351
407
  :amount => 100,
@@ -359,6 +415,7 @@ module Stripe
359
415
  :fee => 0,
360
416
  :fee_details => [],
361
417
  :id => "tr_test_transfer",
418
+ :reversals => make_reversal_array('tr_test_transfer'),
362
419
  :livemode => false,
363
420
  :currency => "usd",
364
421
  :object => "transfer",
@@ -367,21 +424,33 @@ module Stripe
367
424
  }.merge(params)
368
425
  end
369
426
 
370
- def test_transfer_array
427
+ def make_transfer_array
371
428
  {
372
- :data => [test_transfer, test_transfer, test_transfer],
429
+ :data => [make_transfer, make_transfer, make_transfer],
373
430
  :object => 'list',
374
431
  :url => '/v1/transfers'
375
432
  }
376
433
  end
377
434
 
378
- def test_canceled_transfer
379
- test_transfer.merge({
435
+ def make_canceled_transfer
436
+ make_transfer.merge({
380
437
  :status => 'canceled'
381
438
  })
382
439
  end
383
440
 
384
- def test_bitcoin_receiver(params={})
441
+ def make_reversal(params={})
442
+ {
443
+ :object => 'transfer_reversal',
444
+ :amount => 30,
445
+ :currency => "usd",
446
+ :created => 1308595038,
447
+ :id => "ref_test_reversal",
448
+ :transfer => "tr_test_transfer",
449
+ :metadata => {}
450
+ }.merge(params)
451
+ end
452
+
453
+ def make_bitcoin_receiver(params={})
385
454
  {
386
455
  :id => 'btcrcv_test_receiver',
387
456
  :amount => 100,
@@ -389,19 +458,19 @@ module Stripe
389
458
  :description => 'some details',
390
459
  :metadata => {},
391
460
  :object => 'bitcoin_receiver',
392
- :transactions => test_bitcoin_transaction_array
461
+ :transactions => make_bitcoin_transaction_array
393
462
  }.merge(params)
394
463
  end
395
464
 
396
- def test_bitcoin_receiver_array
465
+ def make_bitcoin_receiver_array
397
466
  {
398
- :data => [test_bitcoin_receiver, test_bitcoin_receiver, test_bitcoin_receiver],
467
+ :data => [make_bitcoin_receiver, make_bitcoin_receiver, make_bitcoin_receiver],
399
468
  :object => 'list',
400
469
  :url => '/v1/bitcoin/receivers'
401
470
  }
402
471
  end
403
472
 
404
- def test_bitcoin_transaction(params={})
473
+ def make_bitcoin_transaction(params={})
405
474
  {
406
475
  :id => 'btctxn_test_transaction',
407
476
  :object => 'bitcoin_transaction',
@@ -412,15 +481,15 @@ module Stripe
412
481
  }.merge(params)
413
482
  end
414
483
 
415
- def test_bitcoin_transaction_array
484
+ def make_bitcoin_transaction_array
416
485
  {
417
- :data => [test_bitcoin_transaction, test_bitcoin_transaction, test_bitcoin_transaction],
486
+ :data => [make_bitcoin_transaction, make_bitcoin_transaction, make_bitcoin_transaction],
418
487
  :object => 'list',
419
488
  :url => "/v1/bitcoin/receivers/btcrcv_test_receiver/transactions"
420
489
  }
421
490
  end
422
491
 
423
- def test_invalid_api_key_error
492
+ def make_invalid_api_key_error
424
493
  {
425
494
  :error => {
426
495
  :type => "invalid_request_error",
@@ -429,7 +498,7 @@ module Stripe
429
498
  }
430
499
  end
431
500
 
432
- def test_invalid_exp_year_error
501
+ def make_invalid_exp_year_error
433
502
  {
434
503
  :error => {
435
504
  :code => "invalid_expiry_year",
@@ -440,7 +509,7 @@ module Stripe
440
509
  }
441
510
  end
442
511
 
443
- def test_missing_id_error
512
+ def make_missing_id_error
444
513
  {
445
514
  :error => {
446
515
  :param => "id",
@@ -450,7 +519,16 @@ module Stripe
450
519
  }
451
520
  end
452
521
 
453
- def test_api_error
522
+ def make_rate_limit_error
523
+ {
524
+ :error => {
525
+ :type => "invalid_request_error",
526
+ :message => "Too many requests in a period of time."
527
+ }
528
+ }
529
+ end
530
+
531
+ def make_api_error
454
532
  {
455
533
  :error => {
456
534
  :type => "api_error"
@@ -458,11 +536,140 @@ module Stripe
458
536
  }
459
537
  end
460
538
 
461
- def test_delete_discount_response
539
+ def make_delete_discount_response
462
540
  {
463
541
  :deleted => true,
464
542
  :id => "di_test_coupon"
465
543
  }
466
544
  end
545
+
546
+ def make_product(params={})
547
+ {
548
+ :id => "pr_test_product",
549
+ :created => 1441992477,
550
+ :updated => 1441992477,
551
+ :object => "product",
552
+ :livemode => false,
553
+ :name => "Test Product",
554
+ :caption => "Comfy comfu",
555
+ :description => "Testing",
556
+ :active => true,
557
+ :attributes => [],
558
+ :shippable => true,
559
+ :metadata => {},
560
+ :url => "http://example.com/product",
561
+ :package_dimensions => nil,
562
+ :images => [],
563
+ :skus => make_sku_array("pr_test_product")
564
+ }.merge(params)
565
+ end
566
+
567
+ def make_product_array
568
+ {
569
+ :object => "list",
570
+ :url => "/v1/products",
571
+ :data => [
572
+ make_product,
573
+ make_product,
574
+ make_product,
575
+ ],
576
+ }
577
+ end
578
+
579
+ def make_sku(params={})
580
+ {
581
+ :id => "12345",
582
+ :created => 1441992494,
583
+ :updated => 1441992494,
584
+ :object => "sku",
585
+ :livemode => false,
586
+ :product => "pr_test_product",
587
+ :image => nil,
588
+ :active => true,
589
+ :price => 999,
590
+ :currency => "usd",
591
+ :inventory => {
592
+ :type => "infinite",
593
+ :quantity => nil,
594
+ :value => nil,
595
+ },
596
+ :attributes => {},
597
+ :metadata => {},
598
+ :package_dimensions => nil,
599
+ }.merge(params)
600
+ end
601
+
602
+ def make_sku_array(product_id, params={})
603
+ {
604
+ :object => "list",
605
+ :url => "/v1/skus",
606
+ :data => [
607
+ make_sku(:product => product_id),
608
+ make_sku(:product => product_id),
609
+ make_sku(:product => product_id),
610
+ ]
611
+ }
612
+ end
613
+
614
+ def make_order(params={})
615
+ {
616
+ :id => "or_16kg0uDAu10Yox5RReNVCthv",
617
+ :created => 1442171988,
618
+ :updated => nil,
619
+ :object => "order",
620
+ :livemode => false,
621
+ :status => "created",
622
+ :metadata => {},
623
+ :customer => nil,
624
+ :shipping => {
625
+ :name => "Jenny Rosen",
626
+ :address => {
627
+ :line1 => "1234 Main street",
628
+ :line2 => nil,
629
+ :city => "Anytown",
630
+ :state => nil,
631
+ :postal_code => "123456",
632
+ :country => "US"
633
+ },
634
+ :phone => nil,
635
+ },
636
+ :email => nil,
637
+ :items => [
638
+ {
639
+ :parent => "sk_16bHXrDAu10Yox5RU2007dpU",
640
+ :object => "order_item",
641
+ :type => "sku",
642
+ :description => "T-shirt",
643
+ :amount => 1500,
644
+ :currency => "usd",
645
+ :quantity => nil,
646
+ }
647
+ ],
648
+ :shipping_methods => nil,
649
+ :selected_shipping_method => nil,
650
+ :amount => 1500,
651
+ :currency => "usd",
652
+ :charge => nil,
653
+ }.merge(params)
654
+ end
655
+
656
+ def make_order_array(params={})
657
+ {
658
+ :object => "list",
659
+ :url => "/v1/orders",
660
+ :data => [
661
+ make_order,
662
+ make_order,
663
+ make_order,
664
+ ]
665
+ }
666
+ end
667
+
668
+ def make_paid_order(params={})
669
+ make_order.merge({
670
+ :status => "paid",
671
+ :charge => make_charge,
672
+ }).merge(params)
673
+ end
467
674
  end
468
675
  end