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.
- data/lib/stripe_mock.rb +8 -0
- data/lib/stripe_mock/api/errors.rb +16 -16
- data/lib/stripe_mock/api/webhooks.rb +55 -0
- data/lib/stripe_mock/errors/unsupported_request_error.rb +4 -0
- data/lib/stripe_mock/util.rb +23 -0
- data/lib/stripe_mock/version.rb +1 -1
- data/lib/stripe_mock/webhook_fixtures/account.application.deauthorized.json +12 -0
- data/lib/stripe_mock/webhook_fixtures/account.updated.json +24 -0
- data/lib/stripe_mock/webhook_fixtures/charge.dispute.closed.json +21 -0
- data/lib/stripe_mock/webhook_fixtures/charge.dispute.created.json +21 -0
- data/lib/stripe_mock/webhook_fixtures/charge.dispute.updated.json +24 -0
- data/lib/stripe_mock/webhook_fixtures/charge.failed.json +57 -0
- data/lib/stripe_mock/webhook_fixtures/charge.refunded.json +57 -0
- data/lib/stripe_mock/webhook_fixtures/charge.succeeded.json +57 -0
- data/lib/stripe_mock/webhook_fixtures/coupon.created.json +22 -0
- data/lib/stripe_mock/webhook_fixtures/coupon.deleted.json +22 -0
- data/lib/stripe_mock/webhook_fixtures/customer.created.json +40 -0
- data/lib/stripe_mock/webhook_fixtures/customer.deleted.json +40 -0
- data/lib/stripe_mock/webhook_fixtures/customer.discount.created.json +28 -0
- data/lib/stripe_mock/webhook_fixtures/customer.discount.deleted.json +28 -0
- data/lib/stripe_mock/webhook_fixtures/customer.discount.updated.json +43 -0
- data/lib/stripe_mock/webhook_fixtures/customer.subscription.created.json +34 -0
- data/lib/stripe_mock/webhook_fixtures/customer.subscription.deleted.json +34 -0
- data/lib/stripe_mock/webhook_fixtures/customer.subscription.trial_will_end.json +34 -0
- data/lib/stripe_mock/webhook_fixtures/customer.subscription.updated.json +47 -0
- data/lib/stripe_mock/webhook_fixtures/customer.updated.json +43 -0
- data/lib/stripe_mock/webhook_fixtures/invoice.created.json +64 -0
- data/lib/stripe_mock/webhook_fixtures/invoice.payment_failed.json +64 -0
- data/lib/stripe_mock/webhook_fixtures/invoice.payment_succeeded.json +64 -0
- data/lib/stripe_mock/webhook_fixtures/invoice.updated.json +67 -0
- data/lib/stripe_mock/webhook_fixtures/invoiceitem.created.json +21 -0
- data/lib/stripe_mock/webhook_fixtures/invoiceitem.deleted.json +21 -0
- data/lib/stripe_mock/webhook_fixtures/invoiceitem.updated.json +24 -0
- data/lib/stripe_mock/webhook_fixtures/plan.created.json +20 -0
- data/lib/stripe_mock/webhook_fixtures/plan.deleted.json +20 -0
- data/lib/stripe_mock/webhook_fixtures/plan.updated.json +23 -0
- data/lib/stripe_mock/webhook_fixtures/transfer.created.json +23 -0
- data/lib/stripe_mock/webhook_fixtures/transfer.failed.json +23 -0
- data/lib/stripe_mock/webhook_fixtures/transfer.paid.json +23 -0
- data/lib/stripe_mock/webhook_fixtures/transfer.updated.json +26 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/util_spec.rb +45 -0
- data/spec/webhook_spec.rb +61 -0
- metadata +43 -2
@@ -0,0 +1,64 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"data": {
|
4
|
+
"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,
|
15
|
+
"id": "in_00000000000000",
|
16
|
+
"lines": {
|
17
|
+
"count": 1,
|
18
|
+
"data": [
|
19
|
+
{
|
20
|
+
"amount": 0,
|
21
|
+
"currency": "usd",
|
22
|
+
"description": null,
|
23
|
+
"id": "su_22DqVThf1vOC0I",
|
24
|
+
"livemode": true,
|
25
|
+
"object": "line_item",
|
26
|
+
"period": {
|
27
|
+
"end": 1371760715,
|
28
|
+
"start": 1371501515
|
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_22DqULONy3rpya/lines"
|
48
|
+
},
|
49
|
+
"livemode": false,
|
50
|
+
"next_payment_attempt": 1371505115,
|
51
|
+
"object": "invoice",
|
52
|
+
"paid": false,
|
53
|
+
"period_end": 1371501515,
|
54
|
+
"period_start": 1371501515,
|
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.payment_failed"
|
64
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"data": {
|
4
|
+
"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,
|
15
|
+
"id": "in_00000000000000",
|
16
|
+
"lines": {
|
17
|
+
"count": 1,
|
18
|
+
"data": [
|
19
|
+
{
|
20
|
+
"amount": 0,
|
21
|
+
"currency": "usd",
|
22
|
+
"description": null,
|
23
|
+
"id": "su_22DqbnCBi7246V",
|
24
|
+
"livemode": true,
|
25
|
+
"object": "line_item",
|
26
|
+
"period": {
|
27
|
+
"end": 1371760711,
|
28
|
+
"start": 1371501511
|
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_22DqkNc6rNrhQo/lines"
|
48
|
+
},
|
49
|
+
"livemode": false,
|
50
|
+
"next_payment_attempt": 1371505111,
|
51
|
+
"object": "invoice",
|
52
|
+
"paid": true,
|
53
|
+
"period_end": 1371501511,
|
54
|
+
"period_start": 1371501511,
|
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.payment_succeeded"
|
64
|
+
}
|
@@ -0,0 +1,67 @@
|
|
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": 1371501471,
|
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_22Dpwn91jC18NU",
|
24
|
+
"livemode": true,
|
25
|
+
"object": "line_item",
|
26
|
+
"period": {
|
27
|
+
"end": 1371760671,
|
28
|
+
"start": 1371501471
|
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_22Dp2xXO64B6ce/lines"
|
48
|
+
},
|
49
|
+
"livemode": false,
|
50
|
+
"next_payment_attempt": 1371505071,
|
51
|
+
"object": "invoice",
|
52
|
+
"paid": false,
|
53
|
+
"period_end": 1371501471,
|
54
|
+
"period_start": 1371501471,
|
55
|
+
"starting_balance": 0,
|
56
|
+
"subtotal": 0,
|
57
|
+
"total": 0
|
58
|
+
},
|
59
|
+
"previous_attributes": {
|
60
|
+
"lines": []
|
61
|
+
}
|
62
|
+
},
|
63
|
+
"id": "evt_00000000000000",
|
64
|
+
"livemode": false,
|
65
|
+
"object": "event",
|
66
|
+
"type": "invoice.updated"
|
67
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"data": {
|
4
|
+
"object": {
|
5
|
+
"amount": 1000,
|
6
|
+
"currency": "usd",
|
7
|
+
"customer": "cus_00000000000000",
|
8
|
+
"date": 1371501563,
|
9
|
+
"description": "My First Invoice Item (created for API docs)",
|
10
|
+
"id": "ii_00000000000000",
|
11
|
+
"invoice": null,
|
12
|
+
"livemode": false,
|
13
|
+
"object": "invoiceitem",
|
14
|
+
"proration": false
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"id": "evt_00000000000000",
|
18
|
+
"livemode": false,
|
19
|
+
"object": "event",
|
20
|
+
"type": "invoiceitem.created"
|
21
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"data": {
|
4
|
+
"object": {
|
5
|
+
"amount": 1000,
|
6
|
+
"currency": "usd",
|
7
|
+
"customer": "cus_00000000000000",
|
8
|
+
"date": 1371501569,
|
9
|
+
"description": "My First Invoice Item (created for API docs)",
|
10
|
+
"id": "ii_00000000000000",
|
11
|
+
"invoice": null,
|
12
|
+
"livemode": false,
|
13
|
+
"object": "invoiceitem",
|
14
|
+
"proration": false
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"id": "evt_00000000000000",
|
18
|
+
"livemode": false,
|
19
|
+
"object": "event",
|
20
|
+
"type": "invoiceitem.deleted"
|
21
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"data": {
|
4
|
+
"object": {
|
5
|
+
"amount": 1000,
|
6
|
+
"currency": "usd",
|
7
|
+
"customer": "cus_00000000000000",
|
8
|
+
"date": 1371501566,
|
9
|
+
"description": "My First Invoice Item (created for API docs)",
|
10
|
+
"id": "ii_00000000000000",
|
11
|
+
"invoice": null,
|
12
|
+
"livemode": false,
|
13
|
+
"object": "invoiceitem",
|
14
|
+
"proration": false
|
15
|
+
},
|
16
|
+
"previous_attributes": {
|
17
|
+
"amount": 2121
|
18
|
+
}
|
19
|
+
},
|
20
|
+
"id": "evt_00000000000000",
|
21
|
+
"livemode": false,
|
22
|
+
"object": "event",
|
23
|
+
"type": "invoiceitem.updated"
|
24
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"data": {
|
4
|
+
"object": {
|
5
|
+
"amount": 1000,
|
6
|
+
"currency": "usd",
|
7
|
+
"id": "1_00000000000000",
|
8
|
+
"interval": "month",
|
9
|
+
"interval_count": 1,
|
10
|
+
"livemode": false,
|
11
|
+
"name": "Cool Plan",
|
12
|
+
"object": "plan",
|
13
|
+
"trial_period_days": 3
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"id": "evt_00000000000000",
|
17
|
+
"livemode": false,
|
18
|
+
"object": "event",
|
19
|
+
"type": "plan.created"
|
20
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"data": {
|
4
|
+
"object": {
|
5
|
+
"amount": 1000,
|
6
|
+
"currency": "usd",
|
7
|
+
"id": "1_00000000000000",
|
8
|
+
"interval": "month",
|
9
|
+
"interval_count": 1,
|
10
|
+
"livemode": false,
|
11
|
+
"name": "Cool Plan",
|
12
|
+
"object": "plan",
|
13
|
+
"trial_period_days": 3
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"id": "evt_00000000000000",
|
17
|
+
"livemode": false,
|
18
|
+
"object": "event",
|
19
|
+
"type": "plan.deleted"
|
20
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"data": {
|
4
|
+
"object": {
|
5
|
+
"amount": 1000,
|
6
|
+
"currency": "usd",
|
7
|
+
"id": "1_00000000000000",
|
8
|
+
"interval": "month",
|
9
|
+
"interval_count": 1,
|
10
|
+
"livemode": false,
|
11
|
+
"name": "Cool Plan",
|
12
|
+
"object": "plan",
|
13
|
+
"trial_period_days": 3
|
14
|
+
},
|
15
|
+
"previous_attributes": {
|
16
|
+
"name": "Old name"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"id": "evt_00000000000000",
|
20
|
+
"livemode": false,
|
21
|
+
"object": "event",
|
22
|
+
"type": "plan.updated"
|
23
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"data": {
|
4
|
+
"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
|
+
"id": "tr_00000000000000",
|
13
|
+
"livemode": true,
|
14
|
+
"object": "transfer",
|
15
|
+
"recipient": "rp_00000000000000",
|
16
|
+
"status": "pending"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"id": "evt_00000000000000",
|
20
|
+
"livemode": false,
|
21
|
+
"object": "event",
|
22
|
+
"type": "transfer.created"
|
23
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"data": {
|
4
|
+
"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
|
+
"id": "tr_00000000000000",
|
13
|
+
"livemode": true,
|
14
|
+
"object": "transfer",
|
15
|
+
"recipient": "rp_00000000000000",
|
16
|
+
"status": "failed"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"id": "evt_00000000000000",
|
20
|
+
"livemode": false,
|
21
|
+
"object": "event",
|
22
|
+
"type": "transfer.failed"
|
23
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"data": {
|
4
|
+
"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
|
+
"id": "tr_00000000000000",
|
13
|
+
"livemode": true,
|
14
|
+
"object": "transfer",
|
15
|
+
"recipient": "rp_00000000000000",
|
16
|
+
"status": "paid"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"id": "evt_00000000000000",
|
20
|
+
"livemode": false,
|
21
|
+
"object": "event",
|
22
|
+
"type": "transfer.paid"
|
23
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"created": 1326853478,
|
3
|
+
"data": {
|
4
|
+
"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
|
+
"id": "tr_00000000000000",
|
13
|
+
"livemode": true,
|
14
|
+
"object": "transfer",
|
15
|
+
"recipient": "rp_00000000000000",
|
16
|
+
"status": "pending"
|
17
|
+
},
|
18
|
+
"previous_attributes": {
|
19
|
+
"amount": 123
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"id": "evt_00000000000000",
|
23
|
+
"livemode": false,
|
24
|
+
"object": "event",
|
25
|
+
"type": "transfer.updated"
|
26
|
+
}
|