create public layout and admin and fix escrow and refund
This commit is contained in:
@@ -6,6 +6,8 @@ import { participantRepo } from "@/server/repositories/participant.repo";
|
||||
import { bookingRepo } from "@/server/repositories/booking.repo";
|
||||
import { bookingService } from "@/server/services/booking.service";
|
||||
import { refundService } from "@/server/services/refund.service";
|
||||
import { payoutService } from "@/server/services/payout.service";
|
||||
import { payoutRepo } from "@/server/repositories/payout.repo";
|
||||
import { LIMITS } from "@/lib/limits";
|
||||
import { utcStartOfDay, isTripDepartureDayPast } from "@/lib/trip-dates";
|
||||
import { isFreeTrip } from "@/lib/trip-pricing";
|
||||
@@ -546,6 +548,16 @@ export const tripService = {
|
||||
}
|
||||
);
|
||||
refundsCreated.push(refund.id);
|
||||
|
||||
// Trip dibatalkan → cancel payout HELD/RELEASED organizer untuk
|
||||
// booking ini. Payout PAID di-flag clawback otomatis.
|
||||
const payout = await payoutRepo.findByBookingId(b.id, tx);
|
||||
if (payout) {
|
||||
await payoutService.cancel(tx, {
|
||||
payoutId: payout.id,
|
||||
reason: "Trip dibatalkan organizer.",
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// PENDING / AWAITING_PAY → uang belum masuk → langsung CANCELLED.
|
||||
await tx.booking.update({
|
||||
|
||||
Reference in New Issue
Block a user