create payment roadmap pr a

This commit is contained in:
2026-05-08 20:43:14 +07:00
parent ccb3437e82
commit d4db13778a
10 changed files with 823 additions and 51 deletions
+10
View File
@@ -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) {