protected override object GetDataFromSource() { var gateways = PaymentAccountDetails.AllGateways; var availableGateways = new HashSet <PaymentProcessor>(); foreach (var gateway in gateways) { if (gateway.IsActive && (gateway.Cashflow == GatewayCashflowDirection.ToGate || gateway.Cashflow == GatewayCashflowDirection.Both)) { availableGateways.Add(gateway.GetProcessorType()); } } var cryptocurrencies = CryptocurrencyFactory.GetAllAvailable(); foreach (var crypto in cryptocurrencies) { if (crypto.DepositApiProcessor != 0 && CryptocurrencyApiFactory.Get(crypto.DepositApiProcessor).AllowToUsePaymentButtons()) { if (crypto.DepositApiProcessor == CryptocurrencyAPIProvider.CoinPayments) { availableGateways.Add(PaymentProcessor.CoinPayments); } if (crypto.DepositApiProcessor == CryptocurrencyAPIProvider.Coinbase) { availableGateways.Add(PaymentProcessor.Coinbase); } } } return(availableGateways.Distinct().ToList()); }
protected void btnDepositBTC_Click(object sender, EventArgs e) { try { if (BtcCryptocurrency.DepositEnabled) { if (CryptocurrencyApiFactory.GetDepositApi(BtcCryptocurrency).AllowToUsePaymentButtons()) { BTCDepositInfopanel.Visible = false; var amount = Money.Parse(BTCAmountTextBox.Text).FromMulticurrency(); var bg = new DepositCryptocurrencyButtonGenerator(user, amount); BTCPaymentButton.Text = GenerateHTMLButtons.GetBtcButton(bg); } else { classicbtcDepositBTC.Visible = false; BTCValuePanel.Visible = true; string adminAddress = CryptocurrencyApiFactory.Get(BtcCryptocurrency.DepositApiProcessor).TryGetAdminAddress(); WalletToBTCPanel.Visible = true; ClassicBTCPanel.Visible = true; if (!string.IsNullOrWhiteSpace(adminAddress)) { multipleDepositWarningLiteral.Visible = true; multipleDepositWarningLiteral.Text = "<p class='alert alert-warning'>" + U5005.MUSTWAITTODEPOSIT + "</p>"; BitcoinQRCode.ImageUrl = "~/Handlers/Utils/BitcoinQRCode.ashx?address=" + adminAddress; depositBTCLabel.Text = adminAddress; DepositBTCInfoPanel.Visible = true; DepositBTCInfoLabel.Text = string.Format(U4200.DEPOSITBTCDESCRIPTION, "<b>" + adminAddress + "</b>", "<br/>", BtcCryptocurrency.DepositMinimumConfirmations.ToString()); } else { depositBTCLabel.Text = "<p class='alert alert-danger'>" + U4200.DEPOSITUNAVAILABLE + "</p>"; } } } else { throw new MsgException(U4200.DEPOSITUNAVAILABLE); } } catch (MsgException ex) { ErrorMessagePanelBTC.Visible = true; ErrorMessageBTC.Text = ex.Message; } catch (Exception ex) { ErrorLogger.Log(ex); ErrorMessagePanelBTC.Visible = true; ErrorMessageBTC.Text = ex.Message; } }
public static string GetPaymentButtons(BaseButtonGenerator bg) { var BtcCryptocurrency = CryptocurrencyFactory.Get(CryptocurrencyType.BTC); int buttonsPresent = 0; StringBuilder sb = new StringBuilder(); foreach (var t in PaymentAccountDetails.PaymentAccountDetailsClasses) { var instance = Activator.CreateInstance(t); var gateway = (PaymentAccountDetails)PaymentAccountDetails.RunStaticMethod(t, "GetFirstIncomeGateway"); if (gateway != null && gateway.AccountType != "MPesaAgent") //MPesaAgent do not support payment buttons { bg.Strategy = gateway.GetStrategy(); sb.Append(bg.Generate()); buttonsPresent++; } } if (BtcCryptocurrency.DepositEnabled && CryptocurrencyApiFactory.Get(BtcCryptocurrency.DepositApiProcessor).AllowToUsePaymentButtons()) { sb.Append(GetBtcButton(bg)); buttonsPresent++; } if (buttonsPresent == 0) { return(U6011.NOACTIVEPAYMENTPROCESSORS); } return(sb.ToString()); }
public static string GetPaymentButton(BaseButtonGenerator bg, CryptocurrencyType t) { var cryptocurrency = CryptocurrencyFactory.Get(t); var sb = new StringBuilder(); if (cryptocurrency.DepositEnabled && CryptocurrencyApiFactory.Get(cryptocurrency.DepositApiProcessor).AllowToUsePaymentButtons()) { sb.Append(GetBtcButton(bg)); } return(string.IsNullOrEmpty(sb.ToString()) ? U6011.NOACTIVEPAYMENTPROCESSORS : sb.ToString()); }
public static string GetBtcButton(BaseButtonGenerator bg) { StringBuilder sb = new StringBuilder(); var BtcCryptocurrency = CryptocurrencyFactory.Get(CryptocurrencyType.BTC); if (BtcCryptocurrency.DepositEnabled && CryptocurrencyApiFactory.Get(BtcCryptocurrency.DepositApiProcessor).AllowToUsePaymentButtons()) { bg.Strategy = CryptocurrencyApiFactory.Get(BtcCryptocurrency.DepositApiProcessor).GetStrategy(); sb.Append(bg.Generate()); } return(sb.ToString()); }
protected override object GetDataFromSource() { var gateways = PaymentAccountDetails.AllGateways; foreach (var gateway in gateways) { if (gateway.IsActive && (gateway.Cashflow == GatewayCashflowDirection.ToGate || gateway.Cashflow == GatewayCashflowDirection.Both)) { return(true); } } var BtcCryptocurrency = CryptocurrencyFactory.Get(CryptocurrencyType.BTC); if (BtcCryptocurrency.DepositEnabled && CryptocurrencyApiFactory.Get(BtcCryptocurrency.DepositApiProcessor).AllowToUsePaymentButtons()) { return(true); } return(false); }
public static Dictionary <string, List <string> > GetAvailableOptions() { Dictionary <string, List <string> > AvailableTransfers = new Dictionary <string, List <string> >(); var TokenCryptocurrency = CryptocurrencyFactory.Get(CryptocurrencyType.ERC20Token); var BtcCryptocurrency = CryptocurrencyFactory.Get(CryptocurrencyType.BTC); if (AppSettings.Payments.TransferMainInAdBalanceEnabled) { TryAdd(AvailableTransfers, "Main balance", "Purchase balance"); } if (((AppSettings.Payments.CommissionToMainBalanceEnabled && !TitanFeatures.UserCommissionToMainBalanceEnabled) || (TitanFeatures.UserCommissionToMainBalanceEnabled && Member.Current.CommissionToMainBalanceEnabled)) && Member.CurrentInCache.CheckAccessCustomizeTradeOwnSystem) { TryAdd(AvailableTransfers, "Commission Balance", "Main balance"); } if (AppSettings.Payments.CommissionToAdBalanceEnabled) { TryAdd(AvailableTransfers, "Commission Balance", "Purchase balance"); } if (TitanFeatures.isAri) { TryAdd(AvailableTransfers, "Main balance", "Cash balance"); TryAdd(AvailableTransfers, "Commission Balance", "Cash balance"); } if (TitanFeatures.IsRevolca) { TryAdd(AvailableTransfers, "Purchase balance", "Main balance"); } foreach (var t in PaymentAccountDetails.PaymentAccountDetailsClasses) { var instance = Activator.CreateInstance(t); if (PaymentAccountDetails.RunStaticMethod(t, "GetFirstIncomeGateway") != null) { string pp = t.GetProperty("AccountType").GetValue(instance, null).ToString(); if (pp == "MPesa") //MPesa only to Cash Balance or Purchase Balance (if Cash Balance disabled) { if (AppSettings.Payments.CashBalanceEnabled) { TryAdd(AvailableTransfers, pp, "Cash balance"); } else { TryAdd(AvailableTransfers, pp, "Purchase balance"); } } else //All other payment processors = no restrictions { if (AppSettings.Payments.TransferFromPaymentProcessorsToAdBalanceEnabled) { TryAdd(AvailableTransfers, pp, "Purchase balance"); } if (AppSettings.TitanFeatures.AdvertTrafficExchangeEnabled) { TryAdd(AvailableTransfers, pp, "Traffic balance"); } if (AppSettings.Payments.CashBalanceEnabled) { TryAdd(AvailableTransfers, pp, "Cash balance"); } if (AppSettings.Payments.MarketplaceBalanceDepositEnabled) { TryAdd(AvailableTransfers, pp, "Marketplace balance"); } if (AppSettings.Points.PointsDepositEnable) { TryAdd(AvailableTransfers, pp, TransferOptionConst.PointsTransfer); } } } } if (AppSettings.TitanFeatures.AdvertTrafficExchangeEnabled) { TryAdd(AvailableTransfers, "Main balance", "Traffic balance"); } if (AppSettings.Payments.CashToAdBalanceEnabled) { TryAdd(AvailableTransfers, "Cash balance", "Purchase balance"); } if (AppSettings.Payments.MainToMarketplaceBalanceEnabled) { TryAdd(AvailableTransfers, "Main balance", "Marketplace balance"); } if (AppSettings.Payments.TransferFromBTCWalletToPurchaseBalanceEnabled) { TryAdd(AvailableTransfers, "BTC Wallet", "Purchase balance"); } if (AppSettings.Payments.TransferFromTokenWalletToPurchaseBalanceEnabled) { TryAdd(AvailableTransfers, TokenCryptocurrency.Code + " Wallet", "Purchase balance"); } if (AppSettings.Payments.TransferFromMainBalanceToTokenWalletEnabled) { TryAdd(AvailableTransfers, "Main balance", TokenCryptocurrency.Code + " Wallet"); } if (BtcCryptocurrency.DepositEnabled && CryptocurrencyApiFactory.Get(BtcCryptocurrency.DepositApiProcessor).AllowToUsePaymentButtons()) { string RadioToName = (BtcCryptocurrency.DepositTarget == DepositTargetBalance.Wallet) ? "BTC Wallet" : BtcCryptocurrency.DepositTarget.ToString(); TryAdd(AvailableTransfers, BtcCryptocurrency.DepositApiProcessor.ToString(), RadioToName); } return(AvailableTransfers); }