From 6c05814a809b237175db78f38f05189170cc499d Mon Sep 17 00:00:00 2001 From: NickyHariniaina Date: Tue, 23 Jun 2026 11:25:35 +0300 Subject: [PATCH 01/17] build: add new deps --- build.gradle | 6 +++++- .../school/hei/vola/endpoint/event/EventProducer.java | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index ba7cc269..9c680864 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ plugins { id 'jacoco' - + } jacoco { @@ -154,5 +154,9 @@ implementation 'org.postgresql:postgresql' implementation("org.apache.poi:poi:5.2.5") implementation("org.apache.poi:poi-ooxml:5.2.5") +implementation 'org.springframework.boot:spring-boot-starter-security' +implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' +implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' +implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6' } diff --git a/src/main/java/school/hei/vola/endpoint/event/EventProducer.java b/src/main/java/school/hei/vola/endpoint/event/EventProducer.java index a58c9fbe..19f92bbe 100644 --- a/src/main/java/school/hei/vola/endpoint/event/EventProducer.java +++ b/src/main/java/school/hei/vola/endpoint/event/EventProducer.java @@ -47,8 +47,12 @@ public EventProducer( public void accept(Collection events) { for (var batch : listGrouper.apply(events.stream().toList(), MAX_EVENTS_FOR_PUT_REQUEST)) { log.info("Events to send: {}", batch); - PutEventsResponse response = sendRequest(batch); - checkResponse(response); + try { + PutEventsResponse response = sendRequest(batch); + checkResponse(response); + } catch (Exception e) { + log.warn(""); + } } } From 3b2b7e812c063d1de5bc44e5cb56e3683383633e Mon Sep 17 00:00:00 2001 From: NickyHariniaina Date: Tue, 23 Jun 2026 11:33:36 +0300 Subject: [PATCH 02/17] chore: add application.yml config for casdoor --- .../hei/vola/endpoint/event/EventProducer.java | 8 ++------ src/main/resources/application.yml | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/application.yml diff --git a/src/main/java/school/hei/vola/endpoint/event/EventProducer.java b/src/main/java/school/hei/vola/endpoint/event/EventProducer.java index 19f92bbe..a58c9fbe 100644 --- a/src/main/java/school/hei/vola/endpoint/event/EventProducer.java +++ b/src/main/java/school/hei/vola/endpoint/event/EventProducer.java @@ -47,12 +47,8 @@ public EventProducer( public void accept(Collection events) { for (var batch : listGrouper.apply(events.stream().toList(), MAX_EVENTS_FOR_PUT_REQUEST)) { log.info("Events to send: {}", batch); - try { - PutEventsResponse response = sendRequest(batch); - checkResponse(response); - } catch (Exception e) { - log.warn(""); - } + PutEventsResponse response = sendRequest(batch); + checkResponse(response); } } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 00000000..fab909e4 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,16 @@ +spring: + security: + oauth2: + client: + registration: + casdoor: + client-id: ${CASDOOR_CLIENT_ID} + client-secret: ${CASDOOR_CLIENT_SECRET} + scope: openid, profile, email + authorization-grant-type: authorization_code + redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" + provider: + casdoor: + issuer-uri: ${CASDOOR_ISSUER_URI} +vola: + admins: ${VOLA_ADMINS} From 2637aa45a616e7ca0df50a6fd1688b28a026bf5b Mon Sep 17 00:00:00 2001 From: NickyHariniaina Date: Tue, 23 Jun 2026 11:48:12 +0300 Subject: [PATCH 03/17] chore: add security config for casdoor --- .../endpoint/rest/security/SecurityConf.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java diff --git a/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java b/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java new file mode 100644 index 00000000..6e2fae6e --- /dev/null +++ b/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java @@ -0,0 +1,50 @@ +package school.hei.vola.endpoint.rest.security; + +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configurers.LogoutConfigurer; +import org.springframework.security.oauth2.core.oidc.user.OidcUser; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.AuthenticationSuccessHandler; + +@Configuration +@EnableWebSecurity +@RequiredArgsConstructor +public class SecurityConf { + + private final VolaAdminChecker volaAdminChecker; + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http.authorizeHttpRequests( + auth -> + auth.requestMatchers( + "/ping", "/health/**", "/error", "/swagger-ui/**", "/v3/api-docs/**") + .permitAll() + .anyRequest() + .authenticated()) + .oauth2Login(oauth2 -> oauth2.successHandler(authenticationSuccessHandler())) + .logout(LogoutConfigurer::permitAll) + .csrf(csrf -> csrf.ignoringRequestMatchers("/payment", "/payments/search", "/orange/**")); + + return http.build(); + } + + @Bean + public AuthenticationSuccessHandler authenticationSuccessHandler() { + return (request, response, authentication) -> { + var oidcUser = (OidcUser) authentication.getPrincipal(); + String email = oidcUser.getEmail(); + if (!volaAdminChecker.isAdmin(email)) { + response.sendError( + HttpServletResponse.SC_FORBIDDEN, "Access denied. You are not a Vola administrator."); + return; + } + response.sendRedirect("/payments"); + }; + } +} From 00f0f1dd346d6e653acdd53054dc6e68c43ffd27 Mon Sep 17 00:00:00 2001 From: NickyHariniaina Date: Tue, 23 Jun 2026 11:52:31 +0300 Subject: [PATCH 04/17] chore: add admin checker utility --- .../rest/security/VolaAdminChecker.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/school/hei/vola/endpoint/rest/security/VolaAdminChecker.java diff --git a/src/main/java/school/hei/vola/endpoint/rest/security/VolaAdminChecker.java b/src/main/java/school/hei/vola/endpoint/rest/security/VolaAdminChecker.java new file mode 100644 index 00000000..13e9204d --- /dev/null +++ b/src/main/java/school/hei/vola/endpoint/rest/security/VolaAdminChecker.java @@ -0,0 +1,21 @@ +package school.hei.vola.endpoint.rest.security; + +import java.util.Arrays; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component +public class VolaAdminChecker { + @Value("${vola.admins}") + private String admins; + + public boolean isAdmin(String email) { + if (email == null || admins == null) { + return false; + } + return Arrays.stream(admins.split(",")) + .map(String::trim) + .map(String::toLowerCase) + .anyMatch(admin -> admin.equals(email.toLowerCase())); + } +} From c50c505967c0d889818e883cb17e4852bda3dc98 Mon Sep 17 00:00:00 2001 From: NickyHariniaina Date: Tue, 23 Jun 2026 12:00:23 +0300 Subject: [PATCH 05/17] fix: only match the /payment endpoint to be authenticated --- .../school/hei/vola/endpoint/rest/security/SecurityConf.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java b/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java index 6e2fae6e..49237fc2 100644 --- a/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java +++ b/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java @@ -23,10 +23,9 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http.authorizeHttpRequests( auth -> auth.requestMatchers( - "/ping", "/health/**", "/error", "/swagger-ui/**", "/v3/api-docs/**") + "/ping", "/health/**", "/error", "/swagger-ui/**", "/v3/api-docs/**", "/payment", "/payments/search", "/orange/**") .permitAll() - .anyRequest() - .authenticated()) + .requestMatchers("/payments/**").authenticated() .oauth2Login(oauth2 -> oauth2.successHandler(authenticationSuccessHandler())) .logout(LogoutConfigurer::permitAll) .csrf(csrf -> csrf.ignoringRequestMatchers("/payment", "/payments/search", "/orange/**")); From 31dc793011d10358dc156a832c6f82154d5bd5ed Mon Sep 17 00:00:00 2001 From: NickyHariniaina Date: Tue, 23 Jun 2026 12:01:22 +0300 Subject: [PATCH 06/17] fix: deny all unknown route since every route are matched --- .../school/hei/vola/endpoint/rest/security/SecurityConf.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java b/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java index 49237fc2..d3d505b0 100644 --- a/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java +++ b/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java @@ -26,6 +26,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { "/ping", "/health/**", "/error", "/swagger-ui/**", "/v3/api-docs/**", "/payment", "/payments/search", "/orange/**") .permitAll() .requestMatchers("/payments/**").authenticated() + .anyRequest().denyAll()) .oauth2Login(oauth2 -> oauth2.successHandler(authenticationSuccessHandler())) .logout(LogoutConfigurer::permitAll) .csrf(csrf -> csrf.ignoringRequestMatchers("/payment", "/payments/search", "/orange/**")); From a5f5a6b8ecb2016dd7b64f0853222b4975a9c23a Mon Sep 17 00:00:00 2001 From: NickyHariniaina Date: Tue, 23 Jun 2026 12:09:45 +0300 Subject: [PATCH 07/17] fix: replace HttpServletRespnose with Spring default 403 error. --- .../school/hei/vola/endpoint/rest/security/SecurityConf.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java b/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java index d3d505b0..2b4e1164 100644 --- a/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java +++ b/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java @@ -40,9 +40,7 @@ public AuthenticationSuccessHandler authenticationSuccessHandler() { var oidcUser = (OidcUser) authentication.getPrincipal(); String email = oidcUser.getEmail(); if (!volaAdminChecker.isAdmin(email)) { - response.sendError( - HttpServletResponse.SC_FORBIDDEN, "Access denied. You are not a Vola administrator."); - return; + throw new AccessDeniedException("You're not a Vola Administrator"); } response.sendRedirect("/payments"); }; From 2a16b0475141844ff3f4edde9183830bfd9d1a5b Mon Sep 17 00:00:00 2001 From: NickyHariniaina Date: Tue, 23 Jun 2026 12:27:18 +0300 Subject: [PATCH 08/17] fix: change to constructor injection --- .../hei/vola/endpoint/rest/security/VolaAdminChecker.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/school/hei/vola/endpoint/rest/security/VolaAdminChecker.java b/src/main/java/school/hei/vola/endpoint/rest/security/VolaAdminChecker.java index 13e9204d..d8a958ec 100644 --- a/src/main/java/school/hei/vola/endpoint/rest/security/VolaAdminChecker.java +++ b/src/main/java/school/hei/vola/endpoint/rest/security/VolaAdminChecker.java @@ -6,9 +6,12 @@ @Component public class VolaAdminChecker { - @Value("${vola.admins}") private String admins; + public VolaAdminChecker(@Value("${vola.admins}") String admins) { + this.admins = admins; + } + public boolean isAdmin(String email) { if (email == null || admins == null) { return false; From 64e05133b5c377b96b95e9ea02da6d87bbd605f4 Mon Sep 17 00:00:00 2001 From: NickyHariniaina Date: Tue, 23 Jun 2026 12:38:54 +0300 Subject: [PATCH 09/17] chore: add test for vola admin checker --- .../vola/endpoint/event/EventProducer.java | 8 +++- .../endpoint/rest/security/SecurityConf.java | 17 +++++-- .../hei/vola/unit/VolaAdminCheckerTest.java | 45 +++++++++++++++++++ 3 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 src/test/java/school/hei/vola/unit/VolaAdminCheckerTest.java diff --git a/src/main/java/school/hei/vola/endpoint/event/EventProducer.java b/src/main/java/school/hei/vola/endpoint/event/EventProducer.java index a58c9fbe..3248cdca 100644 --- a/src/main/java/school/hei/vola/endpoint/event/EventProducer.java +++ b/src/main/java/school/hei/vola/endpoint/event/EventProducer.java @@ -47,8 +47,12 @@ public EventProducer( public void accept(Collection events) { for (var batch : listGrouper.apply(events.stream().toList(), MAX_EVENTS_FOR_PUT_REQUEST)) { log.info("Events to send: {}", batch); - PutEventsResponse response = sendRequest(batch); - checkResponse(response); + try { + PutEventsResponse response = sendRequest(batch); + checkResponse(response); + } catch (Exception e) { + log.warn(""); + } } } diff --git a/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java b/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java index 2b4e1164..2b28f688 100644 --- a/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java +++ b/src/main/java/school/hei/vola/endpoint/rest/security/SecurityConf.java @@ -1,9 +1,9 @@ package school.hei.vola.endpoint.rest.security; -import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.security.access.AccessDeniedException; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configurers.LogoutConfigurer; @@ -23,10 +23,19 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http.authorizeHttpRequests( auth -> auth.requestMatchers( - "/ping", "/health/**", "/error", "/swagger-ui/**", "/v3/api-docs/**", "/payment", "/payments/search", "/orange/**") + "/ping", + "/health/**", + "/error", + "/swagger-ui/**", + "/v3/api-docs/**", + "/payment", + "/payments/search", + "/orange/**") .permitAll() - .requestMatchers("/payments/**").authenticated() - .anyRequest().denyAll()) + .requestMatchers("/payments/**") + .authenticated() + .anyRequest() + .denyAll()) .oauth2Login(oauth2 -> oauth2.successHandler(authenticationSuccessHandler())) .logout(LogoutConfigurer::permitAll) .csrf(csrf -> csrf.ignoringRequestMatchers("/payment", "/payments/search", "/orange/**")); diff --git a/src/test/java/school/hei/vola/unit/VolaAdminCheckerTest.java b/src/test/java/school/hei/vola/unit/VolaAdminCheckerTest.java new file mode 100644 index 00000000..f3782b0a --- /dev/null +++ b/src/test/java/school/hei/vola/unit/VolaAdminCheckerTest.java @@ -0,0 +1,45 @@ +package school.hei.vola.unit; + +import org.junit.jupiter.api.Test; + +class VolaAdminCheckerTest { + @Test + void admin_email_returns_true() { + var checker = + new school.hei.vola.endpoint.rest.security.VolaAdminChecker( + "admin@hei.school, bob@hei.school"); + assert checker.isAdmin("admin@hei.school"); + } + + @Test + void admin_email_case_insensitive() { + var checker = + new school.hei.vola.endpoint.rest.security.VolaAdminChecker( + "admin@hei.school,bob@hei.school"); + assert checker.isAdmin("bob@Hei.School"); + } + + @Test + void non_admin_email_returns_false() { + var checker = + new school.hei.vola.endpoint.rest.security.VolaAdminChecker( + "admin@hei.school,bob@hei.school"); + assert !checker.isAdmin("other@hei.school"); + } + + @Test + void null_email_returns_false() { + var checker = + new school.hei.vola.endpoint.rest.security.VolaAdminChecker( + "admin@hei.school, valisoa@hei.school"); + assert !checker.isAdmin(null); + } + + @Test + void second_admin_also_matches() { + var checker = + new school.hei.vola.endpoint.rest.security.VolaAdminChecker( + "admin@hei.school,valisoa@hei.school"); + assert checker.isAdmin("valisoa@hei.school"); + } +} From 01b6fc3a5c8145faf387b5d87ab420ab5e6a4feb Mon Sep 17 00:00:00 2001 From: NickyHariniaina Date: Tue, 23 Jun 2026 12:44:43 +0300 Subject: [PATCH 10/17] chore: put back to the default generated code --- .../school/hei/vola/endpoint/event/EventProducer.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/school/hei/vola/endpoint/event/EventProducer.java b/src/main/java/school/hei/vola/endpoint/event/EventProducer.java index 3248cdca..7f64e4fc 100644 --- a/src/main/java/school/hei/vola/endpoint/event/EventProducer.java +++ b/src/main/java/school/hei/vola/endpoint/event/EventProducer.java @@ -47,12 +47,9 @@ public EventProducer( public void accept(Collection events) { for (var batch : listGrouper.apply(events.stream().toList(), MAX_EVENTS_FOR_PUT_REQUEST)) { log.info("Events to send: {}", batch); - try { - PutEventsResponse response = sendRequest(batch); - checkResponse(response); - } catch (Exception e) { - log.warn(""); - } + PutEventsResponse response = sendRequest(batch); + checkResponse(response); + log.warn(""); } } From df4a6350aad7083c8b213d8bb53f8de026fb9c9c Mon Sep 17 00:00:00 2001 From: colombefioren Date: Fri, 10 Jul 2026 12:14:27 +0300 Subject: [PATCH 11/17] chore: remove dead code --- src/main/java/school/hei/vola/endpoint/event/EventProducer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/school/hei/vola/endpoint/event/EventProducer.java b/src/main/java/school/hei/vola/endpoint/event/EventProducer.java index 7f64e4fc..a58c9fbe 100644 --- a/src/main/java/school/hei/vola/endpoint/event/EventProducer.java +++ b/src/main/java/school/hei/vola/endpoint/event/EventProducer.java @@ -49,7 +49,6 @@ public void accept(Collection events) { log.info("Events to send: {}", batch); PutEventsResponse response = sendRequest(batch); checkResponse(response); - log.warn(""); } } From bfa80a11d2e346d4d228cc0e944cbeeb8dd76021 Mon Sep 17 00:00:00 2001 From: colombefioren Date: Fri, 10 Jul 2026 12:19:27 +0300 Subject: [PATCH 12/17] chore: untrack env --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8c901fb7..b2e7b18b 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,6 @@ out/ **.toml ### Mac OS ### -.DS_Store \ No newline at end of file +.DS_Store + +.env \ No newline at end of file From f9a611e656f2dcbffe30c3c186f0a5ec912a4e9e Mon Sep 17 00:00:00 2001 From: colombefioren Date: Fri, 10 Jul 2026 12:44:02 +0300 Subject: [PATCH 13/17] feat: configure test environment properties --- src/test/java/school/hei/vola/conf/EnvConf.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/test/java/school/hei/vola/conf/EnvConf.java b/src/test/java/school/hei/vola/conf/EnvConf.java index b27597cb..313a96d5 100644 --- a/src/test/java/school/hei/vola/conf/EnvConf.java +++ b/src/test/java/school/hei/vola/conf/EnvConf.java @@ -10,6 +10,20 @@ void configureProperties(DynamicPropertyRegistry registry) { "spring.datasource.url", () -> "jdbc:h2:mem:testdb;CASE_INSENSITIVE_IDENTIFIERS=TRUE"); registry.add("spring.datasource.driverClassName", () -> "org.h2.Driver"); registry.add("spring.jpa.database-platform", () -> "org.hibernate.dialect.H2Dialect"); - registry.add("orange.api.url", () -> apiUrl); + registry.add("orange.api.url", () -> apiUrl != null ? apiUrl : "http://dummy.orange.api"); + registry.add( + "spring.security.oauth2.client.registration.casdoor.provider", () -> "casdoor-test"); + registry.add("spring.security.oauth2.client.registration.casdoor.client-id", () -> "dummy"); + registry.add("spring.security.oauth2.client.registration.casdoor.client-secret", () -> "dummy"); + registry.add( + "spring.security.oauth2.client.registration.casdoor.authorization-grant-type", + () -> "authorization_code"); + registry.add( + "spring.security.oauth2.client.registration.casdoor.redirect-uri", + () -> "{baseUrl}/login/oauth2/code/casdoor"); + registry.add( + "spring.security.oauth2.client.provider.casdoor-test.authorization-uri", () -> "dummy"); + registry.add("spring.security.oauth2.client.provider.casdoor-test.token-uri", () -> "dummy"); + registry.add("vola.admins", () -> "admin@test.com"); } } From bfaa4b7c98b97f63e5a82b4aa96f801d2f5a2068 Mon Sep 17 00:00:00 2001 From: Tsiory Jonathan Date: Fri, 10 Jul 2026 12:57:36 +0300 Subject: [PATCH 14/17] chore: update test date --- src/test/java/school/hei/vola/conf/TestData.java | 2 +- .../endpoint/rest/controller/PaymentControllerIT.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/school/hei/vola/conf/TestData.java b/src/test/java/school/hei/vola/conf/TestData.java index a13d2b79..8b1f0a75 100644 --- a/src/test/java/school/hei/vola/conf/TestData.java +++ b/src/test/java/school/hei/vola/conf/TestData.java @@ -4,5 +4,5 @@ public class TestData { public static final String ORANGE_REF_SUCCEEDED = // note(unique_pspPayment) // Changed on waiting of scraper fix - "MP260520.0631.C79321"; + "MP260629.0828.B25889"; } diff --git a/src/test/java/school/hei/vola/endpoint/rest/controller/PaymentControllerIT.java b/src/test/java/school/hei/vola/endpoint/rest/controller/PaymentControllerIT.java index bb7d9078..981d62f7 100644 --- a/src/test/java/school/hei/vola/endpoint/rest/controller/PaymentControllerIT.java +++ b/src/test/java/school/hei/vola/endpoint/rest/controller/PaymentControllerIT.java @@ -97,13 +97,13 @@ void can_create_payment_beforeOrangeDailyRetrieval_then_verify_it() { assertEquals(VERIFYING, createdPayment.getVerificationStatus()); orangeDailyTransactionsRetrievalRequestedService.accept( - new OrangeDailyTransactionsRetrievalRequested(LocalDate.of(2026, 5, 20))); + new OrangeDailyTransactionsRetrievalRequested(LocalDate.of(2026, 6, 29))); var retrievedPayment = subject.getPayment(apiKey, email, pspType, pspPaymentId); assertEquals( createdPayment.pspPayment().toBuilder() .amount(316800) - .creationInstant(Instant.parse("2026-05-20T06:31:26Z")) + .creationInstant(Instant.parse("2026-06-29T08:28:31Z")) .build(), retrievedPayment.pspPayment()); assertNotNull(retrievedPayment.lastPspVerificationInstant()); @@ -120,7 +120,7 @@ void can_create_payment_afterOrangeDailyRetrieval_then_verify_it() { try { orangeDailyTransactionsRetrievalRequestedService.accept( - new OrangeDailyTransactionsRetrievalRequested(LocalDate.of(2026, 5, 20))); + new OrangeDailyTransactionsRetrievalRequested(LocalDate.of(2026, 6, 29))); } catch (Exception e) { throw new RuntimeException("The error is ", e); @@ -145,7 +145,7 @@ void can_create_payment_afterOrangeDailyRetrieval_then_verify_it() { assertEquals( createdPayment.pspPayment().toBuilder() .amount(316800) - .creationInstant(Instant.parse("2026-05-20T06:31:26Z")) + .creationInstant(Instant.parse("2026-06-29T08:28:31Z")) .build(), retrievedPayment.pspPayment()); assertNotNull(retrievedPayment.lastPspVerificationInstant()); From 9417266a99ea698f36eb0508fb9ace97f23c96f5 Mon Sep 17 00:00:00 2001 From: NickyHariniaina Date: Wed, 29 Jul 2026 11:40:11 +0300 Subject: [PATCH 15/17] refactor: VolaAdminChecker instantiation in tests --- .../hei/vola/unit/VolaAdminCheckerTest.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/test/java/school/hei/vola/unit/VolaAdminCheckerTest.java b/src/test/java/school/hei/vola/unit/VolaAdminCheckerTest.java index f3782b0a..32e23c97 100644 --- a/src/test/java/school/hei/vola/unit/VolaAdminCheckerTest.java +++ b/src/test/java/school/hei/vola/unit/VolaAdminCheckerTest.java @@ -1,45 +1,41 @@ package school.hei.vola.unit; import org.junit.jupiter.api.Test; +import school.hei.vola.endpoint.rest.security.VolaAdminChecker; class VolaAdminCheckerTest { @Test void admin_email_returns_true() { var checker = - new school.hei.vola.endpoint.rest.security.VolaAdminChecker( - "admin@hei.school, bob@hei.school"); + new VolaAdminChecker("admin@hei.school, bob@hei.school"); assert checker.isAdmin("admin@hei.school"); } @Test void admin_email_case_insensitive() { var checker = - new school.hei.vola.endpoint.rest.security.VolaAdminChecker( - "admin@hei.school,bob@hei.school"); + new VolaAdminChecker("admin@hei.school,bob@hei.school"); assert checker.isAdmin("bob@Hei.School"); } @Test void non_admin_email_returns_false() { var checker = - new school.hei.vola.endpoint.rest.security.VolaAdminChecker( - "admin@hei.school,bob@hei.school"); + new VolaAdminChecker("admin@hei.school,bob@hei.school"); assert !checker.isAdmin("other@hei.school"); } @Test void null_email_returns_false() { var checker = - new school.hei.vola.endpoint.rest.security.VolaAdminChecker( - "admin@hei.school, valisoa@hei.school"); + new VolaAdminChecker("admin@hei.school, valisoa@hei.school"); assert !checker.isAdmin(null); } @Test void second_admin_also_matches() { var checker = - new school.hei.vola.endpoint.rest.security.VolaAdminChecker( - "admin@hei.school,valisoa@hei.school"); + new VolaAdminChecker("admin@hei.school,valisoa@hei.school"); assert checker.isAdmin("valisoa@hei.school"); } } From 949258444e374c2495202c0a081a0a5b5a03a302 Mon Sep 17 00:00:00 2001 From: Tsiory Jonathan Date: Wed, 29 Jul 2026 11:54:04 +0300 Subject: [PATCH 16/17] chore: format code --- .../hei/vola/unit/VolaAdminCheckerTest.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/test/java/school/hei/vola/unit/VolaAdminCheckerTest.java b/src/test/java/school/hei/vola/unit/VolaAdminCheckerTest.java index 32e23c97..18af1201 100644 --- a/src/test/java/school/hei/vola/unit/VolaAdminCheckerTest.java +++ b/src/test/java/school/hei/vola/unit/VolaAdminCheckerTest.java @@ -6,36 +6,31 @@ class VolaAdminCheckerTest { @Test void admin_email_returns_true() { - var checker = - new VolaAdminChecker("admin@hei.school, bob@hei.school"); + var checker = new VolaAdminChecker("admin@hei.school, bob@hei.school"); assert checker.isAdmin("admin@hei.school"); } @Test void admin_email_case_insensitive() { - var checker = - new VolaAdminChecker("admin@hei.school,bob@hei.school"); + var checker = new VolaAdminChecker("admin@hei.school,bob@hei.school"); assert checker.isAdmin("bob@Hei.School"); } @Test void non_admin_email_returns_false() { - var checker = - new VolaAdminChecker("admin@hei.school,bob@hei.school"); + var checker = new VolaAdminChecker("admin@hei.school,bob@hei.school"); assert !checker.isAdmin("other@hei.school"); } @Test void null_email_returns_false() { - var checker = - new VolaAdminChecker("admin@hei.school, valisoa@hei.school"); + var checker = new VolaAdminChecker("admin@hei.school, valisoa@hei.school"); assert !checker.isAdmin(null); } @Test void second_admin_also_matches() { - var checker = - new VolaAdminChecker("admin@hei.school,valisoa@hei.school"); + var checker = new VolaAdminChecker("admin@hei.school,valisoa@hei.school"); assert checker.isAdmin("valisoa@hei.school"); } } From 58bcdfe043745c18f9294c46b0b61742b744e798 Mon Sep 17 00:00:00 2001 From: NickyHariniaina Date: Wed, 29 Jul 2026 11:56:58 +0300 Subject: [PATCH 17/17] fix: remove Thymeleaf and related dependencies --- build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.gradle b/build.gradle index 9c680864..41f7b3d0 100644 --- a/build.gradle +++ b/build.gradle @@ -156,7 +156,5 @@ implementation 'org.postgresql:postgresql' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' -implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' -implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6' }