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

petshop-10-services.spp

petshop/catalogue/petshop-10-services.spp

Download original file · Petstore source contents

1domain petshop;23atomic query importCatalogue(Goods, Goods[]);45atomic query listProducts(Goods, Goods[]);67atomic check checkGoodsCredential(Goods) {8    require(goods.sku != BLANK, RejectionCode.ITEM_REQUIRED);9}1011atomic check checkGoodsSale(Goods) {12    require(goods.active, RejectionCode.PRODUCT_UNAVAILABLE);13}1415atomic calculate prepareInventorySelection(Goods[], StockLine[]) {16    stockLines = new StockLine[] {17    };18    for (Goods product : goodss) {19        StockLine stock = new StockLine();20        stock.goods = product;21        stockLines = append(stockLines, stock);22    }23}2425atomic calculate initializeInventory(Goods[], StockLine[], StockSupply[]);