Skip to content

Commit

Permalink
Add fixtures for quotes (stripe#708)
Browse files Browse the repository at this point in the history
Co-authored-by: Munaz Rahman <[email protected]>
  • Loading branch information
munaz2-stripe and munaz-stripe authored Jul 20, 2021
1 parent cd15563 commit b8415d0
Show file tree
Hide file tree
Showing 5 changed files with 228 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/fixtures/triggers.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ var Events = map[string]string{
"subscription_schedule.created": "triggers/subscription_schedule.created.json",
"subscription_schedule.released": "triggers/subscription_schedule.released.json",
"subscription_schedule.updated": "triggers/subscription_schedule.updated.json",
"quote.created": "triggers/quote.created.json",
"quote.canceled": "triggers/quote.canceled.json",
"quote.finalized": "triggers/quote.finalized.json",
"quote.accepted": "triggers/quote.accepted.json",
}

// BuildFromFixture creates a new fixture struct for a file
Expand Down
61 changes: 61 additions & 0 deletions pkg/fixtures/triggers/quote.accepted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"source": "tok_visa"
}
},
{
"name": "product",
"path": "/v1/products",
"method": "post",
"params": {
"name": "myproduct",
"description": "(created by Stripe CLI)"
}
},
{
"name": "price",
"path": "/v1/prices",
"method": "post",
"params": {
"product": "${product:id}",
"unit_amount": "1500",
"currency": "usd",
"recurring[interval]": "month"
}
},
{
"name": "quote",
"path": "/v1/quotes",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"customer": "${customer:id}",
"line_items": {
"0": {
"price": "${price:id}",
"quantity": 10
}
}
}
},
{
"name": "quote",
"path": "/v1/quotes/${quote:id}/finalize",
"method": "post"
},
{
"name": "quote",
"path": "/v1/quotes/${quote:id}/accept",
"method": "post"
}
]
}
56 changes: 56 additions & 0 deletions pkg/fixtures/triggers/quote.canceled.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"source": "tok_visa"
}
},
{
"name": "product",
"path": "/v1/products",
"method": "post",
"params": {
"name": "myproduct",
"description": "(created by Stripe CLI)"
}
},
{
"name": "price",
"path": "/v1/prices",
"method": "post",
"params": {
"product": "${product:id}",
"unit_amount": "1500",
"currency": "usd",
"recurring[interval]": "month"
}
},
{
"name": "quote",
"path": "/v1/quotes",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"customer": "${customer:id}",
"line_items": {
"0": {
"price": "${price:id}",
"quantity": 10
}
}
}
},
{
"name": "quote",
"path": "/v1/quotes/${quote:id}/cancel",
"method": "post"
}
]
}
51 changes: 51 additions & 0 deletions pkg/fixtures/triggers/quote.created.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"source": "tok_visa"
}
},
{
"name": "product",
"path": "/v1/products",
"method": "post",
"params": {
"name": "myproduct",
"description": "(created by Stripe CLI)"
}
},
{
"name": "price",
"path": "/v1/prices",
"method": "post",
"params": {
"product": "${product:id}",
"unit_amount": "1500",
"currency": "usd",
"recurring[interval]": "month"
}
},
{
"name": "quote",
"path": "/v1/quotes",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"customer": "${customer:id}",
"line_items": {
"0": {
"price": "${price:id}",
"quantity": 10
}
}
}
}
]
}
56 changes: 56 additions & 0 deletions pkg/fixtures/triggers/quote.finalized.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"source": "tok_visa"
}
},
{
"name": "product",
"path": "/v1/products",
"method": "post",
"params": {
"name": "myproduct",
"description": "(created by Stripe CLI)"
}
},
{
"name": "price",
"path": "/v1/prices",
"method": "post",
"params": {
"product": "${product:id}",
"unit_amount": "1500",
"currency": "usd",
"recurring[interval]": "month"
}
},
{
"name": "quote",
"path": "/v1/quotes",
"method": "post",
"params": {
"description": "(created by Stripe CLI)",
"customer": "${customer:id}",
"line_items": {
"0": {
"price": "${price:id}",
"quantity": 10
}
}
}
},
{
"name": "quote",
"path": "/v1/quotes/${quote:id}/finalize",
"method": "post"
}
]
}

0 comments on commit b8415d0

Please sign in to comment.