Changes between Initial Version and Version 1 of UseCase06


Ignore:
Timestamp:
05/08/26 03:10:35 (4 hours ago)
Author:
181201
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase06

    v1 v1  
     1== Use-case 0006 - Process a Payment
     2
     3'''Initiating actor:''' Pet Owner
     4
     5'''Other actors:''' None
     6
     7'''Description:'''
     8The owner must pay for a confirmed booking. The system finds unpaid bookings for that user, and the owner submits their payment method. The system records the financial transaction and links it securely to the booking.
     9
     10'''Scenario:'''
     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
     15SELECT b.booking_id, b.address, b.date_from
     16FROM bookings b
     17LEFT JOIN payments p ON b.booking_id = p.booking_id
     18WHERE 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:
     24{{{
     25#!sql
     26INSERT INTO payments (amount, payment_type, booking_id)
     27VALUES (
     28    1500,
     29    'CREDIT_CARD',
     30    (SELECT booking_id FROM bookings WHERE address = 'ul. Partizanska br. 10' LIMIT 1)
     31);
     32}}}