¶ States and events
stateDiagram-v2
direction LR
state "ANY_STATE" as s0
s0 --> PAYMENT_PENDING : transition
note right of PAYMENT_PENDING
breakingActions:
EXECUTE_PRICING + BILL_ID_GENERATION
nonBreakingActions: NOTIFICATION
end note
PAYMENT_PENDING --> PAID : PAY [system]
PAYMENT_PENDING --> PAYMENT_EXPIRED : EXPIRE_PAYMENT [system]
EXECUTE_PRICING and BILL_ID_GENERATION are always paired in breakingActions (plural) with args: null
PAY: system-triggered (systemAuthorised: true), fires when payment gateway confirms payment
EXPIRE_PAYMENT: system-triggered (systemAuthorised: true), fires when payment deadline lapses → PAYMENT_EXPIRED (terminal)
- Payment can happen at submission (
APPLY endStateOne) or after a processing step
{
"stateName": "Payment Pending",
"stateNames": null,
"stateCode": "PAYMENT_PENDING",
"breakingAction": null,
"breakingActions": [
{ "actionType": "EXECUTE_PRICING", "args": null },
{ "actionType": "BILL_ID_GENERATION", "args": null }
],
"nonBreakingActions": [{ "actionType": "NOTIFICATION", "args": { "...payment pending notification..." } }],
"nextEvent": null,
"position": null
}
{
"startState": "PAYMENT_PENDING",
"event": "EXPIRE_PAYMENT",
"endStateOne": {
"stateName": "Payment Expired", "stateNames": null, "stateCode": "PAYMENT_EXPIRED",
"breakingAction": null, "breakingActions": null,
"nonBreakingActions": [{ "actionType": "NOTIFICATION", "args": { "...expiry notification..." } }],
"nextEvent": null, "position": null
},
"endStateTwo": null, "endStateCondition": null,
"authorisation": { "authorisedRoles": null, "authorisedUsers": null, "systemAuthorised": true },
"position": null, "eventNames": null, "eventConfigs": null
}
{
"startState": "PAYMENT_PENDING",
"event": "PAY",
"endStateOne": {
"stateName": "Paid", "stateNames": null, "stateCode": "PAID",
"breakingAction": null, "breakingActions": null,
"nonBreakingActions": [{ "actionType": "NOTIFICATION", "args": { "...payment confirmed notification..." } }],
"nextEvent": "ASSIGN_OFFICE",
"position": null
},
"endStateTwo": null, "endStateCondition": null,
"authorisation": { "authorisedRoles": null, "authorisedUsers": null, "systemAuthorised": true },
"position": null, "eventNames": null, "eventConfigs": null
}