condition check lambda
This commit is contained in:
@@ -14,6 +14,7 @@ const DamageAssessmentService = require("../services/damageAssessmentService");
|
||||
const StripeWebhookService = require("../services/stripeWebhookService");
|
||||
const StripeService = require("../services/stripeService");
|
||||
const emailServices = require("../services/email");
|
||||
const EventBridgeSchedulerService = require("../services/eventBridgeSchedulerService");
|
||||
const logger = require("../utils/logger");
|
||||
const { PaymentError } = require("../utils/stripeErrors");
|
||||
const { validateS3Keys } = require("../utils/s3KeyValidator");
|
||||
@@ -553,6 +554,23 @@ router.put("/:id/status", authenticateToken, async (req, res) => {
|
||||
],
|
||||
});
|
||||
|
||||
// Create condition check reminder schedules
|
||||
try {
|
||||
await EventBridgeSchedulerService.createConditionCheckSchedules(
|
||||
updatedRental
|
||||
);
|
||||
} catch (schedulerError) {
|
||||
const reqLogger = logger.withRequestId(req.id);
|
||||
reqLogger.error(
|
||||
"Failed to create condition check schedules",
|
||||
{
|
||||
error: schedulerError.message,
|
||||
rentalId: updatedRental.id,
|
||||
}
|
||||
);
|
||||
// Don't fail the confirmation - schedules are non-critical
|
||||
}
|
||||
|
||||
// Send confirmation emails
|
||||
// Send approval confirmation to owner with Stripe reminder
|
||||
try {
|
||||
@@ -707,6 +725,23 @@ router.put("/:id/status", authenticateToken, async (req, res) => {
|
||||
],
|
||||
});
|
||||
|
||||
// Create condition check reminder schedules
|
||||
try {
|
||||
await EventBridgeSchedulerService.createConditionCheckSchedules(
|
||||
updatedRental
|
||||
);
|
||||
} catch (schedulerError) {
|
||||
const reqLogger = logger.withRequestId(req.id);
|
||||
reqLogger.error(
|
||||
"Failed to create condition check schedules",
|
||||
{
|
||||
error: schedulerError.message,
|
||||
rentalId: updatedRental.id,
|
||||
}
|
||||
);
|
||||
// Don't fail the confirmation - schedules are non-critical
|
||||
}
|
||||
|
||||
// Send confirmation emails
|
||||
// Send approval confirmation to owner (for free rentals, no Stripe reminder shown)
|
||||
try {
|
||||
@@ -1842,6 +1877,21 @@ router.post(
|
||||
paymentMethodLast4,
|
||||
});
|
||||
|
||||
// Create condition check reminder schedules
|
||||
try {
|
||||
await EventBridgeSchedulerService.createConditionCheckSchedules(rental);
|
||||
} catch (schedulerError) {
|
||||
const reqLogger = logger.withRequestId(req.id);
|
||||
reqLogger.error(
|
||||
"Failed to create condition check schedules",
|
||||
{
|
||||
error: schedulerError.message,
|
||||
rentalId: rental.id,
|
||||
}
|
||||
);
|
||||
// Don't fail the confirmation - schedules are non-critical
|
||||
}
|
||||
|
||||
// Send confirmation emails
|
||||
try {
|
||||
await emailServices.rentalFlow.sendRentalApprovalConfirmationEmail(
|
||||
|
||||
Reference in New Issue
Block a user