예제 #1
0
        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);
        }
예제 #2
0
        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))));
        }