petshop-scene-receiveShopStock.spp
petshop/catalogue/petshop-scene-receiveShopStock.spp
Download original file · Petstore source contents
1domain petshop;23atomic check checkStockReceiptQuantity(StockReceiptAgreement) {4require(stockReceiptAgreement.quantity > 0, RejectionCode.INVALID_QUANTITY);5}67atomic calculate prepareStockReceipt(Goods, StockLine, StockSupply, StockReceiptAgreement) {8stockLine.goods = goods;9stockSupply.goods = goods;10stockReceiptAgreement.goods = goods;11stockReceiptAgreement.stock = stockLine;12stockReceiptAgreement.source = stockSupply;13}1415atomic update receiveInventory(StockLine, StockSupply, StockReceiptAgreement);1617Scenario serial receiveShopStock(Goods, StockLine, StockSupply, StockReceiptAgreement) {18checkGoodsCredential;19checkStockReceiptQuantity;20findGoods;21identify(goods);22prepareStockReceipt;23parallel {24findStockLine;25findStockSupply;26}27identify(stockLine);28identify(stockSupply);29transaction {30receiveInventory bounds {31stockSupply.balance: [null, null];32stockLine.available: [0, null];33};34}35}