@@ -76,13 +76,19 @@ public function find(): ?SummitAttendeeTicket
7676 Log::debug (sprintf ("TicketFinderByExternalFeedStrategy::find ticket_criteria %s " , $ this ->ticket_criteria ));
7777
7878 if ($ this ->feed ->isValidQRCode ($ this ->ticket_criteria )){
79+ Log::debug (sprintf ("TicketFinderByExternalFeedStrategy::find ticket_criteria %s is a valid QRCode " , $ this ->ticket_criteria ));
7980 $ externalAttendeeId = $ this ->feed ->getExternalUserIdFromQRCode ($ this ->ticket_criteria );
8081 // check first if we have it locally
8182 $ attendee = $ this ->attendee_repository ->getBySummitAndExternalId
8283 (
8384 $ this ->summit , $ externalAttendeeId
8485 );
8586
87+ if (!is_null ($ attendee ) && !$ attendee ->hasTickets ()){
88+ Log::debug (sprintf ("TicketFinderByExternalFeedStrategy::find attendee %s has no tickets, re fetch it from external feed " , $ externalAttendeeId ));
89+ $ attendee = null ;
90+ }
91+
8692 if (is_null ($ attendee )) {
8793
8894 Log::debug
@@ -123,15 +129,22 @@ public function find(): ?SummitAttendeeTicket
123129
124130 return $ attendee ->getFirstTicket ();
125131 }
132+
126133 if (filter_var ($ this ->ticket_criteria , FILTER_VALIDATE_EMAIL )){
127134
135+ Log::debug (sprintf ("TicketFinderByExternalFeedStrategy::find ticket_criteria %s is a valid email " , $ this ->ticket_criteria ));
128136 $ externalAttendeeEmail = $ this ->ticket_criteria ;
129137 // check first if we have it locally
130138 $ attendee = $ this ->attendee_repository ->getBySummitAndEmail
131139 (
132140 $ this ->summit , $ externalAttendeeEmail
133141 );
134142
143+ if (!is_null ($ attendee ) && !$ attendee ->hasTickets ()){
144+ Log::debug (sprintf ("TicketFinderByExternalFeedStrategy::find attendee %s has no tickets, re fetch it from external feed " , $ externalAttendeeEmail ));
145+ $ attendee = null ;
146+ }
147+
135148 if (is_null ($ attendee )) {
136149
137150 Log::debug
@@ -170,6 +183,7 @@ public function find(): ?SummitAttendeeTicket
170183 }
171184 return $ attendee ->getFirstTicket ();
172185 }
186+ Log::debug (sprintf ("TicketFinderByExternalFeedStrategy::find ticket_criteria %s is not a valid QRCode or email " , $ this ->ticket_criteria ));
173187 return null ;
174188 }
175189}
0 commit comments