Fix python webhook example

This commit is contained in:
Ross Savage
2023-12-17 19:54:44 +01:00
parent d5a05d8717
commit a32f124116
2 changed files with 10 additions and 5 deletions

View File

@@ -16,6 +16,7 @@ from src.lnurl_pay import pay
from src.lnurl_withdraw import withdraw from src.lnurl_withdraw import withdraw
from src.production import production_node_config from src.production import production_node_config
from src.service_status import health_check_status, report_payment_failure from src.service_status import health_check_status, report_payment_failure
from src.webhook import webhook, payment_webhook
import tempfile import tempfile
import os import os
@@ -59,6 +60,10 @@ def main():
# receive payment # receive payment
receive_payment(sdk_services) receive_payment(sdk_services)
# payment notifications
webhook(sdk_services)
payment_webhook(sdk_services)
# receive onchain # receive onchain
generate_receive_onchain_address(sdk_services) generate_receive_onchain_address(sdk_services)
get_in_progress_swap(sdk_services) get_in_progress_swap(sdk_services)

View File

@@ -3,17 +3,17 @@ import breez_sdk
def webhook(sdk_services): def webhook(sdk_services):
try: try:
# ANCHOR: register-webook # ANCHOR: register-webook
sdk_services.registerWebhook("https://yourapplication.com") sdk_services.register_webhook("https://yourapplication.com")
# ANCHOR_END: register-webook # ANCHOR_END: register-webook
except Exception as error: except Exception as error:
print(error) print(error)
raise raise
def paymentWebhook(sdk_services): def payment_webhook(sdk_services):
try: try:
# ANCHOR: register-payment-webook # ANCHOR: register-payment-webook
sdk_services.registerWebhook("https://your-nds-service.com/notify?platform=ios&token=<PUSH_TOKEN>") sdk_services.register_webhook("https://your-nds-service.com/notify?platform=ios&token=<PUSH_TOKEN>")
# ANCHOR_END: register-payment-webook # ANCHOR_END: register-payment-webook
except Exception as error: except Exception as error:
print(error) print(error)
raise raise