cboddeposit-00-agreements.spp
cboddeposit/deposit/cboddeposit-00-agreements.spp
Download original file · Bank deposit source contents
1domain cboddeposit;23Contract CashDepositAgreement {4DepositPostingLine[] postingEvidence;5DepositNotices notices;6DepositOperatorFacts operator;7DepositBankProfile bankProfile;8AdmissionDecision admission;9CashSettlementAccount settlement;10InterestIncomeAccount interestIncome;11CollectionInterestIncomeAccount collectionIncome;12PrincipalRecoveryAccount principalRecovery;13business("Cash deposit receipt number used for transaction enquiry") String depositNumber;14DepositAccount account;15BigDecimal(19, 2) amount;16String currency;17int valueDate;18BigDecimal(19, 2) interestBaseDelta;19BigDecimal(19, 2) interestPaid;20BigDecimal(19, 2) collectionPaid;21BigDecimal(19, 2) principalPaid;22BigDecimal(19, 2) exposureDelta;23BigDecimal(19, 2) fee;24int transactionDate;25int previousTransactionDate;26int settledDetailCount;27BigDecimal(25, 2) addedBackdatedProduct;28boolean reversed;29}3031Contract CashReversalAgreement {32business("Cash reversal receipt number used for business enquiry") String reversalNumber;33CashDepositAgreement original;34int businessDate;35int newDetailItems;36boolean overnightMode2;37BigDecimal(19, 2) refundAmount;38boolean reverseInstitutionLimit;39}4041Role CashFailureRecord {42business("Business failure handling receipt number") String handlingNumber;43CashDepositAgreement deposit;44CashReversalAgreement reversal;45CashHandlingState handlingState;46}4748atomic calculate prepareDepositAgreement(49DepositRequest,50DepositAccount,51CashSettlementAccount,52InterestIncomeAccount,53CollectionInterestIncomeAccount,54PrincipalRecoveryAccount,55DepositPlan,56DepositFeePlan,57AccountEligibility,58BusinessDay,59DepositDetailPolicy,60DepositNotices,61DepositOperatorFacts,62DepositBankProfile,63AdmissionDecision,64CashDepositAgreement65) {66CashDepositAgreement.notices = DepositNotices;67CashDepositAgreement.operator = DepositOperatorFacts;68CashDepositAgreement.bankProfile = DepositBankProfile;69CashDepositAgreement.admission = AdmissionDecision;70CashDepositAgreement.settlement = CashSettlementAccount;71CashDepositAgreement.interestIncome = InterestIncomeAccount;72CashDepositAgreement.collectionIncome = CollectionInterestIncomeAccount;73CashDepositAgreement.principalRecovery = PrincipalRecoveryAccount;74CashDepositAgreement.account = DepositAccount;75CashDepositAgreement.amount = DepositRequest.amount;76CashDepositAgreement.currency = DepositRequest.currency;77CashDepositAgreement.valueDate = DepositRequest.valueDate;78CashDepositAgreement.interestBaseDelta = DepositPlan.newInterestBase - DepositAccount.interestBase;79CashDepositAgreement.interestPaid = DepositPlan.interestPaid;80CashDepositAgreement.collectionPaid = DepositPlan.collectionInterestPaid;81CashDepositAgreement.principalPaid = DepositPlan.principalPaid;82CashDepositAgreement.exposureDelta = DepositPlan.newOverdraftExposure - DepositAccount.overdraftExposure;83CashDepositAgreement.fee = DepositFeePlan.fee;84CashDepositAgreement.transactionDate = BusinessDay.date;85CashDepositAgreement.previousTransactionDate = AccountEligibility.lastTransactionDate;86CashDepositAgreement.settledDetailCount = AccountEligibility.detailCount + DepositDetailPolicy.itemCount;87CashDepositAgreement.addedBackdatedProduct = 0;88CashDepositAgreement.reversed = false;89}9091atomic check checkDetailPolicy(DepositDetailPolicy) {92require(DepositDetailPolicy.itemCount > 0, "INVALID_DETAIL_COUNT");93}9495atomic calculate completeDepositMetadata(96AccountEligibility,97BusinessDay,98DepositDetailPolicy,99AdmissionDecision,100DepositPlan101) {102AccountEligibility.cashDepositedToday = AdmissionDecision.dayCashTotal;103AccountEligibility.accountBalance = DepositPlan.newAccountBalance;104if (AccountEligibility.lastTransactionDate != BusinessDay.date) {105AccountEligibility.transferredToday = 0;106}107AccountEligibility.detailCount += DepositDetailPolicy.itemCount;108AccountEligibility.lastTransactionDate = BusinessDay.date;109}110111quantum update settleCashDeposit(112DepositAccount,113CashSettlementAccount,114InterestIncomeAccount,115CollectionInterestIncomeAccount,116PrincipalRecoveryAccount,117CashDepositAgreement118) {119DepositAccount.interestBase += CashDepositAgreement.interestBaseDelta;120DepositAccount.overdraftInterest -= CashDepositAgreement.interestPaid;121DepositAccount.collectionInterest -= CashDepositAgreement.collectionPaid;122DepositAccount.overdraftPrincipal -= CashDepositAgreement.principalPaid;123DepositAccount.overdraftExposure += CashDepositAgreement.exposureDelta;124CashSettlementAccount.balance -= CashDepositAgreement.amount;125InterestIncomeAccount.balance += CashDepositAgreement.interestPaid;126CollectionInterestIncomeAccount.balance += CashDepositAgreement.collectionPaid;127PrincipalRecoveryAccount.balance += CashDepositAgreement.principalPaid;128}129130atomic calculate recordDepositFailure(CashDepositAgreement, CashFailureRecord) {131CashFailureRecord.deposit = CashDepositAgreement;132CashFailureRecord.handlingState = CashHandlingState.RECONCILIATION_REQUIRED;133}134135atomic calculate recordReversalFailure(CashReversalAgreement, CashFailureRecord) {136CashFailureRecord.reversal = CashReversalAgreement;137CashFailureRecord.handlingState = CashHandlingState.RECONCILIATION_REQUIRED;138}139140atomic calculate confirmNoCashMovement(CashFailureRecord) {141CashFailureRecord.handlingState = CashHandlingState.NOT_COMPLETED;142}