public OrderDetailDTO GetByOrderNo(Guid merchantAccountId, string orderNo) { var order = new OrderDAC().GetByOrderNo(orderNo); var merchantAccount = new MerchantAccountDAC().GetById(merchantAccountId); var pos = new POSDAC().GetById(merchantAccount.POSId.Value); if (order == null) { throw new CommonException(10000, Resources.订单不存在); } if (order.MerchantAccountId != merchantAccountId) { throw new CommonException(10000, Resources.只能查看自己的订单); } var coin = new CryptocurrencyDAC().GetById(order.CryptoId); var er = order.ExchangeRate; var cer = GetExchangeRate(merchantAccount.CountryId, order.FiatCurrency, coin); var iRate = ((cer - er) / er) * 100; // 手续费 var fee = new OrderWithdrawalFeeDAC().GetByOrderId(order.Id); var feeCoin = new Cryptocurrency(); if (fee != null) { feeCoin = new CryptocurrencyDAC().GetById(fee.CryptoId); } var result = new OrderDetailDTO { Id = order.Id, OrderNo = order.OrderNo, OrderStatus = order.Status, Timestamp = order.Timestamp.ToUnixTime(), CryptoStatus = coin.Status, CryptoCode = coin.Code, CryptoAmount = order.CryptoAmount.ToString(coin.DecimalPlace), FiatCurrency = order.FiatCurrency, FiatAmount = order.FiatAmount.ToString(2), Markup = order.Markup, ActualFiatAmount = order.ActualFiatAmount.ToString(2), TransactionFee = (fee == null || fee.Amount == 0) ? order.TransactionFee.ToString(coin.DecimalPlace) : fee.Amount.ToString(feeCoin.DecimalPlace), ActualCryptoAmount = order.ActualCryptoAmount.ToString(coin.DecimalPlace), UserAccount = order.UserAccountId.HasValue ? GetUserMastMaskedCellphone(order.UserAccountId.Value) : string.Empty, SN = pos.Sn, ExchangeRate = er.ToString(4), CurrentExchangeRate = coin.Enable == 1 ? $"1 {coin.Code} = {cer.ToString(4)} {order.FiatCurrency}" : "--", IncreaseRate = coin.Enable == 1 ? (iRate > 0 ? $"+{iRate.ToString(2)}%" : iRate.ToString(2) + "%") : "--", FeeCryptoCode = (fee == null || fee.Amount == 0) ? coin.Code : feeCoin.Code, CryptoEnable = coin.Enable }; if (result.OrderStatus == OrderStatus.Refunded) { var refund = new RefundDAC().GetByOrderId(result.Id); if (refund?.Timestamp != null) { result.RefundTimestamp = refund.Timestamp.ToUnixTime(); } } return(result); }
public static Asset ToAsset(Cryptocurrency value) { return(Kraken.ToAsset(value.GetEnumName()).Value); }
private Order Generate(MerchantAccount merchantAccount, Cryptocurrency coin, string unifiedFiatCurrency, decimal fiatAmount, PaymentType paymentType, string merchantClientIP = null) { return(Generate(merchantAccount, coin, unifiedFiatCurrency, merchantAccount.FiatCurrency, fiatAmount, paymentType, merchantClientIP)); }
/// <summary> /// 计算订单金额 /// </summary> /// <param name="fiatAmount">消费金额</param> /// <param name="markup">溢价率</param> /// <param name="feeRate">手续费率</param> /// <param name="exchangeRate">法比对加密币汇率</param> /// <param name="coin">加密币实体</param> /// <returns>(法币总金额,加密币总数量,加密币手续费,加密币实收数量)</returns> private CalcModel CalculateAmount(decimal fiatAmount, decimal markup, decimal feeRate, decimal exchangeRate, Cryptocurrency coin) { //var tempFiatAmount = (fiatAmount * (1 + markup)); var tempFiatAmount = fiatAmount + (fiatAmount * markup).ToSpecificDecimal(4); //总金额 = 消费金额 + 消费金额 x 溢价 //decimal fiatTotalAmount = (fiatAmount * (1 + markup)).ToSpecificDecimal(4); decimal fiatTotalAmount = tempFiatAmount; //手续费 = 消费金额 x 手续费率 decimal transactionFee = ((fiatAmount * feeRate) / exchangeRate).ToSpecificDecimal(coin.DecimalPlace); //总数量 decimal cryptoAmount = ((fiatAmount + fiatAmount * markup) / exchangeRate).ToSpecificDecimal(coin.DecimalPlace); //实收数量 = 总数量 - 手续费 decimal actualCryptoAmount = cryptoAmount - transactionFee; return(new CalcModel(fiatTotalAmount, cryptoAmount, transactionFee, actualCryptoAmount)); }
private MerchantWithdrawal WithdrawalToOutside(MerchantWallet fromWallet, MerchantWithdrawal fromWithdraw, Cryptocurrency cryptocurrency, MerchantAccount account, decimal amount, decimal fee, string address, string tag, string clientIP) { var actualAmount = amount - fee; ILog _logger = LogManager.GetLogger("LogicError"); using (var scope = new TransactionScope()) { try { fromWithdraw.Status = TransactionStatus.UnSubmit; fromWithdraw = new MerchantWithdrawalDAC().Create(fromWithdraw); var fromWithdrawFee = new MerchantWithdrawalFee { Amount = amount, Fee = fee, Timestamp = DateTime.UtcNow, WithdrawalId = fromWithdraw.Id }; new MerchantWithdrawalFeeDAC().Create(fromWithdrawFee); new MerchantWalletDAC().Freeze(fromWallet.Id, amount); //var requestInfo = new FiiiFinanceAgent().TryCreateWithdraw(requestModel); //new MerchantWithdrawalDAC().UpdateTransactionId(fromWithdraw.Id, requestInfo.RequestID, // requestInfo.TransactionId); scope.Complete(); } catch (CommonException) { throw; } catch (Exception ex) { _logger.Info($"Withdraw ApplyWithdrawal faild.WithdrawID:{fromWithdraw.Id},OrderNo:{fromWithdraw.OrderNo}.request Parameter - . Error message:{ex.Message}"); throw; } } var requestModel = new CreateWithdrawModel { AccountID = account.Id, AccountType = AccountTypeEnum.Merchant, CryptoName = cryptocurrency.Code, ReceivingAddress = address, DestinationTag = tag, Amount = actualAmount, IPAddress = clientIP, TransactionFee = fee, WithdrawalId = fromWithdraw.Id }; RabbitMQSender.SendMessage("WithdrawSubmit", requestModel); return(fromWithdraw); }
private MerchantWithdrawalMasterSettingDTO GetMerchantWithdrawalMasterSettingWithCrypto(Cryptocurrency crypto, int level) { var withdrawMasterSetting = GetMerchantWithdrawalMasterSetting(); var marketPriceComponent = new MarketPriceComponent(); var mpInfo = marketPriceComponent.GetMarketPrice("USD", crypto.Code); if (mpInfo == null) { throw new CommonException(ReasonCode.NOT_SUPORT_WITHDRAWAL, Resources.支持的币种); } var exchangeRate = mpInfo.Price; switch (level) { case 1: withdrawMasterSetting.PerTxLimit = (withdrawMasterSetting.PerTxLimit1 / exchangeRate).ToSpecificDecimal(crypto.DecimalPlace); withdrawMasterSetting.PerDayLimit = (withdrawMasterSetting.PerDayLimit1 / exchangeRate).ToSpecificDecimal(crypto.DecimalPlace); withdrawMasterSetting.PerMonthLimit = (withdrawMasterSetting.PerMonthLimit1 / exchangeRate).ToSpecificDecimal(crypto.DecimalPlace); break; case 2: withdrawMasterSetting.PerTxLimit = (withdrawMasterSetting.PerTxLimit2 / exchangeRate).ToSpecificDecimal(crypto.DecimalPlace); withdrawMasterSetting.PerDayLimit = (withdrawMasterSetting.PerDayLimit2 / exchangeRate).ToSpecificDecimal(crypto.DecimalPlace); withdrawMasterSetting.PerMonthLimit = (withdrawMasterSetting.PerMonthLimit2 / exchangeRate).ToSpecificDecimal(crypto.DecimalPlace); break; default: withdrawMasterSetting.PerTxLimit = (withdrawMasterSetting.PerTxLimit / exchangeRate).ToSpecificDecimal(crypto.DecimalPlace); withdrawMasterSetting.PerDayLimit = (withdrawMasterSetting.PerDayLimit / exchangeRate).ToSpecificDecimal(crypto.DecimalPlace); withdrawMasterSetting.PerMonthLimit = (withdrawMasterSetting.PerMonthLimit / exchangeRate).ToSpecificDecimal(crypto.DecimalPlace); break; } //未设置 默认最小值 if (withdrawMasterSetting.ToOutsideMinAmount <= 0) { withdrawMasterSetting.ToOutsideMinAmount = 1 / (decimal)Math.Pow(10, crypto.DecimalPlace); } else { withdrawMasterSetting.ToOutsideMinAmount = (withdrawMasterSetting.ToOutsideMinAmount / exchangeRate).ToSpecificDecimal(crypto.DecimalPlace); } //未设置 默认最小值 if (withdrawMasterSetting.ToUserMinAmount <= 0) { withdrawMasterSetting.ToUserMinAmount = 1 / (decimal)Math.Pow(10, crypto.DecimalPlace); } else { withdrawMasterSetting.ToUserMinAmount = (withdrawMasterSetting.ToUserMinAmount / exchangeRate).ToSpecificDecimal(crypto.DecimalPlace); } return(withdrawMasterSetting); }
/// <summary> /// //BTC, XRP, TOKEN etc | all cryptocurrencies /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void CryptocurrencyPayout_Activate(object sender, EventArgs e) { CryptocurrencyErrorMessagePanel.Visible = false; CryptocurrencySuccessMessagePanel.Visible = false; WithdrawCryptocurrencyAmountTextBox.Text = string.Empty; CryptoPINTextBox.Enabled = true; CryptoPINTextBox.Text = string.Empty; CryptocurrencyFeeLiteral.Visible = WithdrawTotalCryptocurrencyLiteral.Visible = false; WithdrawCryptocurrencyAddressTextBox.Text = string.Empty; string errorMessage = String.Empty; Cryptocurrency Cryptocurrency = CryptocurrencyFactory.Get(SelectedCryptocurrency); CryptocurrencyImage.ImageUrl = Cryptocurrency.GetImageUrl(); CryptocurrencyAddressLabel.Text = string.Format("{1} {0}", L1.ADDRESS, Cryptocurrency.Code); CryptocurrencyValueLiteral.Text = string.Format("1 {0} = <b>{1}</b>", Cryptocurrency.Code, Cryptocurrency.GetValue().ToString()); if (TitanFeatures.IsTrafficThunder) { CryptocurrencyValueLiteral.Text = "1 BTC = <b>" + String.Format(new System.Globalization.CultureInfo("en-US"), "{0:n2}", CryptocurrencyFactory.Get(CryptocurrencyType.BTC).GetOriginalValue("USD").ToDecimal()) + " USD</b>"; } CryptocurrencyWithdrawalSourceLiteral.Text = string.Format(U6012.WITHDRAWALSOURCE, Cryptocurrency.GetWithdrawalSourceName()); MinimumCryptocurrencyAmountLiteral.Text = string.Format("{0}: {1}<br />", L1.LIMIT, Cryptocurrency.GetMinimumWithdrawalAmount(User, Cryptocurrency.WithdrawalSource).ToString()); MaximumCryptocurrencyAmountLiteral.Text = string.Format("{0}: {1}", U5004.MAXIMUM, Cryptocurrency.GetMaximumWithdrawalAmount(User, Cryptocurrency.WithdrawalSource, out errorMessage).ToString()); //Currency sign CurrencySignLiteral.Text = AppSettings.Site.MulticurrencySign; if (Cryptocurrency.WithdrawalSource == WithdrawalSourceBalance.Wallet) { CurrencySignLiteral.Text = Cryptocurrency.CurrencySign; } if (Cryptocurrency.WithdrawalApiProcessor == CryptocurrencyAPIProvider.Coinbase) { switch (AppSettings.Cryptocurrencies.CoinbaseAddressesPolicy) { case CoinbaseAddressesPolicy.CoinbaseEmail: CryptocurrencyAddressLabel.Text = U6010.COINBASEEMAIL; WithdrawCryptocurrencyAddressTextBox.Text = CoinbaseAddressHelper.GetAddress(User.Id); if (string.IsNullOrEmpty(WithdrawCryptocurrencyAddressTextBox.Text)) { ChangeCryptocurrencyAddressButton.Text = L1.ADDNEW; } else { ChangeCryptocurrencyAddressButton.Text = U6007.CHANGE; } break; case CoinbaseAddressesPolicy.BTCWallet: SetAndCheckCryptocurrencyAddress(); break; case CoinbaseAddressesPolicy.CoinbaseEmailOrBTCWallet: CryptocurrencyAddressLabel.Text = U6010.COINBASEEMAILORBTCWALLET; CoinbaseAddressesDDL.Visible = true; WithdrawCryptocurrencyAddressTextBox.Visible = false; var emailAddress = CoinbaseAddressHelper.GetAddress(User.Id, 1); //coinbase Email first if (string.IsNullOrEmpty(emailAddress)) { CoinbaseAddressesDDL.Items.Add(L1.ADDNEW); ChangeCryptocurrencyAddressButton.Text = L1.ADDNEW; } else { CoinbaseAddressesDDL.Items.Add(new ListItem(emailAddress, CoinbaseAddressesPolicy.CoinbaseEmail.ToString())); ChangeCryptocurrencyAddressButton.Text = U6007.CHANGE; } //btc wallet var btcAddress = CoinbaseAddressHelper.GetAddress(User.Id, 2); if (string.IsNullOrEmpty(btcAddress)) { CoinbaseAddressesDDL.Items.Add(U6010.ADDNEWBTCWALLET); } else { CoinbaseAddressesDDL.Items.Add(new ListItem(btcAddress, CoinbaseAddressesPolicy.BTCWallet.ToString())); } break; } } else { SetAndCheckCryptocurrencyAddress(); } }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.MoneyTransferEnabled); user = Member.Current; AppSettings.Reload(); BtcCryptocurrency = CryptocurrencyFactory.Get <BitcoinCryptocurrency>(); EthCryptocurrency = CryptocurrencyFactory.Get <EthereumCryptocurrency>(); XrpCryptocurrency = CryptocurrencyFactory.Get <RippleCryptocurrency>(); TokenCryptocurrency = CryptocurrencyFactory.Get <RippleCryptocurrency>(); PointsButton.Text = AppSettings.PointsName; PointsButton.Visible = ShowPointsView(); PointsToSpinsButton.Visible = AppSettings.TitanFeatures.SlotMachineEnabled; RofriquePlaceHolder.Visible = TitanFeatures.IsRofrique; if (AppSettings.Payments.TransferMode != TransferFundsMode.DenyAll) { TransferToOthersButton.Visible = true; TransferToOthersButton.Text = U3500.TRANSFERTOOTHER; } if (!Page.IsPostBack) { if (TitanFeatures.IsJ5WalterOffersFromHome) { BalanceButton.Visible = false; PointsButton.CssClass = "ViewSelected"; MenuMultiView.ActiveViewIndex = 1; } if (TitanFeatures.isBoazorSite) { BalanceButton.Visible = false; TransferToOthersButton.Visible = false; MenuMultiView.ActiveViewIndex = 1; } if (TitanFeatures.IsTrafficThunder) { UserBalancesPlaceHolder.Visible = false; } AppSettings.Reload(); LangAdder.Add(btnTransfer, L1.TRANSFER); LangAdder.Add(btnTransferPoints, L1.TRANSFER); LangAdder.Add(MPesaConfirmButton, L1.CONFIRM); //MPesa? if (Request.QueryString["mpesa"] != null) { StandardTransferPlaceHolder.Visible = false; MPesaTransferPlaceHolder2.Visible = true; var gateway = PaymentAccountDetails.GetFirstIncomeGateway <MPesaSapamaAccountDetails>(); MPesaAmount.Text = String.Format(U6005.TODEPOSITVIAMPESA, gateway.Username, gateway.Username, Money.Parse(Request.QueryString["mpesa"]).ToString()); } //Pre-selected tab if (Request.QueryString["button"] != null) { var button = (Button)MenuButtonPlaceHolder.FindControl("Button" + Request.QueryString["button"]); MenuButton_Click(button, null); } RadioFrom.Items.AddRange(GenerateHTMLButtons.TransferBalanceFromItems); //Points -> Main Balance (on/off) if (!AppSettings.Misc.IsTransferPointsToMainBalanceEnabled || !AppSettings.Points.PointsEnabled) { PointsTo.Items.RemoveAt(2); } if (!AppSettings.Payments.PointsToAdBalanceEnabled) { PointsTo.Items.Remove("Purchase balance"); } if (AppSettings.Payments.TransferMode == TransferFundsMode.AllowMainBalanceOnly || AppSettings.Payments.TransferMode == TransferFundsMode.AllowMainToPurchaseBalance) { MemberFrom.Items[1].Selected = true; MemberFrom.Items.RemoveAt(0); } else if (AppSettings.Payments.TransferMode == TransferFundsMode.AllowPointsOnly) { MemberFrom.Items.RemoveAt(1); } if (((AppSettings.Payments.CommissionToMainBalanceEnabled && !TitanFeatures.UserCommissionToMainBalanceEnabled) || (TitanFeatures.UserCommissionToMainBalanceEnabled && user.CommissionToMainBalanceEnabled) || TitanFeatures.IsRevolca) && user.CheckAccessCustomizeTradeOwnSystem) { RadioTo.Items.Add(new ListItem("", "Main balance")); TransferSameCommissionToMainLiteral.Visible = true; TransferSameCommissionToMainLiteral.Text = U5004.TRANSFERCOMMISSIONTOMAINFEE + ": <b>" + user.Membership.SameUserCommissionToMainTransferFee.ToString() + "%</b><br />"; if (user.Membership.SameUserCommissionToMainTransferFee == 0) { TransferSameCommissionToMainP.Visible = false; } } if (AppSettings.TitanFeatures.AdvertTrafficExchangeEnabled == false) { ListItem a = PointsTo.Items.FindByValue("Traffic balance"); ListItem b = RadioTo.Items.FindByValue("Traffic balance"); if (a != null) { PointsTo.Items.Remove(a); } if (b != null) { RadioTo.Items.Remove(b); } } if (!AppSettings.Payments.CashBalanceEnabled) { ListItem cb = RadioTo.Items.FindByValue("Cash balance"); if (cb != null) { RadioTo.Items.Remove(cb); } } if (!AppSettings.Payments.MarketplaceBalanceEnabled) { ListItem cb = RadioTo.Items.FindByValue("Marketplace balance"); if (cb != null) { RadioTo.Items.Remove(cb); } } #region TransferFee var pointsFee = user.Membership.OtherUserPointsToPointsTransferFee; var mainToMainFee = user.Membership.OtherUserMainToMainTransferFee; var mainToAdFee = user.Membership.OtherUserMainToAdTransferFee; if (AppSettings.Payments.TransferMode == TransferFundsMode.AllowPointsAndMainBalance) { TransferOthersMainToMainLiteral.Visible = true; TransferOthersMainToMainLiteral.Text = U5004.THEFEE.Replace("%a%", "<b>" + L1.MAINBALANCE + "</b>") .Replace("%n%", "<b>" + mainToMainFee.ToString() + "%</b>"); TransferOthersPointsLiteral.Visible = true; TransferOthersPointsLiteral.Text = U5004.THEFEE.Replace("%a%", "<b>" + AppSettings.PointsName + "</b>") .Replace("%n%", "<b>" + pointsFee.ToString() + "%</b>"); } else if (AppSettings.Payments.TransferMode == TransferFundsMode.AllowMainBalanceOnly) { TransferOthersMainToMainLiteral.Visible = true; TransferOthersMainToMainLiteral.Text = U5004.THEFEE.Replace("%a%", "<b>" + L1.MAINBALANCE + "</b>") .Replace("%n%", "<b>" + mainToMainFee.ToString() + "%</b>"); } else if (AppSettings.Payments.TransferMode == TransferFundsMode.AllowPointsOnly) { TransferOthersPointsLiteral.Visible = true; TransferOthersPointsLiteral.Text = U5004.THEFEE.Replace("%a%", "<b>" + AppSettings.PointsName + "</b>") .Replace("%n%", "<b>" + pointsFee.ToString() + "%</b>"); } else if (AppSettings.Payments.TransferMode == TransferFundsMode.AllowMainToPurchaseBalance) { TransferOthersMainToAdLiteral.Visible = true; TransferOthersMainToAdLiteral.Text = U5004.THEFEE.Replace("%a%", "<b>" + L1.MAINBALANCE + "</b>") .Replace("%n%", "<b>" + mainToAdFee.ToString() + "%</b>"); } #endregion SetRadioToValues(); //CalculatePointsValue(); SetProcessorValues(); SetupSpecialTransfersProperties(); if (RadioFrom.Items.Count == 0 || RadioTo.Items.Count == 0) { //No transfers available transferInputRow.Visible = false; TransferSameCommissionToMainLiteral.Visible = true; TransferSameCommissionToMainLiteral.Text = "<br/><br/>" + U5006.NOTRANSFEROPTIONS; transfertable.Visible = false; } if (TitanFeatures.IsTradeOwnSystem) { //Checking condition to display appropriate message if (!user.CheckAccessCustomizeTradeOwnSystem && user.CommissionToMainBalanceRequiredViewsMessageInt > 0) { CommissionTransferInfoDiv.Visible = true; CommissionTransferInfo.Text = String.Format(U6010.COMMISSIONBALANCETRANSFERINFO, user.CommissionToMainBalanceRequiredViewsMessageInt, AppSettings.RevShare.AdPack.AdPackName); } else if (!user.CheckAccessCustomizeTradeOwnSystem && user.CommissionToMainBalanceRequiredViewsMessageInt == 0) { CommissionTransferInfoDiv.Visible = true; CommissionTransferInfo.Text = String.Format(U6010.COMMISSIONBALANCETRANSFERNOACTIVEADPACKINFO, AppSettings.RevShare.AdPack.AdPackName); } else { CommissionTransferInfoDiv.Visible = false; } } } SetRadioItemsValues(RadioFrom); SetRadioItemsValues(RadioTo); SetRadioItemsValues(PointsTo); RemoveDuplicatesFromList(); PointsFrom.Items[0].Attributes.Add("data-content", "<img src = '../Images/OneSite/TransferMoney/Points.png' /> " + AppSettings.PointsName); if (!TitanFeatures.IsRofriqueWorkMines) { if (TitanFeatures.IsAhmed) { LangAdder.Add(BalanceButton, string.Format("{0}/{1}", U6012.DEPOSITCOINS, L1.TRANSFER)); } else { LangAdder.Add(BalanceButton, L1.TRANSFER); } } else { LangAdder.Add(BalanceButton, "Cash Deposits"); } LangAdder.Add(btnTransferMember, L1.TRANSFER); LangAdder.Add(CalculatePointsValueButton, U6007.CALCULATE); }
private OrderWithdrawalFee CalculateOrderAmount(ref Order order, RedisOrderDTO orderDto, MerchantAccount account, Cryptocurrency coin) { var orderWithdrawalFee = new OrderWithdrawalFee() { Timestamp = DateTime.UtcNow }; var wallet = new MerchantWalletDAC().GetByAccountId(account.Id, new CryptocurrencyDAC().GetByCode("FIII").Id); if (wallet == null || !wallet.SupportReceipt) { Excute(ref order); } else { var exchangeFiiiRate = GetExchangeRate(orderDto.CountryId, order.FiatCurrency, new CryptocurrencyDAC().GetById(wallet.CryptoId)); var fiiiCoin = new CryptocurrencyDAC().GetById(wallet.CryptoId); //var tempFiatActualAmount = orderDto.FiatAmount * (1 + account.Markup); var tempFiatActualAmount = orderDto.FiatAmount + (orderDto.FiatAmount * account.Markup).ToSpecificDecimal(4); var fiiiTransactionFee = ((orderDto.FiatAmount + orderDto.FiatAmount * account.Markup) * account.Receivables_Tier / exchangeFiiiRate) .ToSpecificDecimal( fiiiCoin.DecimalPlace); if (wallet.Balance < fiiiTransactionFee) { Excute(ref order); } else { orderWithdrawalFee.CryptoId = fiiiCoin.Id; orderWithdrawalFee.Amount = fiiiTransactionFee; order.ActualFiatAmount = tempFiatActualAmount.ToSpecificDecimal(4); order.CryptoAmount = ((orderDto.FiatAmount + orderDto.FiatAmount * account.Markup) / order.ExchangeRate).ToSpecificDecimal(coin.DecimalPlace); order.TransactionFee = 0; order.ActualCryptoAmount = order.CryptoAmount; var model = CalculateUnifiedAmount(order.CryptoAmount, order.ActualCryptoAmount, order.UnifiedExchangeRate); order.UnifiedFiatAmount = model.UnifiedFiatAmount; order.UnifiedActualFiatAmount = model.UnifiedActualFiatAmount; } } void Excute(ref Order inOrder) { var calcModel = CalculateAmount(orderDto.FiatAmount, account.Markup, account.Receivables_Tier, inOrder.ExchangeRate, coin); inOrder.ActualFiatAmount = calcModel.FiatTotalAmount; inOrder.CryptoAmount = calcModel.CryptoAmount; inOrder.TransactionFee = calcModel.TransactionFee; inOrder.ActualCryptoAmount = calcModel.ActualCryptoAmount; var model = CalculateUnifiedAmount(inOrder.CryptoAmount, inOrder.ActualCryptoAmount, inOrder.UnifiedExchangeRate); inOrder.UnifiedFiatAmount = model.UnifiedFiatAmount; inOrder.UnifiedActualFiatAmount = model.UnifiedActualFiatAmount; orderWithdrawalFee.CryptoId = inOrder.CryptoId; orderWithdrawalFee.Amount = 0; } return(orderWithdrawalFee); }
protected void Page_Load(object sender, EventArgs e) { //Add translations & hints LangAdder.Add(ChangeSettingsButton, L1.SAVE); LangAdder.Add(ChangeSettingsButton2, L1.SAVE); LangAdder.Add(SecuritySettingsSaveButton, L1.SAVE); LangAdder.Add(PreferencesSettingsSaveButton, L1.SAVE); LangAdder.Add(ChangeSettingsButton3, U4000.ENTERVAC); LangAdder.Add(EmailRequired, L1.REG_REQ_EMAIL, true); LangAdder.Add(CorrectEmailRequired, L1.ER_BADEMAILFORMAT, true); LangAdder.Add(RegularExpressionValidator2, L1.ER_INVALIDPASS, true); LangAdder.Add(CustomValidator2, U6000.PINCANTSTARTWITHZERO, true); LangAdder.Add(PasswordCompare, L1.ER_PASSDIFFER, true); LangAdder.Add(RegularExpressionValidator6, L1.ER_INVALIDPASS, true); LangAdder.Add(CompareValidator1, L1.ER_PASSDIFFER, true); LangAdder.Add(RegularExpressionValidator3, L1.ER_BADPIN, true); LangAdder.Add(RegularExpressionValidator4, L1.ER_BADPIN, true); LangAdder.Add(RegularExpressionValidator5, L1.ER_BADPIN, true); LangAdder.Add(RequiredFieldValidator4, L1.REG_REQ_PIN, true); LangAdder.Add(RequiredFieldValidator3, L1.REG_REQ_PIN, true); LangAdder.Add(RegularExpressionValidator1, L1.ER_BADPIN, true); LangAdder.Add(RequiredFieldValidator2, L1.REG_REQ_PIN, true); LangAdder.Add(RegularExpressionValidator7, L1.ER_BADPIN, true); LangAdder.Add(RequiredFieldValidator5, L1.REG_REQ_PIN, true); LangAdder.Add(RequiredFieldValidator1, L1.REG_REQ_PIN, true); LangAdder.Add(RegularExpressionValidator8, L1.ER_BADPIN, true); HintAdder.Add(Password, L1.REG_PASSWORD); HintAdder.Add(ConfirmPassword, L1.H_LEAVEBLANK); HintAdder.Add(PIN, L1.H_LEAVEBLANK); LangAdder.Add(MenuButtonGeneral, U4000.GENERAL); LangAdder.Add(MenuButtonPayment, U4000.PAYMENT); LangAdder.Add(MenuButtonVacationMode, U4000.VACATIONMODE); LangAdder.Add(AvatarUploadValidCustomValidator, U4200.INVALIDAVATAR + ". " + string.Format(U6012.AVATARVALIDATOR, ImagesHelper.AvatarImage.MaxWidth, ImagesHelper.AvatarImage.MaxWidth), true); LangAdder.Add(AccountTypeValidator, U6000.SELECTACCOUNTTYPE, true); LangAdder.Add(MenuButtonVerification, L1.VERIFICATION); LangAdder.Add(MenuButtonPreferences, U6000.PREFERENCES); LangAdder.Add(MenuButtonSecurity, U6004.AUTHENTICATION); LangAdder.Add(VerificationButton, L1.SEND); LangAdder.Add(Verification_BannerUploadSubmit, L1.SUBMIT); VacationLiteral.Text = U4200.VACATIONINFO2; if (AppSettings.TitanFeatures.AdvertAdPacksEnabled) { VacationLiteral.Text += "<br/>" + U5002.VACATIONINFO3.Replace("%n%", AppSettings.RevShare.AdPack.AdPackName).Replace("%p%", AppSettings.RevShare.AdPack.AdPackNamePlural); } User = Member.Current; BtcCryptocurrency = CryptocurrencyFactory.Get <BitcoinCryptocurrency>(); EthCryptocurrency = CryptocurrencyFactory.Get <EthereumCryptocurrency>(); XrpCryptocurrency = CryptocurrencyFactory.Get <RippleCryptocurrency>(); TokenCryptocurrency = CryptocurrencyFactory.Get <RippleCryptocurrency>(); EarnerCheckBoxPlaceHolder.Visible = AppSettings.TitanFeatures.EarnersRoleEnabled; AdvertiserCheckBoxPlaceHolder.Visible = AppSettings.TitanFeatures.AdvertisersRoleEnabled; PublisherCheckBoxPlaceHolder.Visible = AppSettings.TitanFeatures.PublishersRoleEnabled; PINDiv1.Visible = PINDiv2.Visible = PINDiv3.Visible = PINDiv4.Visible = PINDiv5.Visible = PINDiv6.Visible = AppSettings.Registration.IsPINEnabled; //Vacation mode if (!AppSettings.VacationAndInactivity.IsEnabled) { MenuButtonVacationMode.Visible = false; } if (User.Status == MemberStatus.VacationMode) { YouAreInVacationPanel.Visible = true; VacationPanel.Visible = false; LangAdder.Add(ChangeSettingsButton3, U4000.EXITVAC); ChangeSettingsButton3.OnClientClick = "return confirm('" + U4000.EXITVACSURE + "');"; VacationEndsLiteral.Text = ((DateTime)User.VacationModeEnds).ToShortDateString(); } Password.Attributes["title"] += " " + L1.H_LEAVEBLANK; XrpDestTagTextBox.Attributes["placeholder"] = U6011.DESTINATIONTAG; myonoffswitch.InputAttributes.Add("class", "onoffswitch-checkbox"); myonoffswitch.ClientIDMode = System.Web.UI.ClientIDMode.Static; myonoffswitch2.InputAttributes.Add("class", "onoffswitch2-checkbox"); myonoffswitch2.ClientIDMode = System.Web.UI.ClientIDMode.Static; AvatarImage.ImageUrl = string.Format("{0}?{1}", User.AvatarUrl, AppSettings.ServerTime); ClientScript.RegisterStartupScript(this.GetType(), "onloadscript", "password2change(true);", true); HadSecondaryPassword.Text = User.HasSecondaryPassword() ? "1" : "0"; // Show/hide proper settings cpaNotifications.Visible = AppSettings.TitanFeatures.EarnCPAGPTEnabled; shoutboxPrivacy.Visible = !(AppSettings.Shoutbox.DisplayMode == ShoutboxDisplayMode.Disabled); captchaSettings.Visible = AppSettings.Captcha.AllowMembersToChooseCaptcha; if (!AppSettings.TitanFeatures.EarnCPAGPTEnabled && !AppSettings.Captcha.AllowMembersToChooseCaptcha && AppSettings.Shoutbox.DisplayMode == ShoutboxDisplayMode.Disabled) { MenuButtonPlaceHolder.Controls.Remove(MenuButtonPreferences); } if (!Page.IsPostBack || SuccMessagePanel.Visible) { if (SuccMessagePanel.Visible == false) { Email.Text = User.Email; myonoffswitch.Checked = User.MessageSystemTurnedOn; PIN.Text = ""; myonoffswitch2.Checked = User.HasSecondaryPassword(); } ShoutboxPrivacyList.SelectedValue = ((int)User.ShoutboxPrivacyPermission).ToString(); CPACompletedPermissionsList.SelectedValue = ((int)User.CPAOfferCompletedBehavior).ToString(); CaptchaRB.SelectedValue = ((int)User.SelectedCaptchaType).ToString(); FirstNameTextBox.Text = User.FirstName; SecondNameTextBox.Text = User.SecondName; AddressTextBox.Text = User.Address; CityTextBox.Text = User.City; StateProvinceTextBox.Text = User.StateProvince; ZipCodeTextBox.Text = User.ZipCode; EarnerCheckBox.Checked = User.IsEarner; EarnerCheckBoxImage.Attributes.Add("class", User.IsEarner ? "icon fa fa-money fa-fw fa-2x img-thumbnail img-check text-primary p-10 check" : "icon fa fa-money fa-fw fa-2x img-thumbnail img-check text-primary p-10"); AdvertiserCheckBox.Checked = User.IsAdvertiser; AdvertiserCheckBoxImage.Attributes.Add("class", User.IsAdvertiser ? "icon fa fa-bullhorn fa-fw fa-2x img-thumbnail img-check text-primary p-10 check" : "icon fa fa-bullhorn fa-fw fa-2x img-thumbnail img-check text-primary p-10"); PublisherCheckBox.Checked = User.IsPublisher; PublisherCheckBoxImage.Attributes.Add("class", User.IsPublisher ? "icon fa fa-globe fa-fw fa-2x img-thumbnail img-check text-primary p-10 check" : "icon fa fa-globe fa-fw fa-2x img-thumbnail img-check text-primary p-10"); } //Loading Basic and Custom Processors LoadBasePayoutProcesssorsControls(); LoadCustomProcessorsControls(); btcSettings.Visible = BtcCryptocurrency.WithdrawalEnabled && !TitanFeatures.IsClickmyad; rippleSettings.Visible = XrpCryptocurrency.WithdrawalEnabled; ethereumSettings.Visible = EthCryptocurrency.WithdrawalEnabled; tokenSettings.Visible = TokenCryptocurrency.WithdrawalEnabled; if (!BtcCryptocurrency.WithdrawalEnabled && BasicPayoutProcessorsPlaceHolder.Controls.Count == 0 && CustomPayoutProcessorsPlaceHolder.Controls.Count == 0 && !XrpCryptocurrency.WithdrawalEnabled && !TokenCryptocurrency.WithdrawalEnabled && !EthCryptocurrency.WithdrawalEnabled) { MenuButtonPlaceHolder.Controls.Remove(MenuButtonPayment); } if (btcSettings.Visible && BtcCryptocurrency.WithdrawalApiProcessor == CryptocurrencyAPIProvider.Coinbase && AppSettings.Cryptocurrencies.CoinbaseAddressesPolicy == CoinbaseAddressesPolicy.CoinbaseEmail) { btcSettings.Visible = false; } if (Request.QueryString["ref"] != null) { //We have target reference string TargetReference = Request.QueryString["ref"]; if (TargetReference == "payment") { MenuMultiView.ActiveViewIndex = 1; foreach (Button b in MenuButtonPlaceHolder.Controls) { b.CssClass = ""; } MenuButtonPayment.CssClass = "ViewSelected"; } else if (TargetReference == "vacation") { MenuMultiView.ActiveViewIndex = 2; foreach (Button b in MenuButtonPlaceHolder.Controls) { b.CssClass = ""; } MenuButtonVacationMode.CssClass = "ViewSelected"; } else if (TargetReference == "verification") { MenuMultiView.ActiveViewIndex = 3; foreach (Button b in MenuButtonPlaceHolder.Controls) { b.CssClass = ""; } MenuButtonVacationMode.CssClass = "ViewSelected"; } } //Verification if (!AppSettings.Authentication.IsDocumentVerificationEnabled) { MenuButtonVerification.Visible = false; } if (User.VerificationStatus == VerificationStatus.Pending) { AccountVerificationStatus.Text = L1.PENDING; AccountVerificationStatus.ForeColor = System.Drawing.Color.Blue; documentsUpload.Visible = false; LockVerificationFields(); } if (User.VerificationStatus == VerificationStatus.Verified) { AccountVerificationStatus.ForeColor = System.Drawing.Color.Green; AccountVerificationStatus.Text = U5006.VERIFIED; LockVerificationFields(); } if (User.VerificationStatus == VerificationStatus.NotVerified) { documentsUpload.Visible = true; AccountVerificationStatus.ForeColor = System.Drawing.Color.DarkRed; AccountVerificationStatus.Text = U5006.NOTVERIFIED; } DetailedInfoPlaceHolder.Visible = AppSettings.Authentication.DetailedRegisterFields; ScriptManager.GetCurrent(this).RegisterPostBackControl(Verification_BannerUploadSubmit); ScriptManager.GetCurrent(this).RegisterPostBackControl(VerificationButton); EarnerCheckBoxImage.Attributes.Add("class", EarnerCheckBox.Checked ? "icon fa fa-money fa-fw fa-2x img-thumbnail img-check text-primary p-10 check" : "icon fa fa-money fa-fw fa-2x img-thumbnail img-check text-primary p-10"); AdvertiserCheckBoxImage.Attributes.Add("class", AdvertiserCheckBox.Checked ? "icon fa fa-bullhorn fa-fw fa-2x img-thumbnail img-check text-primary p-10 check" : "icon fa fa-bullhorn fa-fw fa-2x img-thumbnail img-check text-primary p-10"); PublisherCheckBoxImage.Attributes.Add("class", PublisherCheckBox.Checked ? "icon fa fa-globe fa-fw fa-2x img-thumbnail img-check text-primary p-10 check" : "icon fa fa-globe fa-fw fa-2x img-thumbnail img-check text-primary p-10"); if (TitanFeatures.IsRofriqueWorkMines) { ButtonsPlaceHolder.Visible = false; } if (AppSettings.Registration.IsDefaultRegistrationStatusEnabled) { EarnerCheckBoxPlaceHolder.Visible = AdvertiserCheckBoxPlaceHolder.Visible = PublisherCheckBoxPlaceHolder.Visible = false; } }
private decimal GetExchangeRate(string fiatCurrency, Cryptocurrency crypto) { var price = new MarketPriceComponent().GetMarketPrice(fiatCurrency, crypto.Code); return(price?.Price ?? 0); }
private WalletPreReOrderOmItemTemp GetPreReOrderOMItemTempItem(UserWallet model, Cryptocurrency coin) { return(new WalletPreReOrderOmItemTemp { Id = coin.Id, IconUrl = coin.IconURL, Code = coin.Code, PayRank = model == null ? int.MaxValue : model.PayRank, Name = coin.Name, Fixed = coin.Id == 1 }); }
public bool SaveCryptocurrency(Cryptocurrency cryptocurrency) { return(_cryptocurrencyRepository.Create(cryptocurrency)); }