Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 8 triggers related to Billing #1178

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/fixtures/triggers.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ var Events = map[string]string{
"customer.subscription.created": "triggers/customer.subscription.created.json",
"customer.subscription.deleted": "triggers/customer.subscription.deleted.json",
"customer.subscription.updated": "triggers/customer.subscription.updated.json",
"customer.subscription.paused": "triggers/customer.subscription.paused.json",
"customer.subscription.trial_will_end": "triggers/customer.subscription.trial_will_end.json",
"identity.verification_session.canceled": "triggers/identity.verification_session.canceled.json",
"identity.verification_session.created": "triggers/identity.verification_session.created.json",
"identity.verification_session.redacted": "triggers/identity.verification_session.redacted.json",
Expand All @@ -46,6 +48,12 @@ var Events = map[string]string{
"invoice.payment_failed": "triggers/invoice.payment_failed.json",
"invoice.payment_succeeded": "triggers/invoice.payment_succeeded.json",
"invoice.updated": "triggers/invoice.updated.json",
"invoice.deleted": "triggers/invoice.deleted.json",
"invoice.voided": "triggers/invoice.voided.json",
"invoice.sent": "triggers/invoice.sent.json",
"invoice.marked_uncollectible": "triggers/invoice.marked_uncollectible.json",
"invoiceitem.created": "triggers/invoiceitem.created.json",
"invoiceitem.deleted": "triggers/invoiceitem.deleted.json",
"issuing_authorization.request": "triggers/issuing_authorization.request.json",
"issuing_authorization.request.eu": "triggers/issuing_authorization.request.eu.json",
"issuing_authorization.request.gb": "triggers/issuing_authorization.request.gb.json",
Expand Down
62 changes: 62 additions & 0 deletions pkg/fixtures/triggers/customer.subscription.paused.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"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": "subscription",
"path": "/v1/subscriptions",
"method": "post",
"params": {
"customer": "${customer:id}",
"items": [
{
"price": "${price:id}"
}
],
"trial_period_days": 7,
"trial_settings": {
"end_behavior": {
"missing_payment_method": "pause"
}
}
}
},
{
"name": "subscription_pause",
"path": "/v1/subscriptions/${subscription:id}",
"method": "post",
"params": {
"trial_end": "now"
}
}
]
}
49 changes: 49 additions & 0 deletions pkg/fixtures/triggers/customer.subscription.trial_will_end.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"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": "subscription",
"path": "/v1/subscriptions",
"method": "post",
"params": {
"customer": "${customer:id}",
"items": [
{
"price": "${price:id}"
}
],
"trial_period_days": 1
}
}
]
}
41 changes: 41 additions & 0 deletions pkg/fixtures/triggers/invoice.deleted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoiceitem",
"path": "/v1/invoiceitems",
"method": "post",
"params": {
"amount": 2000,
"currency": "usd",
"customer": "${customer:id}",
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoice",
"path": "/v1/invoices",
"method": "post",
"params": {
"customer": "${customer:id}",
"description": "(created by Stripe CLI)",
"pending_invoice_items_behavior": "include"
}
},
{
"name": "invoice_delete",
"path": "/v1/invoices/${invoice:id}",
"method": "delete"
}
]
}
46 changes: 46 additions & 0 deletions pkg/fixtures/triggers/invoice.marked_uncollectible.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoiceitem",
"path": "/v1/invoiceitems",
"method": "post",
"params": {
"amount": 2000,
"currency": "usd",
"customer": "${customer:id}",
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoice",
"path": "/v1/invoices",
"method": "post",
"params": {
"customer": "${customer:id}",
"description": "(created by Stripe CLI)",
"pending_invoice_items_behavior": "include"
}
},
{
"name": "invoice_finalize",
"path": "/v1/invoices/${invoice:id}/finalize",
"method": "post"
},
{
"name": "invoice_mark_uncollectible",
"path": "/v1/invoices/${invoice:id}/mark_uncollectible",
"method": "post"
}
]
}
44 changes: 44 additions & 0 deletions pkg/fixtures/triggers/invoice.sent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"email": "[email protected]",
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoiceitem",
"path": "/v1/invoiceitems",
"method": "post",
"params": {
"amount": 2000,
"currency": "usd",
"customer": "${customer:id}",
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoice",
"path": "/v1/invoices",
"method": "post",
"params": {
"customer": "${customer:id}",
"description": "(created by Stripe CLI)",
"pending_invoice_items_behavior": "include",
"collection_method": "send_invoice",
"days_until_due": 7
}
},
{
"name": "invoice_send",
"path": "/v1/invoices/${invoice:id}/send",
"method": "post"
}
]
}
46 changes: 46 additions & 0 deletions pkg/fixtures/triggers/invoice.voided.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoiceitem",
"path": "/v1/invoiceitems",
"method": "post",
"params": {
"amount": 2000,
"currency": "usd",
"customer": "${customer:id}",
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoice",
"path": "/v1/invoices",
"method": "post",
"params": {
"customer": "${customer:id}",
"description": "(created by Stripe CLI)",
"pending_invoice_items_behavior": "include"
}
},
{
"name": "invoice_finalize",
"path": "/v1/invoices/${invoice:id}/finalize",
"method": "post"
},
{
"name": "invoice_void",
"path": "/v1/invoices/${invoice:id}/void",
"method": "post"
}
]
}
26 changes: 26 additions & 0 deletions pkg/fixtures/triggers/invoiceitem.created.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoiceitem",
"path": "/v1/invoiceitems",
"method": "post",
"params": {
"amount": 2000,
"currency": "usd",
"customer": "${customer:id}",
"description": "(created by Stripe CLI)"
}
}
]
}
32 changes: 32 additions & 0 deletions pkg/fixtures/triggers/invoiceitem.deleted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"name": "invoiceitem",
"path": "/v1/invoiceitems",
"method": "post",
"params": {
"amount": 2000,
"currency": "usd",
"customer": "${customer:id}",
"description": "(created by Stripe CLI)"
}
}
,
{
"name": "invoiceitem_delete",
"path": "/v1/invoiceitems/${invoiceitem:id}",
"method": "delete"
}
]
}