Payments — acceptance criteria
Settling a payment
4 scenarios — these are acceptance criteria for what the service must do, not a description of what it does.
binding spec features/settle-payment.feature @ 2.0.0 — the spec of record. It states what must be; implementations converge on it, never the reverse.
Enforced by
check:version— any change must bump the artifact and service versions; a silent edit fails CI- bound by implementations in strict mode — an unbound scenario fails their build
check:intent— every schema element added to a contract must be named here- gherkin-lint
Version history
| Version | First released | Service version |
|---|---|---|
2.0.0 | 2026-08-27 | 3.0.0 |
1.1.0 | 2026-08-23 | 2.0.0 |
1.0.0 | 2026-08-23 | 1.0.0 |
Consume it
- Agents, over MCP:
get_acceptance_criteria('payments') - Raw spec:
features/settle-payment.feature - Implementations pin the release tag
payments/v3.0.1in theircontracts.lockand fetch read-only — the full loop is on Drive an implementation.
Settlement is terminal. Authorisation is not.
Settlement emits exactly one event
- Givenan authorised payment
p-1for ordero-1of 2500 pence - Whenthe processor confirms settlement
- Thena
PaymentSettledevent is published onpayments.settled.v2 - Andthe event data amount_pence is 2500
Settlement events are CloudEvents envelopes
- Givenan authorised payment
p-3for ordero-3of 1000 pence - Whenthe processor confirms settlement
- Thena
PaymentSettledevent is published onpayments.settled.v2 - Andthe envelope carries specversion
1.0, a unique id and a time - Andthe envelope source is /payments and its type is com.hungovercoders.payments.settled.v2
- Andthe envelope subject is the payment_id, with datacontenttype
application/json - Andthe data carries the payment_id, order_id, settled_at and amount_pence
- Andhandlers dedupe on the envelope id
Duplicate settlement callbacks are idempotent
- Givenpayment
p-1has already settled - Whenthe processor sends the settlement callback again
- Thenno second
PaymentSettledevent is published
A reversal after authorisation does not emit settlement
- Givenan authorised payment
p-2 - Whenthe authorisation is reversed
- Thenno
PaymentSettledevent is published forp-2
Raw Gherkin
Feature: Settling a payment
Settlement is terminal. Authorisation is not.
Scenario: Settlement emits exactly one event
Given an authorised payment "p-1" for order "o-1" of 2500 pence
When the processor confirms settlement
Then a "PaymentSettled" event is published on "payments.settled.v2"
And the event data amount_pence is 2500
Scenario: Settlement events are CloudEvents envelopes
Given an authorised payment "p-3" for order "o-3" of 1000 pence
When the processor confirms settlement
Then a "PaymentSettled" event is published on "payments.settled.v2"
And the envelope carries specversion "1.0", a unique id and a time
And the envelope source is /payments and its type is com.hungovercoders.payments.settled.v2
And the envelope subject is the payment_id, with datacontenttype "application/json"
And the data carries the payment_id, order_id, settled_at and amount_pence
And handlers dedupe on the envelope id
Scenario: Duplicate settlement callbacks are idempotent
Given payment "p-1" has already settled
When the processor sends the settlement callback again
Then no second "PaymentSettled" event is published
Scenario: A reversal after authorisation does not emit settlement
Given an authorised payment "p-2"
When the authorisation is reversed
Then no "PaymentSettled" event is published for "p-2"