-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OVERALL FIXING] Fixed some issues related to Payment and Rental #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GJ! Left some comments.
@@ -76,6 +77,13 @@ public User getByEmail(String email) { | |||
); | |||
} | |||
|
|||
@Override | |||
public User getByAuthentication(Authentication auth) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public User getByAuthentication(Authentication auth) { | |
public User getAuthenticatedUser(Authentication auth) { |
Payment.Type type = Payment.Type.valueOf(requestDto.getType()); | ||
|
||
checkIfPaymentSessionValid(rental); | ||
|
||
if (paymentRepository.existsByRentalIdAndStatus(rental.getId(), Payment.Status.PAUSED)) { | ||
return paymentMapper.toDto(paymentRepository.findByRentalId(rental.getId()).get()); | ||
} | ||
|
||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant lines
@@ -63,6 +64,8 @@ public PaymentResponseDto updateStatus(String sessionId, Payment.Status status) | |||
|
|||
@Override | |||
public List<PaymentResponseDto> getAll(Authentication authentication, Pageable pageable) { | |||
User user = userService.getByAuthentication(authentication); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant line
if (paymentRepository.existsByRentalIdAndStatus(rental.getId(), Payment.Status.PAID)) { | ||
throw new NotValidPaymentProcessException("The rental is paid!"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant line
@@ -53,6 +53,14 @@ public List<RentalDto> getByUserIdAndActiveStatus(Pageable pageable, | |||
.toList(); | |||
} | |||
|
|||
@Override | |||
public Rental getByUserAndId(User user, Long id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you specify in method name by what entity id you want to get?
…xing-issues # Conflicts: # src/main/java/com/project/carsharingapp/service/impl/RentalServiceImpl.java
No description provided.