Order Processing - Diamond Metamorphosis Demo

Demonstrates parallel pipelines converging to a single Final state

application_state_diagram StockLocated StockLocated QuantityChecked QuantityChecked StockLocated->QuantityChecked doCheckQuantity InventoryReserved InventoryReserved QuantityChecked->InventoryReserved doReserveInventory CardValidated CardValidated PaymentAuthorized PaymentAuthorized CardValidated->PaymentAuthorized doAuthorizePayment PaymentCompleted PaymentCompleted PaymentAuthorized->PaymentCompleted doCapturePayment AddressValidated AddressValidated CarrierSelected CarrierSelected AddressValidated->CarrierSelected doSelectCarrier ShippingArranged ShippingArranged CarrierSelected->ShippingArranged doArrangeShipping OrderConfirmed OrderConfirmed OrderConfirmed->OrderConfirmed goOrderDetails OrderInput OrderInput OrderInput->OrderConfirmed doOrder UnknownState UnknownState UnknownState->StockLocated doLocateStock UnknownState->CardValidated doValidateCard UnknownState->AddressValidated doValidateAddress UnknownState->OrderConfirmed doConfirmOrder
Label:
Size:
Tags:

Semantic Descriptors

Type ID Title Contained Extra Info
AddressValidated Address Validated postalCode
streetAddress
doSelectCarrier
tag:shipping being state
amount Payment Amount def:schema.org/price
authorizationCode Payment Authorization Code
cardCvv Card CVV
cardExpiry Card Expiry Date
cardNumber Card Number
CardValidated Card Validated cardNumber
cardExpiry
doAuthorizePayment
tag:payment being state
carrierId Carrier ID
CarrierSelected Carrier Selected carrierId
postalCode
doArrangeShipping
tag:shipping being state
cartId Cart ID def:schema.org/identifier
customerId Customer ID def:schema.org/identifier
doArrangeShipping Arrange Shipping carrierId
postalCode
streetAddress
tag:choreography shippingrt:#ShippingArrangeddoc:Arrange shipping with carrier - becomes permanent on order confirmation
doAuthorizePayment Authorize Payment cardNumber
amount
tag:choreography paymentrt:#PaymentAuthorizeddoc:Authorize payment amount with the card issuer
doCapturePayment Capture Payment authorizationCode
amount
tag:choreography paymentrt:#PaymentCompleteddoc:Capture authorized payment - becomes permanent on order confirmation
doCheckQuantity Check Quantity productId
quantity
tag:choreography inventoryrt:#QuantityCheckeddoc:Verify sufficient quantity available in the warehouse
doConfirmOrder Confirm Order InventoryReserved
PaymentCompleted
ShippingArranged
tag:choreography convergencert:#OrderConfirmeddoc:Converge all three Moments into Final - triggers be() on each Moment
doLocateStock Locate Stock productId tag:choreography inventoryrt:#StockLocateddoc:Find warehouse with available stock for the product
doOrder Place Order cartId
customerId
cardNumber
cardExpiry
cardCvv
postalCode
streetAddress
tag:choreographyrt:#OrderConfirmeddoc:Diamond Metamorphosis: initiates three parallel pipelines - inventory, payment, and shipping
doReserveInventory Reserve Inventory productId
quantity
warehouseId
tag:choreography inventoryrt:#InventoryReserveddoc:Lock inventory provisionally - becomes permanent on order confirmation
doSelectCarrier Select Carrier postalCode tag:choreography shippingrt:#CarrierSelecteddoc:Select optimal carrier based on destination
doValidateAddress Validate Address postalCode
streetAddress
tag:choreography shippingrt:#AddressValidateddoc:Validate shipping address format and deliverability
doValidateCard Validate Card cardNumber
cardExpiry
cardCvv
tag:choreography paymentrt:#CardValidateddoc:Validate card number, expiry, and CVV
goOrderDetails View Order Details tag:choreographyrt:#OrderConfirmeddoc:View confirmed order details
InventoryReserved Inventory Reserved reservationId
productId
quantity
warehouseId
tag:inventory moment statedoc:Moment: Inventory locked provisionally until order confirmation
OrderConfirmed Order Confirmed InventoryReserved
PaymentCompleted
ShippingArranged
goOrderDetails
tag:final statedoc:Final: All three Moments converge here - the diamond completes
OrderInput Order Input cartId
customerId
cardNumber
cardExpiry
cardCvv
postalCode
streetAddress
doOrder
tag:input state
PaymentAuthorized Payment Authorized authorizationCode
amount
doCapturePayment
tag:payment being state
PaymentCompleted Payment Completed authorizationCode
amount
tag:payment moment statedoc:Moment: Payment captured provisionally until order confirmation
postalCode Postal Code def:schema.org/postalCode
productId Product ID def:schema.org/identifier
quantity Quantity def:schema.org/quantity
QuantityChecked Quantity Checked productId
quantity
warehouseId
doReserveInventory
tag:inventory being state
reservationId Inventory Reservation ID
ShippingArranged Shipping Arranged carrierId
trackingNumber
shippingRate
tag:shipping moment statedoc:Moment: Shipping arranged provisionally until order confirmation
shippingRate Shipping Rate def:schema.org/price
StockLocated Stock Located productId
warehouseId
doCheckQuantity
tag:inventory being state
streetAddress Street Address def:schema.org/streetAddress
trackingNumber Tracking Number
warehouseId Warehouse ID
Semantic
Safe
Unsafe
Idempotent
<?xml version="1.0" encoding="UTF-8"?> <alps version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://alps-io.github.io/schemas/alps.xsd"> <title>Order Processing - Diamond Metamorphosis Demo</title> <doc>Demonstrates parallel pipelines converging to a single Final state</doc> <!-- ═══════════════════════════════════════════════════════════════════════ ONTOLOGY - Semantic Descriptors ═══════════════════════════════════════════════════════════════════════ --> <descriptor id="cartId" title="Cart ID" def="https://schema.org/identifier"/> <descriptor id="customerId" title="Customer ID" def="https://schema.org/identifier"/> <descriptor id="quantity" title="Quantity" def="https://schema.org/quantity"/> <descriptor id="productId" title="Product ID" def="https://schema.org/identifier"/> <descriptor id="cardNumber" title="Card Number"/> <descriptor id="cardExpiry" title="Card Expiry Date"/> <descriptor id="cardCvv" title="Card CVV"/> <descriptor id="postalCode" title="Postal Code" def="https://schema.org/postalCode"/> <descriptor id="streetAddress" title="Street Address" def="https://schema.org/streetAddress"/> <descriptor id="warehouseId" title="Warehouse ID"/> <descriptor id="carrierId" title="Carrier ID"/> <descriptor id="trackingNumber" title="Tracking Number"/> <descriptor id="authorizationCode" title="Payment Authorization Code"/> <descriptor id="reservationId" title="Inventory Reservation ID"/> <descriptor id="shippingRate" title="Shipping Rate" def="https://schema.org/price"/> <descriptor id="amount" title="Payment Amount" def="https://schema.org/price"/> <!-- ═══════════════════════════════════════════════════════════════════════ TAXONOMY - State Descriptors ═══════════════════════════════════════════════════════════════════════ --> <!-- Input State --> <descriptor id="OrderInput" title="Order Input" tag="input state"> <descriptor href="#cartId"/> <descriptor href="#customerId"/> <descriptor href="#cardNumber"/> <descriptor href="#cardExpiry"/> <descriptor href="#cardCvv"/> <descriptor href="#postalCode"/> <descriptor href="#streetAddress"/> <descriptor href="#doOrder"/> </descriptor> <!-- Inventory Pipeline (Being States) --> <descriptor id="StockLocated" title="Stock Located" tag="inventory being state"> <descriptor href="#productId"/> <descriptor href="#warehouseId"/> <descriptor href="#doCheckQuantity"/> </descriptor> <descriptor id="QuantityChecked" title="Quantity Checked" tag="inventory being state"> <descriptor href="#productId"/> <descriptor href="#quantity"/> <descriptor href="#warehouseId"/> <descriptor href="#doReserveInventory"/> </descriptor> <descriptor id="InventoryReserved" title="Inventory Reserved" tag="inventory moment state"> <doc>Moment: Inventory locked provisionally until order confirmation</doc> <descriptor href="#reservationId"/> <descriptor href="#productId"/> <descriptor href="#quantity"/> <descriptor href="#warehouseId"/> </descriptor> <!-- Payment Pipeline (Being States) --> <descriptor id="CardValidated" title="Card Validated" tag="payment being state"> <descriptor href="#cardNumber"/> <descriptor href="#cardExpiry"/> <descriptor href="#doAuthorizePayment"/> </descriptor> <descriptor id="PaymentAuthorized" title="Payment Authorized" tag="payment being state"> <descriptor href="#authorizationCode"/> <descriptor href="#amount"/> <descriptor href="#doCapturePayment"/> </descriptor> <descriptor id="PaymentCompleted" title="Payment Completed" tag="payment moment state"> <doc>Moment: Payment captured provisionally until order confirmation</doc> <descriptor href="#authorizationCode"/> <descriptor href="#amount"/> </descriptor> <!-- Shipping Pipeline (Being States) --> <descriptor id="AddressValidated" title="Address Validated" tag="shipping being state"> <descriptor href="#postalCode"/> <descriptor href="#streetAddress"/> <descriptor href="#doSelectCarrier"/> </descriptor> <descriptor id="CarrierSelected" title="Carrier Selected" tag="shipping being state"> <descriptor href="#carrierId"/> <descriptor href="#postalCode"/> <descriptor href="#doArrangeShipping"/> </descriptor> <descriptor id="ShippingArranged" title="Shipping Arranged" tag="shipping moment state"> <doc>Moment: Shipping arranged provisionally until order confirmation</doc> <descriptor href="#carrierId"/> <descriptor href="#trackingNumber"/> <descriptor href="#shippingRate"/> </descriptor> <!-- Final State --> <descriptor id="OrderConfirmed" title="Order Confirmed" tag="final state"> <doc>Final: All three Moments converge here - the diamond completes</doc> <descriptor href="#InventoryReserved"/> <descriptor href="#PaymentCompleted"/> <descriptor href="#ShippingArranged"/> <descriptor href="#goOrderDetails"/> </descriptor> <!-- ═══════════════════════════════════════════════════════════════════════ CHOREOGRAPHY - Transition Descriptors ═══════════════════════════════════════════════════════════════════════ --> <!-- Main Entry Point --> <descriptor id="doOrder" type="unsafe" rt="#OrderConfirmed" title="Place Order" tag="choreography"> <doc>Diamond Metamorphosis: initiates three parallel pipelines - inventory, payment, and shipping</doc> <descriptor href="#cartId"/> <descriptor href="#customerId"/> <descriptor href="#cardNumber"/> <descriptor href="#cardExpiry"/> <descriptor href="#cardCvv"/> <descriptor href="#postalCode"/> <descriptor href="#streetAddress"/> </descriptor> <!-- Inventory Pipeline Transitions --> <descriptor id="doLocateStock" type="unsafe" rt="#StockLocated" title="Locate Stock" tag="choreography inventory"> <doc>Find warehouse with available stock for the product</doc> <descriptor href="#productId"/> </descriptor> <descriptor id="doCheckQuantity" type="unsafe" rt="#QuantityChecked" title="Check Quantity" tag="choreography inventory"> <doc>Verify sufficient quantity available in the warehouse</doc> <descriptor href="#productId"/> <descriptor href="#quantity"/> </descriptor> <descriptor id="doReserveInventory" type="unsafe" rt="#InventoryReserved" title="Reserve Inventory" tag="choreography inventory"> <doc>Lock inventory provisionally - becomes permanent on order confirmation</doc> <descriptor href="#productId"/> <descriptor href="#quantity"/> <descriptor href="#warehouseId"/> </descriptor> <!-- Payment Pipeline Transitions --> <descriptor id="doValidateCard" type="unsafe" rt="#CardValidated" title="Validate Card" tag="choreography payment"> <doc>Validate card number, expiry, and CVV</doc> <descriptor href="#cardNumber"/> <descriptor href="#cardExpiry"/> <descriptor href="#cardCvv"/> </descriptor> <descriptor id="doAuthorizePayment" type="unsafe" rt="#PaymentAuthorized" title="Authorize Payment" tag="choreography payment"> <doc>Authorize payment amount with the card issuer</doc> <descriptor href="#cardNumber"/> <descriptor href="#amount"/> </descriptor> <descriptor id="doCapturePayment" type="unsafe" rt="#PaymentCompleted" title="Capture Payment" tag="choreography payment"> <doc>Capture authorized payment - becomes permanent on order confirmation</doc> <descriptor href="#authorizationCode"/> <descriptor href="#amount"/> </descriptor> <!-- Shipping Pipeline Transitions --> <descriptor id="doValidateAddress" type="unsafe" rt="#AddressValidated" title="Validate Address" tag="choreography shipping"> <doc>Validate shipping address format and deliverability</doc> <descriptor href="#postalCode"/> <descriptor href="#streetAddress"/> </descriptor> <descriptor id="doSelectCarrier" type="unsafe" rt="#CarrierSelected" title="Select Carrier" tag="choreography shipping"> <doc>Select optimal carrier based on destination</doc> <descriptor href="#postalCode"/> </descriptor> <descriptor id="doArrangeShipping" type="unsafe" rt="#ShippingArranged" title="Arrange Shipping" tag="choreography shipping"> <doc>Arrange shipping with carrier - becomes permanent on order confirmation</doc> <descriptor href="#carrierId"/> <descriptor href="#postalCode"/> <descriptor href="#streetAddress"/> </descriptor> <!-- Convergence Transition --> <descriptor id="doConfirmOrder" type="unsafe" rt="#OrderConfirmed" title="Confirm Order" tag="choreography convergence"> <doc>Converge all three Moments into Final - triggers be() on each Moment</doc> <descriptor href="#InventoryReserved"/> <descriptor href="#PaymentCompleted"/> <descriptor href="#ShippingArranged"/> </descriptor> <!-- Navigation --> <descriptor id="goOrderDetails" type="safe" rt="#OrderConfirmed" title="View Order Details" tag="choreography"> <doc>View confirmed order details</doc> </descriptor> </alps>