Exemple #1
0
 public RevokeActiveBatchIdCommandsHandler(
     IChaosKitty chaosKitty,
     IActiveCashoutsBatchIdRepository activeCashoutsBatchIdRepository,
     ICashoutsBatchRepository cashoutsBatchRepository)
 {
     _chaosKitty = chaosKitty;
     _activeCashoutsBatchIdRepository = activeCashoutsBatchIdRepository;
     _cashoutsBatchRepository         = cashoutsBatchRepository;
 }
Exemple #2
0
 public AcceptCashoutCommandsHandler(
     IChaosKitty chaosKitty,
     ICashoutsBatchRepository cashoutsBatchRepository,
     IClosedBatchedCashoutRepository closedBatchedCashoutRepository,
     IActiveCashoutsBatchIdRepository activeCashoutsBatchIdRepository,
     IBlockchainConfigurationsProvider blockchainConfigurationProvider,
     IBlockchainWalletsClient walletsClient,
     CqrsSettings cqrsSettings,
     bool disableDirectCrossClientCashouts)
 {
     _chaosKitty = chaosKitty;
     _cashoutsBatchRepository         = cashoutsBatchRepository;
     _closedBatchedCashoutRepository  = closedBatchedCashoutRepository;
     _activeCashoutsBatchIdRepository = activeCashoutsBatchIdRepository;
     _blockchainConfigurationProvider = blockchainConfigurationProvider ?? throw new ArgumentNullException(nameof(blockchainConfigurationProvider));
     _walletsClient = walletsClient ?? throw new ArgumentNullException(nameof(walletsClient));
     _cqrsSettings  = cqrsSettings;
     _disableDirectCrossClientCashouts = disableDirectCrossClientCashouts;
 }
        public async Task <TransitionResult> RevokeIdAsync(IActiveCashoutsBatchIdRepository activeCashoutsBatchIdRepository)
        {
            switch (SwitchState(CashoutsBatchState.Closed, CashoutsBatchState.IdRevoked))
            {
            case TransitionResult.AlreadyInFutureState:
                return(TransitionResult.AlreadyInFutureState);

            case TransitionResult.AlreadyInTargetState:
                return(TransitionResult.AlreadyInTargetState);
            }

            await activeCashoutsBatchIdRepository.RevokeActiveIdAsync
            (
                BlockchainType,
                BlockchainAssetId,
                HotWalletAddress,
                BatchId
            );

            IdRevocationMoment = DateTime.UtcNow;

            return(TransitionResult.Switched);
        }