Rebase onto upstream v1.6.8 #63
1 changed files with 7 additions and 3 deletions
fix: issue when calling internal webhook from extern (#57)
- query from localhost and port, important if behind a proxy without loopback
commit
f745370c33
10
views_api.py
10
views_api.py
|
|
@ -534,9 +534,13 @@ async def api_ticket_create(
|
||||||
|
|
||||||
ticket_id = urlsafe_short_hash()
|
ticket_id = urlsafe_short_hash()
|
||||||
base_url = str(request.base_url).rstrip("/")
|
base_url = str(request.base_url).rstrip("/")
|
||||||
webhook_url = f"{base_url}/events/api/v1/tickets/{ticket_id}/satspay-webhook"
|
# Use internal address for webhook — SatsPay calls it server-side and
|
||||||
|
# cannot reach the public domain from within the container.
|
||||||
|
internal_base = f"http://{settings.host}:{settings.port}"
|
||||||
|
webhook_url = (
|
||||||
|
f"{internal_base}/events/api/v1/tickets/{ticket_id}/satspay-webhook"
|
||||||
|
)
|
||||||
complete_url = f"{base_url}/events/ticket/{ticket_id}"
|
complete_url = f"{base_url}/events/ticket/{ticket_id}"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
charge = await create_satspay_charge(
|
charge = await create_satspay_charge(
|
||||||
api_key=wallet_record.inkey,
|
api_key=wallet_record.inkey,
|
||||||
|
|
@ -683,7 +687,7 @@ async def api_ticket_delete(
|
||||||
|
|
||||||
|
|
||||||
@tickets_api_router.post("/{ticket_id}/satspay-webhook")
|
@tickets_api_router.post("/{ticket_id}/satspay-webhook")
|
||||||
async def api_ticket_satspay_webhook(ticket_id: str, request: Request) -> None:
|
async def api_ticket_satspay_webhook(ticket_id: str) -> None:
|
||||||
ticket = await get_ticket(ticket_id)
|
ticket = await get_ticket(ticket_id)
|
||||||
if not ticket:
|
if not ticket:
|
||||||
logger.warning(f"SatsPay webhook: ticket {ticket_id} does not exist.")
|
logger.warning(f"SatsPay webhook: ticket {ticket_id} does not exist.")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue