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

bankdeposit-scene-reverseCash.spp

bankdeposit/reversal/bankdeposit-scene-reverseCash.spp

Download original file · Bank deposit source contents

1domain bankdeposit;23Scenario serial reverseCash(4    DepositAccount,5    CashSettlementAccount,6    InterestIncomeAccount,7    CollectionInterestIncomeAccount,8    PrincipalRecoveryAccount,9    AccountEligibility,10    CashAccountControl,11    CashDepositAgreement,12    CashReversalAgreement,13    DepositReversalCapacity,14    DepositAccrualState,15    CashReversalMetadataPlan,16    DepositOperatorFacts,17    CashChannel,18    CashFailureRecord,19    DepositPostingLine[],20    CashReversalPostingLine[],21    DepositPostingTotals22) {23    parallel {24        findDepositAccount;25        findCashSettlementAccount;26        findInterestIncomeAccount;27        findCollectionInterestIncomeAccount;28        findPrincipalRecoveryAccount;29        findAccountEligibility;30        findCashDepositAgreement;31        findDepositAccrualState;32    }33    identify(depositAccount);34    identify(cashSettlementAccount);35    identify(interestIncomeAccount);36    identify(collectionInterestIncomeAccount);37    identify(principalRecoveryAccount);38    identify(accountEligibility);39    identify(cashDepositAgreement);40    identify(depositAccrualState);41    checkAccountParticipants;42    checkOriginalDepositAccount;43    checkOriginalSettlementAccounts;44    checkBankDepositCashReversalPath;45    checkCoreDepositReversalEligibility;46    checkOriginalCashMovement;47    listDepositPostings;48    checkOriginalDepositPostings;49    checkCashReversalCapacity;50    checkCashReversalFacts;51    calculateBankDepositCashReversalMetadata;52    prepareCashReversalAgreement;53    prepareCashReversalPostings;54    checkDepositPostings;55    transaction {56        reverseCashDeposit bounds {57            cashSettlementAccount.balance: [null, null];58            depositAccount.interestBase: [0, null];59            depositAccount.overdraftInterest: [null, 0];60            depositAccount.collectionInterest: [null, 0];61            depositAccount.overdraftPrincipal: [null, 0];62        };63        deriveOverdraftExposure;64        completeCashReversal;65        updateDepositAccrualState;66        updateAccountEligibility;67        updateCashDepositAgreement;68        insertCashReversalAgreement;69        attachCashReversalPostings;70        insertCashReversalPostingLine;71    } fail(cashReversalAgreement) {72        recordReversalFailure;73        if (ResultInfo.failure.recoveryStatus == "ROLLED_BACK"74            || ResultInfo.failure.recoveryStatus == "REVERSED") {75            confirmNoCashMovement;76        }77        transaction {78            insertCashFailureRecord;79        }80    }81}