feat: Add more logging
All checks were successful
Build Docker / Build Image (push) Successful in 36s
All checks were successful
Build Docker / Build Image (push) Successful in 36s
This commit is contained in:
10
payments.py
10
payments.py
@@ -90,27 +90,29 @@ def check_payments():
|
|||||||
return False
|
return False
|
||||||
data = data.json()
|
data = data.json()
|
||||||
if data['success'] == False:
|
if data['success'] == False:
|
||||||
|
print(data, "Failed",flush=True)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
data = data['data']
|
data = data['data']
|
||||||
|
|
||||||
for tx in data:
|
for tx in data:
|
||||||
for output in tx['outputs']:
|
for output in tx['outputs']:
|
||||||
if output['address'] == HNSaddress:
|
if output['address'] == HNSaddress:
|
||||||
# Convert to HNS
|
# Convert to HNS
|
||||||
outputValue = int(output['value'])
|
outputValue = int(output['value'])
|
||||||
outputValue = str(float(outputValue))
|
outputValue = str(float(outputValue))
|
||||||
|
print(outputValue,flush=True)
|
||||||
|
|
||||||
if outputValue in payments:
|
if outputValue in payments:
|
||||||
# Payment found
|
# Payment found
|
||||||
payment = payments[outputValue]
|
payment = payments[outputValue]
|
||||||
if payment['status'] == "Pending":
|
if payment['status'] == "Pending":
|
||||||
if not finalise_payment(payment):
|
if not finalise_payment(payment):
|
||||||
|
print("Failed to finalise payment",flush=True)
|
||||||
return False
|
return False
|
||||||
payment['status'] = "Paid"
|
payment['status'] = "Paid"
|
||||||
with open(path+'payments.json', 'w') as f:
|
with open(path+'payments.json', 'w') as f:
|
||||||
json.dump(payments, f, indent=4)
|
json.dump(payments, f, indent=4)
|
||||||
print("Payment finalised")
|
print("Payment finalised",flush=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -120,7 +122,7 @@ def finalise_payment(payment):
|
|||||||
data = payment
|
data = payment
|
||||||
resp = requests.post(url, json=data)
|
resp = requests.post(url, json=data)
|
||||||
if resp.status_code != 200:
|
if resp.status_code != 200:
|
||||||
print(resp.text)
|
print(resp.text,flush=True)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user