Beispiel #1
0
def buy_credits_fail(request):
    args = request.GET
    if args.__contains__('details'):
        d = args.__getitem__('details')
        dd = d.split(",") 
        _playerId = int(dd[0])
        _money = float(dd[1])
        _cashAmt = float(dd[2])
        player = Player.get_by_id(_playerId)
        ppTrxn = PayPalTransaction(email = player.email,cashAmt = _cashAmt, money = _money, status="ERROR",playerId = _playerId)
        ppTrxn.put()
        return HttpResponse("Fail")
    else:
        return HttpResponse("Not enough arguments")
Beispiel #2
0
def buy_credits(request):
    
    args = request.GET
    if args.__contains__('details'):
        d = args.__getitem__('details')
        dd = d.split(",") 
        _playerId = int(dd[0])
        _money = float(dd[1])
        _cashAmt = float(dd[2])
        player = Player.get_by_id(_playerId)
        player.money += _money
        player.networth = player.money + player.money_spent
        player.put()
        email = player.email
        accQuery = Account.gql("WHERE email = :1",email)
        acc = accQuery.get()
        acc.payment += _cashAmt
        acc.put()
        ppTrxn = PayPalTransaction(email = player.email,cashAmt = _cashAmt, money = _money, status="OK",playerId = _playerId)
        ppTrxn.put()
        return redirect("/app/main.html#/theworld")
    else:
        return HttpResponse("Not enough arguments")