Maithili fix overlapping dates create payment intent#2155
Open
maithili20 wants to merge 5 commits intodevelopmentfrom
Open
Maithili fix overlapping dates create payment intent#2155maithili20 wants to merge 5 commits intodevelopmentfrom
maithili20 wants to merge 5 commits intodevelopmentfrom
Conversation
|
❌ The last analysis has failed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes bugs in #1808
Payment Allowed for Unavailable (Overlapping) Booking Dates
There is an inconsistency in the booking flow where the system allows users to make a payment for dates that are already booked, but later prevents the actual booking.
Fixes # (bug list priority high/medium/low x.y.z)
Or Implements # (WBS)
Actual Result
Payment is successfully processed for overlapping dates.
Booking creation fails with error:
"Selected dates are unavailable. Please choose different dates."
Expected Result
The system should validate date availability before creating a payment intent.
Payment should be blocked if the selected dates overlap with an existing booking.
Related PRS (if any):
This is only Backend PR
…
Main changes explained:
…
How to test:
PayPal: Create a Sandbox App in the PayPal Developer Dashboard to generate your credentials. Add them to your .env:
PAYPAL_CLIENT_ID=your_sandbox_client_id
PAYPAL_CLIENT_SECRET=your_sandbox_secret
Email: To test email notifications, configure the sender credentials.
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
Note: Do not use your standard login password. You must generate an App Password (if using Gmail, go to Google Account > Security > 2-Step Verification > App Passwords).
Run the backend server (npm start).
Use Postman to test the flow:
Step 1: Generate Payment Intent
POST http://localhost:4500/api/lbdashboard/bookings/create-payment-intent
Body: { "listingId": "681fdf0e9b28a081622ba775", "startDate": "2026-05-03", "endDate": "2026-05-15", "currency": "USD" }
Expected: Returns a PayPal orderId.
Step 2: Create Booking (Happy Path)
POST http://localhost:4500/api/lbdashboard/bookings/book
Body: Use the orderId from Step 1. {
"listingId": "681fdf0e9b28a081622ba775",
"startDate": "2026-05-03",
"endDate": "2026-05-15",
"paypalOrderId": "order_id"
}
Expected: Returns 201 Created and triggers email notifications.
Step 3: Test Error Handling