private CashoutAggregate(
            string version,
            CashoutState state,
            CashoutResult result,
            DateTime startMoment,
            DateTime?operationFinishMoment,
            Guid operationId,
            Guid clientId,
            string blockchainType,
            string blockchainAssetId,
            string hotWalletAddress,
            string toAddress,
            decimal amount,
            string assetId,
            string transactionHash,
            decimal?transactionAmount,
            decimal?fee,
            string error,
            Guid?batchId)
        {
            Version = version;
            State   = state;
            Result  = result;

            StartMoment           = startMoment;
            OperationFinishMoment = operationFinishMoment;

            OperationId       = operationId;
            ClientId          = clientId;
            BlockchainType    = blockchainType;
            BlockchainAssetId = blockchainAssetId;
            HotWalletAddress  = hotWalletAddress;
            ToAddress         = toAddress;
            Amount            = amount;
            AssetId           = assetId;

            TransactionHash   = transactionHash;
            TransactionAmount = transactionAmount;
            Fee     = fee;
            Error   = error;
            BatchId = batchId;
        }
 public static CashoutAggregate Restore(
     string version,
     CashoutState state,
     CashoutResult result,
     DateTime startMoment,
     DateTime?operationFinishMoment,
     Guid operationId,
     Guid clientId,
     string blockchainType,
     string blockchainAssetId,
     string hotWalletAddress,
     string toAddress,
     decimal amount,
     string assetId,
     string transactionHash,
     decimal?transactionAmount,
     decimal?fee,
     string error,
     Guid?batchId)
 {
     return(new CashoutAggregate(
                version,
                state,
                result,
                startMoment,
                operationFinishMoment,
                operationId,
                clientId,
                blockchainType,
                blockchainAssetId,
                hotWalletAddress,
                toAddress,
                amount,
                assetId,
                transactionHash,
                transactionAmount,
                fee,
                error,
                batchId));
 }
コード例 #3
0
        public async Task <IActionResult> Execute([FromBody] CashoutModel request)
        {
            try
            {
                CashoutResult cashoutResult = await _cashoutService.ExecuteAsync(Mapper.Map <CashoutCommand>(request));

                return(Ok(Mapper.Map <CashoutResponse>(cashoutResult)));
            }
            catch (AssetNetworkNotDefinedException e)
            {
                _log.ErrorWithDetails(e, new { e.AssetId });

                return(BadRequest(ErrorResponse.Create(e.Message)));
            }
            catch (InvalidOperationException e)
            {
                _log.ErrorWithDetails(e, request);

                return(BadRequest(ErrorResponse.Create(e.Message)));
            }
            catch (InsufficientFundsException e)
            {
                _log.ErrorWithDetails(e, new
                {
                    e.WalletAddress,
                    e.AssetId
                });

                return(BadRequest(ErrorResponse.Create(e.Message)));
            }
            catch (CashoutOperationFailedException e)
            {
                _log.ErrorWithDetails(e, new { errors = e.TransferErrors });

                return(BadRequest(ErrorResponse.Create(e.Message)));
            }
            catch (MultipleDefaultMerchantWalletsException e)
            {
                _log.ErrorWithDetails(e, new
                {
                    e.AssetId,
                    e.MerchantId,
                    e.PaymentDirection
                });

                return(BadRequest(ErrorResponse.Create(e.Message)));
            }
            catch (DefaultMerchantWalletNotFoundException e)
            {
                _log.ErrorWithDetails(e, new
                {
                    e.AssetId,
                    e.MerchantId,
                    e.PaymentDirection
                });

                return(BadRequest(ErrorResponse.Create(e.Message)));
            }
            catch (MerchantWalletOwnershipException e)
            {
                _log.ErrorWithDetails(e, new
                {
                    e.MerchantId,
                    e.WalletAddress
                });

                return(BadRequest(ErrorResponse.Create(e.Message)));
            }
            catch (CashoutHotwalletNotDefinedException e)
            {
                _log.ErrorWithDetails(e, new { e.Blockchain });

                return(BadRequest(ErrorResponse.Create(e.Message)));
            }
        }