Skip to content

Commit 64476de

Browse files
FINERACT-2206: fix timezone handling in tests and loan constants
1 parent 785e03e commit 64476de

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

fineract-command/src/test/java/org/apache/fineract/command/CommandBaseTest.java

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,17 @@ abstract class CommandBaseTest {
4040
protected static Network network = Network.newNetwork();
4141

4242
@Container
43-
protected static final GenericContainer POSTGRES_CONTAINER = new GenericContainer("postgres:16").withNetwork(network)
44-
.withNetworkAliases("postgres").withExposedPorts(5432)
45-
.withEnv(Map.of("POSTGRES_DB", "fineract-test", "POSTGRES_USER", "root", "POSTGRES_PASSWORD", "mifos"));
43+
protected static final GenericContainer<?> POSTGRES_CONTAINER =
44+
new GenericContainer<>("postgres:16")
45+
.withNetwork(network)
46+
.withNetworkAliases("postgres")
47+
.withExposedPorts(5432)
48+
.withEnv(Map.of(
49+
"POSTGRES_DB", "fineract-test",
50+
"POSTGRES_USER", "root",
51+
"POSTGRES_PASSWORD", "mifos",
52+
"TZ", "UTC"
53+
));
4654

4755
@Autowired
4856
protected CommandRepository commandRepository;
@@ -57,8 +65,16 @@ protected static void configure(DynamicPropertyRegistry registry) {
5765
registry.add("spring.datasource.driver-class-name", () -> "org.postgresql.Driver");
5866
registry.add("spring.datasource.username", () -> "root");
5967
registry.add("spring.datasource.password", () -> "mifos");
60-
registry.add("spring.datasource.url", () -> "jdbc:postgresql://" + POSTGRES_CONTAINER.getHost() + ":"
61-
+ POSTGRES_CONTAINER.getMappedPort(5432) + "/fineract-test");
68+
registry.add("spring.datasource.url", () ->
69+
"jdbc:postgresql://" + POSTGRES_CONTAINER.getHost() + ":"
70+
+ POSTGRES_CONTAINER.getMappedPort(5432)
71+
+ "/fineract-test?options=-c%20TimeZone=UTC"
72+
);
6273
registry.add("spring.datasource.platform", () -> "postgresql");
74+
75+
registry.add(
76+
"spring.jpa.properties.hibernate.jdbc.time_zone",
77+
() -> "UTC"
78+
);
6379
}
6480
}

fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/LoanProductConstants.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,13 @@ public interface LoanProductConstants {
130130
String minimumGapBetweenInstallments = "minimumGap";
131131
String maximumGapBetweenInstallments = "maximumGap";
132132

133+
// New correct constant
133134
String ALLOW_PARTIAL_PERIOD_INTEREST_CALCULATION_PARAM_NAME = "allowPartialPeriodInterestCalculation";
134135

136+
// Old typo constant — kept for compatibility
137+
@Deprecated
138+
String ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME = ALLOW_PARTIAL_PERIOD_INTEREST_CALCULATION_PARAM_NAME;
139+
135140
String CAN_USE_FOR_TOPUP = "canUseForTopup";
136141

137142
String IS_EQUAL_AMORTIZATION_PARAM = "isEqualAmortization";

0 commit comments

Comments
 (0)