-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[trigger] add billing trigger (#1230)
* new trigger for billing * use expected name * add prefix * lint * add tests to parser * simplify trigger * 2 triggers not 1 * update payloads * update to bearer auth
- Loading branch information
1 parent
2f1cc41
commit 5be357c
Showing
12 changed files
with
493 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
pkg/fixtures/triggers/v1.billing.meter.error_report_triggered.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
|
||
|
||
{ | ||
"_meta": { | ||
"template_version": 0 | ||
}, | ||
"fixtures": [ | ||
{ | ||
"name": "list_billing_meters", | ||
"path": "/v1/billing/meters", | ||
"method": "get", | ||
"params": { | ||
"status": "active" | ||
} | ||
}, | ||
{ | ||
"name": "billing_meter", | ||
"path": "/v1/billing/meters", | ||
"method": "post", | ||
"params": { | ||
"display_name": "Stripe CLI Billing Meter", | ||
"event_name": "stripe_cli_billing_meter_for_fixture", | ||
"default_aggregation": { | ||
"formula": "sum" | ||
} | ||
}, | ||
"expected_error_type": "invalid_request_error" | ||
}, | ||
{ | ||
"name": "list_billing_meters_after_creation", | ||
"path": "/v1/billing/meters", | ||
"method": "get", | ||
"params": { | ||
"status": "active" | ||
} | ||
}, | ||
{ | ||
"name": "billing_meter_event_session", | ||
"path": "/v2/billing/meter_event_session", | ||
"method": "post", | ||
"headers": { | ||
"Content-Type": "application/json", | ||
"Stripe-Version": "unsafe-development" | ||
}, | ||
"params": {} | ||
}, | ||
{ | ||
"name": "create_billing_meter_event_stream", | ||
"path": "/v2/billing/meter_event_stream", | ||
"method": "post", | ||
"api_base": "https://events.stripe.com", | ||
"headers": { | ||
"Content-Type": "application/json", | ||
"Stripe-Version": "unsafe-development", | ||
"Authorization": "Bearer ${billing_meter_event_session:authentication_token}" | ||
}, | ||
"params": { | ||
"event_name": "${list_billing_meters_after_creation:data.0.event_name}", | ||
"timestamp":"${time-now-RFC3339}", | ||
"identifier": "${generate-uuid}", | ||
"payload": { | ||
"value":"1" | ||
} | ||
} | ||
} | ||
] | ||
} |
35 changes: 35 additions & 0 deletions
35
pkg/fixtures/triggers/v1.billing.meter.no_meter_found.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"_meta": { | ||
"template_version": 0 | ||
}, | ||
"fixtures": [ | ||
{ | ||
"name": "billing_meter_event_session", | ||
"path": "/v2/billing/meter_event_session", | ||
"method": "post", | ||
"headers": { | ||
"Content-Type": "application/json", | ||
"Stripe-Version": "unsafe-development" | ||
}, | ||
"params": {} | ||
}, | ||
{ | ||
"name": "create_billing_meter_event_stream", | ||
"path": "/v2/billing/meter_event_stream", | ||
"method": "post", | ||
"api_base": "https://events.stripe.com", | ||
"headers": { | ||
"Content-Type": "application/json", | ||
"Stripe-Version": "unsafe-development", | ||
"Authorization": "Bearer ${billing_meter_event_session:authentication_token}" | ||
}, | ||
"params": { | ||
"event_name": "${generate-uuid}", | ||
"timestamp":"${time-now-RFC3339}", | ||
"payload": { | ||
"value":"10" | ||
} | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.