Skip to content

Commit

Permalink
🐛 Enable /pay requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Renan Kummer committed Apr 28, 2021
1 parent f77b221 commit 739c465
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
@Slf4j
public class GlobalExceptionHandler {

// TODO: Enhance error message returned as response body for the client.

@ExceptionHandler({
ToolNotAvailableException.class,
DwellerNotFoundException.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Rental rentTool(@NotNull RentalRequest rentalRequest)

var toolToRent = toolsService.getTool(rentalRequest.getToolId(), rentalRequest.getOwnerDwellerId());
if (isAvailableForRental(toolToRent, rentalRequest.getReturnDate())) {
// payClient.chargeCreditools(new Payment(rentalRequest.getRenterDwellerId(), toolToRent.getPrice()));
payClient.chargeCreditools(new Payment(rentalRequest.getRenterDwellerId(), toolToRent.getPrice()));

return repository.save(
Rental.builder()
Expand All @@ -78,8 +78,8 @@ public Rental returnTool(int toolId, int ownerDwellerId) throws RentalNotFoundEx
var rentalToReturn = rentalEntity.get();
rentalToReturn.setRentUntil(LocalDate.now());

// chargeDelayedDaysIfAny(rentalToReturn);
// payToolOwner(rentalToReturn);
chargeDelayedDaysIfAny(rentalToReturn);
payToolOwner(rentalToReturn);

return repository.save(rentalToReturn);
}
Expand Down

0 comments on commit 739c465

Please sign in to comment.