From df325487cfa52cff4845429296bc8e7f2a0f8fa0 Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Sat, 11 Jul 2026 14:59:09 +0100 Subject: [PATCH] fix: gift card admin notification uses NULL booking_id (not cardID), use tx not db.Conn --- backend/handlers/payments/giftcards.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/handlers/payments/giftcards.go b/backend/handlers/payments/giftcards.go index 5677b73..004ec50 100644 --- a/backend/handlers/payments/giftcards.go +++ b/backend/handlers/payments/giftcards.go @@ -1081,10 +1081,10 @@ func BuyGiftCard(w http.ResponseWriter, r *http.Request) { recipient = userEmail } // Notify admin about the friend gift card (email delivery not yet implemented — admin must send manually) - if _, err := db.Conn.Exec(ctx, ` + if _, err := tx.Exec(ctx, ` INSERT INTO admin_notifications (reason, booking_id, user_id) - VALUES ('gift_card_purchased_for_friend', $1, $2) - `, cardID, userID); err != nil { + VALUES ('gift_card_purchased_for_friend', NULL, $1) + `, userID); err != nil { log.Printf("ALERT: failed to create admin notification for gift card %s: %v", cardID, err) } log.Printf("GIFT CARD FOR FRIEND — code: %s, value: £%.2f, intended for: %s", cardID, amountPounds, recipient)