Ejemplo n.º 1
0
        public async Task <IActionResult> QrCode(string price, string wallet, string currencyType)
        {
            if (decimal.TryParse(price, out decimal result) && !string.IsNullOrWhiteSpace(wallet) && wallet.Length >= 95)
            {
                BrokerExchangeParams brokerExchangeParams = new BrokerExchangeParams
                {
                    SellFiatAmount = result,
                    WalletAddress  = wallet,
                    FiatCurrency   = "USD",
                    BuyCurrency    = "GRFT",
                    SellCurrency   = currencyType.ToUpper()
                };

                BrokerExchangeResult exchangeResult = null;
                try
                {
                    exchangeResult = await CreateExchange(brokerExchangeParams);
                }
                catch (Exception ex)
                {
                    ViewData["ErrorMessage"] = $"{ex.Message} ({ex.InnerException?.Message})";
                    return(View("Error"));
                }

                ViewData["currencyName"] = currencyType.ToUpper() == "BTC" ? "Bitcoin" : "Ethereum";

                return(View(new Tuple <BrokerExchangeResult, string>(exchangeResult, price)));
            }

            ViewData["price"] = price;
            return(View(nameof(SelectGraftWallet)));
        }
Ejemplo n.º 2
0
 public Task <IActionResult> CheckExchangeStatus(BrokerExchangeResult checkTransactionModel)
 {
     return(Task.FromResult((IActionResult)View(checkTransactionModel)));
 }