S++Business systems language
DEMO SOURCE · SPP / APP / PHYRead the book

cboddeposit-00-model.spp

cboddeposit/account/cboddeposit-00-model.spp

Download original file · Bank deposit source contents

1domain cboddeposit;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 == "", "EN432");43    require(44        CashAccountControl.controlStatus != "PayNoReceive" && CashAccountControl.controlStatus != "Locked",45        "EN432"46    );47    require(AccountEligibility.status != AccountStatus.FROZEN, "EG877");48    require(CashAccountControl.cancelledOn == 0, "EN113");49    require(CashAccountControl.productKind != "RealEstate", "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        "ACCOUNT_PARTICIPANTS_MISMATCH"64    );65}