create public layout and admin and fix escrow and refund
This commit is contained in:
@@ -4,6 +4,7 @@ import { prisma } from "@/lib/prisma";
|
||||
import { refundRepo } from "@/server/repositories/refund.repo";
|
||||
import { calculateRefundAmount, daysUntilDeparture } from "@/lib/refund-policy";
|
||||
import { isTripDepartureDayPast } from "@/lib/trip-dates";
|
||||
import { payoutService } from "@/server/services/payout.service";
|
||||
|
||||
const SERIAL_TX_ATTEMPTS = 6;
|
||||
|
||||
@@ -236,6 +237,12 @@ export const refundService = {
|
||||
tx
|
||||
);
|
||||
|
||||
// Escrow: kurangi (atau cancel) payout organizer sesuai nominal refund.
|
||||
await payoutService.applyRefundDelta(tx, {
|
||||
bookingId: refund.bookingId,
|
||||
refundAmount: refund.amount,
|
||||
});
|
||||
|
||||
const totalRefunded = await refundRepo.sumSucceededAmount(
|
||||
refund.bookingId,
|
||||
tx
|
||||
|
||||
Reference in New Issue
Block a user