stripe-ruby-mock 1.8.3.6 → 1.8.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/lib/stripe_mock.rb +8 -0
  2. data/lib/stripe_mock/api/errors.rb +16 -16
  3. data/lib/stripe_mock/api/webhooks.rb +55 -0
  4. data/lib/stripe_mock/errors/unsupported_request_error.rb +4 -0
  5. data/lib/stripe_mock/util.rb +23 -0
  6. data/lib/stripe_mock/version.rb +1 -1
  7. data/lib/stripe_mock/webhook_fixtures/account.application.deauthorized.json +12 -0
  8. data/lib/stripe_mock/webhook_fixtures/account.updated.json +24 -0
  9. data/lib/stripe_mock/webhook_fixtures/charge.dispute.closed.json +21 -0
  10. data/lib/stripe_mock/webhook_fixtures/charge.dispute.created.json +21 -0
  11. data/lib/stripe_mock/webhook_fixtures/charge.dispute.updated.json +24 -0
  12. data/lib/stripe_mock/webhook_fixtures/charge.failed.json +57 -0
  13. data/lib/stripe_mock/webhook_fixtures/charge.refunded.json +57 -0
  14. data/lib/stripe_mock/webhook_fixtures/charge.succeeded.json +57 -0
  15. data/lib/stripe_mock/webhook_fixtures/coupon.created.json +22 -0
  16. data/lib/stripe_mock/webhook_fixtures/coupon.deleted.json +22 -0
  17. data/lib/stripe_mock/webhook_fixtures/customer.created.json +40 -0
  18. data/lib/stripe_mock/webhook_fixtures/customer.deleted.json +40 -0
  19. data/lib/stripe_mock/webhook_fixtures/customer.discount.created.json +28 -0
  20. data/lib/stripe_mock/webhook_fixtures/customer.discount.deleted.json +28 -0
  21. data/lib/stripe_mock/webhook_fixtures/customer.discount.updated.json +43 -0
  22. data/lib/stripe_mock/webhook_fixtures/customer.subscription.created.json +34 -0
  23. data/lib/stripe_mock/webhook_fixtures/customer.subscription.deleted.json +34 -0
  24. data/lib/stripe_mock/webhook_fixtures/customer.subscription.trial_will_end.json +34 -0
  25. data/lib/stripe_mock/webhook_fixtures/customer.subscription.updated.json +47 -0
  26. data/lib/stripe_mock/webhook_fixtures/customer.updated.json +43 -0
  27. data/lib/stripe_mock/webhook_fixtures/invoice.created.json +64 -0
  28. data/lib/stripe_mock/webhook_fixtures/invoice.payment_failed.json +64 -0
  29. data/lib/stripe_mock/webhook_fixtures/invoice.payment_succeeded.json +64 -0
  30. data/lib/stripe_mock/webhook_fixtures/invoice.updated.json +67 -0
  31. data/lib/stripe_mock/webhook_fixtures/invoiceitem.created.json +21 -0
  32. data/lib/stripe_mock/webhook_fixtures/invoiceitem.deleted.json +21 -0
  33. data/lib/stripe_mock/webhook_fixtures/invoiceitem.updated.json +24 -0
  34. data/lib/stripe_mock/webhook_fixtures/plan.created.json +20 -0
  35. data/lib/stripe_mock/webhook_fixtures/plan.deleted.json +20 -0
  36. data/lib/stripe_mock/webhook_fixtures/plan.updated.json +23 -0
  37. data/lib/stripe_mock/webhook_fixtures/transfer.created.json +23 -0
  38. data/lib/stripe_mock/webhook_fixtures/transfer.failed.json +23 -0
  39. data/lib/stripe_mock/webhook_fixtures/transfer.paid.json +23 -0
  40. data/lib/stripe_mock/webhook_fixtures/transfer.updated.json +26 -0
  41. data/spec/spec_helper.rb +2 -0
  42. data/spec/util_spec.rb +45 -0
  43. data/spec/webhook_spec.rb +61 -0
  44. metadata +43 -2
@@ -0,0 +1,22 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "amount_off": null,
6
+ "currency": "usd",
7
+ "duration": "repeating",
8
+ "duration_in_months": 3,
9
+ "id": "25OFF_00000000000000",
10
+ "livemode": false,
11
+ "max_redemptions": null,
12
+ "object": "coupon",
13
+ "percent_off": 25,
14
+ "redeem_by": null,
15
+ "times_redeemed": 0
16
+ }
17
+ },
18
+ "id": "evt_00000000000000",
19
+ "livemode": false,
20
+ "object": "event",
21
+ "type": "coupon.created"
22
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "amount_off": null,
6
+ "currency": "usd",
7
+ "duration": "repeating",
8
+ "duration_in_months": 3,
9
+ "id": "25OFF_00000000000000",
10
+ "livemode": false,
11
+ "max_redemptions": null,
12
+ "object": "coupon",
13
+ "percent_off": 25,
14
+ "redeem_by": null,
15
+ "times_redeemed": 0
16
+ }
17
+ },
18
+ "id": "evt_00000000000000",
19
+ "livemode": false,
20
+ "object": "event",
21
+ "type": "coupon.deleted"
22
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "account_balance": 0,
6
+ "active_card": {
7
+ "address_city": null,
8
+ "address_country": null,
9
+ "address_line1": null,
10
+ "address_line1_check": null,
11
+ "address_line2": null,
12
+ "address_state": null,
13
+ "address_zip": null,
14
+ "address_zip_check": null,
15
+ "country": "US",
16
+ "cvc_check": "pass",
17
+ "exp_month": 12,
18
+ "exp_year": 2013,
19
+ "fingerprint": "wXWJT135mEK107G8",
20
+ "last4": "4242",
21
+ "name": "1231",
22
+ "object": "card",
23
+ "type": "Visa"
24
+ },
25
+ "created": 1359947599,
26
+ "delinquent": false,
27
+ "description": null,
28
+ "discount": null,
29
+ "email": "ajoe@mailinator.com",
30
+ "id": "cus_00000000000000",
31
+ "livemode": false,
32
+ "object": "customer",
33
+ "subscription": null
34
+ }
35
+ },
36
+ "id": "evt_00000000000000",
37
+ "livemode": false,
38
+ "object": "event",
39
+ "type": "customer.created"
40
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "account_balance": 0,
6
+ "active_card": {
7
+ "address_city": null,
8
+ "address_country": null,
9
+ "address_line1": null,
10
+ "address_line1_check": null,
11
+ "address_line2": null,
12
+ "address_state": null,
13
+ "address_zip": null,
14
+ "address_zip_check": null,
15
+ "country": "US",
16
+ "cvc_check": "pass",
17
+ "exp_month": 12,
18
+ "exp_year": 2013,
19
+ "fingerprint": "wXWJT135mEK107G8",
20
+ "last4": "4242",
21
+ "name": "1231",
22
+ "object": "card",
23
+ "type": "Visa"
24
+ },
25
+ "created": 1359947599,
26
+ "delinquent": false,
27
+ "description": null,
28
+ "discount": null,
29
+ "email": "ajoe@mailinator.com",
30
+ "id": "cus_00000000000000",
31
+ "livemode": false,
32
+ "object": "customer",
33
+ "subscription": null
34
+ }
35
+ },
36
+ "id": "evt_00000000000000",
37
+ "livemode": false,
38
+ "object": "event",
39
+ "type": "customer.deleted"
40
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "coupon": {
6
+ "amount_off": null,
7
+ "currency": "usd",
8
+ "duration": "repeating",
9
+ "duration_in_months": 3,
10
+ "id": "25OFF_00000000000000",
11
+ "livemode": false,
12
+ "max_redemptions": null,
13
+ "object": "coupon",
14
+ "percent_off": 25,
15
+ "redeem_by": null,
16
+ "times_redeemed": 0
17
+ },
18
+ "customer": "cus_00000000000000",
19
+ "end": 1379450108,
20
+ "object": "discount",
21
+ "start": 1371501308
22
+ }
23
+ },
24
+ "id": "evt_00000000000000",
25
+ "livemode": false,
26
+ "object": "event",
27
+ "type": "customer.discount.created"
28
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "coupon": {
6
+ "amount_off": null,
7
+ "currency": "usd",
8
+ "duration": "repeating",
9
+ "duration_in_months": 3,
10
+ "id": "25OFF_00000000000000",
11
+ "livemode": false,
12
+ "max_redemptions": null,
13
+ "object": "coupon",
14
+ "percent_off": 25,
15
+ "redeem_by": null,
16
+ "times_redeemed": 0
17
+ },
18
+ "customer": "cus_00000000000000",
19
+ "end": 1379450113,
20
+ "object": "discount",
21
+ "start": 1371501313
22
+ }
23
+ },
24
+ "id": "evt_00000000000000",
25
+ "livemode": false,
26
+ "object": "event",
27
+ "type": "customer.discount.deleted"
28
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "coupon": {
6
+ "amount_off": null,
7
+ "currency": "usd",
8
+ "duration": "repeating",
9
+ "duration_in_months": 3,
10
+ "id": "25OFF_00000000000000",
11
+ "livemode": false,
12
+ "max_redemptions": null,
13
+ "object": "coupon",
14
+ "percent_off": 25,
15
+ "redeem_by": null,
16
+ "times_redeemed": 0
17
+ },
18
+ "customer": "cus_00000000000000",
19
+ "end": 1379450110,
20
+ "object": "discount",
21
+ "start": 1371501310
22
+ },
23
+ "previous_attributes": {
24
+ "coupon": {
25
+ "amount_off": null,
26
+ "currency": "usd",
27
+ "duration": "repeating",
28
+ "duration_in_months": 3,
29
+ "id": "OLD_COUPON_ID",
30
+ "livemode": false,
31
+ "max_redemptions": null,
32
+ "object": "coupon",
33
+ "percent_off": 25,
34
+ "redeem_by": null,
35
+ "times_redeemed": 0
36
+ }
37
+ }
38
+ },
39
+ "id": "evt_00000000000000",
40
+ "livemode": false,
41
+ "object": "event",
42
+ "type": "customer.discount.updated"
43
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "cancel_at_period_end": false,
6
+ "canceled_at": null,
7
+ "current_period_end": 1371760577,
8
+ "current_period_start": 1371501377,
9
+ "customer": "cus_00000000000000",
10
+ "ended_at": null,
11
+ "object": "subscription",
12
+ "plan": {
13
+ "amount": 1000,
14
+ "currency": "usd",
15
+ "id": "1_00000000000000",
16
+ "interval": "month",
17
+ "interval_count": 1,
18
+ "livemode": false,
19
+ "name": "Cool Plan",
20
+ "object": "plan",
21
+ "trial_period_days": 3
22
+ },
23
+ "quantity": 1,
24
+ "start": 1371501377,
25
+ "status": "trialing",
26
+ "trial_end": 1371760577,
27
+ "trial_start": 1371501377
28
+ }
29
+ },
30
+ "id": "evt_00000000000000",
31
+ "livemode": false,
32
+ "object": "event",
33
+ "type": "customer.subscription.created"
34
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "cancel_at_period_end": false,
6
+ "canceled_at": null,
7
+ "current_period_end": 1371760585,
8
+ "current_period_start": 1371501385,
9
+ "customer": "cus_00000000000000",
10
+ "ended_at": 1371420375,
11
+ "object": "subscription",
12
+ "plan": {
13
+ "amount": 1000,
14
+ "currency": "usd",
15
+ "id": "1_00000000000000",
16
+ "interval": "month",
17
+ "interval_count": 1,
18
+ "livemode": false,
19
+ "name": "Cool Plan",
20
+ "object": "plan",
21
+ "trial_period_days": 3
22
+ },
23
+ "quantity": 1,
24
+ "start": 1371501385,
25
+ "status": "canceled",
26
+ "trial_end": 1371760585,
27
+ "trial_start": 1371501385
28
+ }
29
+ },
30
+ "id": "evt_00000000000000",
31
+ "livemode": false,
32
+ "object": "event",
33
+ "type": "customer.subscription.deleted"
34
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "cancel_at_period_end": false,
6
+ "canceled_at": null,
7
+ "current_period_end": 1371760588,
8
+ "current_period_start": 1371501388,
9
+ "customer": "cus_00000000000000",
10
+ "ended_at": null,
11
+ "object": "subscription",
12
+ "plan": {
13
+ "amount": 1000,
14
+ "currency": "usd",
15
+ "id": "1_00000000000000",
16
+ "interval": "month",
17
+ "interval_count": 1,
18
+ "livemode": false,
19
+ "name": "Cool Plan",
20
+ "object": "plan",
21
+ "trial_period_days": 3
22
+ },
23
+ "quantity": 1,
24
+ "start": 1371501388,
25
+ "status": "trialing",
26
+ "trial_end": 1371679569,
27
+ "trial_start": 1371420369
28
+ }
29
+ },
30
+ "id": "evt_00000000000000",
31
+ "livemode": false,
32
+ "object": "event",
33
+ "type": "customer.subscription.trial_will_end"
34
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "cancel_at_period_end": false,
6
+ "canceled_at": null,
7
+ "current_period_end": 1371760581,
8
+ "current_period_start": 1371501381,
9
+ "customer": "cus_00000000000000",
10
+ "ended_at": null,
11
+ "object": "subscription",
12
+ "plan": {
13
+ "amount": 1000,
14
+ "currency": "usd",
15
+ "id": "1_00000000000000",
16
+ "interval": "month",
17
+ "interval_count": 1,
18
+ "livemode": false,
19
+ "name": "Cool Plan",
20
+ "object": "plan",
21
+ "trial_period_days": 3
22
+ },
23
+ "quantity": 1,
24
+ "start": 1371501381,
25
+ "status": "trialing",
26
+ "trial_end": 1371760581,
27
+ "trial_start": 1371501381
28
+ },
29
+ "previous_attributes": {
30
+ "plan": {
31
+ "amount": 1000,
32
+ "currency": "usd",
33
+ "id": "OLD_PLAN_ID",
34
+ "interval": "month",
35
+ "interval_count": 1,
36
+ "livemode": false,
37
+ "name": "Old plan",
38
+ "object": "plan",
39
+ "trial_period_days": 3
40
+ }
41
+ }
42
+ },
43
+ "id": "evt_00000000000000",
44
+ "livemode": false,
45
+ "object": "event",
46
+ "type": "customer.subscription.updated"
47
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "account_balance": 0,
6
+ "active_card": {
7
+ "address_city": null,
8
+ "address_country": null,
9
+ "address_line1": null,
10
+ "address_line1_check": null,
11
+ "address_line2": null,
12
+ "address_state": null,
13
+ "address_zip": null,
14
+ "address_zip_check": null,
15
+ "country": "US",
16
+ "cvc_check": "pass",
17
+ "exp_month": 12,
18
+ "exp_year": 2013,
19
+ "fingerprint": "wXWJT135mEK107G8",
20
+ "last4": "4242",
21
+ "name": "1231",
22
+ "object": "card",
23
+ "type": "Visa"
24
+ },
25
+ "created": 1359947599,
26
+ "delinquent": false,
27
+ "description": null,
28
+ "discount": null,
29
+ "email": "ajoe@mailinator.com",
30
+ "id": "cus_00000000000000",
31
+ "livemode": false,
32
+ "object": "customer",
33
+ "subscription": null
34
+ },
35
+ "previous_attributes": {
36
+ "description": "Old description"
37
+ }
38
+ },
39
+ "id": "evt_00000000000000",
40
+ "livemode": false,
41
+ "object": "event",
42
+ "type": "customer.updated"
43
+ }
@@ -0,0 +1,64 @@
1
+ {
2
+ "created": 1326853478,
3
+ "data": {
4
+ "object": {
5
+ "amount_due": 0,
6
+ "attempt_count": 0,
7
+ "attempted": false,
8
+ "charge": null,
9
+ "closed": false,
10
+ "currency": "usd",
11
+ "customer": "cus_00000000000000",
12
+ "date": 1371501468,
13
+ "discount": null,
14
+ "ending_balance": null,
15
+ "id": "in_00000000000000",
16
+ "lines": {
17
+ "count": 1,
18
+ "data": [
19
+ {
20
+ "amount": 0,
21
+ "currency": "usd",
22
+ "description": null,
23
+ "id": "su_22Dpg5ktMdA0i6",
24
+ "livemode": true,
25
+ "object": "line_item",
26
+ "period": {
27
+ "end": 1371760668,
28
+ "start": 1371501468
29
+ },
30
+ "plan": {
31
+ "amount": 1000,
32
+ "currency": "usd",
33
+ "id": "1",
34
+ "interval": "month",
35
+ "interval_count": 1,
36
+ "livemode": false,
37
+ "name": "Cool Plan",
38
+ "object": "plan",
39
+ "trial_period_days": 3
40
+ },
41
+ "proration": false,
42
+ "quantity": 1,
43
+ "type": "subscription"
44
+ }
45
+ ],
46
+ "object": "list",
47
+ "url": "/v1/invoices/in_22DpL6reHupqSS/lines"
48
+ },
49
+ "livemode": false,
50
+ "next_payment_attempt": 1371505068,
51
+ "object": "invoice",
52
+ "paid": true,
53
+ "period_end": 1371501468,
54
+ "period_start": 1371501468,
55
+ "starting_balance": 0,
56
+ "subtotal": 0,
57
+ "total": 0
58
+ }
59
+ },
60
+ "id": "evt_00000000000000",
61
+ "livemode": false,
62
+ "object": "event",
63
+ "type": "invoice.created"
64
+ }