Exemplo n.º 1
0
        public async Task <PerformDepositResponseDto> PerformDeposit(PerformDepositRequestDto performDepositRequestDto)
        {
            try
            {
                var transactionId   = Guid.NewGuid().ToString();
                var performTransfer = new StartTransfer(
                    transactionId,
                    performDepositRequestDto.FromBankAccountNumber,
                    "",
                    performDepositRequestDto.Amount
                    );
                await _messageSession.Send(performTransfer).ConfigureAwait(false);

                return(new PerformDepositResponseDto
                {
                    Response = "OK"
                });
            }
            catch (Exception ex)
            {
                return(new PerformDepositResponseDto
                {
                    Response = "ERROR: " + ex.Message + " -- " + ex.StackTrace
                });
            }
        }
Exemplo n.º 2
0
            public bool AddTransfer(string txId, string fromAccount, string toAccount, string assetId, double amount, string date = null)
            {
                var assetsList = _bus.QueryAsync(new AssetPairsInfoQuery()).Result;
                var asset      = assetsList.Assets.SingleOrDefault(a => a.AssetId == assetId);
                var nDate      = date.ToInstant();

                if (asset == null)
                {
                    throw new InvalidOperationException($"Asset {assetId} not registered");
                }

                var command = new StartTransfer(txId, fromAccount, toAccount, new Quantity(amount, asset));
                var result  = Resolve(new RetroactiveCommand <StartTransfer>(command, nDate.Value));

                return(result);
            }