stripe-ruby-mock 1.8.4.10 → 1.8.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/README.md +2 -2
  2. data/lib/stripe_mock/api/webhooks.rb +1 -0
  3. data/lib/stripe_mock/data.rb +2 -1
  4. data/lib/stripe_mock/instance.rb +4 -0
  5. data/lib/stripe_mock/request_handlers/cards.rb +26 -0
  6. data/lib/stripe_mock/version.rb +1 -1
  7. data/lib/stripe_mock/webhook_fixtures/account.updated.json +13 -11
  8. data/lib/stripe_mock/webhook_fixtures/balance.available.json +25 -0
  9. data/lib/stripe_mock/webhook_fixtures/charge.dispute.closed.json +12 -11
  10. data/lib/stripe_mock/webhook_fixtures/charge.dispute.created.json +12 -11
  11. data/lib/stripe_mock/webhook_fixtures/charge.dispute.updated.json +12 -11
  12. data/lib/stripe_mock/webhook_fixtures/charge.failed.json +40 -43
  13. data/lib/stripe_mock/webhook_fixtures/charge.refunded.json +44 -40
  14. data/lib/stripe_mock/webhook_fixtures/charge.succeeded.json +40 -43
  15. data/lib/stripe_mock/webhook_fixtures/coupon.created.json +12 -12
  16. data/lib/stripe_mock/webhook_fixtures/coupon.deleted.json +45 -15
  17. data/lib/stripe_mock/webhook_fixtures/customer.created.json +44 -32
  18. data/lib/stripe_mock/webhook_fixtures/customer.discount.created.json +15 -15
  19. data/lib/stripe_mock/webhook_fixtures/customer.discount.deleted.json +15 -15
  20. data/lib/stripe_mock/webhook_fixtures/customer.discount.updated.json +22 -22
  21. data/lib/stripe_mock/webhook_fixtures/customer.subscription.created.json +25 -23
  22. data/lib/stripe_mock/webhook_fixtures/customer.subscription.deleted.json +25 -23
  23. data/lib/stripe_mock/webhook_fixtures/customer.subscription.trial_will_end.json +25 -23
  24. data/lib/stripe_mock/webhook_fixtures/customer.subscription.updated.json +31 -29
  25. data/lib/stripe_mock/webhook_fixtures/customer.updated.json +44 -32
  26. data/lib/stripe_mock/webhook_fixtures/invoice.created.json +41 -40
  27. data/lib/stripe_mock/webhook_fixtures/invoice.payment_failed.json +41 -40
  28. data/lib/stripe_mock/webhook_fixtures/invoice.payment_succeeded.json +41 -40
  29. data/lib/stripe_mock/webhook_fixtures/invoice.updated.json +45 -42
  30. data/lib/stripe_mock/webhook_fixtures/invoiceitem.created.json +13 -13
  31. data/lib/stripe_mock/webhook_fixtures/invoiceitem.deleted.json +13 -13
  32. data/lib/stripe_mock/webhook_fixtures/invoiceitem.updated.json +13 -13
  33. data/lib/stripe_mock/webhook_fixtures/plan.created.json +12 -12
  34. data/lib/stripe_mock/webhook_fixtures/plan.deleted.json +12 -12
  35. data/lib/stripe_mock/webhook_fixtures/plan.updated.json +12 -12
  36. data/lib/stripe_mock/webhook_fixtures/transfer.created.json +80 -15
  37. data/lib/stripe_mock/webhook_fixtures/transfer.failed.json +80 -15
  38. data/lib/stripe_mock/webhook_fixtures/transfer.paid.json +80 -15
  39. data/lib/stripe_mock/webhook_fixtures/transfer.updated.json +80 -15
  40. data/spec/readme_spec.rb +1 -1
  41. data/spec/shared_stripe_examples/card_examples.rb +20 -0
  42. data/spec/shared_stripe_examples/charge_examples.rb +1 -0
  43. metadata +3 -2
@@ -1,34 +1,36 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.subscription.deleted",
6
+ "object": "event",
3
7
  "data": {
4
8
  "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",
9
+ "id": "su_00000000000000",
12
10
  "plan": {
13
- "amount": 1000,
14
- "currency": "usd",
15
- "id": "1_00000000000000",
16
11
  "interval": "month",
17
- "interval_count": 1,
18
- "livemode": false,
19
- "name": "Cool Plan",
12
+ "name": "Member's Club",
13
+ "amount": 100,
14
+ "currency": "usd",
15
+ "id": "fkx0AFo_00000000000000",
20
16
  "object": "plan",
21
- "trial_period_days": 3
17
+ "livemode": false,
18
+ "interval_count": 1,
19
+ "trial_period_days": null
22
20
  },
23
- "quantity": 1,
24
- "start": 1371501385,
21
+ "object": "subscription",
22
+ "start": 1381080564,
25
23
  "status": "canceled",
26
- "trial_end": 1371760585,
27
- "trial_start": 1371501385
24
+ "customer": "cus_00000000000000",
25
+ "cancel_at_period_end": false,
26
+ "current_period_start": 1381080564,
27
+ "current_period_end": 1383758964,
28
+ "ended_at": 1381021514,
29
+ "trial_start": null,
30
+ "trial_end": null,
31
+ "canceled_at": null,
32
+ "quantity": 1,
33
+ "application_fee_percent": null
28
34
  }
29
- },
30
- "id": "evt_00000000000000",
31
- "livemode": false,
32
- "object": "event",
33
- "type": "customer.subscription.deleted"
35
+ }
34
36
  }
@@ -1,34 +1,36 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.subscription.trial_will_end",
6
+ "object": "event",
3
7
  "data": {
4
8
  "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",
9
+ "id": "su_00000000000000",
12
10
  "plan": {
13
- "amount": 1000,
14
- "currency": "usd",
15
- "id": "1_00000000000000",
16
11
  "interval": "month",
17
- "interval_count": 1,
18
- "livemode": false,
19
- "name": "Cool Plan",
12
+ "name": "Member's Club",
13
+ "amount": 100,
14
+ "currency": "usd",
15
+ "id": "fkx0AFo_00000000000000",
20
16
  "object": "plan",
21
- "trial_period_days": 3
17
+ "livemode": false,
18
+ "interval_count": 1,
19
+ "trial_period_days": null
22
20
  },
23
- "quantity": 1,
24
- "start": 1371501388,
21
+ "object": "subscription",
22
+ "start": 1381080623,
25
23
  "status": "trialing",
26
- "trial_end": 1371679569,
27
- "trial_start": 1371420369
24
+ "customer": "cus_00000000000000",
25
+ "cancel_at_period_end": false,
26
+ "current_period_start": 1381080623,
27
+ "current_period_end": 1383759023,
28
+ "ended_at": null,
29
+ "trial_start": 1381021530,
30
+ "trial_end": 1381280730,
31
+ "canceled_at": null,
32
+ "quantity": 1,
33
+ "application_fee_percent": null
28
34
  }
29
- },
30
- "id": "evt_00000000000000",
31
- "livemode": false,
32
- "object": "event",
33
- "type": "customer.subscription.trial_will_end"
35
+ }
34
36
  }
@@ -1,47 +1,49 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.subscription.updated",
6
+ "object": "event",
3
7
  "data": {
4
8
  "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",
9
+ "id": "su_00000000000000",
12
10
  "plan": {
13
- "amount": 1000,
14
- "currency": "usd",
15
- "id": "1_00000000000000",
16
11
  "interval": "month",
17
- "interval_count": 1,
18
- "livemode": false,
19
- "name": "Cool Plan",
12
+ "name": "Member's Club",
13
+ "amount": 100,
14
+ "currency": "usd",
15
+ "id": "fkx0AFo_00000000000000",
20
16
  "object": "plan",
21
- "trial_period_days": 3
17
+ "livemode": false,
18
+ "interval_count": 1,
19
+ "trial_period_days": null
22
20
  },
21
+ "object": "subscription",
22
+ "start": 1381080561,
23
+ "status": "active",
24
+ "customer": "cus_00000000000000",
25
+ "cancel_at_period_end": false,
26
+ "current_period_start": 1381080561,
27
+ "current_period_end": 1383758961,
28
+ "ended_at": null,
29
+ "trial_start": null,
30
+ "trial_end": null,
31
+ "canceled_at": null,
23
32
  "quantity": 1,
24
- "start": 1371501381,
25
- "status": "trialing",
26
- "trial_end": 1371760581,
27
- "trial_start": 1371501381
33
+ "application_fee_percent": null
28
34
  },
29
35
  "previous_attributes": {
30
36
  "plan": {
31
- "amount": 1000,
32
- "currency": "usd",
33
- "id": "OLD_PLAN_ID",
34
37
  "interval": "month",
35
- "interval_count": 1,
36
- "livemode": false,
37
38
  "name": "Old plan",
39
+ "amount": 100,
40
+ "currency": "usd",
41
+ "id": "OLD_PLAN_ID",
38
42
  "object": "plan",
39
- "trial_period_days": 3
43
+ "livemode": false,
44
+ "interval_count": 1,
45
+ "trial_period_days": null
40
46
  }
41
47
  }
42
- },
43
- "id": "evt_00000000000000",
44
- "livemode": false,
45
- "object": "event",
46
- "type": "customer.subscription.updated"
48
+ }
47
49
  }
@@ -1,43 +1,55 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.updated",
6
+ "object": "event",
3
7
  "data": {
4
8
  "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",
9
+ "object": "customer",
10
+ "created": 1375148334,
30
11
  "id": "cus_00000000000000",
31
12
  "livemode": false,
32
- "object": "customer",
33
- "subscription": null
13
+ "description": null,
14
+ "email": "bond@mailinator.com",
15
+ "delinquent": true,
16
+ "metadata": {
17
+ },
18
+ "subscription": null,
19
+ "discount": null,
20
+ "account_balance": 0,
21
+ "cards": {
22
+ "object": "list",
23
+ "count": 1,
24
+ "url": "/v1/customers/cus_2I2AhGQOPmEFeu/cards",
25
+ "data": [
26
+ {
27
+ "id": "cc_2I2akIhmladin5",
28
+ "object": "card",
29
+ "last4": "0341",
30
+ "type": "Visa",
31
+ "exp_month": 12,
32
+ "exp_year": 2013,
33
+ "fingerprint": "fWvZEzdbEIFF8QrK",
34
+ "customer": "cus_2I2AhGQOPmEFeu",
35
+ "country": "US",
36
+ "name": "Johnny Goodman",
37
+ "address_line1": null,
38
+ "address_line2": null,
39
+ "address_city": null,
40
+ "address_state": null,
41
+ "address_zip": null,
42
+ "address_country": null,
43
+ "cvc_check": "pass",
44
+ "address_line1_check": null,
45
+ "address_zip_check": null
46
+ }
47
+ ]
48
+ },
49
+ "default_card": "cc_2I2akIhmladin5"
34
50
  },
35
51
  "previous_attributes": {
36
52
  "description": "Old description"
37
53
  }
38
- },
39
- "id": "evt_00000000000000",
40
- "livemode": false,
41
- "object": "event",
42
- "type": "customer.updated"
54
+ }
43
55
  }
@@ -1,64 +1,65 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "invoice.created",
6
+ "object": "event",
3
7
  "data": {
4
8
  "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,
9
+ "date": 1380674206,
15
10
  "id": "in_00000000000000",
11
+ "period_start": 1378082075,
12
+ "period_end": 1380674075,
16
13
  "lines": {
17
- "count": 1,
18
14
  "data": [
19
15
  {
20
- "amount": 0,
21
- "currency": "usd",
22
- "description": null,
23
- "id": "su_22Dpg5ktMdA0i6",
24
- "livemode": true,
16
+ "id": "su_2hksGtIPylSBg2",
25
17
  "object": "line_item",
18
+ "type": "subscription",
19
+ "livemode": true,
20
+ "amount": 100,
21
+ "currency": "usd",
22
+ "proration": false,
26
23
  "period": {
27
- "end": 1371760668,
28
- "start": 1371501468
24
+ "start": 1383759042,
25
+ "end": 1386351042
29
26
  },
27
+ "quantity": 1,
30
28
  "plan": {
31
- "amount": 1000,
32
- "currency": "usd",
33
- "id": "1",
34
29
  "interval": "month",
35
- "interval_count": 1,
36
- "livemode": false,
37
- "name": "Cool Plan",
30
+ "name": "Member's Club",
31
+ "amount": 100,
32
+ "currency": "usd",
33
+ "id": "fkx0AFo",
38
34
  "object": "plan",
39
- "trial_period_days": 3
35
+ "livemode": false,
36
+ "interval_count": 1,
37
+ "trial_period_days": null
40
38
  },
41
- "proration": false,
42
- "quantity": 1,
43
- "type": "subscription"
39
+ "description": null
44
40
  }
45
41
  ],
42
+ "count": 1,
46
43
  "object": "list",
47
- "url": "/v1/invoices/in_22DpL6reHupqSS/lines"
44
+ "url": "/v1/invoices/in_2fzcb1D7guR4IE/lines"
48
45
  },
49
- "livemode": false,
50
- "next_payment_attempt": 1371505068,
46
+ "subtotal": 1000,
47
+ "total": 1000,
48
+ "customer": "cus_00000000000000",
51
49
  "object": "invoice",
50
+ "attempted": false,
51
+ "closed": true,
52
52
  "paid": true,
53
- "period_end": 1371501468,
54
- "period_start": 1371501468,
53
+ "livemode": false,
54
+ "attempt_count": 1,
55
+ "amount_due": 1000,
56
+ "currency": "usd",
55
57
  "starting_balance": 0,
56
- "subtotal": 0,
57
- "total": 0
58
+ "ending_balance": 0,
59
+ "next_payment_attempt": null,
60
+ "charge": "ch_00000000000000",
61
+ "discount": null,
62
+ "application_fee": null
58
63
  }
59
- },
60
- "id": "evt_00000000000000",
61
- "livemode": false,
62
- "object": "event",
63
- "type": "invoice.created"
64
+ }
64
65
  }
@@ -1,64 +1,65 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "invoice.payment_failed",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
- "amount_due": 0,
6
- "attempt_count": 0,
7
- "attempted": true,
8
- "charge": null,
9
- "closed": false,
10
- "currency": "usd",
11
- "customer": "cus_00000000000000",
12
- "date": 1371501515,
13
- "discount": null,
14
- "ending_balance": null,
9
+ "date": 1380674206,
15
10
  "id": "in_00000000000000",
11
+ "period_start": 1378082075,
12
+ "period_end": 1380674075,
16
13
  "lines": {
17
- "count": 1,
18
14
  "data": [
19
15
  {
20
- "amount": 0,
21
- "currency": "usd",
22
- "description": null,
23
- "id": "su_22DqVThf1vOC0I",
24
- "livemode": true,
16
+ "id": "su_2hkslKrnt23NBz",
25
17
  "object": "line_item",
18
+ "type": "subscription",
19
+ "livemode": true,
20
+ "amount": 100,
21
+ "currency": "usd",
22
+ "proration": false,
26
23
  "period": {
27
- "end": 1371760715,
28
- "start": 1371501515
24
+ "start": 1383759056,
25
+ "end": 1386351056
29
26
  },
27
+ "quantity": 1,
30
28
  "plan": {
31
- "amount": 1000,
32
- "currency": "usd",
33
- "id": "1",
34
29
  "interval": "month",
35
- "interval_count": 1,
36
- "livemode": false,
37
- "name": "Cool Plan",
30
+ "name": "Member's Club",
31
+ "amount": 100,
32
+ "currency": "usd",
33
+ "id": "fkx0AFo",
38
34
  "object": "plan",
39
- "trial_period_days": 3
35
+ "livemode": false,
36
+ "interval_count": 1,
37
+ "trial_period_days": null
40
38
  },
41
- "proration": false,
42
- "quantity": 1,
43
- "type": "subscription"
39
+ "description": null
44
40
  }
45
41
  ],
42
+ "count": 1,
46
43
  "object": "list",
47
- "url": "/v1/invoices/in_22DqULONy3rpya/lines"
44
+ "url": "/v1/invoices/in_2fzcb1D7guR4IE/lines"
48
45
  },
49
- "livemode": false,
50
- "next_payment_attempt": 1371505115,
46
+ "subtotal": 1000,
47
+ "total": 1000,
48
+ "customer": "cus_00000000000000",
51
49
  "object": "invoice",
50
+ "attempted": true,
51
+ "closed": false,
52
52
  "paid": false,
53
- "period_end": 1371501515,
54
- "period_start": 1371501515,
53
+ "livemode": false,
54
+ "attempt_count": 1,
55
+ "amount_due": 1000,
56
+ "currency": "usd",
55
57
  "starting_balance": 0,
56
- "subtotal": 0,
57
- "total": 0
58
+ "ending_balance": 0,
59
+ "next_payment_attempt": null,
60
+ "charge": "ch_00000000000000",
61
+ "discount": null,
62
+ "application_fee": null
58
63
  }
59
- },
60
- "id": "evt_00000000000000",
61
- "livemode": false,
62
- "object": "event",
63
- "type": "invoice.payment_failed"
64
+ }
64
65
  }