use transactions table in rdrama (#99)

Co-authored-by: Aevann <randomname42029@gmail.com>
Reviewed-on: #99
pull/100/head
Aevann 2023-01-26 11:25:28 +00:00
parent cf27b8bd66
commit d00fef9faf
3 changed files with 36 additions and 5 deletions

View File

@ -29,8 +29,7 @@ from .lottery import *
from .casino_game import *
from .hats import *
from .marsey import *
if KOFI_TOKEN:
from .transactions import *
from .transactions import *
from .sub_logs import *
from .media import *
from .push_subscriptions import *

View File

@ -404,7 +404,7 @@ def themecolor(v):
@limiter.limit(DEFAULT_RATELIMIT_SLOWER)
@limiter.limit(DEFAULT_RATELIMIT_SLOWER, key_func=get_ID)
@auth_required
def gumroad(v):
def settings_gumroad(v):
if GUMROAD_TOKEN == DEFAULT_CONFIG_VALUE: abort(404)
if not (v.email and v.is_activated):
abort(400, f"You must have a verified email to verify {patron} status and claim your rewards!")

View File

@ -1277,7 +1277,7 @@ def bid_list(v:User, bid):
kofi_tiers={
tiers={
3: 1,
5: 1,
10: 2,
@ -1295,7 +1295,7 @@ def claim_rewards(v):
marseybux = 0
for transaction in transactions:
tier = kofi_tiers[transaction.amount]
tier = tiers[transaction.amount]
marseybux += marseybux_li[tier]
if tier > highest_tier:
highest_tier = tier
@ -1347,6 +1347,38 @@ def kofi():
return ''
@app.post("/gumroad")
def gumroad():
data = request.values
ip = request.headers.get('CF-Connecting-IP')
if ip != '34.193.146.117':
print('\n\n\n-----------------------\n\n\ngumroad: ' + ip + '\n\n\n-----------------------\n\n\n')
abort(400)
id = data['sale_id']
created_utc = time.time()
type = data['recurrence']
amount = int(data['price'])
email = data['email']
transaction = Transaction(
id=id,
created_utc=created_utc,
type=type,
amount=amount,
email=email
)
g.db.add(transaction)
user = g.db.query(User).filter_by(email=email, is_activated=True).order_by(User.truescore.desc()).first()
# if user:
# claim_rewards(user)
return ''
@app.post("/settings/kofi")
@limiter.limit(DEFAULT_RATELIMIT_SLOWER)