diff --git a/src/main/java/com/champions/carsharingservice/controller/PaymentController.java b/src/main/java/com/champions/carsharingservice/controller/PaymentController.java index ed7dd04..5983000 100644 --- a/src/main/java/com/champions/carsharingservice/controller/PaymentController.java +++ b/src/main/java/com/champions/carsharingservice/controller/PaymentController.java @@ -33,8 +33,10 @@ public class PaymentController { @ResponseBody @PreAuthorize("hasRole('CUSTOMER')") @GetMapping - @Operation(summary = "Get all payments", - description = "Get all rentals for user, Pageable default: page = 0, size = 10") + @Operation(summary = "Get all user's payments", + description = """ + Get all user's payments. + Pageable default: page = 0, size = 10""") public List getAll(@PageableDefault(page = 0, size = 10) Pageable pageable, Authentication authentication) { User user = (User) authentication.getPrincipal(); @@ -59,22 +61,27 @@ public List searchPayments(@RequestParam(name = "status") @ResponseBody @PostMapping("/pay") @PreAuthorize("hasRole('CUSTOMER')") - @Operation(summary = "Create ") + @Operation(summary = "Create session", + description = "Session is created to enable user to use Stripe") public PaymentDto createPaymentIntent(@RequestBody @Valid CreatePaymentRequestDto requestDto) { return paymentService.createPaymentSession(requestDto); } @GetMapping("/success") - @Operation(summary = "", - description = "") + @Operation(summary = "Page redirection on successful payment", + description = """ + On finishing payment in Stripe user is + redirected to page on successful payment""") public String success(@RequestParam String sessionId) { paymentService.getSuccessfulPayment(sessionId); return "success"; } @GetMapping("/cancel") - @Operation(summary = "", - description = "Customer is redirected to a page when ") + @Operation(summary = "Page redirection on canceled payment", + description = """ + On canceling payment in Stripe user is + redirected to page on canceled payment""") public String afterCancelPayment(@RequestParam String sessionId) { paymentService.getCancelledPayment(sessionId); return "cancel"; diff --git a/src/main/java/com/champions/carsharingservice/service/impl/NotificationServiceImpl.java b/src/main/java/com/champions/carsharingservice/service/impl/NotificationServiceImpl.java index 58366c4..2a749e7 100644 --- a/src/main/java/com/champions/carsharingservice/service/impl/NotificationServiceImpl.java +++ b/src/main/java/com/champions/carsharingservice/service/impl/NotificationServiceImpl.java @@ -25,7 +25,7 @@ public class NotificationServiceImpl implements NotificationService { public void sendMessageAboutCreatedRental(Rental rental) { String carInfo = formatCarInfo(rental.getCar()); String dateInfo = formatDate(rental.getRentalDateTime(), rental.getReturnDateTime()); - String name = "Dear, %s".formatted(rental.getUser().getFirstName()); + String name = "Dear, %s 🙌".formatted(rental.getUser().getFirstName()); String message = name + System.lineSeparator() + "You rent car: " + System.lineSeparator() + carInfo + System.lineSeparator() @@ -39,7 +39,7 @@ public void sendMessageAboutOverdueRental(Rental rental) { String message = """ You should have returned car: %s, - on %s + on 🕛 %s """.formatted(formatCarInfo(car), formatDateForOverdueRental(rental.getReturnDateTime(), rental.getActualReturnDateTime())); @@ -100,12 +100,16 @@ private String formatDateForOverdueRental(LocalDateTime returnDateTime, String formattedActualReturnDateTime = actualReturnDateTime.format(formatter); return """ %s, - but you return it on %s + but you return it on 🕑 %s """.formatted(formattedReturnDateTime, formattedActualReturnDateTime); } public String formatCarInfo(Car car) { - return " model ➡ %s, brand ➡ %s, type ➡ %s" + return """ + 🚗 + model ➡ %s, + brand ➡ %s, + type ➡ %s""" .formatted(car.getModel(), car.getBrand(), car.getType().name()); } @@ -114,9 +118,9 @@ private String formatDate(LocalDateTime rentalDateTime, LocalDateTime returnDate String formattedRentalDateTime = rentalDateTime.format(formatter); String formattedReturnDateTime = returnDateTime.format(formatter); return """ - Your rent day and time is: %s, - you should return car on %s. - If you don't return the car on time, you will be fined. + Your rent day and time is ⌛: %s, + you should return car on ⏳ %s. + If you don't return the car on time, you will be fined 💸 """.formatted(formattedRentalDateTime, formattedReturnDateTime); } } diff --git a/src/main/java/com/champions/carsharingservice/telegram/CarSharingBot.java b/src/main/java/com/champions/carsharingservice/telegram/CarSharingBot.java index 8a91eed..e49be80 100644 --- a/src/main/java/com/champions/carsharingservice/telegram/CarSharingBot.java +++ b/src/main/java/com/champions/carsharingservice/telegram/CarSharingBot.java @@ -19,17 +19,6 @@ public class CarSharingBot extends TelegramLongPollingBot { @Value("${bot.token}") private String token; - /* - 1. You should create your bot in Telegram (I will send you a video) - 2. Save token of the bot to env. file and after as variable in application.properties - 3. Save name of your bot to env. file and after as variable in application.properties - 4. Run the app and click /start in your bot - 5. In the console you will see chat id which you should add to - env. file and after as variable in application.properties (just numbers) - 6. After all members do that we will delete this instruction - and functionality to get chat id in method onUpdateReceive - */ - @Value("${bot.chat}") private String chatId;