fake_stripe 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
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,15 @@
1
+ module FakeStripe
2
+ module Configuration
3
+ attr_writer :fixture_path
4
+
5
+ DEFAULT_FIXTURE_PATH = File.join(File.dirname(__FILE__), 'fixtures/')
6
+
7
+ def fixture_path
8
+ @fixture_path or DEFAULT_FIXTURE_PATH
9
+ end
10
+
11
+ def configure
12
+ yield self
13
+ end
14
+ end
15
+ end
@@ -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": "canceled",
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": "STRIPE TRANSFER",
157
+ "metadata": {
158
+ },
159
+ "statement_descriptor": null,
160
+ "recipient": null
161
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "id": "ch_103ewb2eZvKYlo2CjopvmZyM",
3
+ "object": "charge",
4
+ "created": 1394732018,
5
+ "livemode": false,
6
+ "paid": true,
7
+ "amount": 500,
8
+ "currency": "usd",
9
+ "refunded": false,
10
+ "card": {
11
+ "id": "card_103ewb2eZvKYlo2CMKnx53Vg",
12
+ "object": "card",
13
+ "last4": "4242",
14
+ "brand": "Visa",
15
+ "exp_month": 1,
16
+ "exp_year": 2050,
17
+ "fingerprint": "ZYXWVUTSRQPONMLK",
18
+ "customer": null,
19
+ "country": "US",
20
+ "name": null,
21
+ "address_line1": null,
22
+ "address_line2": null,
23
+ "address_city": null,
24
+ "address_state": null,
25
+ "address_zip": null,
26
+ "address_country": null,
27
+ "cvc_check": "pass",
28
+ "address_line1_check": null,
29
+ "address_zip_check": null
30
+ },
31
+ "captured": true,
32
+ "refunds": [
33
+ {
34
+ "amount": 500,
35
+ "currency": "usd",
36
+ "created": 1394732152,
37
+ "object": "refund",
38
+ "balance_transaction": "txn_3ewdvdDggQXEhV"
39
+ }
40
+ ],
41
+ "balance_transaction": "txn_103cQg2eZvKYlo2CYKVlR2nh",
42
+ "failure_message": null,
43
+ "failure_code": null,
44
+ "amount_refunded": 500,
45
+ "customer": null,
46
+ "invoice": null,
47
+ "description": null,
48
+ "dispute": null,
49
+ "metadata": {
50
+ }
51
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "charge": "ch_103ewb2eZvKYlo2CjopvmZyM",
3
+ "amount": 1000,
4
+ "created": 1394732152,
5
+ "status": "lost",
6
+ "livemode": false,
7
+ "currency": "usd",
8
+ "object": "dispute",
9
+ "reason": "general",
10
+ "balance_transaction": "txn_103cQg2eZvKYlo2CYKVlR2nh",
11
+ "evidence_due_by": 1396396799,
12
+ "evidence": null
13
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "id": "card_103ewd2eZvKYlo2CzCsKfISF",
3
+ "object": "card",
4
+ "last4": "0002",
5
+ "brand": "Visa",
6
+ "exp_month": 5,
7
+ "exp_year": 2015,
8
+ "fingerprint": "Ffz7dpISyG2aKd75",
9
+ "customer": "abcdefghijklmnop",
10
+ "country": "US",
11
+ "name": null,
12
+ "address_line1": null,
13
+ "address_line2": null,
14
+ "address_city": null,
15
+ "address_state": null,
16
+ "address_zip": null,
17
+ "address_country": null,
18
+ "cvc_check": null,
19
+ "address_line1_check": null,
20
+ "address_zip_check": null
21
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "id": "ch_1HLqBx9AyixBof",
3
+ "object": "charge",
4
+ "created": 1360691193,
5
+ "livemode": false,
6
+ "paid": true,
7
+ "amount": 1000,
8
+ "currency": "usd",
9
+ "refunded": false,
10
+ "fee": 59,
11
+ "fee_details": [
12
+ {
13
+ "amount": 59,
14
+ "currency": "usd",
15
+ "type": "stripe_fee",
16
+ "description": "Stripe processing fees",
17
+ "application": null
18
+ }
19
+ ],
20
+ "card": {
21
+ "object": "card",
22
+ "last4": "4242",
23
+ "brand": "Visa",
24
+ "exp_month": 11,
25
+ "exp_year": 2014,
26
+ "fingerprint": "qhjxpr7DiCdFYTlH",
27
+ "country": "US",
28
+ "name": "john doe",
29
+ "address_line1": null,
30
+ "address_line2": null,
31
+ "address_city": null,
32
+ "address_state": null,
33
+ "address_zip": null,
34
+ "address_country": null,
35
+ "cvc_check": "pass",
36
+ "address_line1_check": null,
37
+ "address_zip_check": null
38
+ },
39
+ "failure_message": null,
40
+ "amount_refunded": 0,
41
+ "customer": null,
42
+ "invoice": null,
43
+ "description": "Polygonian licensing",
44
+ "dispute": null
45
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "id": "25OFF",
3
+ "created": 1391687276,
4
+ "percent_off": 25,
5
+ "amount_off": null,
6
+ "currency": "usd",
7
+ "object": "coupon",
8
+ "livemode": false,
9
+ "duration": "repeating",
10
+ "redeem_by": null,
11
+ "max_redemptions": null,
12
+ "times_redeemed": 0,
13
+ "duration_in_months": 3,
14
+ "valid": true,
15
+ "metadata": {
16
+ }
17
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "object": "customer",
3
+ "created": 1394731627,
4
+ "id": "abcdefghijklmnop",
5
+ "livemode": false,
6
+ "description": null,
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,52 @@
1
+ {
2
+ "date": 1394731307,
3
+ "id": "in_103ewP2eZvKYlo2CFLLwIX7a",
4
+ "period_start": 1394731307,
5
+ "period_end": 1394731307,
6
+ "lines": {
7
+ "data": [
8
+ {
9
+ "id": "ii_103UAn2eZvKYlo2CkLmj7ne9",
10
+ "object": "line_item",
11
+ "type": "invoiceitem",
12
+ "livemode": false,
13
+ "amount": 0,
14
+ "currency": "usd",
15
+ "proration": false,
16
+ "period": {
17
+ "start": 1392247767,
18
+ "end": 1392247767
19
+ },
20
+ "quantity": null,
21
+ "plan": null,
22
+ "description": null,
23
+ "metadata": {
24
+ }
25
+ }
26
+ ],
27
+ "count": 1,
28
+ "object": "list",
29
+ "url": "/v1/invoices/in_103ewP2eZvKYlo2CFLLwIX7a/lines"
30
+ },
31
+ "subtotal": 0,
32
+ "total": 0,
33
+ "customer": "abcdefghijklmnop",
34
+ "object": "invoice",
35
+ "attempted": true,
36
+ "closed": true,
37
+ "paid": true,
38
+ "livemode": false,
39
+ "attempt_count": 0,
40
+ "amount_due": 0,
41
+ "currency": "usd",
42
+ "starting_balance": 0,
43
+ "ending_balance": null,
44
+ "next_payment_attempt": null,
45
+ "charge": null,
46
+ "discount": null,
47
+ "application_fee": null,
48
+ "subscription": "sub_3ewPpEGKafMelq",
49
+ "metadata": {
50
+ },
51
+ "description": null
52
+ }