Reservation: - uuid - deposit_price - price - start_date - status // 'pending' | 'active' | 'canceled' - end_date - room_uuid - created_at - updated_at - deleted_at Payment: - uuid - payment_intent_id (Id of Stripe's PaymentIntent) - status - reservation_uuid - customer_uuid - created_at - updated_at - deleted_at Customer - uuid - first_name - last_name - email - phone - created_at - updated_at - deleted_at Link utili: - https://stripe.com/docs/payments/capture-later#authorize-only - https://stripe.com/docs/stripe-js/react - https://medium.com/javascript-in-plain-english/stripe-payment-form-with-reactjs-and-material-ui-part-4-118e60fca962 # User Stories ## Customer ## Backoffice # Scenari [TBD] #### Scenario 1: il client non riesce a contattare l'endpoint `POST /rooms/:roomId/payment-intents` GIVEN L'utente ha acceduto la pagina della stanza AND il componente per il pagament viene renderrizzato nel modo corretto WHEN La chiamata per la creazione del payment intent fallisce per problemi di comunicazione tra backend e frontend THEN Il client frontend visualizza un messaggio di errore **AND** non permette all'utente di pagare #### Scenario 2: il client riesce a contattare l'endpoint `POST /rooms/:roomId/payment-intent`, ma il servizio backend non riesce a rispondere GIVEN WHEN THEN #### Scenario 3: il client fallisce la finalizzazione del Payment Intent GIVEN Il form di pagamento è correttamente inizializzato AND il client ha accesso al Payment Intent AND l'utente clicca sul bottone paga WHEN Il client non riesce a contattare Stripe THEN il client mostra un messaggio di errore AND il client permette nuovamente all'utente di finalizzare il Payment Intent #### Scenario 4: il client finalizza il Payment Intent, ma non riesce a contattare il servizio di backend GIVEN La finalizzazione del Payment Intent è avvenuta AND il client cerca di contattare il servizio di backend WHEN la comunicazione con il servizio di backend fallisce THEN R V r -----+++++++++++++-------- p --=====------------------- t p ---==================----- t p -------=========---------- t p ---------------======----- t p ===----------------------- f p --------------------====== f (r.end >= p.start AND r.start <= p.end )