Skip to content

Commit

Permalink
Add more triggers (stripe#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
ob-stripe authored Dec 10, 2019
1 parent 5401859 commit b6b6bdf
Show file tree
Hide file tree
Showing 31 changed files with 281 additions and 72 deletions.
136 changes: 88 additions & 48 deletions pkg/fixtures/fs_vfsdata.go

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions pkg/fixtures/triggers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

// Events is a mapping of pre-built trigger events and the corresponding json file
var Events = map[string]string{
"balance.available": "/balance.available.json",
"charge.captured": "/charge.captured.json",
"charge.dispute.created": "/charge.disputed.created.json",
"charge.failed": "/charge.failed.json",
Expand All @@ -36,6 +37,10 @@ var Events = map[string]string{
"payment_intent.succeeded": "/payment_intent.succeeded.json",
"payment_intent.canceled": "/payment_intent.canceled.json",
"payment_method.attached": "/payment_method.attached.json",
"setup_intent.canceled": "/setup_intent.canceled.json",
"setup_intent.created": "/setup_intent.created.json",
"setup_intent.setup_failed": "/setup_intent.setup_failed.json",
"setup_intent.succeeded": "/setup_intent.succeeded.json",
}

// BuildFromFixture creates a new fixture struct for a file
Expand Down
30 changes: 30 additions & 0 deletions triggers/balance.available.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "payment_intent",
"path": "/v1/payment_intents",
"method": "post",
"params": {
"amount": 2000,
"confirm": "true",
"currency": "usd",
"description": "(created by Stripe CLI)",
"payment_method": "pm_card_bypassPending",
"payment_method_types": ["card"],
"shipping": {
"name": "Jenny Rosen",
"address": {
"line1": "510 Townsend St",
"postal_code": "94103",
"city": "San Francisco",
"state": "CA",
"country": "US"
}
}
}
}
]
}
3 changes: 2 additions & 1 deletion triggers/charge.captured.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"source": "tok_visa",
"amount": 100,
"currency": "usd",
"capture": false
"capture": false,
"description": "(created by Stripe CLI)"
}
},
{
Expand Down
3 changes: 2 additions & 1 deletion triggers/charge.disputed.created.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"params": {
"source": "tok_createDisputeInquiry",
"amount": 100,
"currency": "usd"
"currency": "usd",
"description": "(created by Stripe CLI)"
}
}
]
Expand Down
3 changes: 2 additions & 1 deletion triggers/charge.failed.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"params": {
"source": "tok_chargeDeclined",
"amount": 100,
"currency": "usd"
"currency": "usd",
"description": "(created by Stripe CLI)"
}
}
]
Expand Down
3 changes: 2 additions & 1 deletion triggers/charge.refunded.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"params": {
"source": "tok_visa",
"amount": 100,
"currency": "usd"
"currency": "usd",
"description": "(created by Stripe CLI)"
}
},
{
Expand Down
3 changes: 2 additions & 1 deletion triggers/charge.succeeded.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"params": {
"source": "tok_visa",
"amount": 100,
"currency": "usd"
"currency": "usd",
"description": "(created by Stripe CLI)"
}
}
]
Expand Down
5 changes: 4 additions & 1 deletion triggers/customer.created.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
{
"name": "customer",
"path": "/v1/customers",
"method": "post"
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
}
]
}
5 changes: 4 additions & 1 deletion triggers/customer.deleted.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
{
"name": "customer",
"path": "/v1/customers",
"method": "post"
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"name": "customer_deleted",
Expand Down
5 changes: 4 additions & 1 deletion triggers/customer.source.created.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
{
"name": "customer",
"path": "/v1/customers",
"method": "post"
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"name": "customer_source",
Expand Down
5 changes: 4 additions & 1 deletion triggers/customer.source.updated.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
{
"name": "customer",
"path": "/v1/customers",
"method": "post"
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"name": "customer_source",
Expand Down
1 change: 1 addition & 0 deletions triggers/customer.subscription.created.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"source": "tok_visa"
}
},
Expand Down
1 change: 1 addition & 0 deletions triggers/customer.subscription.deleted.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"source": "tok_visa"
}
},
Expand Down
1 change: 1 addition & 0 deletions triggers/customer.subscription.updated.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"source": "tok_visa"
}
},
Expand Down
5 changes: 4 additions & 1 deletion triggers/customer.updated.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
{
"name": "customer",
"path": "/v1/customers",
"method": "post"
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"name": "customer_updated",
Expand Down
7 changes: 5 additions & 2 deletions triggers/invoice.created.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"source": "tok_visa"
}
},
Expand All @@ -16,17 +17,19 @@
"path": "/v1/invoiceitems",
"method": "post",
"params": {
"amount": 2000,
"currency": "usd",
"customer": "${customer:id}",
"amount": 2000
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoice",
"path": "/v1/invoices",
"method": "post",
"params": {
"customer": "${customer:id}"
"customer": "${customer:id}",
"description": "(created by Stripe CLI)"
}
}
]
Expand Down
7 changes: 5 additions & 2 deletions triggers/invoice.finalized.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"source": "tok_visa"
}
},
Expand All @@ -16,17 +17,19 @@
"path": "/v1/invoiceitems",
"method": "post",
"params": {
"amount": 2000,
"currency": "usd",
"customer": "${customer:id}",
"amount": 2000
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoice",
"path": "/v1/invoices",
"method": "post",
"params": {
"customer": "${customer:id}"
"customer": "${customer:id}",
"description": "(created by Stripe CLI)"
}
},
{
Expand Down
7 changes: 5 additions & 2 deletions triggers/invoice.payment_failed.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"source": "tok_chargeCustomerFail"
}
},
Expand All @@ -16,17 +17,19 @@
"path": "/v1/invoiceitems",
"method": "post",
"params": {
"amount": 2000,
"currency": "usd",
"customer": "${customer:id}",
"amount": 2000
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoice",
"path": "/v1/invoices",
"method": "post",
"params": {
"customer": "${customer:id}"
"customer": "${customer:id}",
"description": "(created by Stripe CLI)"
}
},
{
Expand Down
7 changes: 5 additions & 2 deletions triggers/invoice.payment_succeeded.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"source": "tok_visa"
}
},
Expand All @@ -16,17 +17,19 @@
"path": "/v1/invoiceitems",
"method": "post",
"params": {
"amount": 2000,
"currency": "usd",
"customer": "${customer:id}",
"amount": 2000
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoice",
"path": "/v1/invoices",
"method": "post",
"params": {
"customer": "${customer:id}"
"customer": "${customer:id}",
"description": "(created by Stripe CLI)"
}
},
{
Expand Down
11 changes: 8 additions & 3 deletions triggers/invoice.updated.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,29 @@
{
"name": "customer",
"path": "/v1/customers",
"method": "post"
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoiceitem",
"path": "/v1/invoiceitems",
"method": "post",
"params": {
"amount": 2000,
"currency": "usd",
"customer": "${customer:id}",
"amount": 2000
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoice",
"path": "/v1/invoices",
"method": "post",
"params": {
"customer": "${customer:id}"
"customer": "${customer:id}",
"description": "(created by Stripe CLI)"
}
},
{
Expand Down
1 change: 1 addition & 0 deletions triggers/payment_intent.amount_capturable_updated.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"confirm": true,
"confirmation_method": "manual",
"currency": "usd",
"description": "(created by Stripe CLI)",
"payment_method": "pm_card_visa",
"return_url": "https://stripe.com"
}
Expand Down
3 changes: 2 additions & 1 deletion triggers/payment_intent.canceled.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"method": "post",
"params": {
"amount": 2000,
"currency": "usd"
"currency": "usd",
"description": "(created by Stripe CLI)"
}
},
{
Expand Down
1 change: 1 addition & 0 deletions triggers/payment_intent.created.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"params": {
"amount": 2000,
"currency": "usd",
"description": "(created by Stripe CLI)",
"payment_method_types": ["card"]
}
}
Expand Down
1 change: 1 addition & 0 deletions triggers/payment_intent.payment_failed.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"amount": 2000,
"confirm": "true",
"currency": "usd",
"description": "(created by Stripe CLI)",
"payment_method": "pm_card_chargeDeclined",
"payment_method_types": ["card"]
}
Expand Down
13 changes: 12 additions & 1 deletion triggers/payment_intent.succeeded.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,19 @@
"amount": 2000,
"confirm": "true",
"currency": "usd",
"description": "(created by Stripe CLI)",
"payment_method": "pm_card_visa",
"payment_method_types": ["card"]
"payment_method_types": ["card"],
"shipping": {
"name": "Jenny Rosen",
"address": {
"line1": "510 Townsend St",
"postal_code": "94103",
"city": "San Francisco",
"state": "CA",
"country": "US"
}
}
}
}
]
Expand Down
Loading

0 comments on commit b6b6bdf

Please sign in to comment.