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

bankdeposit-scene-bookOverdraftClaims.spp

bankdeposit/accrual/bankdeposit-scene-bookOverdraftClaims.spp

Download original file · Bank deposit source contents

1domain bankdeposit;23Contract OverdraftCharge {4    BigDecimal(19, 2) interest;5    BigDecimal(19, 2) collection;6    BigDecimal(19, 2) principal;7}89atomic check checkOverdraftCharge(OverdraftCharge) {10    require(11        overdraftCharge.interest >= 0 && overdraftCharge.collection >= 0 && overdraftCharge.principal >= 0,12        RejectionCode.E115513    );14}1516quantum update originateClaims(17    OverdraftCharge,18    DepositAccount,19    InterestIncomeAccount,20    CollectionInterestIncomeAccount,21    CashSettlementAccount22) {23    depositAccount.overdraftInterest -> interestIncomeAccount.balance : overdraftCharge.interest;24    depositAccount.collectionInterest -> collectionInterestIncomeAccount.balance : overdraftCharge.collection;25    depositAccount.overdraftPrincipal -> cashSettlementAccount.balance : overdraftCharge.principal;26}2728Scenario serial bookOverdraftClaims(29    OverdraftCharge,30    DepositAccount,31    InterestIncomeAccount,32    CollectionInterestIncomeAccount,33    CashSettlementAccount34) {35    parallel {36        findDepositAccount;37        findInterestIncomeAccount;38        findCollectionInterestIncomeAccount;39        findCashSettlementAccount;40    }41    identify(depositAccount);42    identify(interestIncomeAccount);43    identify(collectionInterestIncomeAccount);44    identify(cashSettlementAccount);45    checkOverdraftCharge;46    transaction {47        originateClaims bounds {48            depositAccount.overdraftInterest: [null, 0];49            depositAccount.collectionInterest: [null, 0];50            depositAccount.overdraftPrincipal: [null, 0];51            interestIncomeAccount.balance: [0, null];52            collectionInterestIncomeAccount.balance: [0, null];53        };54        deriveOverdraftExposure;55    }56}