Skip to content

Commit

Permalink
Add support for 8 triggers related to Billing (#1178)
Browse files Browse the repository at this point in the history
* first commit

* fixes
  • Loading branch information
tlefevre-stripe authored May 9, 2024
1 parent c929341 commit e9e833a
Show file tree
Hide file tree
Showing 9 changed files with 354 additions and 0 deletions.
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"
}
]
}

0 comments on commit e9e833a

Please sign in to comment.