add more logs to btcpay webhook
This commit is contained in:
parent
7448cd90da
commit
be8cfee3c3
@ -77,11 +77,15 @@ def btcpay_payment():
|
||||
@bp.route("/btcpay/webhook", methods=("POST",))
|
||||
def btcpay_webhook():
|
||||
|
||||
current_app.logger.info(f"got btcpay webhook")
|
||||
|
||||
# IMPORTANT! there is no signature or credential for the data sent into this webhook :facepalm:
|
||||
# its just a notification, thats all.
|
||||
request_data = json.loads(request.data)
|
||||
invoice_id = request_data['id']
|
||||
|
||||
current_app.logger.info(f"got btcpay webhook with invoice_id={invoice_id}")
|
||||
|
||||
# so you better make sure to get the invoice directly from the horses mouth!
|
||||
invoice = current_app.config['BTCPAY_CLIENT'].get_invoice(invoice_id)
|
||||
|
||||
@ -90,6 +94,8 @@ def btcpay_webhook():
|
||||
|
||||
dollars = invoice['price']
|
||||
|
||||
current_app.logger.info(f"got btcpay webhook with invoice_id={invoice_id}, status={invoice['status']} dollars={dollars}")
|
||||
|
||||
if invoice['status'] == "paid" or invoice['status'] == "confirmed" or invoice['status'] == "complete":
|
||||
success_account = get_model().consume_payment_session("btcpay", invoice_id, dollars)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user