| 11 | | 1. Pet Owner navigates to their "Pending Payments" dashboard. |
| 12 | | 2. System fetches confirmed bookings that do not have a matching payment record yet using a LEFT JOIN: |
| 13 | | {{{ |
| 14 | | #!sql |
| 15 | | SELECT b.booking_id, b.address, b.date_from |
| 16 | | FROM bookings b |
| 17 | | LEFT JOIN payments p ON b.booking_id = p.booking_id |
| 18 | | WHERE b.owner_id = (SELECT user_id FROM users WHERE username = 'owner_bojan') |
| 19 | | AND b.status = 'CONFIRMED' |
| 20 | | AND p.payment_id IS NULL; |
| 21 | | }}} |
| 22 | | 3. Owner selects a booking, chooses 'CREDIT_CARD', and submits the payment. |
| 23 | | 4. System securely records the payment in the database, satisfying the 1:1 relationship rule: |
| | 11 | 1. Pet Owner navigates to a Sitter's profile and clicks "Book Now". |
| | 12 | 2. Owner fills out the booking dates, address, and selects their pets. |
| | 13 | 3. Owner enters the payment amount, chooses 'Card' from the dropdown, and submits the form. |
| | 14 | 4. System securely creates the booking, and immediately records the payment in the database, satisfying the 1:1 relationship rule: |