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

petshop-scene-reviseShopGoodsPrice.spp

petshop/catalogue/petshop-scene-reviseShopGoodsPrice.spp

Download original file · Petstore source contents

1domain petshop;23Contract GoodsPriceRevisionAgreement {4    Goods goods;5    BigDecimal(19, 2) unitPrice;6}78atomic check checkGoodsPriceRevision(GoodsPriceRevisionAgreement) {9    require(goodsPriceRevisionAgreement.unitPrice >= 0, RejectionCode.INVALID_GOODS_PRICE);10}1112atomic calculate applyGoodsPriceRevision(Goods, GoodsPriceRevisionAgreement) {13    goods.price = goodsPriceRevisionAgreement.unitPrice;14    goodsPriceRevisionAgreement.goods = goods;15}1617Scenario serial reviseShopGoodsPrice(Goods, GoodsPriceRevisionAgreement) {18    findGoods;19    identify(goods);20    checkGoodsPriceRevision;21    applyGoodsPriceRevision;22    transaction {23        updateGoods;24    }25}