create payment roadmap pr a
This commit is contained in:
@@ -5,6 +5,7 @@ import { tripRepo, type TripFilters } from "@/server/repositories/trip.repo";
|
||||
import { participantRepo } from "@/server/repositories/participant.repo";
|
||||
import { LIMITS } from "@/lib/limits";
|
||||
import { utcStartOfDay, isTripDepartureDayPast } from "@/lib/trip-dates";
|
||||
import { isFreeTrip } from "@/lib/trip-pricing";
|
||||
|
||||
const SERIAL_TX_ATTEMPTS = 6;
|
||||
|
||||
@@ -311,6 +312,12 @@ export const tripService = {
|
||||
throw new Error("Trip tidak ditemukan");
|
||||
}
|
||||
|
||||
if (isFreeTrip(trip)) {
|
||||
throw new Error(
|
||||
"Trip ini gratis — tidak ada pembayaran yang perlu ditandai"
|
||||
);
|
||||
}
|
||||
|
||||
if (isTripDepartureDayPast(trip.date)) {
|
||||
throw new Error("Trip sudah lewat — pembayaran tidak perlu ditandai");
|
||||
}
|
||||
@@ -363,6 +370,9 @@ export const tripService = {
|
||||
if (trip.organizerId !== organizerId) {
|
||||
throw new Error("Hanya organizer yang bisa mengonfirmasi pembayaran");
|
||||
}
|
||||
if (isFreeTrip(trip)) {
|
||||
throw new Error("Trip ini gratis — tidak ada pembayaran yang perlu dikonfirmasi");
|
||||
}
|
||||
|
||||
const participant = await participantRepo.findById(participantId);
|
||||
if (!participant || participant.tripId !== tripId) {
|
||||
|
||||
Reference in New Issue
Block a user