pub enum WorkflowStep {
Query {
cmd_json: String,
store_as: Option<String>,
},
Notify {
channel: ChannelKind,
template: String,
recipient_key: String,
payload_key: Option<String>,
},
Wait {
event: String,
timeout: Duration,
on_timeout: Vec<WorkflowStep>,
},
Branch {
condition_key: String,
branches: Vec<(String, Vec<WorkflowStep>)>,
default: Vec<WorkflowStep>,
},
BranchWhen {
condition_key: String,
branches: Vec<(WorkflowBranchCondition, Vec<WorkflowStep>)>,
default: Vec<WorkflowStep>,
},
ForEach {
list_key: String,
steps: Vec<WorkflowStep>,
},
Transition {
to: String,
},
Log {
message: String,
},
Charge {
provider: PaymentKind,
amount_key: String,
reference_key: String,
description_key: Option<String>,
payment_method_key: Option<String>,
order_origin_key: Option<String>,
store_as: Option<String>,
},
}Expand description
A single step in a workflow execution.
Variants§
Query
Execute a QAIL query against the database.
The cmd_json field stores QAIL wire text (qail_core::wire::encode_cmd_text).
The store_as key saves the result into WorkflowContext for later steps.
Fields
Notify
Send a notification via a channel (WhatsApp, Email, SMS, Push).
Fields
channel: ChannelKindWhich channel to send through
Wait
Wait for an external event (webhook callback, user action, timeout).
Fields
on_timeout: Vec<WorkflowStep>Steps to execute if timeout is reached
Branch
Conditional branching based on a context value.
Fields
branches: Vec<(String, Vec<WorkflowStep>)>Map of value → steps to execute
default: Vec<WorkflowStep>Default steps if no branch matches
BranchWhen
Conditional branching with richer predicates.
Fields
branches: Vec<(WorkflowBranchCondition, Vec<WorkflowStep>)>Ordered predicates and steps. The first matching predicate is selected.
default: Vec<WorkflowStep>Default steps if no predicate matches
ForEach
Execute steps for each item in a context list.
Fields
steps: Vec<WorkflowStep>Steps to execute per item (item available as “item” in context)
Transition
Transition to a new workflow state.
Log
Log a message (useful for debugging/audit trails).
Charge
Create a payment charge via a payment provider.
Resolves amount and reference from context, calls the provider,
and stores a redacted PaymentDisplay in context for downstream steps.
Fields
provider: PaymentKindWhich payment provider to use
Implementations§
Source§impl WorkflowStep
impl WorkflowStep
Sourcepub fn query(cmd: &Qail, store_as: Option<&str>) -> Self
pub fn query(cmd: &Qail, store_as: Option<&str>) -> Self
Create a Query step from a Qail command.
Sourcepub fn notify(channel: ChannelKind, template: &str, recipient_key: &str) -> Self
pub fn notify(channel: ChannelKind, template: &str, recipient_key: &str) -> Self
Create a Notify step.
Sourcepub fn notify_with_payload(
channel: ChannelKind,
template: &str,
recipient_key: &str,
payload_key: &str,
) -> Self
pub fn notify_with_payload( channel: ChannelKind, template: &str, recipient_key: &str, payload_key: &str, ) -> Self
Create a Notify step with payload.
Sourcepub fn wait_or(
event: &str,
timeout: Duration,
on_timeout: Vec<WorkflowStep>,
) -> Self
pub fn wait_or( event: &str, timeout: Duration, on_timeout: Vec<WorkflowStep>, ) -> Self
Create a Wait step with timeout fallback.
Sourcepub fn for_each(list_key: &str, steps: Vec<WorkflowStep>) -> Self
pub fn for_each(list_key: &str, steps: Vec<WorkflowStep>) -> Self
Create a ForEach step.
Sourcepub fn transition(to: &str) -> Self
pub fn transition(to: &str) -> Self
Create a Transition step.
Sourcepub fn charge(
provider: PaymentKind,
amount_key: &str,
reference_key: &str,
store_as: Option<&str>,
) -> Self
pub fn charge( provider: PaymentKind, amount_key: &str, reference_key: &str, store_as: Option<&str>, ) -> Self
Create a Charge step.
Sourcepub fn charge_with(
provider: PaymentKind,
amount_key: &str,
reference_key: &str,
description_key: Option<&str>,
payment_method_key: Option<&str>,
store_as: Option<&str>,
) -> Self
pub fn charge_with( provider: PaymentKind, amount_key: &str, reference_key: &str, description_key: Option<&str>, payment_method_key: Option<&str>, store_as: Option<&str>, ) -> Self
Create a Charge step with full options.
Sourcepub fn charge_with_origin(
provider: PaymentKind,
amount_key: &str,
reference_key: &str,
description_key: Option<&str>,
payment_method_key: Option<&str>,
order_origin_key: Option<&str>,
store_as: Option<&str>,
) -> Self
pub fn charge_with_origin( provider: PaymentKind, amount_key: &str, reference_key: &str, description_key: Option<&str>, payment_method_key: Option<&str>, order_origin_key: Option<&str>, store_as: Option<&str>, ) -> Self
Create a Charge step with explicit source-channel tracking.
Sourcepub fn branch(
condition_key: &str,
branches: Vec<(&str, Vec<WorkflowStep>)>,
default: Vec<WorkflowStep>,
) -> Self
pub fn branch( condition_key: &str, branches: Vec<(&str, Vec<WorkflowStep>)>, default: Vec<WorkflowStep>, ) -> Self
Create a Branch step.
Sourcepub fn branch_when(
condition_key: &str,
branches: Vec<(WorkflowBranchCondition, Vec<WorkflowStep>)>,
default: Vec<WorkflowStep>,
) -> Self
pub fn branch_when( condition_key: &str, branches: Vec<(WorkflowBranchCondition, Vec<WorkflowStep>)>, default: Vec<WorkflowStep>, ) -> Self
Create a BranchWhen step with richer predicates.