fix: create booking_payments record on YooKassa webhook payment.succeeded
Payment tab shows 'Оплачено' from booking_payments table, not from paid_amount. Webhook now inserts a payment record so the tab shows the correct amount. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -767,6 +767,13 @@ ${refund > 0 && (!items || items.length === 0) ? `<p style="color:#16a34a">Ос
|
||||
if (bRows[0]) {
|
||||
broadcast(ob.slug, { type: 'booking:updated', booking: bRows[0] })
|
||||
}
|
||||
// Insert payment record so the payment tab shows the amount
|
||||
await db.query(
|
||||
`INSERT INTO booking_payments (hotel_id, booking_id, amount, method, note)
|
||||
VALUES ($1, $2, $3, 'yookassa', 'Оплата через ЮКассу (онлайн-бронирование)')
|
||||
ON CONFLICT DO NOTHING`,
|
||||
[ob.hotel_id, ob.booking_id, ob.total_amount],
|
||||
).catch(() => {})
|
||||
}
|
||||
if (ob.guest_email) {
|
||||
sendBookingConfirmedEmail({
|
||||
|
||||
Reference in New Issue
Block a user