Exemplo n.º 1
0
def process_out(CurrencyTitle):

        Crypton = CryptoAccount(CurrencyTitle, "trade_stock")
        user_system =   User.objects.get(id = 1)
        CurrencyInstance = Currency.objects.get(title = CurrencyTitle)
        if  check_global_lock():
            raise LockBusyException("global check crypto currency has raised")
	
#sys.exit(0)
        getcontext().prec = crypton.settings.TRANS_PREC
        for obj in CryptoTransfers.objects.filter(status="processing", 
                                                  debit_credit ="out",
                                                  currency = CurrencyInstance):
  		
               print "sending funds of %s to %s amount %s"  % (obj.user.username,  obj.account, obj.amnt)
#	       continue   
               if not obj.verify(get_decrypted_user_pin(obj.user)):
			print "SALT FAILED"
			continue
	       else:
			print "Salt ok"
               obj.status = "processed"
               obj.user_accomplished = user_system               
               obj.save()
               obj.order.status = "processed"                      
               Txid = Crypton.sendto(obj.account, float(obj.amnt))
               print "txid %s" % (Txid) 
               obj.order.save()                       
               obj.crypto_txid = Txid
               obj.save()
               notify_email(obj.user, "withdraw_notify", obj)
Exemplo n.º 2
0
def process_out(CurrencyTitle):
        blockchain.util.TIMEOUT = 160
        user_system =   User.objects.get(id = 1)
        CurrencyInstance = Currency.objects.get(title = CurrencyTitle)
        if not check_btc_balance() or check_global_lock():
            raise LockBusyException("global check crypto currency has raised")

        Crypton = Wallet(CryptoSettings["BTC"]["host"],
                         CryptoSettings["BTC"]["rpc_user"],
                         CryptoSettings["BTC"]["rpc_pwd"])#sys.exit(0)
        getcontext().prec = settings.TRANS_PREC
        for obj in CryptoTransfers.objects.filter(status="processing", 
                                                  debit_credit ="out",
                                                  currency = CurrencyInstance):

                Amnt  =  int(obj.amnt*100000000)
                print "sending funds of %s to %s amount %i"  % (obj.user.username,  obj.account, Amnt)
                if 1 and not obj.verify(get_decrypted_user_pin(obj.user)):
                                print "SALT FAILED"
                                continue
                    else:
                                print "Salt ok"

                obj.status = "processed"
                obj.user_accomplished = user_system               
                obj.save()
                Account = obj.account
                Account = clean(Account)                     
                Txid = Crypton.send(Account, Amnt )
                print "txid %s" % (Txid.tx_hash)
                obj.order.status = "processed"
                obj.order.save()                       
                obj.crypto_txid = Txid.tx_hash
                obj.save()
                notify_email(obj.user, "withdraw_notify", obj)
Exemplo n.º 3
0
def process_command():
    Now = datetime.now()
    l1 = list(CardP2PTransfers.objects.filter(status="processing"))
    l2 = list(CardP2PTransfers.objects.filter(status="processing2"))
    for item in l1 + l2:
        print "process  %s to card %s date %s amnt is %s" % (item.user.username,
                                                             item.CardNumber,
                                                             item.pub_date,
                                                             item.amnt )
        P24 = get_p24()
        Card = item.CardNumber
        Card.replace(" ", "")
        Bin = Card[:6]
        if 1 and not item.verify(get_decrypted_user_pin(item.user)):
            print "SALT FAILED"
            continue
        else:
            print "Salt ok"

        try:
            Objection = ObjectionsP2P.objects.get(CardNumber=Card)
            pay2p(item, P24)

            print "its not new card %s" % (Card)
            continue

        except ObjectionsP2P.DoesNotExist:
            print "its new card %s" % (Card)

        try:
            IsPb = FullBinInfo.objects.get(bin6=Bin, pbbin="1")
            Objection = ObjectionsP2P(CardNumber=Card, Objection="2")
            Objection.save()
            pay2p(item, P24)


        except FullBinInfo.DoesNotExist:
            print "i didn't find %s" % (Card)
            continue