stripe 1.30.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +4 -0
  3. data/.github/ISSUE_TEMPLATE.md +5 -0
  4. data/.travis.yml +3 -14
  5. data/Gemfile +28 -4
  6. data/History.txt +180 -0
  7. data/README.md +147 -0
  8. data/Rakefile +10 -0
  9. data/VERSION +1 -1
  10. data/bin/stripe-console +12 -5
  11. data/lib/data/ca-certificates.crt +3868 -5114
  12. data/lib/stripe/account.rb +43 -23
  13. data/lib/stripe/alipay_account.rb +20 -0
  14. data/lib/stripe/api_operations/create.rb +2 -2
  15. data/lib/stripe/api_operations/delete.rb +2 -2
  16. data/lib/stripe/api_operations/list.rb +2 -3
  17. data/lib/stripe/api_operations/request.rb +9 -3
  18. data/lib/stripe/api_operations/save.rb +85 -0
  19. data/lib/stripe/api_resource.rb +38 -5
  20. data/lib/stripe/apple_pay_domain.rb +12 -0
  21. data/lib/stripe/application_fee.rb +8 -8
  22. data/lib/stripe/application_fee_refund.rb +7 -3
  23. data/lib/stripe/balance_transaction.rb +1 -1
  24. data/lib/stripe/bank_account.rb +13 -4
  25. data/lib/stripe/bitcoin_receiver.rb +6 -6
  26. data/lib/stripe/bitcoin_transaction.rb +1 -1
  27. data/lib/stripe/card.rb +9 -5
  28. data/lib/stripe/charge.rb +38 -20
  29. data/lib/stripe/country_spec.rb +9 -0
  30. data/lib/stripe/coupon.rb +1 -1
  31. data/lib/stripe/customer.rb +12 -10
  32. data/lib/stripe/dispute.rb +4 -5
  33. data/lib/stripe/errors.rb +92 -0
  34. data/lib/stripe/file_upload.rb +1 -1
  35. data/lib/stripe/invoice.rb +7 -7
  36. data/lib/stripe/invoice_item.rb +1 -1
  37. data/lib/stripe/list_object.rb +8 -7
  38. data/lib/stripe/order.rb +12 -4
  39. data/lib/stripe/order_return.rb +9 -0
  40. data/lib/stripe/plan.rb +1 -1
  41. data/lib/stripe/product.rb +2 -10
  42. data/lib/stripe/recipient.rb +1 -1
  43. data/lib/stripe/refund.rb +1 -1
  44. data/lib/stripe/reversal.rb +7 -3
  45. data/lib/stripe/singleton_api_resource.rb +3 -3
  46. data/lib/stripe/sku.rb +2 -2
  47. data/lib/stripe/source.rb +11 -0
  48. data/lib/stripe/stripe_client.rb +396 -0
  49. data/lib/stripe/stripe_object.rb +167 -91
  50. data/lib/stripe/stripe_response.rb +48 -0
  51. data/lib/stripe/subscription.rb +15 -9
  52. data/lib/stripe/subscription_item.rb +12 -0
  53. data/lib/stripe/three_d_secure.rb +9 -0
  54. data/lib/stripe/transfer.rb +4 -5
  55. data/lib/stripe/util.rb +105 -33
  56. data/lib/stripe/version.rb +1 -1
  57. data/lib/stripe.rb +69 -266
  58. data/spec/fixtures.json +1409 -0
  59. data/spec/fixtures.yaml +1153 -0
  60. data/spec/spec.json +19949 -0
  61. data/spec/spec.yaml +15504 -0
  62. data/stripe.gemspec +5 -18
  63. data/test/api_fixtures.rb +29 -0
  64. data/test/api_stub_helpers.rb +125 -0
  65. data/test/stripe/account_test.rb +163 -211
  66. data/test/stripe/alipay_account_test.rb +19 -0
  67. data/test/stripe/api_operations_test.rb +31 -0
  68. data/test/stripe/api_resource_test.rb +174 -340
  69. data/test/stripe/apple_pay_domain_test.rb +33 -0
  70. data/test/stripe/application_fee_refund_test.rb +22 -31
  71. data/test/stripe/application_fee_test.rb +6 -14
  72. data/test/stripe/balance_test.rb +3 -3
  73. data/test/stripe/bank_account_test.rb +41 -0
  74. data/test/stripe/bitcoin_receiver_test.rb +51 -42
  75. data/test/stripe/bitcoin_transaction_test.rb +11 -19
  76. data/test/stripe/charge_test.rb +39 -98
  77. data/test/stripe/country_spec_test.rb +20 -0
  78. data/test/stripe/coupon_test.rb +35 -11
  79. data/test/stripe/customer_card_test.rb +25 -46
  80. data/test/stripe/customer_test.rb +89 -61
  81. data/test/stripe/dispute_test.rb +28 -31
  82. data/test/stripe/errors_test.rb +18 -0
  83. data/test/stripe/file_upload_test.rb +32 -24
  84. data/test/stripe/invoice_item_test.rb +55 -0
  85. data/test/stripe/invoice_test.rb +50 -24
  86. data/test/stripe/list_object_test.rb +57 -45
  87. data/test/stripe/order_return_test.rb +21 -0
  88. data/test/stripe/order_test.rb +41 -34
  89. data/test/stripe/plan_test.rb +52 -0
  90. data/test/stripe/product_test.rb +31 -25
  91. data/test/stripe/recipient_card_test.rb +23 -40
  92. data/test/stripe/recipient_test.rb +50 -0
  93. data/test/stripe/refund_test.rb +20 -36
  94. data/test/stripe/reversal_test.rb +27 -31
  95. data/test/stripe/sku_test.rb +39 -13
  96. data/test/stripe/source_test.rb +43 -0
  97. data/test/stripe/stripe_client_test.rb +428 -0
  98. data/test/stripe/stripe_object_test.rb +186 -13
  99. data/test/stripe/stripe_response_test.rb +46 -0
  100. data/test/stripe/subscription_item_test.rb +54 -0
  101. data/test/stripe/subscription_test.rb +40 -52
  102. data/test/stripe/three_d_secure_test.rb +23 -0
  103. data/test/stripe/transfer_test.rb +38 -13
  104. data/test/stripe/util_test.rb +48 -16
  105. data/test/stripe_test.rb +25 -0
  106. data/test/test_data.rb +5 -621
  107. data/test/test_helper.rb +24 -24
  108. metadata +60 -139
  109. data/README.rdoc +0 -68
  110. data/gemfiles/default-with-activesupport.gemfile +0 -10
  111. data/gemfiles/json.gemfile +0 -12
  112. data/gemfiles/yajl.gemfile +0 -12
  113. data/lib/stripe/api_operations/update.rb +0 -58
  114. data/lib/stripe/errors/api_connection_error.rb +0 -4
  115. data/lib/stripe/errors/api_error.rb +0 -4
  116. data/lib/stripe/errors/authentication_error.rb +0 -4
  117. data/lib/stripe/errors/card_error.rb +0 -12
  118. data/lib/stripe/errors/invalid_request_error.rb +0 -11
  119. data/lib/stripe/errors/rate_limit_error.rb +0 -4
  120. data/lib/stripe/errors/stripe_error.rb +0 -26
  121. data/test/stripe/charge_refund_test.rb +0 -55
  122. data/test/stripe/metadata_test.rb +0 -129
data/test/stripe_test.rb CHANGED
@@ -13,4 +13,29 @@ class StripeTest < Test::Unit::TestCase
13
13
  $stderr = old_stderr
14
14
  end
15
15
  end
16
+
17
+ should "allow ca_bundle_path to be configured" do
18
+ begin
19
+ old = Stripe.ca_bundle_path
20
+ Stripe.ca_bundle_path = "path/to/ca/bundle"
21
+ assert_equal "path/to/ca/bundle", Stripe.ca_bundle_path
22
+ ensure
23
+ Stripe.ca_bundle_path = old
24
+ end
25
+ end
26
+
27
+ should "allow max_network_retries to be configured" do
28
+ begin
29
+ old = Stripe.max_network_retries
30
+ Stripe.max_network_retries = 99
31
+ assert_equal 99, Stripe.max_network_retries
32
+ ensure
33
+ Stripe.max_network_retries = old
34
+ end
35
+ end
36
+
37
+ should "have default open and read timeouts" do
38
+ assert_equal Stripe.open_timeout, 30
39
+ assert_equal Stripe.read_timeout, 80
40
+ end
16
41
  end
data/test/test_data.rb CHANGED
@@ -1,491 +1,11 @@
1
1
  module Stripe
2
2
  module TestData
3
- def make_response(body, code=200)
4
- # When an exception is raised, restclient clobbers method_missing. Hence we
5
- # can't just use the stubs interface.
6
- body = JSON.generate(body) if !(body.kind_of? String)
7
- m = mock
8
- m.instance_variable_set('@stripe_values', {
9
- :body => body,
10
- :code => code,
11
- :headers => {},
12
- })
13
- def m.body; @stripe_values[:body]; end
14
- def m.code; @stripe_values[:code]; end
15
- def m.headers; @stripe_values[:headers]; end
16
- m
17
- end
18
-
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={})
28
- {
29
- :pending => [
30
- {:amount => 12345, :currency => "usd"}
31
- ],
32
- :available => [
33
- {:amount => 6789, :currency => "usd"}
34
- ],
35
- :livemode => false,
36
- :object => "balance"
37
- }.merge(params)
38
- end
39
-
40
- def make_balance_transaction(params={})
41
- {
42
- :amount => 100,
43
- :net => 41,
44
- :currency => "usd",
45
- :type => "charge",
46
- :created => 1371945005,
47
- :available_on => 1372549805,
48
- :status => "pending",
49
- :description => "A test balance transaction",
50
- :fee => 59,
51
- :object => "balance_transaction"
52
- }.merge(params)
53
- end
54
-
55
- def make_balance_transaction_array
56
- {
57
- :data => [make_balance_transaction, make_balance_transaction, make_balance_transaction],
58
- :object => "list",
59
- :url => "/v1/balance/history"
60
- }
61
- end
62
-
63
- def make_application_fee(params={})
64
- id = params[:id] || 'fee_test_fee'
65
- {
66
- :refunded => false,
67
- :amount => 100,
68
- :application => "ca_test_application",
69
- :user => "acct_test_user",
70
- :charge => "ch_test_charge",
71
- :id => id,
72
- :livemode => false,
73
- :currency => "usd",
74
- :object => "application_fee",
75
- :refunds => make_application_fee_refund_array(id),
76
- :created => 1304114826
77
- }.merge(params)
78
- end
79
-
80
- def make_application_fee_refund(params = {})
81
- {
82
- :object => 'fee_refund',
83
- :amount => 30,
84
- :currency => "usd",
85
- :created => 1308595038,
86
- :id => "ref_test_app_fee_refund",
87
- :fee => "ca_test_application",
88
- :metadata => {}
89
- }.merge(params)
90
- end
91
-
92
- def make_application_fee_array
93
- {
94
- :data => [make_application_fee, make_application_fee, make_application_fee],
95
- :object => 'list',
96
- :url => '/v1/application_fees'
97
- }
98
- end
99
-
100
- def make_application_fee_refund_array(fee_id)
101
- {
102
- :data => [make_application_fee_refund, make_application_fee_refund, make_application_fee_refund],
103
- :object => 'list',
104
- :url => '/v1/application_fees/' + fee_id + '/refunds'
105
- }
106
- end
107
-
108
- def make_customer(params={})
109
- id = params[:id] || 'c_test_customer'
110
- {
111
- :subscription_history => [],
112
- :bills => [],
113
- :charges => [],
114
- :livemode => false,
115
- :object => "customer",
116
- :id => id,
117
- :default_card => "cc_test_card",
118
- :created => 1304114758,
119
- :sources => make_customer_card_array(id),
120
- :metadata => {},
121
- :subscriptions => make_subscription_array(id)
122
- }.merge(params)
123
- end
124
-
125
- def make_customer_array
126
- {
127
- :data => [make_customer, make_customer, make_customer],
128
- :object => 'list',
129
- :url => '/v1/customers'
130
- }
131
- end
132
-
133
- def make_charge(params={})
134
- id = params[:id] || 'ch_test_charge'
135
- {
136
- :refunded => false,
137
- :paid => true,
138
- :amount => 100,
139
- :card => {
140
- :type => "Visa",
141
- :last4 => "4242",
142
- :exp_month => 11,
143
- :country => "US",
144
- :exp_year => 2012,
145
- :id => "cc_test_card",
146
- :object => "card"
147
- },
148
- :id => id,
149
- :reason => "execute_charge",
150
- :livemode => false,
151
- :currency => "usd",
152
- :object => "charge",
153
- :created => 1304114826,
154
- :refunds => make_refund_array(id),
155
- :metadata => {}
156
- }.merge(params)
157
- end
158
-
159
- def make_charge_array
160
- {
161
- :data => [make_charge, make_charge, make_charge],
162
- :object => 'list',
163
- :url => '/v1/charges'
164
- }
165
- end
166
-
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)
201
- {
202
- :data => [make_card, make_card, make_card],
203
- :object => 'list',
204
- :url => '/v1/customers/' + customer_id + '/sources'
205
- }
206
- end
207
-
208
- def make_card(params={})
209
- {
210
- :type => "Visa",
211
- :last4 => "4242",
212
- :exp_month => 11,
213
- :country => "US",
214
- :exp_year => 2012,
215
- :id => "cc_test_card",
216
- :customer => 'c_test_customer',
217
- :object => "card"
218
- }.merge(params)
219
- end
220
-
221
- def make_coupon(params={})
222
- {
223
- :duration => 'repeating',
224
- :duration_in_months => 3,
225
- :percent_off => 25,
226
- :id => "co_test_coupon",
227
- :object => "coupon",
228
- :metadata => {},
229
- }.merge(params)
230
- end
231
-
232
- def make_file(params={})
233
- {
234
- :object => "file_upload",
235
- :id => "fil_test_file",
236
- :created => 1403047735,
237
- :size => 4908,
238
- :purpose => params[:purpose] || "dispute_evidence",
239
- :url => nil,
240
- :type => nil,
241
- }
242
- end
243
-
244
- def make_file_array
245
- {
246
- :data => [make_file, make_file, make_file],
247
- :object => 'list',
248
- :url => '/v1/files'
249
- }
250
- end
251
-
252
- #FIXME nested overrides would be better than hardcoding plan_id
253
- def make_subscription(params = {})
254
- plan = params.delete(:plan) || 'gold'
255
- {
256
- :current_period_end => 1308681468,
257
- :status => "trialing",
258
- :plan => {
259
- :interval => "month",
260
- :amount => 7500,
261
- :trial_period_days => 30,
262
- :object => "plan",
263
- :identifier => plan
264
- },
265
- :current_period_start => 1308595038,
266
- :start => 1308595038,
267
- :object => "subscription",
268
- :trial_start => 1308595038,
269
- :trial_end => 1308681468,
270
- :customer => "c_test_customer",
271
- :id => 's_test_subscription'
272
- }.merge(params)
273
- end
274
-
275
- def make_refund(params = {})
276
- {
277
- :object => 'refund',
278
- :amount => 30,
279
- :currency => "usd",
280
- :created => 1308595038,
281
- :id => "ref_test_refund",
282
- :charge => "ch_test_charge",
283
- :metadata => {}
284
- }.merge(params)
285
- end
286
-
287
- def make_subscription_array(customer_id)
288
- {
289
- :data => [make_subscription, make_subscription, make_subscription],
290
- :object => 'list',
291
- :url => '/v1/customers/' + customer_id + '/subscriptions'
292
- }
293
- end
294
-
295
- def make_refund_array(charge=nil)
296
- p = charge ? {:charge => charge} : {}
297
-
298
- {
299
- :data => [make_refund(p), make_refund(p), make_refund(p)],
300
- :object => 'list',
301
- :url => charge ? "/v1/charges/#{charge}/refunds" : '/v1/refunds'
302
- }
303
- end
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
312
-
313
- def make_invoice
314
- {
315
- :id => 'in_test_invoice',
316
- :object => 'invoice',
317
- :livemode => false,
318
- :amount_due => 1000,
319
- :attempt_count => 0,
320
- :attempted => false,
321
- :closed => false,
322
- :currency => 'usd',
323
- :customer => 'c_test_customer',
324
- :date => 1349738950,
325
- :lines => {
326
- :object => 'list',
327
- :data => [
328
- {
329
- :id => 'ii_test_invoice_item',
330
- :object => 'invoiceitem',
331
- :livemode => false,
332
- :amount => 1000,
333
- :currency => 'usd',
334
- :customer => 'c_test_customer',
335
- :date => 1349738950,
336
- :description => "A Test Invoice Item",
337
- :invoice => 'in_test_invoice'
338
- },
339
- ],
340
- },
341
- :paid => false,
342
- :period_end => 1349738950,
343
- :period_start => 1349738950,
344
- :starting_balance => 0,
345
- :subtotal => 1000,
346
- :total => 1000,
347
- :charge => nil,
348
- :discount => nil,
349
- :ending_balance => nil,
350
- :next_payment_attempt => 1349825350,
351
- }
352
- end
353
-
354
- def make_paid_invoice
355
- make_invoice.merge({
356
- :attempt_count => 1,
357
- :attempted => true,
358
- :closed => true,
359
- :paid => true,
360
- :charge => 'ch_test_charge',
361
- :ending_balance => 0,
362
- :next_payment_attempt => nil,
363
- })
364
- end
365
-
366
- def make_invoice_customer_array
367
- {
368
- :data => [make_invoice],
369
- :object => 'list',
370
- :url => '/v1/invoices?customer=test_customer'
371
- }
372
- end
373
-
374
- def make_recipient(params={})
375
- id = params[:id] || 'rp_test_recipient'
376
- {
377
- :name => "Stripe User",
378
- :type => "individual",
379
- :livemode => false,
380
- :object => "recipient",
381
- :id => "rp_test_recipient",
382
- :cards => make_recipient_card_array(id),
383
- :default_card => "debit_test_card",
384
- :active_account => {
385
- :last4 => "6789",
386
- :bank_name => "STRIPE TEST BANK",
387
- :country => "US",
388
- :object => "bank_account"
389
- },
390
- :created => 1304114758,
391
- :verified => true,
392
- :metadata => {}
393
- }.merge(params)
394
- end
395
-
396
- def make_recipient_array
397
- {
398
- :data => [make_recipient, make_recipient, make_recipient],
399
- :object => 'list',
400
- :url => '/v1/recipients'
401
- }
402
- end
403
-
404
- def make_transfer(params={})
405
- {
406
- :status => 'pending',
407
- :amount => 100,
408
- :account => {
409
- :object => 'bank_account',
410
- :country => 'US',
411
- :bank_name => 'STRIPE TEST BANK',
412
- :last4 => '6789'
413
- },
414
- :recipient => 'test_recipient',
415
- :fee => 0,
416
- :fee_details => [],
417
- :id => "tr_test_transfer",
418
- :reversals => make_reversal_array('tr_test_transfer'),
419
- :livemode => false,
420
- :currency => "usd",
421
- :object => "transfer",
422
- :date => 1304114826,
423
- :metadata => {}
424
- }.merge(params)
425
- end
426
-
427
- def make_transfer_array
428
- {
429
- :data => [make_transfer, make_transfer, make_transfer],
430
- :object => 'list',
431
- :url => '/v1/transfers'
432
- }
433
- end
434
-
435
- def make_canceled_transfer
436
- make_transfer.merge({
437
- :status => 'canceled'
438
- })
439
- end
440
-
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={})
454
- {
455
- :id => 'btcrcv_test_receiver',
456
- :amount => 100,
457
- :currency => 'usd',
458
- :description => 'some details',
459
- :metadata => {},
460
- :object => 'bitcoin_receiver',
461
- :transactions => make_bitcoin_transaction_array
462
- }.merge(params)
463
- end
464
-
465
- def make_bitcoin_receiver_array
466
- {
467
- :data => [make_bitcoin_receiver, make_bitcoin_receiver, make_bitcoin_receiver],
468
- :object => 'list',
469
- :url => '/v1/bitcoin/receivers'
470
- }
471
- end
472
-
473
- def make_bitcoin_transaction(params={})
474
- {
475
- :id => 'btctxn_test_transaction',
476
- :object => 'bitcoin_transaction',
477
- :amount => 100,
478
- :currency => 'usd',
479
- :bitcoin_amount => 90,
480
- :receiver => 'btcrcv_test_receiver'
481
- }.merge(params)
482
- end
483
-
484
- def make_bitcoin_transaction_array
3
+ def make_error(type, message)
485
4
  {
486
- :data => [make_bitcoin_transaction, make_bitcoin_transaction, make_bitcoin_transaction],
487
- :object => 'list',
488
- :url => "/v1/bitcoin/receivers/btcrcv_test_receiver/transactions"
5
+ :error => {
6
+ :type => type,
7
+ :message => message,
8
+ }
489
9
  }
490
10
  end
491
11
 
@@ -535,141 +55,5 @@ module Stripe
535
55
  }
536
56
  }
537
57
  end
538
-
539
- def make_delete_discount_response
540
- {
541
- :deleted => true,
542
- :id => "di_test_coupon"
543
- }
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
674
58
  end
675
59
  end