S++Core systems, human-reviewable
DEMO SOURCE · SPP / APP / PHYRead the book

petshop-20-calculations.spp

petshop/fulfillment/petshop-20-calculations.spp

Download original file · Petstore source contents

1domain petshop;23atomic calculate prepareShipment(ShopOrder, ShipmentAgreement) {4    shipmentAgreement.shippedQuantity = 0;5    for (OrderLine line : shopOrder.lines) {6        shipmentAgreement.shippedQuantity += line.quantity;7    }8    shopOrder.status = OrderStatus.SHIPPED;9    shopOrder.tracking = shipmentAgreement.tracking;10}1112atomic calculate prepareDelivery(ShopOrder) {13    shopOrder.status = OrderStatus.DELIVERED;14}