{
"Comment": "Express rate check: quickly verify carrier capacity and calculate freight rates before committing to a full booking",
"StartAt": "SetCheckMeta",
"States": {
"SetCheckMeta": {
"Type": "Pass",
"Parameters": {
"checkId.$": "States.Format('RCK-{}', $$.Execution.Name)",
"channel": "EXPRESS",
"booking.$": "$"
},
"Next": "CheckCarrierCapacity"
},
"CheckCarrierCapacity": {
"Type": "Task",
"Resource": "${CheckCarrierCapacityFunctionArn}",
"ResultPath": "$.capacity",
"Next": "IsCapacityAvailable"
},
"IsCapacityAvailable": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.capacity.Payload.isCapacityAvailable",
"BooleanEquals": true,
"Next": "CalculateFreightRates"
}
],
"Default": "RateUnavailable"
},
"CalculateFreightRates": {
"Type": "Task",
"Resource": "${CalculateFreightRatesFunctionArn}",
"ResultPath": "$.rates",
"Next": "RatePropagationDelay"
},
"RatePropagationDelay": {
"Type": "Wait",
"Seconds": 2,
"Next": "IsRateCalculated"
},
"IsRateCalculated": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.rates.Payload.totalRate",
"NumericGreaterThan": 0,
"Next": "RateAvailable"
}
],
"Default": "RateUnavailable"
},
"RateAvailable": {
"Type": "Succeed"
},
"RateUnavailable": {
"Type": "Fail",
"Error": "RateUnavailable",
"Cause": "No rate could be determined for this shipment"
}
}
}JSONLogistics teams can use patterns like this to build reliable, compliant, and scalable automation for payment systems and can test and refine these flows locally with Thrubit to reduce cloud cost and speed up iteration.