petshop-scene-fundShopWallet.spp
petshop/payment/petshop-scene-fundShopWallet.spp
Download original file · Petstore source contents
1domain petshop;23atomic check checkFundingAmount(WalletFundingAgreement) {4require(walletFundingAgreement.amount > 0, RejectionCode.INVALID_FUNDING_AMOUNT);5}67atomic calculate prepareWalletFunding(Buyer, SettlementAccount, WalletFundingAgreement) {8settlementAccount.accountNumber = "EXTERNAL-SETTLEMENT";9walletFundingAgreement.buyer = buyer;10walletFundingAgreement.source = settlementAccount;11}1213quantum update transferWalletFunds(Buyer, SettlementAccount, WalletFundingAgreement) {14settlementAccount.balance -> buyer.wallet : walletFundingAgreement.amount;15}1617Scenario serial fundShopWallet(Buyer, SettlementAccount, WalletFundingAgreement) {18checkBuyerCredential;19checkFundingAmount;20prepareWalletFunding;21parallel {22findBuyer;23findSettlementAccount;24}25identify(buyer);26identify(settlementAccount);27transaction {28transferWalletFunds bounds {29settlementAccount.balance: [null, null];30buyer.wallet: [0, null];31};32}33}