예제 #1
0
        private CrossClientCashoutAggregate(
            string version,
            CrossClientCashoutState state,
            DateTime startMoment,
            Guid operationId,
            Guid clientId,
            string blockchainType,
            string blockchainAssetId,
            string hotWalletAddress,
            string toAddress,
            decimal amount,
            string assetId,
            DateTime?enrollmentDate,
            Guid recipientClientId,
            Guid cashinOperationId)
        {
            Version = version;
            State   = state;

            StartMoment = startMoment;

            OperationId       = operationId;
            ClientId          = clientId;
            BlockchainType    = blockchainType;
            BlockchainAssetId = blockchainAssetId;
            HotWalletAddress  = hotWalletAddress;
            ToAddress         = toAddress;
            Amount            = amount;
            AssetId           = assetId;
            MatchingEngineEnrollementMoment = enrollmentDate;
            RecipientClientId = recipientClientId;
            CashinOperationId = cashinOperationId;
        }
예제 #2
0
 public static CrossClientCashoutAggregate Restore(
     string version,
     CrossClientCashoutState state,
     DateTime startMoment,
     Guid operationId,
     Guid clientId,
     string blockchainType,
     string blockchainAssetId,
     string hotWalletAddress,
     string toAddress,
     decimal amount,
     string assetId,
     DateTime?enrollmentDate,
     Guid recipientClientId,
     Guid cashinOperationId)
 {
     return(new CrossClientCashoutAggregate(
                version,
                state,
                startMoment,
                operationId,
                clientId,
                blockchainType,
                blockchainAssetId,
                hotWalletAddress,
                toAddress,
                amount,
                assetId,
                enrollmentDate,
                recipientClientId,
                cashinOperationId));
 }
예제 #3
0
        private bool SwitchState(CrossClientCashoutState expectedState, CrossClientCashoutState nextState)
        {
            if (State < expectedState)
            {
                // Throws to retry and wait until aggregate will be in the required state
                throw new InvalidAggregateStateException(State, expectedState, nextState);
            }

            if (State > expectedState)
            {
                // Aggregate already in the next state, so this event can be just ignored
                return(false);
            }

            State = nextState;

            return(true);
        }