Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion payguard-api-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<parent>
<groupId>dev.amg.payguard</groupId>
<artifactId>payguard</artifactId>
<artifactId>payguard-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

Expand Down
31 changes: 27 additions & 4 deletions payguard-collateral-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,30 @@

<parent>
<groupId>dev.amg.payguard</groupId>
<artifactId>payguard</artifactId>
<artifactId>payguard-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>payguard-collateral-service</artifactId>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc17</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>dev.amg.payguard</groupId>
<artifactId>payguard-shared</artifactId>
Expand All @@ -24,11 +41,17 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-kafka</artifactId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-oracle-xe</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
spring:
application:
name: payguard-collateral-service
datasource:
url: ${SPRING_DATASOURCE_URL}
username: ${SPRING_DATASOURCE_USERNAME}
password: ${SPRING_DATASOURCE_PASSWORD}
driver-class-name: oracle.jdbc.OracleDriver
jpa:
open-in-view: false
flyway:
enabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE collateral (id RAW(16) PRIMARY KEY, owner_token VARCHAR2(128) NOT NULL, loan_id RAW(16) NOT NULL, amount NUMBER(28,8) NOT NULL, asset_currency CHAR(3) NOT NULL, warning_ltv NUMBER(10,8) NOT NULL, margin_ltv NUMBER(10,8) NOT NULL, liquidation_ltv NUMBER(10,8) NOT NULL, status VARCHAR2(24) NOT NULL, version NUMBER(19) DEFAULT 0 NOT NULL, retention_until TIMESTAMP WITH TIME ZONE, created_at TIMESTAMP WITH TIME ZONE DEFAULT SYSTIMESTAMP NOT NULL);
CREATE INDEX ix_collateral_loan_status ON collateral(loan_id, status);
CREATE TABLE collateral_valuation (id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, collateral_id RAW(16) NOT NULL, asset_value NUMBER(28,8) NOT NULL, fx_rate NUMBER(28,12) NOT NULL, observed_at TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT fk_val_collateral FOREIGN KEY(collateral_id) REFERENCES collateral(id));
CREATE INDEX ix_collateral_val_time ON collateral_valuation(collateral_id, observed_at);
CREATE TABLE collateral_audit_log (id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, collateral_id RAW(16) NOT NULL, subject_token VARCHAR2(128), actor_token VARCHAR2(128), action VARCHAR2(64) NOT NULL, reason VARCHAR2(256), occurred_at TIMESTAMP WITH TIME ZONE DEFAULT SYSTIMESTAMP NOT NULL, previous_hash VARCHAR2(128), record_hash VARCHAR2(128) NOT NULL);
CREATE INDEX ix_collateral_audit_subject_time ON collateral_audit_log(subject_token, occurred_at);
CREATE TABLE collateral_processed_event (event_id RAW(16) NOT NULL, consumer_name VARCHAR2(128) NOT NULL, processed_at TIMESTAMP WITH TIME ZONE DEFAULT SYSTIMESTAMP NOT NULL, PRIMARY KEY(event_id, consumer_name));
CREATE TABLE collateral_outbox (id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, event_id RAW(16) UNIQUE NOT NULL, event_type VARCHAR2(128) NOT NULL, aggregate_id VARCHAR2(128) NOT NULL, payload CLOB NOT NULL, occurred_at TIMESTAMP WITH TIME ZONE NOT NULL, published_at TIMESTAMP WITH TIME ZONE);
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,33 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.containers.OracleContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

@SpringBootTest
@ActiveProfiles("test")
@Testcontainers
class CollateralServiceApplicationTests {

@Container
static final OracleContainer ORACLE =
new OracleContainer("gvenzl/oracle-xe:21-slim-faststart")
.withUsername("PAYGUARD_TEST")
.withPassword("payguard_test");

@DynamicPropertySource
static void oracleProperties(DynamicPropertyRegistry registry) {
registry.add("spring.datasource.url", ORACLE::getJdbcUrl);
registry.add("spring.datasource.username", ORACLE::getUsername);
registry.add("spring.datasource.password", ORACLE::getPassword);
registry.add("spring.datasource.driver-class-name", ORACLE::getDriverClassName);
registry.add("spring.jpa.database-platform", () -> "org.hibernate.dialect.OracleDialect");
}

@Test
void contextLoads() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
spring:
datasource:
# Replaced by CollateralServiceApplicationTests.oracleProperties at runtime.
url: ${TEST_ORACLE_JDBC_URL:jdbc:oracle:thin:@//localhost:1521/XEPDB1}
username: ${TEST_ORACLE_USERNAME:PAYGUARD_TEST}
password: ${TEST_ORACLE_PASSWORD:payguard_test}
driver-class-name: oracle.jdbc.OracleDriver
jpa:
database-platform: org.hibernate.dialect.OracleDialect
hibernate:
ddl-auto: none
open-in-view: false
flyway:
# Schema migrations are exercised independently; context tests only need
# the Oracle-backed JPA infrastructure to start.
enabled: false
25 changes: 24 additions & 1 deletion payguard-loan-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<parent>
<groupId>dev.amg.payguard</groupId>
<artifactId>payguard</artifactId>
<artifactId>payguard-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

Expand All @@ -26,11 +26,34 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc17</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-oracle-xe</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
9 changes: 9 additions & 0 deletions payguard-loan-service/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
spring:
application:
name: payguard-loan-service
datasource:
url: ${SPRING_DATASOURCE_URL}
username: ${SPRING_DATASOURCE_USERNAME}
password: ${SPRING_DATASOURCE_PASSWORD}
driver-class-name: oracle.jdbc.OracleDriver
jpa:
open-in-view: false
flyway:
enabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE loan_account (id RAW(16) PRIMARY KEY, borrower_token VARCHAR2(128) NOT NULL, collateral_id RAW(16) NOT NULL, principal NUMBER(28,8) NOT NULL, annual_rate NUMBER(20,12) NOT NULL, term_months NUMBER(5) NOT NULL, status VARCHAR2(24) NOT NULL, outstanding_principal NUMBER(28,8) NOT NULL, accrued_interest NUMBER(28,8) NOT NULL, last_accrual_date DATE NOT NULL, version NUMBER(19) DEFAULT 0 NOT NULL, retention_until TIMESTAMP WITH TIME ZONE, created_at TIMESTAMP WITH TIME ZONE DEFAULT SYSTIMESTAMP NOT NULL);
CREATE INDEX ix_loan_due ON loan_account(status, last_accrual_date);
CREATE TABLE loan_audit_log (id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, loan_id RAW(16) NOT NULL, subject_token VARCHAR2(128), actor_token VARCHAR2(128), action VARCHAR2(64) NOT NULL, reason VARCHAR2(256), occurred_at TIMESTAMP WITH TIME ZONE DEFAULT SYSTIMESTAMP NOT NULL, previous_hash VARCHAR2(128), record_hash VARCHAR2(128) NOT NULL);
CREATE INDEX ix_loan_audit_subject_time ON loan_audit_log(subject_token, occurred_at);
CREATE TABLE loan_processed_event (event_id RAW(16) NOT NULL, consumer_name VARCHAR2(128) NOT NULL, processed_at TIMESTAMP WITH TIME ZONE DEFAULT SYSTIMESTAMP NOT NULL, PRIMARY KEY(event_id, consumer_name));
CREATE TABLE loan_outbox (id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, event_id RAW(16) UNIQUE NOT NULL, event_type VARCHAR2(128) NOT NULL, aggregate_id VARCHAR2(128) NOT NULL, payload CLOB NOT NULL, occurred_at TIMESTAMP WITH TIME ZONE NOT NULL, published_at TIMESTAMP WITH TIME ZONE);
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,33 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.containers.OracleContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

@SpringBootTest
@ActiveProfiles("test")
@Testcontainers
class LoanServiceApplicationTests {

@Container
static final OracleContainer ORACLE =
new OracleContainer("gvenzl/oracle-xe:21-slim-faststart")
.withUsername("PAYGUARD_TEST")
.withPassword("payguard_test");

@DynamicPropertySource
static void oracleProperties(DynamicPropertyRegistry registry) {
registry.add("spring.datasource.url", ORACLE::getJdbcUrl);
registry.add("spring.datasource.username", ORACLE::getUsername);
registry.add("spring.datasource.password", ORACLE::getPassword);
registry.add("spring.datasource.driver-class-name", ORACLE::getDriverClassName);
registry.add("spring.jpa.database-platform", () -> "org.hibernate.dialect.OracleDialect");
}

@Test
void contextLoads() {}
}
16 changes: 16 additions & 0 deletions payguard-loan-service/src/test/resources/application-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
spring:
datasource:
# Replaced by LoanServiceApplicationTests.oracleProperties at runtime.
url: ${TEST_ORACLE_JDBC_URL:jdbc:oracle:thin:@//localhost:1521/XEPDB1}
username: ${TEST_ORACLE_USERNAME:PAYGUARD_TEST}
password: ${TEST_ORACLE_PASSWORD:payguard_test}
driver-class-name: oracle.jdbc.OracleDriver
jpa:
database-platform: org.hibernate.dialect.OracleDialect
hibernate:
ddl-auto: none
open-in-view: false
flyway:
# Schema migrations are exercised independently; context tests only need
# the Oracle-backed JPA infrastructure to start.
enabled: false
2 changes: 1 addition & 1 deletion payguard-proto/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<parent>
<groupId>dev.amg.payguard</groupId>
<artifactId>payguard</artifactId>
<artifactId>payguard-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion payguard-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.amg.payguard</groupId>
<artifactId>payguard</artifactId>
<artifactId>payguard-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion payguard-wallet-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.amg.payguard</groupId>
<artifactId>payguard</artifactId>
<artifactId>payguard-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>payguard-wallet-service</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions payguard-wallet-service/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ spring:
application:
name: wallet-service
datasource:
url: jdbc:oracle:thin:@localhost:${ORACLE_PORT:1521}/FREE
username: ${ORACLE_APP_USER:payguard_user}
password: ${ORACLE_APP_PASSWORD:payguard_pass}
url: ${SPRING_DATASOURCE_URL}
username: ${SPRING_DATASOURCE_USERNAME}
password: ${SPRING_DATASOURCE_PASSWORD}
driver-class-name: oracle.jdbc.OracleDriver
jooq:
sql-dialect: default
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>dev.amg.payguard</groupId>
<artifactId>payguard</artifactId>
<artifactId>payguard-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

Expand All @@ -24,7 +24,7 @@
<java.version>25</java.version>
<maven.compiler.release>25</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>4.0.1</spring-boot.version>
<spring-boot.version>4.1.1</spring-boot.version>
<grpc.version>1.68.0</grpc.version>
<protobuf.version>3.25.5</protobuf.version>
<jooq.version>3.19.15</jooq.version>
Expand Down
Loading