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

bankdeposit-00-model.spp

bankdeposit/account/bankdeposit-00-model.spp

Download original file · Bank deposit source contents

1domain bankdeposit;23Entity BankAccount {4    String accountNumber;5}67Role CashSettlementAccount {8    String accountNumber;9    quantum BigDecimal(19, 2) balance;10}1112Role CashAccountControl {13    String controllingInstitution;14    String controlStatus;15    int cancelledOn;16    String productKind;17}1819Role DepositAccrualState {20    String accountNumber;21    int lastProductDate;22    BigDecimal(25, 2) normalProduct;23    BigDecimal(25, 2) overdraftProduct;24    BigDecimal(25, 2) overdraftInterestProduct;25    BigDecimal(25, 2) actualProduct;26    BigDecimal(25, 2) agreementProduct;27    int overdraftDays;28    int overdraftInterestDays;29}3031Role DepositInterestPolicy {32    boolean normalEnabled;33    BigDecimal(19, 2) normalUnit;34    BigDecimal(19, 2) overdraftUnit;35}3637Role DepositDetailPolicy {38    int itemCount;39}4041atomic check checkCashControl(CashAccountControl, AccountEligibility) {42    require(cashAccountControl.controllingInstitution == BLANK, RejectionCode.EN432);43    require(44        cashAccountControl.controlStatus != "PayNoReceive" && cashAccountControl.controlStatus != "Locked",45        RejectionCode.EN43246    );47    require(accountEligibility.status != AccountStatus.FROZEN, RejectionCode.EG877);48    require(cashAccountControl.cancelledOn == 0, RejectionCode.EN113);49    require(cashAccountControl.productKind != "RealEstate", RejectionCode.EI090);50}5152atomic calculate describeAccountBalance(DepositAccount, AccountEligibility) {53    accountEligibility.accountBalance = depositAccount.interestBase54        + depositAccount.overdraftInterest55        + depositAccount.collectionInterest56        + depositAccount.overdraftPrincipal;57}5859atomic check checkAccountParticipants(DepositAccount, AccountEligibility, DepositAccrualState) {60    require(61        depositAccount.accountNumber == accountEligibility.accountNumber62            && depositAccount.accountNumber == depositAccrualState.accountNumber,63        RejectionCode.ACCOUNT_PARTICIPANTS_MISMATCH64    );65}6667atomic calculate deriveOverdraftExposure(DepositAccount) {68    depositAccount.overdraftExposure = -depositAccount.overdraftPrincipal;69}