public void MakeWithdrawal(Money amount, string address, Member user, WithdrawalSourceBalance withdrawalSource) { decimal amountInCryptocurrency = Decimal.Zero; Money amountInMoney = Money.Zero; if (withdrawalSource == WithdrawalSourceBalance.MainBalance) { amountInCryptocurrency = ConvertFromMoney(amount); amountInMoney = amount; } else //Wallets { amountInCryptocurrency = amount.ToDecimal(); amountInMoney = ConvertToMoney(amountInCryptocurrency); } CryptocurrencyApiFactory.GetWithdrawalApi(this).TryWithDrawCryptocurrencyFromWallet(amountInCryptocurrency, address, Type); BitcoinIPNManager.AddIPNLog(AppSettings.ServerTime, OperationType.Withdrawal, null, user.Id, address, amountInCryptocurrency, amountInMoney, this.WithdrawalApiProcessor, true); if (withdrawalSource == WithdrawalSourceBalance.MainBalance) { PaymentProportionsManager.MemberPaidOut(amountInMoney, CryptocurrencyTypeHelper.ConvertToPaymentProcessor(Type), user); } AddPaymentProof(amount, user); }
private decimal EstimatedWithdrawalFee(decimal cryptocurrencyAmount, string userAddress, int userId) { decimal ProcessorFee = CryptocurrencyApiFactory.GetWithdrawalApi(this).GetEstimatedWithdrawalFee(cryptocurrencyAmount, userAddress); if (this.WithdrawalFeePolicy == WithdrawalFeePolicy.Packs) { var fee = BitcoinWithdrawalFeePacks.GetFeePackForUser(userId).Fee; return(ProcessorFee + this.ConvertFromMoney(Money.MultiplyPercent(this.ConvertToMoney(cryptocurrencyAmount), fee))); } return(ProcessorFee + this.ConvertFromMoney(GetAdminWithdrawalFee(this.ConvertToMoney(cryptocurrencyAmount)))); }
private static List <CryptocurrencyApi> GetEnabledApis(CryptocurrencyType cryptocurrencyType, string columnToCheck) { var query = String.Format("SELECT TypeInt FROM CryptocurrencyApis WHERE Enabled = 1 AND TypeInt IN " + "(SELECT TypeInt FROM CryptocurrencyApiOperations WHERE {1} = 1 AND CryptocurrencyTypeId = {0})", (int)cryptocurrencyType, columnToCheck); var list = TableHelper.GetStringListFromRawQuery(query); var result = new List <CryptocurrencyApi>(); foreach (var api in list) { result.Add(CryptocurrencyApiFactory.Get((CryptocurrencyAPIProvider)Convert.ToInt32(api))); } return(result); }
public static CryptocurrencyApi Get(CryptocurrencyAPIProvider cryptocurrencyApiProvider) { return(CryptocurrencyApiFactory.Get(cryptocurrencyApiProvider)); }