Exemplo n.º 1
0
        public List <OrderDTO> ReceiptStatement(Guid accountId, DateTime startTime, DateTime endTime, int pageIndex, int pageSize)
        {
            var orderDac = new OrderDAC();

            _logger.Info("----------------" + accountId + startTime + pageIndex + pageSize);
            var orderList = orderDac.GetMerchantOrderByDate(accountId, startTime, endTime, pageIndex, pageSize);

            _logger.Info("----------------" + JsonConvert.SerializeObject(orderList));
            var coinList = new CryptocurrencyDAC().GetAll();
            var result   = new List <OrderDTO>();

            foreach (var order in orderList)
            {
                var coin     = coinList.FirstOrDefault(e => e.Id == order.CryptoId);
                var orderDTO = new OrderDTO
                {
                    Id                 = order.Id,
                    OrderNo            = order.OrderNo,
                    OrderStatus        = order.Status,
                    Timestamp          = order.PaymentTime.Value.ToUtcTimeTicks(),
                    CryptoCode         = coin?.Code,
                    CryptoAmount       = order.CryptoAmount.ToString(coin?.DecimalPlace ?? 0),
                    FiatCurrency       = order.FiatCurrency,
                    FiatAmount         = order.FiatAmount.ToString("F", CultureInfo.InvariantCulture),
                    UserAccount        = order.UserAccountId.HasValue ? GetUserMastMaskedCellphone(order.UserAccountId.Value) : string.Empty,
                    ActualCryptoAmount = order.ActualCryptoAmount.ToString(coin?.DecimalPlace ?? 0)
                };
                result.Add(orderDTO);
            }

            return(result);
        }