feat: send ticket receipts via WhatsApp and normalize phone numbers
Add WhatsApp API integration for automated receipt delivery Enforce country codes for all phone number inputs (defaults to +60)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import type { PublicBooking } from '~~/shared/booking'
|
||||
import type { ConfirmBookingResponse, PublicBooking } from '~~/shared/booking'
|
||||
|
||||
import {
|
||||
formatBookingCurrency,
|
||||
@@ -85,7 +85,7 @@ async function confirmBooking() {
|
||||
confirming.value = true
|
||||
|
||||
try {
|
||||
const response = await apiClient<{ booking: PublicBooking, alreadyConfirmed: boolean }>(
|
||||
const response = await apiClient<ConfirmBookingResponse>(
|
||||
`/api/public/bookings/${token}/confirm`,
|
||||
{
|
||||
method: 'POST'
|
||||
@@ -98,8 +98,10 @@ async function confirmBooking() {
|
||||
title: response.alreadyConfirmed ? 'Booking already confirmed' : 'Booking confirmed',
|
||||
description: response.alreadyConfirmed
|
||||
? 'This booking had already been confirmed earlier.'
|
||||
: 'The booking details have been confirmed successfully.',
|
||||
color: 'success',
|
||||
: response.ticketReceiptWhatsApp.sent
|
||||
? `Ticket receipt was sent to ${response.ticketReceiptWhatsApp.recipientPhone}.`
|
||||
: `Booking confirmed, but the ticket receipt WhatsApp was not sent: ${response.ticketReceiptWhatsApp.error}`,
|
||||
color: response.alreadyConfirmed || response.ticketReceiptWhatsApp.sent ? 'success' : 'warning',
|
||||
icon: 'i-lucide-check-circle-2'
|
||||
})
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user