- Timestamp:
- 02/12/22 17:21:18 (2 years ago)
- Branches:
- master
- Children:
- b2e6513
- Parents:
- 7bb19d4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/app/src/main/java/parkup/services/ParkingSessionService.java
r7bb19d4 rbfc49f4 93 93 94 94 } 95 96 // public void executePayment(int id){ 97 // ParkingSession session = parkingSessionRepository.findByPssId(id); 98 // if(session==null){ 99 // throw new IllegalStateException("No such session exists"); 100 // } 101 // else if(session.getStatus()== SessionStatus.ENDED_UNPAID){ 102 // throw new IllegalStateException("Cannot execute payment on an ended session"); 103 // } 104 // session.setStatus(SessionStatus.ENDED_PAID); 105 // } 106 107 public int calculatePayment(int id){ 108 ParkingSession session = parkingSessionRepository.findByPssId(id); 95 public int calculatePayment(){ 96 ParkingSession session = getParkingSession(); 109 97 if(session==null){ 110 98 throw new IllegalStateException("No such session exists"); … … 182 170 parkingSession.getParkingSpace().setTaken(false); 183 171 registeredUserRepository.findAll().stream().filter(rp->rp.getSession().getStatus().equals(SessionStatus.ENDED_PAID)).forEach(rp->rp.setSession(null)); 172 guestRepository.findAll().stream().filter(g->g.getSession().getStatus().equals(SessionStatus.ENDED_PAID)).forEach(g->g.setSession(null)); 173 guestRepository.deleteAll(guestRepository.findAll().stream().filter(g-> g.getSession() == null).collect(Collectors.toList())); 184 174 parkingSessionRepository.deleteByPssId(parkingSession.getPssId()); 185 175 return true;
Note:
See TracChangeset
for help on using the changeset viewer.