S++Business systems language
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}