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,57 +1,54 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "charge.succeeded",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
- "amount": 14500,
6
- "amount_refunded": 0,
7
- "captured": true,
9
+ "id": "ch_00000000000000",
10
+ "object": "charge",
11
+ "created": 1380933505,
12
+ "livemode": false,
13
+ "paid": true,
14
+ "amount": 1000,
15
+ "currency": "usd",
16
+ "refunded": false,
8
17
  "card": {
9
- "address_city": null,
10
- "address_country": null,
18
+ "id": "cc_00000000000000",
19
+ "object": "card",
20
+ "last4": "4242",
21
+ "type": "Visa",
22
+ "exp_month": 12,
23
+ "exp_year": 2013,
24
+ "fingerprint": "wXWJT135mEK107G8",
25
+ "customer": "cus_00000000000000",
26
+ "country": "US",
27
+ "name": "Actual Nothing",
11
28
  "address_line1": null,
12
- "address_line1_check": null,
13
29
  "address_line2": null,
30
+ "address_city": null,
14
31
  "address_state": null,
15
32
  "address_zip": null,
16
- "address_zip_check": null,
17
- "country": "US",
33
+ "address_country": null,
18
34
  "cvc_check": null,
19
- "exp_month": 2,
20
- "exp_year": 2016,
21
- "fingerprint": "wXWJT135mEK107G8",
22
- "last4": "4242",
23
- "name": "Johnny Appleseed",
24
- "object": "card",
25
- "type": "Visa"
35
+ "address_line1_check": null,
36
+ "address_zip_check": null
26
37
  },
27
- "created": 1360179715,
28
- "currency": "usd",
29
- "customer": null,
30
- "description": "Customer: Johnny Appleseed Email: japp@mailinator.com Product: A Box of Happiness ID: 36 Quantity: 3 ",
31
- "dispute": null,
32
- "failure_code": null,
33
- "failure_message": null,
34
- "fee": 451,
35
- "fee_details": [
36
- {
37
- "amount": 451,
38
- "amount_refunded": 0,
39
- "application": null,
40
- "currency": "usd",
41
- "description": "Stripe processing fees",
42
- "type": "stripe_fee"
43
- }
38
+ "captured": true,
39
+ "refunds": [
40
+
44
41
  ],
45
- "id": "ch_00000000000000",
46
- "invoice": null,
47
- "livemode": false,
48
- "object": "charge",
49
- "paid": true,
50
- "refunded": false
42
+ "balance_transaction": "txn_00000000000000",
43
+ "failure_message": null,
44
+ "failure_code": null,
45
+ "amount_refunded": 0,
46
+ "customer": "cus_00000000000000",
47
+ "invoice": "in_00000000000000",
48
+ "description": null,
49
+ "dispute": null,
50
+ "metadata": {
51
+ }
51
52
  }
52
- },
53
- "id": "evt_00000000000000",
54
- "livemode": false,
55
- "object": "event",
56
- "type": "charge.succeeded"
53
+ }
57
54
  }
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "coupon.created",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
9
+ "id": "25OFF_00000000000000",
10
+ "percent_off": 25,
5
11
  "amount_off": null,
6
12
  "currency": "usd",
7
- "duration": "repeating",
8
- "duration_in_months": 3,
9
- "id": "25OFF_00000000000000",
10
- "livemode": false,
11
- "max_redemptions": null,
12
13
  "object": "coupon",
13
- "percent_off": 25,
14
+ "livemode": false,
15
+ "duration": "repeating",
14
16
  "redeem_by": null,
15
- "times_redeemed": 0
17
+ "max_redemptions": null,
18
+ "times_redeemed": 0,
19
+ "duration_in_months": 3
16
20
  }
17
- },
18
- "id": "evt_00000000000000",
19
- "livemode": false,
20
- "object": "event",
21
- "type": "coupon.created"
21
+ }
22
22
  }
@@ -1,22 +1,52 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.deleted",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
- "amount_off": null,
6
- "currency": "usd",
7
- "duration": "repeating",
8
- "duration_in_months": 3,
9
- "id": "25OFF_00000000000000",
9
+ "object": "customer",
10
+ "created": 1375148334,
11
+ "id": "cus_00000000000000",
10
12
  "livemode": false,
11
- "max_redemptions": null,
12
- "object": "coupon",
13
- "percent_off": 25,
14
- "redeem_by": null,
15
- "times_redeemed": 0
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"
16
50
  }
17
- },
18
- "id": "evt_00000000000000",
19
- "livemode": false,
20
- "object": "event",
21
- "type": "coupon.deleted"
51
+ }
22
52
  }
@@ -1,40 +1,52 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.created",
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
- },
36
- "id": "evt_00000000000000",
37
- "livemode": false,
38
- "object": "event",
39
- "type": "customer.created"
51
+ }
40
52
  }
@@ -1,28 +1,28 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.discount.created",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
9
  "coupon": {
10
+ "id": "25OFF_00000000000000",
11
+ "percent_off": 25,
6
12
  "amount_off": null,
7
13
  "currency": "usd",
8
- "duration": "repeating",
9
- "duration_in_months": 3,
10
- "id": "25OFF_00000000000000",
11
- "livemode": false,
12
- "max_redemptions": null,
13
14
  "object": "coupon",
14
- "percent_off": 25,
15
+ "livemode": false,
16
+ "duration": "repeating",
15
17
  "redeem_by": null,
16
- "times_redeemed": 0
18
+ "max_redemptions": null,
19
+ "times_redeemed": 0,
20
+ "duration_in_months": 3
17
21
  },
18
- "customer": "cus_00000000000000",
19
- "end": 1379450108,
22
+ "start": 1381080505,
20
23
  "object": "discount",
21
- "start": 1371501308
24
+ "customer": "cus_00000000000000",
25
+ "end": 1389029305
22
26
  }
23
- },
24
- "id": "evt_00000000000000",
25
- "livemode": false,
26
- "object": "event",
27
- "type": "customer.discount.created"
27
+ }
28
28
  }
@@ -1,28 +1,28 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.discount.deleted",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
9
  "coupon": {
10
+ "id": "25OFF_00000000000000",
11
+ "percent_off": 25,
6
12
  "amount_off": null,
7
13
  "currency": "usd",
8
- "duration": "repeating",
9
- "duration_in_months": 3,
10
- "id": "25OFF_00000000000000",
11
- "livemode": false,
12
- "max_redemptions": null,
13
14
  "object": "coupon",
14
- "percent_off": 25,
15
+ "livemode": false,
16
+ "duration": "repeating",
15
17
  "redeem_by": null,
16
- "times_redeemed": 0
18
+ "max_redemptions": null,
19
+ "times_redeemed": 0,
20
+ "duration_in_months": 3
17
21
  },
18
- "customer": "cus_00000000000000",
19
- "end": 1379450113,
22
+ "start": 1381080512,
20
23
  "object": "discount",
21
- "start": 1371501313
24
+ "customer": "cus_00000000000000",
25
+ "end": 1389029312
22
26
  }
23
- },
24
- "id": "evt_00000000000000",
25
- "livemode": false,
26
- "object": "event",
27
- "type": "customer.discount.deleted"
27
+ }
28
28
  }
@@ -1,43 +1,43 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.discount.updated",
6
+ "object": "event",
3
7
  "data": {
4
8
  "object": {
5
9
  "coupon": {
10
+ "id": "25OFF_00000000000000",
11
+ "percent_off": 25,
6
12
  "amount_off": null,
7
13
  "currency": "usd",
8
- "duration": "repeating",
9
- "duration_in_months": 3,
10
- "id": "25OFF_00000000000000",
11
- "livemode": false,
12
- "max_redemptions": null,
13
14
  "object": "coupon",
14
- "percent_off": 25,
15
+ "livemode": false,
16
+ "duration": "repeating",
15
17
  "redeem_by": null,
16
- "times_redeemed": 0
18
+ "max_redemptions": null,
19
+ "times_redeemed": 0,
20
+ "duration_in_months": 3
17
21
  },
18
- "customer": "cus_00000000000000",
19
- "end": 1379450110,
22
+ "start": 1381080509,
20
23
  "object": "discount",
21
- "start": 1371501310
24
+ "customer": "cus_00000000000000",
25
+ "end": 1389029309
22
26
  },
23
27
  "previous_attributes": {
24
28
  "coupon": {
29
+ "id": "OLD_COUPON_ID",
30
+ "percent_off": 25,
25
31
  "amount_off": null,
26
32
  "currency": "usd",
27
- "duration": "repeating",
28
- "duration_in_months": 3,
29
- "id": "OLD_COUPON_ID",
30
- "livemode": false,
31
- "max_redemptions": null,
32
33
  "object": "coupon",
33
- "percent_off": 25,
34
+ "livemode": false,
35
+ "duration": "repeating",
34
36
  "redeem_by": null,
35
- "times_redeemed": 0
37
+ "max_redemptions": null,
38
+ "times_redeemed": 0,
39
+ "duration_in_months": 3
36
40
  }
37
41
  }
38
- },
39
- "id": "evt_00000000000000",
40
- "livemode": false,
41
- "object": "event",
42
- "type": "customer.discount.updated"
42
+ }
43
43
  }
@@ -1,34 +1,36 @@
1
1
  {
2
2
  "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.subscription.created",
6
+ "object": "event",
3
7
  "data": {
4
8
  "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",
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": 1381080557,
23
+ "status": "active",
24
+ "customer": "cus_00000000000000",
25
+ "cancel_at_period_end": false,
26
+ "current_period_start": 1381080557,
27
+ "current_period_end": 1383758957,
28
+ "ended_at": null,
29
+ "trial_start": null,
30
+ "trial_end": null,
31
+ "canceled_at": null,
23
32
  "quantity": 1,
24
- "start": 1371501377,
25
- "status": "trialing",
26
- "trial_end": 1371760577,
27
- "trial_start": 1371501377
33
+ "application_fee_percent": null
28
34
  }
29
- },
30
- "id": "evt_00000000000000",
31
- "livemode": false,
32
- "object": "event",
33
- "type": "customer.subscription.created"
35
+ }
34
36
  }