fix: Incorrect file location fix
All checks were successful
Build Docker / Build Image (push) Successful in 21s
All checks were successful
Build Docker / Build Image (push) Successful in 21s
This commit is contained in:
14
payments.py
14
payments.py
@@ -15,18 +15,18 @@ if os.getenv('LOCAL') == "true":
|
||||
|
||||
|
||||
if os.path.exists(path+'payments.json'):
|
||||
with open('payments.json', 'r') as f:
|
||||
with open(path+'payments.json', 'r') as f:
|
||||
payments = json.load(f)
|
||||
else:
|
||||
with open(path+'payments.json', 'w') as f:
|
||||
json.dump(payments, f, indent=4)
|
||||
|
||||
used = []
|
||||
if os.path.exists('used.json'):
|
||||
with open('used.json', 'r') as f:
|
||||
if os.path.exists(path+'used.json'):
|
||||
with open(path+'used.json', 'r') as f:
|
||||
used = json.load(f)
|
||||
else:
|
||||
with open('used.json', 'w') as f:
|
||||
with open(path+'used.json', 'w') as f:
|
||||
json.dump(used, f, indent=4)
|
||||
|
||||
HNSaddress = os.getenv('ADDRESS')
|
||||
@@ -64,7 +64,7 @@ def generate_payment(name,email,mobile,address,country,cart,hns):
|
||||
finalPriceDolarydoo = float(finalPrice) * 1000000
|
||||
payments[finalPriceDolarydoo] = payment
|
||||
# Save payments to file
|
||||
with open('payments.json', 'w') as f:
|
||||
with open(path+'payments.json', 'w') as f:
|
||||
json.dump(payments, f, indent=4)
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ def check_payments():
|
||||
if not finalise_payment(payment):
|
||||
return False
|
||||
payment['status'] = "Paid"
|
||||
with open('payments.json', 'w') as f:
|
||||
with open(path+'payments.json', 'w') as f:
|
||||
json.dump(payments, f, indent=4)
|
||||
print("Payment finalised")
|
||||
|
||||
@@ -122,7 +122,7 @@ def generate_payment_id():
|
||||
while True:
|
||||
if id not in used:
|
||||
used.append(id)
|
||||
with open('used.json', 'w') as f:
|
||||
with open(path+'used.json', 'w') as f:
|
||||
json.dump(used, f, indent=4)
|
||||
|
||||
# Return the id padded to 2 digits
|
||||
|
||||
Reference in New Issue
Block a user