Esempio n. 1
0
def history(request):
    #userid = request.user.id
    user = request.user

    data = createUserTransactionList(user)

    return render_to_response('History.html', addCommonData(request, data))
Esempio n. 2
0
def index(request):

    #fdh = BTCTransactionFinder()
    #fdh.CheckForNewConfirmations()

    #pmt = Payment()
    #pmt.PayToMerchant('1KUU6exVPSDFtMgAgdDnN5Z1145eL7teah', 1, 0.01, 'EUR', 'BTC', 'TestPayment1')

    #wd = Withdrawer()
    #wd.WithdrawFunds('1KUU6exVPSDFtMgAgdDnN5Z1145eL7teah', 0.0001, 'BTC', '12at3mFdtghPzz2ESTtGPktYKNw5JFWmEr')

    funds = AccountFund.objects.filter(accountId=request.user.account)
    fundList = []

    sumFiat = 0
    bal = 0
    BTCFundAdress = ''
    for f in funds:
        if(f.currencyCode!='EUR'):
            fundList.append(f)

            f.FiatValue=f.funds*ExchangeRate.getExchangeRate('BTC', 'EUR')
            sumFiat+=f.FiatValue

        if(f.currencyCode=='BTC'):
            bal=f.funds
            f.coinprefix = 'm'
            BTCFundAdress = f.fundAddress

    transactions = createUserTransactionList(request.user, True, True)

    deposit = {}
    deposit['BTC'] = {}
    deposit['BTC']['Address'] = BTCFundAdress
    deposit['BTC']['QrString'] = 'bitcoin:'+BTCFundAdress

    data =  {'funds':fundList, 'sum':sumFiat, 'activeTransactions' : transactions,
             'depositData': deposit }

    return render_to_response('Account.html', addCommonData(request, data))