fake_stripe 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.md +33 -0
  3. data/LICENSE +19 -0
  4. data/README.md +66 -0
  5. data/Rakefile +8 -0
  6. data/lib/fake_stripe.rb +49 -0
  7. data/lib/fake_stripe/assets/v1.js +38 -0
  8. data/lib/fake_stripe/assets/v2-mock.js +18 -0
  9. data/lib/fake_stripe/assets/v2.js +757 -0
  10. data/lib/fake_stripe/configuration.rb +15 -0
  11. data/lib/fake_stripe/fixtures/cancel_subscription.json +18 -0
  12. data/lib/fake_stripe/fixtures/cancel_transfer.json +161 -0
  13. data/lib/fake_stripe/fixtures/capture_charge.json +51 -0
  14. data/lib/fake_stripe/fixtures/close_dispute.json +13 -0
  15. data/lib/fake_stripe/fixtures/create_card.json +21 -0
  16. data/lib/fake_stripe/fixtures/create_charge.json +45 -0
  17. data/lib/fake_stripe/fixtures/create_coupon.json +17 -0
  18. data/lib/fake_stripe/fixtures/create_customer.json +51 -0
  19. data/lib/fake_stripe/fixtures/create_invoice.json +52 -0
  20. data/lib/fake_stripe/fixtures/create_invoiceitem.json +15 -0
  21. data/lib/fake_stripe/fixtures/create_plan.json +14 -0
  22. data/lib/fake_stripe/fixtures/create_recipient.json +25 -0
  23. data/lib/fake_stripe/fixtures/create_subscription.json +18 -0
  24. data/lib/fake_stripe/fixtures/create_token.json +26 -0
  25. data/lib/fake_stripe/fixtures/create_transfer.json +161 -0
  26. data/lib/fake_stripe/fixtures/delete_card.json +4 -0
  27. data/lib/fake_stripe/fixtures/delete_coupon.json +4 -0
  28. data/lib/fake_stripe/fixtures/delete_customer.json +4 -0
  29. data/lib/fake_stripe/fixtures/delete_customer_discount.json +4 -0
  30. data/lib/fake_stripe/fixtures/delete_invoiceitem.json +4 -0
  31. data/lib/fake_stripe/fixtures/delete_plan.json +4 -0
  32. data/lib/fake_stripe/fixtures/delete_recipient.json +4 -0
  33. data/lib/fake_stripe/fixtures/delete_subscription_discount.json +4 -0
  34. data/lib/fake_stripe/fixtures/list_application_fees.json +55 -0
  35. data/lib/fake_stripe/fixtures/list_balance_history.json +76 -0
  36. data/lib/fake_stripe/fixtures/list_cards.json +70 -0
  37. data/lib/fake_stripe/fixtures/list_charges.json +146 -0
  38. data/lib/fake_stripe/fixtures/list_coupons.json +58 -0
  39. data/lib/fake_stripe/fixtures/list_customers.json +157 -0
  40. data/lib/fake_stripe/fixtures/list_events.json +172 -0
  41. data/lib/fake_stripe/fixtures/list_invoiceitems.json +52 -0
  42. data/lib/fake_stripe/fixtures/list_invoices.json +199 -0
  43. data/lib/fake_stripe/fixtures/list_plans.json +49 -0
  44. data/lib/fake_stripe/fixtures/list_recipients.json +82 -0
  45. data/lib/fake_stripe/fixtures/list_subscriptions.json +100 -0
  46. data/lib/fake_stripe/fixtures/list_transfers.json +488 -0
  47. data/lib/fake_stripe/fixtures/pay_invoice.json +65 -0
  48. data/lib/fake_stripe/fixtures/refund_application_fee.json +17 -0
  49. data/lib/fake_stripe/fixtures/refund_charge.json +51 -0
  50. data/lib/fake_stripe/fixtures/retrieve_account.json +19 -0
  51. data/lib/fake_stripe/fixtures/retrieve_application_fee.json +17 -0
  52. data/lib/fake_stripe/fixtures/retrieve_balance.json +16 -0
  53. data/lib/fake_stripe/fixtures/retrieve_balance_transaction.json +23 -0
  54. data/lib/fake_stripe/fixtures/retrieve_card.json +21 -0
  55. data/lib/fake_stripe/fixtures/retrieve_charge.json +45 -0
  56. data/lib/fake_stripe/fixtures/retrieve_coupon.json +17 -0
  57. data/lib/fake_stripe/fixtures/retrieve_customer.json +51 -0
  58. data/lib/fake_stripe/fixtures/retrieve_event.json +56 -0
  59. data/lib/fake_stripe/fixtures/retrieve_invoice.json +64 -0
  60. data/lib/fake_stripe/fixtures/retrieve_invoice_line_items.json +61 -0
  61. data/lib/fake_stripe/fixtures/retrieve_invoiceitem.json +15 -0
  62. data/lib/fake_stripe/fixtures/retrieve_plan.json +14 -0
  63. data/lib/fake_stripe/fixtures/retrieve_recipient.json +25 -0
  64. data/lib/fake_stripe/fixtures/retrieve_subscription.json +31 -0
  65. data/lib/fake_stripe/fixtures/retrieve_token.json +26 -0
  66. data/lib/fake_stripe/fixtures/retrieve_transfer.json +161 -0
  67. data/lib/fake_stripe/fixtures/retrieve_upcoming_invoice.json +63 -0
  68. data/lib/fake_stripe/fixtures/update_card.json +21 -0
  69. data/lib/fake_stripe/fixtures/update_charge.json +45 -0
  70. data/lib/fake_stripe/fixtures/update_customer.json +51 -0
  71. data/lib/fake_stripe/fixtures/update_dispute.json +13 -0
  72. data/lib/fake_stripe/fixtures/update_invoice.json +64 -0
  73. data/lib/fake_stripe/fixtures/update_invoiceitem.json +15 -0
  74. data/lib/fake_stripe/fixtures/update_plan.json +14 -0
  75. data/lib/fake_stripe/fixtures/update_recipient.json +25 -0
  76. data/lib/fake_stripe/fixtures/update_subscription.json +18 -0
  77. data/lib/fake_stripe/fixtures/update_transfer.json +161 -0
  78. data/lib/fake_stripe/initializers/webmock.rb +3 -0
  79. data/lib/fake_stripe/stub_app.rb +307 -0
  80. data/lib/fake_stripe/stub_stripe_js.rb +29 -0
  81. data/lib/fake_stripe/version.rb +3 -0
  82. metadata +211 -0
@@ -0,0 +1,51 @@
1
+ {
2
+ "object": "customer",
3
+ "created": 1394731627,
4
+ "id": "abcdefghijklmnop",
5
+ "livemode": false,
6
+ "description": "Customer for test@example.com",
7
+ "email": null,
8
+ "delinquent": false,
9
+ "metadata": {
10
+ },
11
+ "subscriptions": {
12
+ "object": "list",
13
+ "count": 0,
14
+ "url": "/v1/customers/abcdefghijklmnop/subscriptions",
15
+ "data": [
16
+
17
+ ]
18
+ },
19
+ "discount": null,
20
+ "account_balance": 0,
21
+ "currency": "usd",
22
+ "cards": {
23
+ "object": "list",
24
+ "count": 1,
25
+ "url": "/v1/customers/abcdefghijklmnop/cards",
26
+ "data": [
27
+ {
28
+ "id": "card_1234567890ABCDEFghijklmn",
29
+ "object": "card",
30
+ "last4": "4242",
31
+ "brand": "Visa",
32
+ "exp_month": 10,
33
+ "exp_year": 2016,
34
+ "fingerprint": "ZYXWVUTSRQPONMLK",
35
+ "customer": "abcdefghijklmnop",
36
+ "country": "US",
37
+ "name": "ralph@example.com",
38
+ "address_line1": null,
39
+ "address_line2": null,
40
+ "address_city": null,
41
+ "address_state": null,
42
+ "address_zip": null,
43
+ "address_country": null,
44
+ "cvc_check": "pass",
45
+ "address_line1_check": null,
46
+ "address_zip_check": null
47
+ }
48
+ ]
49
+ },
50
+ "default_card": "card_1234567890ABCDEFghijklmn"
51
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "charge": "ch_103ewb2eZvKYlo2CjopvmZyM",
3
+ "amount": 1000,
4
+ "created": 1394732152,
5
+ "status": "needs_response",
6
+ "livemode": false,
7
+ "currency": "usd",
8
+ "object": "dispute",
9
+ "reason": "general",
10
+ "balance_transaction": "txn_103cQg2eZvKYlo2CYKVlR2nh",
11
+ "evidence_due_by": 1396396799,
12
+ "evidence": "Here's evidence showing this charge is legitimate."
13
+ }
@@ -0,0 +1,64 @@
1
+ {
2
+ "date": 1394731307,
3
+ "id": "in_103ewP2eZvKYlo2CFLLwIX7a",
4
+ "period_start": 1394731307,
5
+ "period_end": 1394731307,
6
+ "lines": {
7
+ "data": [
8
+ {
9
+ "id": "sub_3ewdhCIki3FxWt",
10
+ "object": "line_item",
11
+ "type": "subscription",
12
+ "livemode": true,
13
+ "amount": 2000,
14
+ "currency": "usd",
15
+ "proration": false,
16
+ "period": {
17
+ "start": 1397410552,
18
+ "end": 1400002552
19
+ },
20
+ "quantity": 1,
21
+ "plan": {
22
+ "interval": "month",
23
+ "name": "New plan name123",
24
+ "created": 1386247539,
25
+ "amount": 2000,
26
+ "currency": "usd",
27
+ "id": "gold21323",
28
+ "object": "plan",
29
+ "livemode": false,
30
+ "interval_count": 1,
31
+ "trial_period_days": null,
32
+ "metadata": {
33
+ }
34
+ },
35
+ "description": null,
36
+ "metadata": null
37
+ }
38
+ ],
39
+ "count": 1,
40
+ "object": "list",
41
+ "url": "/v1/invoices/in_103ewP2eZvKYlo2CFLLwIX7a/lines"
42
+ },
43
+ "subtotal": 0,
44
+ "total": 0,
45
+ "customer": "abcdefghijklmnop",
46
+ "object": "invoice",
47
+ "attempted": true,
48
+ "closed": true,
49
+ "paid": true,
50
+ "livemode": false,
51
+ "attempt_count": 0,
52
+ "amount_due": 0,
53
+ "currency": "usd",
54
+ "starting_balance": 0,
55
+ "ending_balance": null,
56
+ "next_payment_attempt": null,
57
+ "charge": null,
58
+ "discount": null,
59
+ "application_fee": null,
60
+ "subscription": "sub_3ewPpEGKafMelq",
61
+ "metadata": {
62
+ },
63
+ "description": null
64
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "object": "invoiceitem",
3
+ "id": "ii_103UAn2eZvKYlo2CkLmj7ne9",
4
+ "date": 1392247767,
5
+ "amount": 1500,
6
+ "livemode": false,
7
+ "proration": false,
8
+ "currency": "usd",
9
+ "customer": "abcdefghijklmnop",
10
+ "description": "Customer for test@example.com",
11
+ "metadata": {
12
+ },
13
+ "invoice": "in_103UAp2eZvKYlo2C6xOPMzPj",
14
+ "subscription": null
15
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "interval": "month",
3
+ "name": "New plan name",
4
+ "created": 1386247539,
5
+ "amount": 2000,
6
+ "currency": "usd",
7
+ "id": "gold21323",
8
+ "object": "plan",
9
+ "livemode": false,
10
+ "interval_count": 1,
11
+ "trial_period_days": null,
12
+ "metadata": {
13
+ }
14
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "id": "rp_103WyK2eZvKYlo2CXgqlepdQ",
3
+ "object": "recipient",
4
+ "created": 1392893343,
5
+ "livemode": false,
6
+ "type": "individual",
7
+ "description": "Recipient for test@example.com",
8
+ "email": null,
9
+ "name": "John Doe",
10
+ "verified": false,
11
+ "metadata": {
12
+ },
13
+ "active_account": {
14
+ "object": "bank_account",
15
+ "id": "ba_103WyK2eZvKYlo2CRbxre4Eb",
16
+ "bank_name": "BANK OF AMERICA, N.A.",
17
+ "last4": "6789",
18
+ "country": "US",
19
+ "currency": "usd",
20
+ "validated": false,
21
+ "verified": false,
22
+ "fingerprint": "j1CvuuIQNXSIdZuK",
23
+ "disabled": false
24
+ }
25
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "id": "sub_3ewdhCIki3FxWt",
3
+ "plan": "basic",
4
+ "object": "subscription",
5
+ "start": 1394732152,
6
+ "status": "active",
7
+ "customer": "abcdefghijklmnop",
8
+ "cancel_at_period_end": false,
9
+ "current_period_start": 1394732152,
10
+ "current_period_end": 1397410552,
11
+ "ended_at": null,
12
+ "trial_start": null,
13
+ "trial_end": null,
14
+ "canceled_at": null,
15
+ "quantity": 1,
16
+ "application_fee_percent": null,
17
+ "discount": null
18
+ }
@@ -0,0 +1,161 @@
1
+ {
2
+ "id": "tr_103ehW2eZvKYlo2CvqXdcIQL",
3
+ "object": "transfer",
4
+ "date": 1394841600,
5
+ "livemode": false,
6
+ "amount": 336081,
7
+ "currency": "usd",
8
+ "status": "pending",
9
+ "balance_transaction": "txn_103cQg2eZvKYlo2CYKVlR2nh",
10
+ "summary": {
11
+ "charge_gross": 365872,
12
+ "charge_fees": 29694,
13
+ "charge_fee_details": [
14
+ {
15
+ "amount": 29661,
16
+ "currency": "usd",
17
+ "type": "stripe_fee",
18
+ "description": null,
19
+ "application": null
20
+ }
21
+ ],
22
+ "refund_gross": -100,
23
+ "refund_fees": -3,
24
+ "refund_fee_details": [
25
+ {
26
+ "amount": -3,
27
+ "currency": "usd",
28
+ "type": "stripe_fee",
29
+ "description": null,
30
+ "application": null
31
+ }
32
+ ],
33
+ "adjustment_gross": 0,
34
+ "adjustment_fees": 0,
35
+ "adjustment_fee_details": [
36
+
37
+ ],
38
+ "validation_fees": 0,
39
+ "validation_count": 0,
40
+ "charge_count": 625,
41
+ "refund_count": 1,
42
+ "adjustment_count": 0,
43
+ "net": 336081,
44
+ "currency": "usd",
45
+ "collected_fee_gross": 0,
46
+ "collected_fee_count": 0,
47
+ "collected_fee_refund_gross": 0,
48
+ "collected_fee_refund_count": 0
49
+ },
50
+ "transactions": {
51
+ "object": "list",
52
+ "count": 626,
53
+ "url": "/v1/transfers/tr_103ehW2eZvKYlo2CvqXdcIQL/transactions",
54
+ "data": [
55
+ {
56
+ "id": "ch_103d7S2eZvKYlo2ClgiFvMVj",
57
+ "type": "charge",
58
+ "amount": 500,
59
+ "currency": "usd",
60
+ "net": 455,
61
+ "created": 1394311101,
62
+ "description": null,
63
+ "fee": 45,
64
+ "fee_details": [
65
+ {
66
+ "amount": 45,
67
+ "currency": "usd",
68
+ "type": "stripe_fee",
69
+ "description": "Stripe processing fees",
70
+ "application": null
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ "id": "ch_103d4l2eZvKYlo2CYxMUKdVS",
76
+ "type": "charge",
77
+ "amount": 500,
78
+ "currency": "usd",
79
+ "net": 455,
80
+ "created": 1394301116,
81
+ "description": null,
82
+ "fee": 45,
83
+ "fee_details": [
84
+ {
85
+ "amount": 45,
86
+ "currency": "usd",
87
+ "type": "stripe_fee",
88
+ "description": "Stripe processing fees",
89
+ "application": null
90
+ }
91
+ ]
92
+ },
93
+ {
94
+ "id": "ch_103cv62eZvKYlo2CC16QiOJh",
95
+ "type": "charge",
96
+ "amount": 2000,
97
+ "currency": "usd",
98
+ "net": 1912,
99
+ "created": 1394265182,
100
+ "description": "payinguser@example.com",
101
+ "fee": 88,
102
+ "fee_details": [
103
+ {
104
+ "amount": 88,
105
+ "currency": "usd",
106
+ "type": "stripe_fee",
107
+ "description": "Stripe processing fees",
108
+ "application": null
109
+ }
110
+ ]
111
+ },
112
+ {
113
+ "id": "ch_103cnV2eZvKYlo2CRoDM3aSW",
114
+ "type": "charge",
115
+ "amount": 500,
116
+ "currency": "usd",
117
+ "net": 455,
118
+ "created": 1394236904,
119
+ "description": null,
120
+ "fee": 45,
121
+ "fee_details": [
122
+ {
123
+ "amount": 45,
124
+ "currency": "usd",
125
+ "type": "stripe_fee",
126
+ "description": "Stripe processing fees",
127
+ "application": null
128
+ }
129
+ ]
130
+ },
131
+ {
132
+ "id": "ch_103cnX2eZvKYlo2CrtXEpq5u",
133
+ "type": "charge",
134
+ "amount": 500,
135
+ "currency": "usd",
136
+ "net": 455,
137
+ "created": 1394237040,
138
+ "description": null,
139
+ "fee": 45,
140
+ "fee_details": [
141
+ {
142
+ "amount": 45,
143
+ "currency": "usd",
144
+ "type": "stripe_fee",
145
+ "description": "Stripe processing fees",
146
+ "application": null
147
+ }
148
+ ]
149
+ }
150
+ ]
151
+ },
152
+ "other_transfers": [
153
+ "tr_103ehW2eZvKYlo2CvqXdcIQL"
154
+ ],
155
+ "account": null,
156
+ "description": "Transfer to test@example.com",
157
+ "metadata": {
158
+ },
159
+ "statement_descriptor": null,
160
+ "recipient": null
161
+ }
@@ -0,0 +1,3 @@
1
+ require 'webmock'
2
+ include WebMock::API
3
+ WebMock.disable_net_connect!(allow_localhost: true)
@@ -0,0 +1,307 @@
1
+ require 'sinatra/base'
2
+
3
+ module FakeStripe
4
+ class StubApp < Sinatra::Base
5
+
6
+ # Charges
7
+ post '/v1/charges' do
8
+ FakeStripe.charge_count += 1
9
+ json_response 201, fixture('create_charge')
10
+ end
11
+
12
+ get '/v1/charges/:charge_id' do
13
+ json_response 200, fixture('retrieve_charge')
14
+ end
15
+
16
+ post '/v1/charges/:charge_id' do
17
+ json_response 200, fixture('update_charge')
18
+ end
19
+
20
+ post '/v1/charges/:charge_id/refund' do
21
+ FakeStripe.refund_count += 1
22
+ json_response 200, fixture('refund_charge')
23
+ end
24
+
25
+ post '/v1/charges/:charge_id/capture' do
26
+ json_response 200, fixture('capture_charge')
27
+ end
28
+
29
+ get '/v1/charges' do
30
+ json_response 200, fixture('list_charges')
31
+ end
32
+
33
+ # Customers
34
+ post '/v1/customers' do
35
+ FakeStripe.customer_count += 1
36
+ json_response 200, fixture('create_customer')
37
+ end
38
+
39
+ get '/v1/customers/:id' do
40
+ json_response 200, fixture('retrieve_customer')
41
+ end
42
+
43
+ post '/v1/customers/:id' do
44
+ json_response 200, fixture('update_customer')
45
+ end
46
+
47
+ delete '/v1/customers/:customer_id' do
48
+ json_response 200, fixture('delete_customer')
49
+ end
50
+
51
+ get '/v1/customers' do
52
+ json_response 200, fixture('list_customers')
53
+ end
54
+
55
+ # Cards
56
+ post '/v1/customers/:customer_id/cards' do
57
+ json_response 200, fixture('create_card')
58
+ end
59
+
60
+ get '/v1/customers/:customer_id/cards/:card_id' do
61
+ json_response 200, fixture('retrieve_card')
62
+ end
63
+
64
+ post '/v1/customers/:customer_id/cards/:card_id' do
65
+ json_response 200, fixture('update_card')
66
+ end
67
+
68
+ delete '/v1/customers/:customer_id/cards/:card_id' do
69
+ json_response 200, fixture('delete_card')
70
+ end
71
+
72
+ get '/v1/customers/:customer_id/cards' do
73
+ json_response 200, fixture('list_cards')
74
+ end
75
+
76
+ # Subscriptions
77
+ post '/v1/customers/:customer_id/subscriptions' do
78
+ json_response 200, fixture('create_subscription')
79
+ end
80
+
81
+ get '/v1/customers/:customer_id/subscriptions/:subscription_id' do
82
+ json_response 200, fixture('retrieve_subscription')
83
+ end
84
+
85
+ post '/v1/customers/:customer_id/subscriptions/:subscription_id' do
86
+ json_response 200, fixture('update_subscription')
87
+ end
88
+
89
+ delete '/v1/customers/:customer_id/subscriptions/:subscription_id' do
90
+ json_response 200, fixture('cancel_subscription')
91
+ end
92
+
93
+ get '/v1/customers/:customer_id/subscriptions' do
94
+ json_response 200, fixture('list_subscriptions')
95
+ end
96
+
97
+ # Plans
98
+ post '/v1/plans' do
99
+ json_response 200, fixture('create_plan')
100
+ end
101
+
102
+ get '/v1/plans/:plan_id' do
103
+ json_response 200, fixture('retrieve_plan')
104
+ end
105
+
106
+ post '/v1/plans/:plan_id' do
107
+ json_response 200, fixture('update_plan')
108
+ end
109
+
110
+ delete '/v1/plans/:plan_id' do
111
+ json_response 200, fixture('delete_plan')
112
+ end
113
+
114
+ get '/v1/plans' do
115
+ json_response 200, fixture('list_plans')
116
+ end
117
+
118
+ # Coupons
119
+ post '/v1/coupons' do
120
+ json_response 200, fixture('create_coupon')
121
+ end
122
+
123
+ get '/v1/coupons/:coupon_id' do
124
+ json_response 200, fixture('retrieve_coupon')
125
+ end
126
+
127
+ delete '/v1/coupons/:coupon_id' do
128
+ json_response 200, fixture('delete_coupon')
129
+ end
130
+
131
+ get '/v1/coupons' do
132
+ json_response 200, fixture('list_coupons')
133
+ end
134
+
135
+ # Discounts
136
+ delete '/v1/customers/:customer_id/discount' do
137
+ json_response 200, fixture('delete_customer_discount')
138
+ end
139
+
140
+ delete '/v1/customers/:customer_id/subscriptions/:subscription_id/discount' do
141
+ json_response 200, fixture('delete_subscription_discount')
142
+ end
143
+
144
+ # Invoices
145
+ get '/v1/invoices/:invoice_id' do
146
+ json_response 200, fixture('retrieve_invoice')
147
+ end
148
+
149
+ get '/v1/invoices/:invoice_id/lines' do
150
+ json_response 200, fixture('retrieve_invoice_line_items')
151
+ end
152
+
153
+ post '/v1/invoices' do
154
+ json_response 200, fixture('create_invoice')
155
+ end
156
+
157
+ post '/v1/invoices/:invoice_id/pay' do
158
+ json_response 200, fixture('pay_invoice')
159
+ end
160
+
161
+ post '/v1/invoices/:invoice_id' do
162
+ json_response 200, fixture('update_invoice')
163
+ end
164
+
165
+ get '/v1/invoices' do
166
+ json_response 200, fixture('list_invoices')
167
+ end
168
+
169
+ get '/v1/invoices/upcoming' do
170
+ json_response 200, fixture('retrieve_upcoming_invoice')
171
+ end
172
+
173
+ # Invoice Items
174
+ post '/v1/invoiceitems' do
175
+ json_response 200, fixture('create_invoiceitem')
176
+ end
177
+
178
+ get '/v1/invoiceitems/:invoiceitem_id' do
179
+ json_response 200, fixture('retrieve_invoiceitem')
180
+ end
181
+
182
+ post '/v1/invoiceitems/:invoiceitem_id' do
183
+ json_response 200, fixture('update_invoiceitem')
184
+ end
185
+
186
+ delete '/v1/invoiceitems/:invoiceitem_id' do
187
+ json_response 200, fixture('delete_invoiceitem')
188
+ end
189
+
190
+ get '/v1/invoiceitems' do
191
+ json_response 200, fixture('list_invoiceitems')
192
+ end
193
+
194
+ # Disputes
195
+ post '/v1/charges/:charge_id/dispute' do
196
+ json_response 200, fixture('update_dispute')
197
+ end
198
+
199
+ post '/v1/charges/:charge_id/dispute/close' do
200
+ json_response 200, fixture('close_dispute')
201
+ end
202
+
203
+ # Transfers
204
+ post '/v1/transfers' do
205
+ json_response 200, fixture('create_transfer')
206
+ end
207
+
208
+ get '/v1/transfers/:transfer_id' do
209
+ json_response 200, fixture('retrieve_transfer')
210
+ end
211
+
212
+ post '/v1/transfers/:transfer_id' do
213
+ json_response 200, fixture('update_transfer')
214
+ end
215
+
216
+ post '/v1/transfers/:transfer_id/cancel' do
217
+ json_response 200, fixture('cancel_transfer')
218
+ end
219
+
220
+ get '/v1/transfers' do
221
+ json_response 200, fixture('list_transfers')
222
+ end
223
+
224
+ # Recipients
225
+ post '/v1/recipients' do
226
+ json_response 200, fixture('create_recipient')
227
+ end
228
+
229
+ get '/v1/recipients/:recipient_id' do
230
+ json_response 200, fixture('retrieve_recipient')
231
+ end
232
+
233
+ post '/v1/recipients/:recipient_id' do
234
+ json_response 200, fixture('update_recipient')
235
+ end
236
+
237
+ delete '/v1/recipients/:recipient_id' do
238
+ json_response 200, fixture('delete_recipient')
239
+ end
240
+
241
+ get '/v1/recipients' do
242
+ json_response 200, fixture('list_recipients')
243
+ end
244
+
245
+ # Application Fees
246
+ get '/v1/application_fees/:fee_id' do
247
+ json_response 200, fixture('retrieve_application_fee')
248
+ end
249
+
250
+ post '/v1/application_fees/:fee_id/refund' do
251
+ json_response 200, fixture('refund_application_fee')
252
+ end
253
+
254
+ get '/v1/application_fees' do
255
+ json_response 200, fixture('list_application_fees')
256
+ end
257
+
258
+ # Accounts
259
+ get '/v1/account' do
260
+ json_response 200, fixture('retrieve_account')
261
+ end
262
+
263
+ # Balance
264
+ get '/v1/balance' do
265
+ json_response 200, fixture('retrieve_balance')
266
+ end
267
+
268
+ get '/v1/balance/history/:transaction_id' do
269
+ json_response 200, fixture('retrieve_balance_transaction')
270
+ end
271
+
272
+ get '/v1/balance/history' do
273
+ json_response 200, fixture('list_balance_history')
274
+ end
275
+
276
+ # Events
277
+ get '/v1/events/:event_id' do
278
+ json_response 200, fixture('retrieve_event')
279
+ end
280
+
281
+ get '/v1/events' do
282
+ json_response 200, fixture('list_events')
283
+ end
284
+
285
+ # Tokens
286
+ post '/v1/tokens' do
287
+ json_response 200, fixture('create_token')
288
+ end
289
+
290
+ get '/v1/tokens/:token_id' do
291
+ json_response 200, fixture('retrieve_token')
292
+ end
293
+
294
+ private
295
+
296
+ def fixture(file_name)
297
+ file_path = File.join(FakeStripe.fixture_path, "#{file_name}.json")
298
+ File.open(file_path, 'rb').read
299
+ end
300
+
301
+ def json_response(response_code, response_body)
302
+ content_type :json
303
+ status response_code
304
+ response_body
305
+ end
306
+ end
307
+ end