Skip to content

Commit

Permalink
Add support for 13 triggers (#1194)
Browse files Browse the repository at this point in the history
* first commit

* cleanup

---------

Co-authored-by: tomer-stripe <42354557+tomer-stripe@users.noreply.github.com>
  • Loading branch information
tlefevre-stripe and tomer-stripe authored May 29, 2024
1 parent 9e86ed7 commit 2b8b6f4
Show file tree
Hide file tree
Showing 15 changed files with 649 additions and 97 deletions.
207 changes: 110 additions & 97 deletions pkg/fixtures/triggers.go

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions pkg/fixtures/triggers/cash_balance.funds_available.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"name": "fund_cash_balance",
"path": "/v1/test_helpers/customers/${customer:id}/fund_cash_balance",
"method": "post",
"params": {
"amount": 1000,
"currency": "usd"
}
}
]
}
33 changes: 33 additions & 0 deletions pkg/fixtures/triggers/charge.dispute.closed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "payment_intent",
"path": "/v1/payment_intents",
"method": "post",
"params": {
"amount": 100,
"currency": "usd",
"payment_method_types": ["card"],
"payment_method": "pm_card_createDisputeInquiry",
"confirm": true,
"description": "(created by Stripe CLI)"
}
},
{
"name": "disputes_list",
"path": "/v1/disputes",
"method": "get",
"params": {
"payment_intent": "${payment_intent:id}"
}
},
{
"name": "disputes_close",
"path": "/v1/disputes/${disputes_list:data.0.id}/close",
"method": "post"
}
]
}
38 changes: 38 additions & 0 deletions pkg/fixtures/triggers/charge.dispute.updated.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "payment_intent",
"path": "/v1/payment_intents",
"method": "post",
"params": {
"amount": 100,
"currency": "usd",
"payment_method_types": ["card"],
"payment_method": "pm_card_createDisputeInquiry",
"confirm": true,
"description": "(created by Stripe CLI)"
}
},
{
"name": "disputes_list",
"path": "/v1/disputes",
"method": "get",
"params": {
"payment_intent": "${payment_intent:id}"
}
},
{
"name": "disputes_update",
"path": "/v1/disputes/${disputes_list:data.0.id}",
"method": "post",
"params": {
"metadata": {
"foo": "bar"
}
}
}
]
}
47 changes: 47 additions & 0 deletions pkg/fixtures/triggers/checkout.session.expired.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"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"
}
},
{
"name": "checkout_session",
"path": "/v1/checkout/sessions",
"method": "post",
"params": {
"success_url": "https://httpbin.org/post",
"cancel_url": "https://httpbin.org/post",
"mode": "payment",
"line_items": [
{
"price": "${price:id}",
"quantity": 2
}
]
}
},
{
"name": "checkout_session_expired",
"path": "/v1/checkout/sessions/${checkout_session:id}/expire",
"method": "post"
}
]
}
55 changes: 55 additions & 0 deletions pkg/fixtures/triggers/credit_note.created.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"_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_finalized",
"path": "/v1/invoices/${invoice:id}/finalize",
"method": "post"
},
{
"name": "credit_note",
"path": "/v1/credit_notes",
"method": "post",
"params": {
"invoice": "${invoice:id}",
"lines": [{
"type": "custom_line_item",
"unit_amount": 1000,
"quantity": 1,
"description": "(created by Stripe CLI)"
}]
}
}
]
}
65 changes: 65 additions & 0 deletions pkg/fixtures/triggers/credit_note.updated.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"_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_finalized",
"path": "/v1/invoices/${invoice:id}/finalize",
"method": "post"
},
{
"name": "credit_note",
"path": "/v1/credit_notes",
"method": "post",
"params": {
"invoice": "${invoice:id}",
"lines": [{
"type": "custom_line_item",
"unit_amount": 1000,
"quantity": 1,
"description": "(created by Stripe CLI)"
}]
}
},
{
"name": "credit_note_updated",
"path": "/v1/credit_notes/${credit_note:id}",
"method": "post",
"params": {
"metadata": {
"foo": "bar"
}
}
}
]
}
60 changes: 60 additions & 0 deletions pkg/fixtures/triggers/credit_note.voided.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"_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_finalized",
"path": "/v1/invoices/${invoice:id}/finalize",
"method": "post"
},
{
"name": "credit_note",
"path": "/v1/credit_notes",
"method": "post",
"params": {
"invoice": "${invoice:id}",
"lines": [{
"type": "custom_line_item",
"unit_amount": 1000,
"quantity": 1,
"description": "(created by Stripe CLI)"
}]
}
},
{
"name": "credit_note_voided",
"path": "/v1/credit_notes/${credit_note:id}/void",
"method": "post"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"description": "(created by Stripe CLI)"
}
},
{
"name": "fund_cash_balance",
"path": "/v1/test_helpers/customers/${customer:id}/fund_cash_balance",
"method": "post",
"params": {
"amount": 1000,
"currency": "usd"
}
}
]
}
40 changes: 40 additions & 0 deletions pkg/fixtures/triggers/payment_intent.processing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "payment_method",
"path": "/v1/payment_methods",
"method": "post",
"params": {
"type": "sepa_debit",
"sepa_debit": {
"iban": "AT321904300235473204"
},
"billing_details": {
"name": "Bob",
"email": "bob@example.com"
}
}
},
{
"name": "payment_intent",
"path": "/v1/payment_intents",
"method": "post",
"params": {
"payment_method": "${payment_method:id}",
"payment_method_types": [ "sepa_debit" ],
"amount": 1000,
"currency": "eur",
"confirm": true,
"mandate_data": {
"customer_acceptance": {
"accepted_at": "1590590577",
"type": "offline"
}
}
}
}
]
}
Loading

0 comments on commit 2b8b6f4

Please sign in to comment.