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,64 +1,65 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "invoice.payment_succeeded",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
- "amount_due": 0,
6
- "attempt_count": 0,
7
- "attempted": true,
8
- "charge": "_00000000000000",
9
- "closed": true,
10
- "currency": "usd",
11
- "customer": "cus_00000000000000",
12
- "date": 1371501511,
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_22DqbnCBi7246V",
24
- "livemode": true,
16
+ "id": "su_2hkscimMTuAjFP",
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": 1371760711,
28
- "start": 1371501511
24
+ "start": 1383759053,
25
+ "end": 1386351053
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_22DqkNc6rNrhQo/lines"
44
+ "url": "/v1/invoices/in_2fzcb1D7guR4IE/lines"
48
45
  },
49
- "livemode": false,
50
- "next_payment_attempt": 1371505111,
46
+ "subtotal": 1000,
47
+ "total": 1000,
48
+ "customer": "cus_00000000000000",
51
49
  "object": "invoice",
50
+ "attempted": true,
51
+ "closed": true,
52
52
  "paid": true,
53
- "period_end": 1371501511,
54
- "period_start": 1371501511,
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": "_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_succeeded"
64
+ }
64
65
  }
@@ -1,67 +1,70 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "invoice.updated",
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": 1371501471,
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_22Dpwn91jC18NU",
24
- "livemode": true,
16
+ "id": "su_2hkskhhOSfPr47",
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": 1371760671,
28
- "start": 1371501471
24
+ "start": 1383759047,
25
+ "end": 1386351047
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_22Dp2xXO64B6ce/lines"
44
+ "url": "/v1/invoices/in_2fzcb1D7guR4IE/lines"
48
45
  },
49
- "livemode": false,
50
- "next_payment_attempt": 1371505071,
46
+ "subtotal": 1000,
47
+ "total": 1000,
48
+ "customer": "cus_00000000000000",
51
49
  "object": "invoice",
52
- "paid": false,
53
- "period_end": 1371501471,
54
- "period_start": 1371501471,
50
+ "attempted": true,
51
+ "closed": true,
52
+ "paid": true,
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
64
  "previous_attributes": {
60
- "lines": []
65
+ "lines": [
66
+
67
+ ]
61
68
  }
62
- },
63
- "id": "evt_00000000000000",
64
- "livemode": false,
65
- "object": "event",
66
- "type": "invoice.updated"
69
+ }
67
70
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "invoiceitem.created",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
- "amount": 1000,
6
- "currency": "usd",
7
- "customer": "cus_00000000000000",
8
- "date": 1371501563,
9
- "description": "My First Invoice Item (created for API docs)",
9
+ "object": "invoiceitem",
10
10
  "id": "ii_00000000000000",
11
- "invoice": null,
11
+ "date": 1372126711,
12
+ "amount": 2500,
12
13
  "livemode": false,
13
- "object": "invoiceitem",
14
- "proration": false
14
+ "proration": false,
15
+ "currency": "usd",
16
+ "customer": "cus_00000000000000",
17
+ "description": "Plan: Veteran's Club Signup Fee Plan Id: 4",
18
+ "invoice": "in_00000000000000"
15
19
  }
16
- },
17
- "id": "evt_00000000000000",
18
- "livemode": false,
19
- "object": "event",
20
- "type": "invoiceitem.created"
20
+ }
21
21
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "invoiceitem.deleted",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
- "amount": 1000,
6
- "currency": "usd",
7
- "customer": "cus_00000000000000",
8
- "date": 1371501569,
9
- "description": "My First Invoice Item (created for API docs)",
9
+ "object": "invoiceitem",
10
10
  "id": "ii_00000000000000",
11
- "invoice": null,
11
+ "date": 1372126711,
12
+ "amount": 2500,
12
13
  "livemode": false,
13
- "object": "invoiceitem",
14
- "proration": false
14
+ "proration": false,
15
+ "currency": "usd",
16
+ "customer": "cus_00000000000000",
17
+ "description": "Plan: Veteran's Club Signup Fee Plan Id: 4",
18
+ "invoice": "in_00000000000000"
15
19
  }
16
- },
17
- "id": "evt_00000000000000",
18
- "livemode": false,
19
- "object": "event",
20
- "type": "invoiceitem.deleted"
20
+ }
21
21
  }
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "invoiceitem.updated",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
- "amount": 1000,
6
- "currency": "usd",
7
- "customer": "cus_00000000000000",
8
- "date": 1371501566,
9
- "description": "My First Invoice Item (created for API docs)",
9
+ "object": "invoiceitem",
10
10
  "id": "ii_00000000000000",
11
- "invoice": null,
11
+ "date": 1372126711,
12
+ "amount": 2500,
12
13
  "livemode": false,
13
- "object": "invoiceitem",
14
- "proration": false
14
+ "proration": false,
15
+ "currency": "usd",
16
+ "customer": "cus_00000000000000",
17
+ "description": "Plan: Veteran's Club Signup Fee Plan Id: 4",
18
+ "invoice": "in_00000000000000"
15
19
  },
16
20
  "previous_attributes": {
17
21
  "amount": 2121
18
22
  }
19
- },
20
- "id": "evt_00000000000000",
21
- "livemode": false,
22
- "object": "event",
23
- "type": "invoiceitem.updated"
23
+ }
24
24
  }
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "plan.created",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
- "amount": 1000,
6
- "currency": "usd",
7
- "id": "1_00000000000000",
8
9
  "interval": "month",
9
- "interval_count": 1,
10
- "livemode": false,
11
- "name": "Cool Plan",
10
+ "name": "Member's Club",
11
+ "amount": 100,
12
+ "currency": "usd",
13
+ "id": "fkx0AFo_00000000000000",
12
14
  "object": "plan",
13
- "trial_period_days": 3
15
+ "livemode": false,
16
+ "interval_count": 1,
17
+ "trial_period_days": null
14
18
  }
15
- },
16
- "id": "evt_00000000000000",
17
- "livemode": false,
18
- "object": "event",
19
- "type": "plan.created"
19
+ }
20
20
  }
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "plan.deleted",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
- "amount": 1000,
6
- "currency": "usd",
7
- "id": "1_00000000000000",
8
9
  "interval": "month",
9
- "interval_count": 1,
10
- "livemode": false,
11
- "name": "Cool Plan",
10
+ "name": "Member's Club",
11
+ "amount": 100,
12
+ "currency": "usd",
13
+ "id": "fkx0AFo_00000000000000",
12
14
  "object": "plan",
13
- "trial_period_days": 3
15
+ "livemode": false,
16
+ "interval_count": 1,
17
+ "trial_period_days": null
14
18
  }
15
- },
16
- "id": "evt_00000000000000",
17
- "livemode": false,
18
- "object": "event",
19
- "type": "plan.deleted"
19
+ }
20
20
  }
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "plan.updated",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
- "amount": 1000,
6
- "currency": "usd",
7
- "id": "1_00000000000000",
8
9
  "interval": "month",
9
- "interval_count": 1,
10
- "livemode": false,
11
- "name": "Cool Plan",
10
+ "name": "Member's Club",
11
+ "amount": 100,
12
+ "currency": "usd",
13
+ "id": "fkx0AFo_00000000000000",
12
14
  "object": "plan",
13
- "trial_period_days": 3
15
+ "livemode": false,
16
+ "interval_count": 1,
17
+ "trial_period_days": null
14
18
  },
15
19
  "previous_attributes": {
16
20
  "name": "Old name"
17
21
  }
18
- },
19
- "id": "evt_00000000000000",
20
- "livemode": false,
21
- "object": "event",
22
- "type": "plan.updated"
22
+ }
23
23
  }
@@ -1,23 +1,88 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "transfer.created",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
- "account": null,
6
- "amount": 1100,
7
- "currency": "usd",
8
- "date": 1371513600,
9
- "description": "Transfer to test@example.com",
10
- "fee": 0,
11
- "fee_details": [],
12
9
  "id": "tr_00000000000000",
13
- "livemode": true,
14
10
  "object": "transfer",
15
- "recipient": "rp_00000000000000",
16
- "status": "pending"
11
+ "date": 1381104000,
12
+ "livemode": false,
13
+ "amount": 67,
14
+ "currency": "usd",
15
+ "status": "pending",
16
+ "balance_transaction": "txn_00000000000000",
17
+ "summary": {
18
+ "charge_gross": 100,
19
+ "charge_fees": 33,
20
+ "charge_fee_details": [
21
+ {
22
+ "amount": 33,
23
+ "currency": "usd",
24
+ "type": "stripe_fee",
25
+ "description": null,
26
+ "application": null
27
+ }
28
+ ],
29
+ "refund_gross": 0,
30
+ "refund_fees": 0,
31
+ "refund_fee_details": [
32
+
33
+ ],
34
+ "adjustment_gross": 0,
35
+ "adjustment_fees": 0,
36
+ "adjustment_fee_details": [
37
+
38
+ ],
39
+ "validation_fees": 0,
40
+ "validation_count": 0,
41
+ "charge_count": 1,
42
+ "refund_count": 0,
43
+ "adjustment_count": 0,
44
+ "net": 67,
45
+ "currency": "usd",
46
+ "collected_fee_gross": 0,
47
+ "collected_fee_count": 0,
48
+ "collected_fee_refund_gross": 0,
49
+ "collected_fee_refund_count": 0
50
+ },
51
+ "transactions": {
52
+ "object": "list",
53
+ "count": 1,
54
+ "url": "/v1/transfers/tr_2h8RC13PPvwDZs/transactions",
55
+ "data": [
56
+ {
57
+ "id": "ch_2fb4RERw49oI8s",
58
+ "type": "charge",
59
+ "amount": 100,
60
+ "currency": "usd",
61
+ "net": 67,
62
+ "created": 1380582860,
63
+ "description": null,
64
+ "fee": 33,
65
+ "fee_details": [
66
+ {
67
+ "amount": 33,
68
+ "currency": "usd",
69
+ "type": "stripe_fee",
70
+ "description": "Stripe processing fees",
71
+ "application": null
72
+ }
73
+ ]
74
+ }
75
+ ]
76
+ },
77
+ "other_transfers": [
78
+ "tr_2h8RC13PPvwDZs"
79
+ ],
80
+ "account": null,
81
+ "description": "STRIPE TRANSFER",
82
+ "metadata": {
83
+ },
84
+ "statement_descriptor": null,
85
+ "recipient": null
17
86
  }
18
- },
19
- "id": "evt_00000000000000",
20
- "livemode": false,
21
- "object": "event",
22
- "type": "transfer.created"
87
+ }
23
88
  }