updates
This commit is contained in:
@@ -365,6 +365,30 @@ export const capturePayPalPayment = async (
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Cancel PayPal payment (when user cancels on PayPal page)
|
||||
* POST /api/payments/paypal/cancel
|
||||
*/
|
||||
export const cancelPayPalPayment = async (
|
||||
bookingId: number
|
||||
): Promise<{
|
||||
success: boolean;
|
||||
message?: string;
|
||||
}> => {
|
||||
const response = await apiClient.post(
|
||||
'/payments/paypal/cancel',
|
||||
{
|
||||
booking_id: bookingId,
|
||||
}
|
||||
);
|
||||
// Map backend response format (status: "success") to frontend format (success: true)
|
||||
const data = response.data;
|
||||
return {
|
||||
success: data.status === "success" || data.success === true,
|
||||
message: data.message,
|
||||
};
|
||||
};
|
||||
|
||||
export default {
|
||||
createPayment,
|
||||
getPayments,
|
||||
@@ -378,4 +402,5 @@ export default {
|
||||
confirmStripePayment,
|
||||
createPayPalOrder,
|
||||
capturePayPalPayment,
|
||||
cancelPayPalPayment,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user