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

petshop-scene-cancelPaidShopOrder.spp

petshop/order/petshop-scene-cancelPaidShopOrder.spp

Download original file · Petstore source contents

1domain petshop;23Scenario serial cancelPaidShopOrder(Buyer, Merchant, StockLine[], ShopOrder, PaidCancellationAgreement) {4    checkBuyerCredential;5    initializePaidCancellationAgreement;6    checkPaidCancellationAgreementInput;78    configureMerchantLookup;9    parallel {10        findBuyer;11        findMerchant;12        findShopOrder;13    }14    identify(buyer);15    identify(merchant);16    identify(shopOrder);17    checkOrderOwner;18    prepareOrderInventory;19    findStockLine;20    identify(stockLines);21    checkPaidCancellation;22    checkReservedInventory;23    preparePaidCancellation;24    prepareCancellationRefund;25    preparePaidCancellationAgreementReceipt;26    transaction {27        releasePaidInventory bounds {28            stockLines.available: [0, null];29            stockLines.reserved: [0, null];30        };31        refundCancellationFunds bounds {32            buyer.wallet: [0, null];33            merchant.cash: [0, null];34        };35        updateShopOrder;3637        insertReceipt(paidCancellationAgreement.receipt);38    }39}