Пример #1
0
def confirm_withdraw_emoney(Req, S, PrivateKey):
    Transfer = TransOut.objects.get(user=Req.user,
                                    confirm_key=S,
                                    status='created')

    IsCancel = Req.REQUEST.get("do", None)
    if Transfer.status == "created" and IsCancel is not None:
        Transfer.status = "canceled"
        Transfer.save()
        order = Transfer.order
        order.status = "canceled"
        order.save()
        add_trans(order.transit_2, Transfer.amnt, Transfer.currency, order.transit_1,
                  order, "canceled", S, False)

        t = loader.get_template("simple_msg.html")
        Dict = {}
        Dict["title"] = settings.withdraw_cancel
        Dict["simple_msg"] = settings.withdraw_msg_cancel
        caching().delete("balance_" + str(Req.user.id))
        return tmpl_context(Req, t, Dict)

    if Transfer.status != "created":
        raise TransError("hacker " + Req.user.username)
        ##add trans may be there
    Transfer.status = "processing"
    Transfer.sign_record(PrivateKey)
    Transfer.save()
    t = loader.get_template("ajax_simple_msg.html")
    Dict = {}
    Dict["title"] = settings.withdraw_ok
    Dict["simple_msg"] = settings.withdraw_msg_ok
    return tmpl_context(Req, t, Dict)
Пример #2
0
def confirm_withdraw_p2p(Req, S, PrivateKey):

    Transfer = CardP2PTransfers.objects.get(user=Req.user, confirm_key=S, status="created")

    IsCancel = Req.REQUEST.get("do", None)
    if (
        Transfer.status == "processing" or Transfer.status == "auto" or Transfer.status == "created"
    ) and IsCancel is not None:
        Transfer.status = "order_cancel"
        Transfer.save()
        order = Transfer.order
        order.status = "order_cancel"
        order.save()
        add_trans(order.transit_2, Transfer.amnt, Transfer.currency, order.transit_1, order, "order_cancel", S, True)

        t = loader.get_template("simple_msg.html")
        Dict = {}
        Dict["title"] = settings.withdraw_cancel
        Dict["simple_msg"] = settings.withdraw_msg_cancel
        caching().delete("balance_" + str(Req.user.id))
        return tmpl_context(Req, t, Dict)

    if Transfer.status != "created":
        raise TransError("hacker " + Req.user.username)

    ##add trans may be there
    Transfer.status = "processing"
    Transfer.sign_record(PrivateKey)
    Transfer.save()
    t = loader.get_template("ajax_simple_msg.html")
    Dict = {}
    Dict["title"] = settings.withdraw_ok
    Dict["simple_msg"] = settings.withdraw_msg_ok
    notify_admin_withdraw(withdraw_p2p(Transfer))
    return tmpl_context(Req, t, Dict)
Пример #3
0
def deals(Req, TradePair="btc_uah"):
    t = loader.get_template("finance_deals.html")
    Dict = {}
    Dict["current_stock"] = TradePair
    Dict["trade_pair"] = TradePair
    Dict = views.setup_trades_pairs(TradePair, Dict)
    return tmpl_context(Req, t, Dict)
Пример #4
0
def common_secure_page(Req, Type, Key):
    Use = False
    IsCancel = Req.REQUEST.get("do", None)

    Avalible = {
        "confirm_withdraw_bank": confirm_withdraw_bank,
        "confirm_withdraw_currency": confirm_withdraw_currency,
        "confirm_withdraw_liqpay": confirm_withdraw_liqpay,
        "confirm_withdraw_p2p": confirm_withdraw_p2p,
        "confirm_withdraw_emoney": confirm_withdraw_emoney
    }

    if IsCancel == "cancel":
        return Avalible[Type](Req, Key)

    if Req.session.has_key("use_f2a"):
        Use = Req.session["use_f2a"]

    t = loader.get_template("common_secure_page.html")
    Dict = {}
    Dict["type"] = Type
    Dict["key"] = Key
    Dict["pin_load"] = not Use
    Dict["use_f2a"] = Use
    return tmpl_context(Req, t, Dict)
Пример #5
0
def home(Req):
    if not Req.user.is_authenticated():
        return login_page_with_redirect(Req)
    else:
        t = loader.get_template("finance.html")
        Dict = {}

        All = Accounts.objects.filter(user=Req.user).order_by("-currency__ordering")
        BalancesOrders = (
            OrdersMem.objects.filter(user=Req.user.id, status="processing")
            .values("currency1")
            .annotate(balances=Sum("sum1"))
        )
        OrdersBalances = {}
        for currency in BalancesOrders:
            OrdersBalances[currency["currency1"]] = currency["balances"]
        ResAcc = []
        for i in All:
            item = {}
            i.balance = format_numbers_strong(i.balance)
            item["balance"] = i.balance
            currency_id = i.currency.id
            item["currency"] = i.currency
            if OrdersBalances.has_key(currency_id):
                item["on_orders"] = format_numbers_strong(OrdersBalances[currency_id])
            ResAcc.append(item)

        Dict["page_accounts"] = ResAcc
        return tmpl_context(Req, t, Dict)
Пример #6
0
def p2p_transfer_withdraw_submit(Req):

    Form = CardP2PTransfersForm(Req.POST, user=Req.user)
    Dict = {}
    if Form.is_valid():
        ##check if it common operation
        Last = list(
            CardP2PTransfers.objects.filter(
                user=Req.user, CardNumber=Form.cleaned_data["CardNumber"], status="processed"
            ).order_by("-id")
        )
        if len(Last) > 0:
            p2p_transfer_withdraw_common_operation(Req, Form)
            return redirect("/finance/confirm_withdraw_msg")
        else:
            p2p_transfer_withdraw_secure(Req, Form)
            return redirect("/finance/confirm_withdraw_msg_auto")

    else:
        t = loader.get_template("simple_form.html")
        Dict["action"] = "/finance/p2p_transfer_withdraw_submit"
        Dict["action_title"] = settings.p2p_transfer
        Dict["common_help_text"] = settings.p2p_attention_be_aware
        Dict["form"] = Form.as_p()
        return tmpl_context(Req, t, Dict)
Пример #7
0
def liqpay_transfer_withdraw(Req, CurrencyTitle, Amnt):

    amnt = Decimal(Amnt)
    if amnt < 10:
        raise TransError("pay_requirments")
    if CurrencyTitle != "UAH":
        raise TransError("pay_requirments")

    Dict = {}
    CurrencyIn = Currency.objects.get(title=CurrencyTitle)

    Account = Accounts.objects.get(user=Req.user, currency=CurrencyIn)
    if Account.reference is None or len(Account.reference) == 0:
        Account.reference = generate_key(settings.BANK_KEY_SALT)
        Account.save()

    Dict["amnt"] = str(Amnt)
    Dict["currency"] = "UAH"
    try:
        Last = LiqPayTrans.objects.filter(user=Req.user, status="processed").order_by("-id")[0]
        Dict["phone"] = Last.phone
    except:
        pass

    t = loader.get_template("ajax_form.html")
    Dict["action"] = "/finance/liqpay_transfer_withdraw_submit"
    Dict["action_title"] = settings.withdraw_transfer
    Dict["common_help_text"] = settings.liqpay_attention_be_aware
    Form = LiqPayTransferForm(initial=Dict, user=Req.user)

    Dict["form"] = Form.as_p()
    return tmpl_context(Req, t, Dict)
Пример #8
0
def crypto_currency_withdraw(Req, CurrencyTitle):

    Dict = {}
    CurrencyIn = Currency.objects.get(title=CurrencyTitle)
    Dict["currency"] = CurrencyTitle
    Dict["use_f2a"] = False
    if Req.session.has_key("use_f2a"):
        Dict["use_f2a"] = Req.session["use_f2a"]

    t = loader.get_template("ajax_form.html")
    Dict["action"] = "/finance/crypto_currency_withdraw_submit"
    Dict["action_title"] = settings.withdraw_transfer

    try:
        Last = CryptoTransfers.objects.filter(user=Req.user, currency=CurrencyIn, status="processed").order_by("-id")[0]
    #         Dict["wallet"] = Last.account
    except:
        pass

    TradePair = TradePairs.objects.get(currency_on=CurrencyIn, currency_from=CurrencyIn)
    Dict["common_help_text"] = settings.attention_be_aware_crypto % (str(TradePair.min_trade_base))

    Form = CurrencyTransferForm(initial=Dict, user=Req.user)

    Dict["form"] = Form.as_p()
    return tmpl_context(Req, t, Dict)
Пример #9
0
def home(Req):
    if not Req.user.is_authenticated():
        return login_page_with_redirect(Req)
    else:
        t = loader.get_template("finance.html")
        Dict = {}
        # it is not an actual information
        user_id =  Req.user.id

        All = Accounts.objects.filter(user_id=user_id).order_by('-currency__ordering')

        OrdersBalances = {}
       
        ResAcc = []
        for i in All:
            item = {}
            
            crypto_account  =  CryptoAccount(i.currency.title, "")
            try:
                i.balance = crypto_account.getbalance()
                item["balance"] = i.balance
            except :
                traceback.print_exc()
                item["balance"] = "not Avalible"
                
            currency_id = i.currency.id
            item["currency"] = i.currency
            ResAcc.append(item)
            
        Dict["page_accounts"] = ResAcc
        return tmpl_context(Req, t, Dict)
Пример #10
0
def home(Req):
    if not Req.user.is_authenticated():
        return login_page_with_redirect(Req)
    else:
        t = loader.get_template("finance.html")
        Dict = {}
        # it is not an actual information
        user_id =  request.session["looking_user"]

        All = Accounts.objects.filter(user_id=user_id).order_by('-currency__ordering')
        BalancesOrders = OrdersMem.objects.filter(user_id=user_id,
                                                  status="processing") 
        OrdersBalances = {}
        for currency in BalancesOrders:
            if OrdersBalances.has_key(currency.currency1):
                OrdersBalances[currency.currency1] += currency.sum1
            else:
                OrdersBalances[currency.currency1] = currency.sum1
        
        ResAcc = []
        for i in All:
            item = {}
            i.balance = format_numbers_strong(i.balance)
            item["balance"] = i.balance
            currency_id = i.currency.id
            item["currency"] = i.currency
            if OrdersBalances.has_key(currency_id):
                item["on_orders"] = format_numbers_strong(OrdersBalances[currency_id])
            ResAcc.append(item)

        Dict["page_accounts"] = ResAcc
        return tmpl_context(Req, t, Dict)
Пример #11
0
def transfer_withdraw(Req, CurrencyTitle, Amnt):

    Dict = {}
    CurrencyIn = Currency.objects.get(title=CurrencyTitle)
    Dict["currency"] = CurrencyTitle
    Dict["use_f2a"] = False
    if Req.session.has_key("use_f2a"):
        Dict["use_f2a"] = Req.session["use_f2a"]

    t = loader.get_template("ajax_form.html")
    Dict["action"] = "/finance/emoney_transfer_withdraw_submit_okpay"
    Dict["action_title"] = my_messages.withdraw_transfer

    try:
        Last = TransOut.objects.filter(
            user=Req.user, provider="okpay", currency=CurrencyIn, status="processed"
        ).order_by("-id")[0]
        Dict["wallet"] = Last.account
    except:
        pass

    Form = FiatCurrencyTransferForm(initial=Dict, user=Req.user)

    Dict["form"] = Form.as_p()
    return tmpl_context(Req, t, Dict)
Пример #12
0
def bank_transfer_withdraw_submit(Req):
    Form = BankTransferForm(Req.POST, user=Req.user)
    Dict = {}
    if Form.is_valid():
        # Save 
        Key = generate_key("bank_withdraw")
        transfer = BankTransfers(
            ref="",
            okpo=Form.cleaned_data["okpo"],
            mfo=Form.cleaned_data["mfo"],
            debit_credit="out",
            account=Form.cleaned_data["account"],
            description=Form.cleaned_data["description"],
            currency=Form.currency_instance,
            amnt=Form.cleaned_data["amnt"],
            user=Req.user,
            comission="0.00",
            confirm_key=Key
        )
        transfer.save()
        #if settings.DEBUG is False:
        send_mail(_(u'Подтверждение вывода  ' + settings.BASE_HOST),
                  confirm_bank_withdraw_email(Form.cleaned_data, Key),
                  settings.EMAIL_HOST_USER,
                  [Req.user.email],
                  fail_silently=False)
        return redirect("/finance/confirm_withdraw_msg")
    else:
        t = loader.get_template("simple_form.html")
        Dict["title"] = settings.withdraw_title_bank
        Dict["form"] = Form.as_p()
        Dict["common_help_text"] = settings.attention_be_aware
        Dict["action"] = "/finance/bank_transfer_withdraw_submit"
        Dict["action_title"] = settings.withdraw_transfer
        return tmpl_context(Req, t, Dict)
Пример #13
0
def p2p_transfer_withdraw(Req, CurrencyTitle, Amnt):
    amnt = Decimal(Amnt)
    if amnt < 10:
        raise TransError("pay_requirments")
    if CurrencyTitle != "UAH":
        raise TransError("pay_requirments")

    Dict = {}
    CurrencyIn = Currency.objects.get(title=CurrencyTitle)
    Dict["amnt"] = str(Amnt)
    Dict["currency"] = CurrencyTitle

    try:
        Last = CardP2PTransfers.objects.filter(user=Req.user, status="processed").order_by('-id')[0]
        Dict["CardNumber"] = Last.CardNumber
        Dict["CardName"] = Last.CardName
    except:
        pass

    t = loader.get_template("ajax_form.html")
    Dict["action"] = "/finance/p2p_transfer_withdraw_submit"
    Dict["action_title"] = settings.p2p_transfer
    Dict["common_help_text"] = settings.p2p_attention_be_aware
    Form = CardP2PTransfersForm(initial=Dict, user=Req.user)
    Dict["form"] = Form.as_p()
    return tmpl_context(Req, t, Dict)
Пример #14
0
def p2p_transfer_withdraw_submit(Req):
    Form = CardP2PTransfersForm(Req.POST, user=Req.user)
    Dict = {}
    if Form.is_valid():
        ##check if it common operation
        Last = list(CardP2PTransfers.objects.filter(user=Req.user,
                                                    CardNumber=Form.cleaned_data["CardNumber"],
                                                    status="processed").order_by('-id'))
        if len(Last) > 0:
            p2p_transfer_withdraw_common_operation(Req, Form)
            return redirect("/finance/confirm_withdraw_msg_auto")

        else:
            p2p_transfer_withdraw_secure(Req, Form)
            return redirect("/finance/confirm_withdraw_msg")

                        


    else:
        t = loader.get_template("simple_form.html")
        Dict["action"] = "/finance/p2p_transfer_withdraw_submit"
        Dict["action_title"] = settings.p2p_transfer
        Dict["common_help_text"] = settings.p2p_attention_be_aware
        Dict["form"] = Form.as_p()
        return tmpl_context(Req, t, Dict)
Пример #15
0
def liqpay_transfer_withdraw_submit(Req):
    Form = LiqPayTransferForm(Req.POST, user=Req.user)
    Dict = {}
    if Form.is_valid():
        # Save 
        Key = generate_key("liqpay_withdraw")
        transfer = LiqPayTrans(
            debit_credit="out",
            phone=Form.cleaned_data["phone"],
            description=Form.cleaned_data["description"],
            currency=Form.currency_instance,
            amnt=Form.cleaned_data["amnt"],
            user=Req.user,
            pub_date=datetime.datetime.now(),
            comission="0.000",
            confirm_key=Key
        )
        transfer.save()
        #if settings.DEBUG is False:
        send_mail(_(u'Подтверждение вывода  ') + settings.BASE_HOST,
                  confirm_liqpay_withdraw_email(Form.cleaned_data, Key),
                  settings.EMAIL_HOST_USER,
                  [Req.user.email],
                  fail_silently=False)
        return redirect("/finance/confirm_withdraw_msg")
    else:
        t = loader.get_template("simple_form.html")
        Dict["title"] = settings.withdraw_title_liqpay
        Dict["form"] = Form.as_p()
        Dict["common_help_text"] = settings.attention_be_aware
        Dict["action"] = "/finance/liqpay_transfer_withdraw_submit"
        Dict["action_title"] = settings.withdraw_transfer
        return tmpl_context(Req, t, Dict)
Пример #16
0
def common_secure_page(Req, Type, Key):
    Use = False
    IsCancel = Req.REQUEST.get("do", None)

    Avalible = {
        "confirm_withdraw_bank": confirm_withdraw_bank,
        "confirm_withdraw_currency": confirm_withdraw_currency,
        "confirm_withdraw_liqpay": confirm_withdraw_liqpay,
        "confirm_withdraw_p2p": confirm_withdraw_p2p,
        "confirm_withdraw_emoney": confirm_withdraw_emoney,
    }

    if IsCancel == "cancel":
        return Avalible[Type](Req, Key)

    if Req.session.has_key("use_f2a"):
        Use = Req.session["use_f2a"]

    t = loader.get_template("common_secure_page.html")
    Dict = {}
    Dict["type"] = Type
    Dict["key"] = Key
    Dict["pin_load"] = not Use
    Dict["use_f2a"] = Use
    return tmpl_context(Req, t, Dict)
Пример #17
0
def deals(Req, TradePair="btc_uah"):
    t = loader.get_template("finance_deals.html")
    Dict = {}
    Dict["current_stock"] = TradePair
    Dict["trade_pair"] = TradePair
    Dict = views.setup_trades_pairs(TradePair, Dict)
    return tmpl_context(Req, t, Dict)
Пример #18
0
def crypto_currency_withdraw(Req, CurrencyTitle):
    Dict = {}
    CurrencyIn = Currency.objects.get(title=CurrencyTitle)
    Dict["currency"] = CurrencyTitle
    Dict["use_f2a"] = False
    if Req.session.has_key("use_f2a"):
        Dict["use_f2a"] = Req.session["use_f2a"]

    t = loader.get_template("ajax_form.html")
    Dict["action"] = "/finance/crypto_currency_withdraw_submit"
    Dict["action_title"] = settings.withdraw_transfer

    try:
        Last = CryptoTransfers.objects.filter(user=Req.user, currency=CurrencyIn, status="processed").order_by('-id')[0]
        #         Dict["wallet"] = Last.account
    except:
        pass

    TradePair = TradePairs.objects.get(currency_on=CurrencyIn,
                                       currency_from=CurrencyIn)
    Dict["common_help_text"] = settings.attention_be_aware_crypto % ( str(TradePair.min_trade_base) )

    Form = CurrencyTransferForm(initial=Dict, user=Req.user)

    Dict["form"] = Form.as_p()
    return tmpl_context(Req, t, Dict)
Пример #19
0
def liqpay_transfer_withdraw_submit(Req):
    Form = LiqPayTransferForm(Req.POST, user=Req.user)
    Dict = {}
    if Form.is_valid():
        # Save 
        Key = generate_key("liqpay_withdraw")
        transfer = LiqPayTrans(
            debit_credit="out",
            phone=Form.cleaned_data["phone"],
            description=Form.cleaned_data["description"],
            currency=Form.currency_instance,
            amnt=Form.cleaned_data["amnt"],
            user=Req.user,
            pub_date=datetime.datetime.now(),
            comission="0.000",
            confirm_key=Key
        )
        transfer.save()
        #if settings.DEBUG is False:
        send_mail(_(u'Подтверждение вывода  ') + settings.BASE_HOST,
                  confirm_liqpay_withdraw_email(Form.cleaned_data, Key),
                  [Req.user.email],
                  fail_silently=False)
        return redirect("/finance/confirm_withdraw_msg")
    else:
        t = loader.get_template("simple_form.html")
        Dict["title"] = settings.withdraw_title_liqpay
        Dict["form"] = Form.as_p()
        Dict["common_help_text"] = settings.attention_be_aware
        Dict["action"] = "/finance/liqpay_transfer_withdraw_submit"
        Dict["action_title"] = settings.withdraw_transfer
        return tmpl_context(Req, t, Dict)
Пример #20
0
def bank_transfer_withdraw_submit(Req):
    Form = BankTransferForm(Req.POST, user=Req.user)
    Dict = {}
    if Form.is_valid():
        # Save 
        Key = generate_key("bank_withdraw")
        transfer = BankTransfers(
            ref="",
            okpo=Form.cleaned_data["okpo"],
            mfo=Form.cleaned_data["mfo"],
            debit_credit="out",
            account=Form.cleaned_data["account"],
            description=Form.cleaned_data["description"],
            currency=Form.currency_instance,
            amnt=Form.cleaned_data["amnt"],
            user=Req.user,
            comission="0.00",
            confirm_key=Key
        )
        transfer.save()
        #if settings.DEBUG is False:
        send_mail(_(u'Подтверждение вывода  ' + settings.BASE_HOST),
                  confirm_bank_withdraw_email(Form.cleaned_data, Key),
                  [Req.user.email],
                  fail_silently=False)
        return redirect("/finance/confirm_withdraw_msg")
    else:
        t = loader.get_template("simple_form.html")
        Dict["title"] = settings.withdraw_title_bank
        Dict["form"] = Form.as_p()
        Dict["common_help_text"] = settings.attention_be_aware
        Dict["action"] = "/finance/bank_transfer_withdraw_submit"
        Dict["action_title"] = settings.withdraw_transfer
        return tmpl_context(Req, t, Dict)
Пример #21
0
def p2p_transfer_withdraw(Req, CurrencyTitle, Amnt):

    amnt = Decimal(Amnt)
    if amnt < 10:
        raise TransError("pay_requirments")
    if CurrencyTitle != "UAH":
        raise TransError("pay_requirments")

    Dict = {}
    CurrencyIn = Currency.objects.get(title=CurrencyTitle)
    Dict["amnt"] = str(Amnt)
    Dict["currency"] = CurrencyTitle

    try:
        Last = CardP2PTransfers.objects.filter(user=Req.user, status="processed").order_by("-id")[0]
        Dict["CardNumber"] = Last.CardNumber
        Dict["CardName"] = Last.CardName
    except:
        pass

    t = loader.get_template("ajax_form.html")
    Dict["action"] = "/finance/p2p_transfer_withdraw_submit"
    Dict["action_title"] = settings.p2p_transfer
    Dict["common_help_text"] = settings.p2p_attention_be_aware
    Form = CardP2PTransfersForm(initial=Dict, user=Req.user)
    Dict["form"] = Form.as_p()
    return tmpl_context(Req, t, Dict)
Пример #22
0
def liqpay_transfer_withdraw(Req, CurrencyTitle, Amnt):
    amnt = Decimal(Amnt)
    if amnt < 10:
        raise TransError("pay_requirments")
    if CurrencyTitle != "UAH":
        raise TransError("pay_requirments")

    Dict = {}
    CurrencyIn = Currency.objects.get(title=CurrencyTitle)

    Account = get_account(user=Req.user, currency=CurrencyIn)
    Acc = Account.acc()
    if Acc.reference is None or len(Acc.reference) == 0:
        Account.reference = generate_key(settings.BANK_KEY_SALT)
        Account.save()

    Dict["amnt"] = str(Amnt)
    Dict["currency"] = "UAH"
    try:
        Last = LiqPayTrans.objects.filter(user=Req.user, status="processed").order_by('-id')[0]
        Dict["phone"] = Last.phone
    except:
        pass

    t = loader.get_template("ajax_form.html")
    Dict["action"] = "/finance/liqpay_transfer_withdraw_submit"
    Dict["action_title"] = settings.withdraw_transfer
    Dict["common_help_text"] = settings.liqpay_attention_be_aware
    Form = LiqPayTransferForm(initial=Dict, user=Req.user)

    Dict["form"] = Form.as_p()
    return tmpl_context(Req, t, Dict)
Пример #23
0
def confirm_withdraw_msg(Req):
    t = loader.get_template("simple_msg.html")
    Dict = {}
    Dict[
        "title"] = my_messages.withdrawing_secondary_main_email_confirmation_title
    Dict["simple_msg"] = my_messages.withdrawing_sending_email_confirmation
    return tmpl_context(Req, t, Dict)
Пример #24
0
def confirm_withdraw_msg_auto(Req):
    t = loader.get_template("simple_msg.html")
    Dict = {}
    Dict[
        "title"] = my_messages.withdrawing_secondary_main_email_confirmation_title
    Dict["simple_msg"] = _(u"Спасибо за работу, ваши деньги уже в пути")
    return tmpl_context(Req, t, Dict)
Пример #25
0
def confirm_withdraw_currency(Req, S, PrivateKey):
    S = S.replace("\n", "").replace(" ", "")
    Transfer = CryptoTransfers.objects.get(status="created", confirm_key=S)
    ##add trans may be there
    AccountTo = Accounts.objects.get(user=Transfer.user, currency=Transfer.currency)
    ## if not by reference, but by users

    TradePair = TradePairs.objects.get(currency_on=Transfer.currency, currency_from=Transfer.currency)
    FreqKey = "orders" + str(Req.user.id)

    if not check_freq(FreqKey, 3):
        Response = HttpResponse('{"status":false}')
        Response["Content-Type"] = "application/json"
        return Response

    order = Orders(
        user=Transfer.user,
        currency1=Transfer.currency,
        currency2=Transfer.currency,
        price=Transfer.amnt,
        sum1_history=Transfer.amnt + Transfer.comission,
        sum2_history=Transfer.amnt,
        sum1=Transfer.amnt + Transfer.comission,
        sum2=Transfer.amnt,
        transit_1=AccountTo,
        transit_2=TradePair.transit_from,
        trade_pair=TradePair,
        status="created",
    )
    order.save()

    order.status = "processing"
    order.save()
    Transfer.order = order
    Transfer.status = "processing"
    Transfer.sign_record(PrivateKey)
    Transfer.save()
    # TODO add process exception in withdraw crypto currency
    add_trans(
        AccountTo,
        Transfer.amnt + Transfer.comission,
        Transfer.currency,
        TradePair.transit_from,
        order,
        "withdraw",
        S,
        True,
    )

    t = loader.get_template("ajax_simple_msg.html")
    Dict = {}
    Dict["title"] = settings.withdraw_ok
    Dict["simple_msg"] = settings.withdraw_msg_ok
    caching().delete("balance_" + str(Transfer.user.id))
    notify_admin_withdraw(withdraw_crypto(Transfer))
    return tmpl_context(Req, t, Dict)
Пример #26
0
def crypto_currency_withdraw_submit(Req):
    
    
    Dict = {"use_f2a": False}     
    
    if Req.session.has_key("use_f2a"):
             Dict["use_f2a"] =  Req.session["use_f2a"]
            
    Form = CurrencyTransferForm(data = Req.POST, user = Req.user )  
    getcontext().prec = settings.TRANS_PREC
    
    if Form.is_valid():
        # Save 
        Key = generate_key("currency_withdraw")
                
        Amnt  = Decimal(Form.cleaned_data["amnt"]) - Form.comission

        transfer = CryptoTransfers(
                                 account = Form.cleaned_data["wallet"],
                                 currency = Form.currency_instance,
                                 amnt = Amnt,
                                 comission = Form.comission,
                                 user = Req.user,
                                 confirm_key = Key,
                                 debit_credit = "out"
                              )
        transfer.save()
        
        #if settings.DEBUG is False:        
        send_mail(_(u'Подтверждение вывода  ') + settings.BASE_HOST,
                                    confirm_crypto_withdraw_email(Form.cleaned_data, Key),
                                    settings.EMAIL_HOST_USER,
                                   [ Req.user.email ],
                                     fail_silently = False)  
        
        return redirect("/finance/confirm_withdraw_msg")                
    else :
        t = loader.get_template("simple_form.html")   
        Dict["form"] = Form.as_p()
        CurrencyIn = Currency.objects.get(title = Form.cleaned_data["currency"]) 
        
        Dict["currency"] = Form.cleaned_data["currency"]
        TradePair = TradePairs.objects.get(currency_on = CurrencyIn,
                                           currency_from  = CurrencyIn )      
        Dict["common_help_text"] = settings.attention_be_aware_crypto % ( str(TradePair.min_trade_base) )        
        Dict["action"] = "/finance/crypto_currency_withdraw_submit"
        Dict["action_title"] = settings.withdraw_transfer        
        Dict["pin_load"] = not Dict["use_f2a"]
        return tmpl_context(Req, t, Dict)
Пример #27
0
def confirm_withdraw_currency(Req, S, PrivateKey=''):
    S = S.replace("\n", "").replace(" ", "")
    Transfer = CryptoTransfers.objects.get(status="created", confirm_key=S)
    ##add trans may be there
    AccountTo = get_account(user=Transfer.user, currency=Transfer.currency)
    ## if not by reference, but by users

    TradePair = TradePairs.objects.get(currency_on=Transfer.currency,
                                       currency_from=Transfer.currency)
    FreqKey = "orders" + str(Req.user.id)

    if not check_freq(FreqKey, 3):
        Response = HttpResponse('{"status":false}')
        Response['Content-Type'] = 'application/json'
        return Response

    order = Orders(price=Decimal("1"),
                   user=Transfer.user,
                   currency1=Transfer.currency,
                   currency2=Transfer.currency,
                   sum1_history=Transfer.amnt + Transfer.comission,
                   sum2_history=Transfer.amnt,
                   sum1=Transfer.amnt + Transfer.comission,
                   sum2=Transfer.amnt,
                   transit_1=AccountTo.acc(),
                   transit_2=TradePair.transit_from,
                   trade_pair=TradePair,
                   status="created",
    )
    order.save()

    order.status = "processing"
    order.save()
    Transfer.order = order
    Transfer.status = "processing"
    Transfer.sign_record(PrivateKey)
    Transfer.save()
    # TODO add process exception in withdraw crypto currency
    add_trans(AccountTo.acc(), Transfer.amnt + Transfer.comission, Transfer.currency, TradePair.transit_from,
              order, "withdraw", S, False)

    t = loader.get_template("ajax_simple_msg.html")
    Dict = {}
    Dict["title"] = settings.withdraw_ok
    Dict["simple_msg"] = settings.withdraw_msg_ok
    caching().delete("balance_" + str(Transfer.user.id))
    notify_admin_withdraw(withdraw_crypto(Transfer))
    return tmpl_context(Req, t, Dict)
Пример #28
0
def common_confirm_page(Req, Order):
    rlog_req = OutRequest(raw_text=str(Req.REQUEST), http_referer=Req.META.get("HTTP_REFERER", ""),
                          from_ip=get_client_ip(Req))
    rlog_req.save()

    OrderData = Orders.objects.get(id=int(Order))
    if OrderData.status == "created":
        OrderData.status = "wait_secure"
        OrderData.save()

    if not Req.user.is_authenticated():
        return denied(Req)
    else:
        t = loader.get_template("finance_confirm_liqpay_page.html")
        Dict = {"order": Order}
        return tmpl_context(Req, t, Dict)
Пример #29
0
def p2p_deposit(Req, Cur, Amnt):
    amnt = Decimal(Amnt)
    if amnt < 1:
        raise TransError("pay_requirments")
    Dict = {}
    t = loader.get_template("p2p_transfer_req.html")
    CurrencyIn = Currency.objects.get(title=Cur)
    Account = get_account(user=Req.user, currency=CurrencyIn)
    Dict["account"] = P2P_DEPOSIT_OPTS[Cur]
    if Account.reference is None or len(Account.reference) == 0:
        Account.reference = generate_key("bank_pp", 16)
        Account.save()
    Dict["description"] = _(u"Оплата информационных услуг в счет публичного договора #" + Account.reference)
    Dict["amnt"] = str(Amnt)

    return tmpl_context(Req, t, Dict)
Пример #30
0
def common_confirm_page(Req, Order):
    rlog_req = OutRequest(raw_text=str(Req.REQUEST), http_referer=Req.META.get("HTTP_REFERER", ""),
                          from_ip=get_client_ip(Req))
    rlog_req.save()

    OrderData = Orders.objects.get(id=int(Order))
    if OrderData.status == "created":
        OrderData.status = "wait_secure"
        OrderData.save()

    if not Req.user.is_authenticated():
        return denied(Req)
    else:
        t = loader.get_template("finance_confirm_liqpay_page.html")
        Dict = {"order": Order}
        return tmpl_context(Req, t, Dict)
Пример #31
0
def p2p_deposit(Req, Cur, Amnt):
    amnt = Decimal(Amnt)
    if amnt < 1:
        raise TransError("pay_requirments")
    Dict = {}
    t = loader.get_template("p2p_transfer_req.html")
    CurrencyIn = Currency.objects.get(title=Cur)
    Account = get_account(user=Req.user, currency=CurrencyIn)
    Dict["account"] = P2P_DEPOSIT_OPTS[Cur]
    Acc = Account.acc()
    if Acc.acc().reference is None or len(Acc.acc().reference) == 0:
        Account.reference = generate_key("bank_pp", 16)
        Account.save()
    Dict["description"] = _(u"Оплата информационных услуг в счет публичного договора #" + Acc.reference)
    Dict["amnt"] = str(Amnt)

    return tmpl_context(Req, t, Dict)
Пример #32
0
def confirm_withdraw_liqpay(Req, S):
        

        Transfer = LiqPayTrans.objects.get(user = Req.user, 
                                           status = "created", 
                                           confirm_key = S)
        liqpay_class = liqpay("ru", Transfer.currency.title)     
        FreqKey = "orders" + str(Req.user.id)
        if not check_freq(FreqKey, 3) :
            Response =   HttpResponse('{"status":false}')
            Response['Content-Type'] = 'application/json'
            return Response

     ##add trans may be there     
        AccountTo = Accounts.objects.get(user = Req.user, currency = Transfer.currency)
                ## if not by reference, but by users
        TradePair = liqpay_class.get_traid_pair()
        order = Orders( user = Req.user,
                                currency1 = Transfer.currency,
                                currency2 = Transfer.currency, 
                                sum1_history = Transfer.amnt,
                                sum2_history = Transfer.amnt,
                                sum1 = Transfer.amnt, 
                                sum2 = Transfer.amnt,
                                transit_1 = AccountTo,
                                transit_2 = TradePair.transit_from ,
                                trade_pair = TradePair,
                                status = "created"
                        )
        order.save()
        add_trans(AccountTo, Transfer.amnt, Transfer.currency, TradePair.transit_from, 
                  order, "withdraw", S, True)
        order.status = "processing"
        order.save()
        Transfer.order = order
        Transfer.status = "processing"
        Transfer.save()
        t = loader.get_template("ajax_simple_msg.html")   
        Dict = {}
        Dict["title"] = settings.withdraw_ok
        Dict["simple_msg"] = settings.withdraw_msg_ok
        caching().delete("balance_" + str(Req.user.id) )

        return tmpl_context(Req, t, Dict)
Пример #33
0
def bank_deposit(Req, Cur, Amnt):
    amnt = Decimal(Amnt)
    if amnt < 1:
        raise TransError("pay_requirments")
    Dict = {}
    t = loader.get_template("bank_transfer_req.html")
    Dict["okpo"] = settings.BANK_UAH_OKPO
    Dict["mfo"] = settings.BANK_UAH_MFO
    Dict["account"] = settings.BANK_UAH_ACCOUNT
    CurrencyIn = Currency.objects.get(title=Cur)
    # TODO add working with ref through Account class
    Account = Accounts.objects.get(user=Req.user, currency=CurrencyIn)
    if Account.reference is None or len(Account.reference) == 0:
        Account.reference = generate_key(settings.BANK_KEY_SALT)
        Account.save()
    Dict["description"] = _(u"Оплата информационных услуг в счет публичного договора #%s" + Account.reference)
    Dict["amnt"] = str(Amnt)

    return tmpl_context(Req, t, Dict)
Пример #34
0
def bank_deposit(Req, Cur, Amnt):
    amnt = Decimal(Amnt)
    if amnt < 1:
        raise TransError("pay_requirments")
    Dict = {}
    t = loader.get_template("bank_transfer_req.html")
    Dict["okpo"] = settings.BANK_UAH_OKPO
    Dict["mfo"] = settings.BANK_UAH_MFO
    Dict["account"] = settings.BANK_UAH_ACCOUNT
    CurrencyIn = Currency.objects.get(title=Cur)
    # TODO add working with ref through Account class
    Account = Accounts.objects.get(user=Req.user, currency=CurrencyIn)
    if Account.reference is None or len(Account.reference) == 0:
        Account.reference = generate_key(settings.BANK_KEY_SALT)
        Account.save()
    Dict["description"] = _(u"Оплата информационных услуг в счет публичного договора #%s" + Account.reference)
    Dict["amnt"] = str(Amnt)

    return tmpl_context(Req, t, Dict)
Пример #35
0
def confirm_withdraw_liqpay(Req, S):
    Transfer = LiqPayTrans.objects.get(user=Req.user,
                                       status="created",
                                       confirm_key=S)
    liqpay_class = liqpay("ru", Transfer.currency.title)
    FreqKey = "orders" + str(Req.user.id)
    if not check_freq(FreqKey, 3):
        Response = HttpResponse('{"status":false}')
        Response['Content-Type'] = 'application/json'
        return Response

        ##add trans may be there
    AccountTo = get_account(user=Req.user, currency=Transfer.currency)
    ## if not by reference, but by users
    TradePair = liqpay_class.get_traid_pair()
    order = Orders(user=Req.user,
                   price=Decimal("1"),
                   currency1=Transfer.currency,
                   currency2=Transfer.currency,
                   sum1_history=Transfer.amnt,
                   sum2_history=Transfer.amnt,
                   sum1=Transfer.amnt,
                   sum2=Transfer.amnt,
                   transit_1=AccountTo.acc(),
                   transit_2=TradePair.transit_from,
                   trade_pair=TradePair,
                   status="created"
    )
    order.save()
    add_trans(AccountTo.acc(), Transfer.amnt, Transfer.currency, TradePair.transit_from,
              order, "withdraw", S, False)
    order.status = "processing"
    order.save()
    Transfer.order = order
    Transfer.status = "processing"
    Transfer.save()
    t = loader.get_template("ajax_simple_msg.html")
    Dict = {}
    Dict["title"] = settings.withdraw_ok
    Dict["simple_msg"] = settings.withdraw_msg_ok
    caching().delete("balance_" + str(Req.user.id))

    return tmpl_context(Req, t, Dict)
Пример #36
0
def trans(Req):
    t = loader.get_template("finance_trans.html")
    Dict = {}
    ListAccounts = []
    DictAccounts = {}
    for i in Accounts.objects.filter(user=Req.user):
        ListAccounts.append(str(i.id))
        DictAccounts[i.id] = 1
    AccountsStr = ",".join(ListAccounts)

    Query = (
        "SELECT * FROM main_trans WHERE 1 \
                               AND status in ('payin','deposit','withdraw','deal','order_cancel','comission','bonus','deal_return')\
                               AND ( user1_id IN (%s) OR user2_id IN  (%s) ) ORDER BY id DESC  "
        % (AccountsStr, AccountsStr)
    )

    List = Trans.objects.raw(Query)
    All = []
    for item in List:

        new_item = {}
        new_item["description"] = generate_description(DictAccounts, item)
        new_item["amnt"] = format_numbers_strong(item.amnt)
        new_item["currency"] = item.currency.title

        new_item["ts"] = formats.date_format(item.pub_date, "DATETIME_FORMAT")
        new_item["id"] = item.id
        new_item["in"] = False
        if DictAccounts.has_key(item.user2_id):
            new_item["in"] = True
        All.append(new_item)

    page = Req.GET.get("page", 1)

    PageObject = my_cached_paging("user_id_trans" + str(Req.user.id), Trans, page, All)

    Dict["trans_list"] = PageObject.object_list
    Dict["paging"] = PageObject

    return tmpl_context(Req, t, Dict)
Пример #37
0
def bank_deposit(Req, Amnt):
    if not Req.user.is_authenticated():
        return denied(Req)

    amnt = Decimal(Amnt)
    if amnt < 100:
        raise TransError("pay_requirments")
    Dict = {}
    t = loader.get_template("bank_transfer_req.html")
    Dict["okpo"] = settings.BANK_UAH_OKPO
    Dict["mfo"] = settings.BANK_UAH_MFO
    Dict["account"] = settings.BANK_UAH_ACCOUNT
    CurrencyIn = Currency.objects.get(title="UAH")
    Account = Accounts.objects.get(user=Req.user, currency=CurrencyIn)
    if Account.reference is None or len(Account.reference) == 0:
        Account.reference = generate_key(settings.BANK_KEY_SALT)
        Account.save()
    Dict["description"] = _(u"Оплата информационных услуг в счет публичного договора #%s" + Account.reference)
    Dict["amnt"] = str(Amnt) + " UAH "

    return tmpl_context(Req, t, Dict)
Пример #38
0
def crypto_currency_withdraw_submit(Req):
    Dict = {"use_f2a": False}
    if Req.session.has_key("use_f2a"):
        Dict["use_f2a"] = Req.session["use_f2a"]
    Form = CurrencyTransferForm(data=Req.POST, user=Req.user)
    getcontext().prec = settings.TRANS_PREC

    if Form.is_valid():
        # Save 
        Key = generate_key("currency_withdraw")
        Amnt = Decimal(Form.cleaned_data["amnt"]) - Form.comission
        transfer = CryptoTransfers(account=Form.cleaned_data["wallet"],
                                   currency=Form.currency_instance,
                                   amnt=Amnt,
                                   pub_date=datetime.datetime.now(),
                                   comission=Form.comission,
                                   user=Req.user,
                                   confirm_key=Key,
                                   debit_credit="out")
        transfer.save()
        #if settings.DEBUG is False:
        send_mail(_(u'Подтверждение вывода  ') + settings.BASE_HOST,
                  confirm_crypto_withdraw_email(Form.cleaned_data, Key),
                  [Req.user.email],
                  fail_silently=False)

        return redirect("/finance/confirm_withdraw_msg")
    else:
        t = loader.get_template("simple_form.html")
        Dict["form"] = Form.as_p()
        CurrencyIn = Currency.objects.get(title=Form.cleaned_data["currency"])

        Dict["currency"] = Form.cleaned_data["currency"]
        TradePair = TradePairs.objects.get(currency_on=CurrencyIn,
                                           currency_from=CurrencyIn)
        Dict["common_help_text"] = settings.attention_be_aware_crypto % ( str(TradePair.min_trade_base) )
        Dict["action"] = "/finance/crypto_currency_withdraw_submit"
        Dict["action_title"] = settings.withdraw_transfer
        Dict["pin_load"] = not Dict["use_f2a"]
        return tmpl_context(Req, t, Dict)
Пример #39
0
def trans(Req):
    t = loader.get_template("finance_trans.html")
    Dict = {}
    user_id =  Req.user.id
    ListAccounts = []
    DictAccounts = {}
    for i in Accounts.objects.filter(user_id=user_id):
        ListAccounts.append(str(i.id))
        DictAccounts[i.id] = 1
    AccountsStr = ",".join(ListAccounts)

    Query = "SELECT * FROM main_trans WHERE 1 \
                               AND status in ('payin','deposit','withdraw','deal','order_cancel','comission','bonus','deal_return')\
                               AND ( user1_id IN (%s) OR user2_id IN  (%s) ) ORDER BY id DESC  " % (
    AccountsStr, AccountsStr)

    List = Trans.objects.raw(Query)
    All = []
    for item in List:

        new_item = {}
        new_item["description"] = generate_description(DictAccounts, item)
        new_item["amnt"] = format_numbers_strong(item.amnt)
        new_item["currency"] = item.currency.title

        new_item["ts"] = int((item.pub_date - datetime.datetime(1970,1,1)).total_seconds())
        new_item["id"] = item.id
        new_item["in"] = False
        if DictAccounts.has_key(item.user2_id):
            new_item["in"] = True
        All.append(new_item)

    page = Req.GET.get('page', 1)

    PageObject = my_cached_paging("user_id_trans" + str(user_id), Trans, page, All)

    Dict["trans_list"] = PageObject.object_list
    Dict["paging"] = PageObject

    return tmpl_context(Req, t, Dict)
Пример #40
0
def confirm_withdraw_bank(Req, S):
    Transfer = BankTransfers.objects.get(user=Req.user, status="created", confirm_key=S)
    ##add trans may be there
    AccountTo = get_account(user=Req.user, currency=Transfer.currency)

    FreqKey = "orders" + str(Req.user.id)
    if not check_freq(FreqKey, 2):
        Response = HttpResponse('{"status":false}')
        Response['Content-Type'] = 'application/json'
        return Response

        ## if not by reference, but by users
    TradePair = TradePairs.objects.get(url_title="bank_transfers")
    order = Orders(user=Req.user,
                   price=Decimal("1"),
                   currency1=Transfer.currency,
                   currency2=Transfer.currency,
                   sum1_history=Transfer.amnt,
                   sum2_history=Transfer.amnt,
                   sum1=Transfer.amnt,
                   sum2=Transfer.amnt,
                   transit_1=AccountTo.acc(),
                   transit_2=TradePair.transit_from,
                   trade_pair=TradePair,
                   status="created"
    )
    order.save()
    # TODO add process exception in withdraw crypto currency
    add_trans(AccountTo.acc(), Transfer.amnt, Transfer.currency,
              TradePair.transit_from, order, "withdraw", S, False)
    order.status = "processing"
    order.save()
    Transfer.order = order
    Transfer.status = "processing"
    Transfer.save()
    t = loader.get_template("ajax_simple_msg.html")
    Dict = {}
    Dict["title"] = settings.withdraw_ok
    Dict["simple_msg"] = settings.withdraw_msg_ok
    return tmpl_context(Req, t, Dict)
Пример #41
0
def confirm_withdraw_bank(Req, S):
    Transfer = BankTransfers.objects.get(user=Req.user, status="created", confirm_key=S)
    ##add trans may be there
    AccountTo = Accounts.objects.get(user=Req.user, currency=Transfer.currency)

    FreqKey = "orders" + str(Req.user.id)
    if not check_freq(FreqKey, 2):
        Response = HttpResponse('{"status":false}')
        Response["Content-Type"] = "application/json"
        return Response

        ## if not by reference, but by users
    TradePair = TradePairs.objects.get(url_title="bank_transfers")
    order = Orders(
        user=Req.user,
        currency1=Transfer.currency,
        currency2=Transfer.currency,
        sum1_history=Transfer.amnt,
        sum2_history=Transfer.amnt,
        sum1=Transfer.amnt,
        sum2=Transfer.amnt,
        transit_1=AccountTo,
        transit_2=TradePair.transit_from,
        trade_pair=TradePair,
        status="created",
    )
    order.save()
    # TODO add process exception in withdraw crypto currency
    add_trans(AccountTo, Transfer.amnt, Transfer.currency, TradePair.transit_from, order, "withdraw", S, True)
    order.status = "processing"
    order.save()
    Transfer.order = order
    Transfer.status = "processing"
    Transfer.save()
    t = loader.get_template("ajax_simple_msg.html")
    Dict = {}
    Dict["title"] = settings.withdraw_ok
    Dict["simple_msg"] = settings.withdraw_msg_ok
    return tmpl_context(Req, t, Dict)
Пример #42
0
def perfect_transfer_withdraw(Req, CurrencyTitle, Amnt):
    Dict = {}
    CurrencyIn = Currency.objects.get(title=CurrencyTitle)
    Dict["currency"] = CurrencyTitle
    Dict["use_f2a"] = False
    if Req.session.has_key("use_f2a"):
        Dict["use_f2a"] = Req.session["use_f2a"]

    t = loader.get_template("ajax_form.html")
    Dict["action"] = "/finance/emoney_transfer_withdraw_submit_perfect"
    Dict["action_title"] = my_messages.withdraw_transfer

    try:
        Last = \
        TransOut.objects.filter(user=Req.user, provider=TITLE, currency=CurrencyIn, status="processed").order_by('-id')[
            0]
        Dict["wallet"] = Last.account
    except:
        pass

    Form = FiatCurrencyTransferForm(initial=Dict, user=Req.user)
    Dict["form"] = Form.as_p()
    return tmpl_context(Req, t, Dict)
Пример #43
0
def bank_transfer_withdraw(Req, CurrencyTitle, Amnt):

    amnt = Decimal(Amnt)
    if amnt < 10:
        raise TransError("pay_requirments")
    if CurrencyTitle != "UAH":
        raise TransError("pay_requirments")

    Dict = {}
    CurrencyIn = Currency.objects.get(title=CurrencyTitle)
    Account = Accounts.objects.get(user=Req.user, currency=CurrencyIn)
    if Account.reference is None or len(Account.reference) == 0:
        Account.reference = generate_key(settings.BANK_KEY_SALT)
        Account.save()
    Dict["amnt"] = str(Amnt)
    Dict["currency"] = "UAH"
    t = loader.get_template("ajax_form.html")
    Dict["action"] = "/finance/bank_transfer_withdraw_submit"
    Dict["action_title"] = settings.withdraw_transfer
    Dict["common_help_text"] = settings.attention_be_aware
    Form = BankTransferForm(initial=Dict, user=Req.user)
    Dict["form"] = Form.as_p()
    return tmpl_context(Req, t, Dict)
Пример #44
0
def bank_transfer_withdraw(Req, CurrencyTitle, Amnt):
    amnt = Decimal(Amnt)
    if amnt < 10:
        raise TransError("pay_requirments")
    if CurrencyTitle != "UAH":
        raise TransError("pay_requirments")

    Dict = {}
    CurrencyIn = Currency.objects.get(title=CurrencyTitle)
    # TODO add working with ref through Account class
    Account = Accounts.objects.get(user=Req.user, currency=CurrencyIn)
    if Account.reference is None or len(Account.reference) == 0:
        Account.reference = generate_key(settings.BANK_KEY_SALT)
        Account.save()
    Dict["amnt"] = str(Amnt)
    Dict["currency"] = "UAH"
    t = loader.get_template("ajax_form.html")
    Dict["action"] = "/finance/bank_transfer_withdraw_submit"
    Dict["action_title"] = settings.withdraw_transfer
    Dict["common_help_text"] = settings.attention_be_aware
    Form = BankTransferForm(initial=Dict, user=Req.user)
    Dict["form"] = Form.as_p()
    return tmpl_context(Req, t, Dict)
Пример #45
0
def emoney_transfer_withdraw_submit(Req, provider):

    Form = FiatCurrencyTransferForm(Req.POST, user=Req.user)
    Dict = {}
    if Form.is_valid():
        ##check if it common operation
        # Last = list(TransOut.objects.filter(user = Req.user,
        # wallet = Form.cleaned_data["wallet"] ,
        # provider= provider,
        # status="processed").order_by('-id') )
        # if len(Last) > 0 :
        # emoney_transfer_withdraw_common_operation(Req, Form)
        # return redirect("/finance/confirm_withdraw_msg")
        # else:
        emoney_transfer_withdraw_secure(Req, Form, provider)
        return redirect("/finance/confirm_withdraw_msg_auto")

    else:
        t = loader.get_template("simple_form.html")
        Dict["action"] = "/finance/emoney_transfer_withdraw_submit_" + provider
        Dict["action_title"] = my_messages.emoney_transfer
        Dict["common_help_text"] = my_messages.emoney_attention_be_aware
        Dict["form"] = Form.as_p()
        return tmpl_context(Req, t, Dict)
Пример #46
0
def emoney_transfer_withdraw_submit(Req, provider):
    Form = FiatCurrencyTransferForm(Req.POST, user=Req.user)
    Dict = {}
    if Form.is_valid():
        ##check if it common operation
        #Last = list(TransOut.objects.filter(user = Req.user,
        #wallet = Form.cleaned_data["wallet"] ,
        #provider= provider,
        #status="processed").order_by('-id') )
        #if len(Last) > 0 :
        #emoney_transfer_withdraw_common_operation(Req, Form)
        #return redirect("/finance/confirm_withdraw_msg")
        #else:
        emoney_transfer_withdraw_secure(Req, Form, provider)
        return redirect("/finance/confirm_withdraw_msg_auto")


    else:
        t = loader.get_template("simple_form.html")
        Dict["action"] = "/finance/emoney_transfer_withdraw_submit_" + provider
        Dict["action_title"] = my_messages.emoney_transfer
        Dict["common_help_text"] = my_messages.emoney_attention_be_aware
        Dict["form"] = Form.as_p()
        return tmpl_context(Req, t, Dict)
Пример #47
0
def confirm_withdraw_msg_auto(Req):
    t = loader.get_template("simple_msg.html")
    Dict = {}
    Dict["title"] = settings.withdrawing_secondary_main_email_confirmation_title
    Dict["simple_msg"] = _(u"Спасибо за работу, ваши деньги уже в пути")
    return tmpl_context(Req, t, Dict)
Пример #48
0
def depmotion_home(Req):
    CurrencyInstance = Currency.objects.all()
    t = loader.get_template("finance_depmotion_home.html")
    Dict = {}
    Dict["CurrencyList"] = CurrencyInstance
    return tmpl_context(Req, t, Dict)
Пример #49
0
def confirm_withdraw_msg(Req):
    t = loader.get_template("simple_msg.html")
    Dict = {}
    Dict["title"] = settings.withdrawing_secondary_main_email_confirmation_title
    Dict["simple_msg"] = settings.withdrawing_sending_email_confirmation
    return tmpl_context(Req, t, Dict)
Пример #50
0
def depmotion_home(Req):
    CurrencyInstance = Currency.objects.all()
    t = loader.get_template("finance_depmotion_home.html")
    Dict = {}
    Dict["CurrencyList"] = CurrencyInstance
    return tmpl_context(Req, t, Dict)