diff --git a/.env.example b/.env.example
index 6c0c3e7..2adc5c1 100644
--- a/.env.example
+++ b/.env.example
@@ -1,3 +1,15 @@
DEFAULT_LOGGING_LEVEL=info
APP_LOGGING_LEVEL=debug
-WEB_LOGGING_LEVEL=debug
\ No newline at end of file
+WEB_LOGGING_LEVEL=debug
+
+PM_ORACLE_HOST=localhost
+PM_ORACLE_PORT=1523
+PM_ORACLE_DATABASE_NAME=pm
+PM_ORACLE_USERNAME=test
+PM_ORACLE_PASSWORD=test
+
+MONGO_HOST="pagopa-ecommerce-mongo"
+MONGO_PORT=27017
+MONGO_USERNAME=admin
+MONGO_PASSWORD=password
+MONGO_SSL_ENABLED=false
\ No newline at end of file
diff --git a/README.md b/README.md
index 39e6fcc..071ec5e 100644
--- a/README.md
+++ b/README.md
@@ -63,13 +63,21 @@ to get a good default configuration.
If you want to customize the application environment, reference this table:
-| Variable name | Description | type | default |
-|-------------------|---------------------------------------------------------|-------------------|---------|
-| MONGO_HOST | Host where MongoDB instance used to persist wallet data | hostname (string) | |
-| MONGO_PORT | Port where MongoDB is bound to in MongoDB host | number | |
-| MONGO_USERNAME | MongoDB username used to connect to the database | string | |
-| MONGO_PASSWORD | MongoDB password used to connect to the database | string | |
-| MONGO_SSL_ENABLED | Whether SSL is enabled while connecting to MongoDB | string | |
+| Variable name | Description | type | default |
+|-------------------------|----------------------------------------------------|-------------------|---------|
+| DEFAULT_LOGGING_LEVEL | Default root application logging level | string | INFO |
+| APP_LOGGING_LEVEL | Application logging level | string | INFO |
+| WEB_LOGGING_LEVEL | Web logging level | string | INFO |
+| MONGO_HOST | MongoDB ecommerce hostname instance | hostname (string) | |
+| MONGO_PORT | Port where MongoDB is bound to in MongoDB host | number | |
+| MONGO_USERNAME | MongoDB username used to connect to the database | string | |
+| MONGO_PASSWORD | MongoDB password used to connect to the database | string | |
+| MONGO_SSL_ENABLED | Whether SSL is enabled while connecting to MongoDB | string | |
+| PM_ORACLE_HOST | PM Oracle DB hostname instance | hostname (string) | |
+| PM_ORACLE_PORT | PM Oracle DB port | int | |
+| PM_ORACLE_DATABASE_NAME | PM Oracle DB database name | string | |
+| PM_ORACLE_USERNAME | PM Oracle DB username | string | |
+| PM_ORACLE_PASSWORD | PM Oracle DB password | string | |
### Run docker container
diff --git a/build.gradle.kts b/build.gradle.kts
index 7931080..747ed56 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -71,6 +71,10 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("it.pagopa:pagopa-ecommerce-commons:$ecommerceCommonsVersion")
+ // oracle
+ implementation("com.oracle.database.jdbc:ojdbc11:23.2.0.0")
+ implementation("com.oracle.database.r2dbc:oracle-r2dbc:1.1.1")
+
// ECS logback encoder
implementation("co.elastic.logging:logback-ecs-encoder:$ecsLoggingVersion")
diff --git a/gradle.lockfile b/gradle.lockfile
index e5db65f..0723faa 100644
--- a/gradle.lockfile
+++ b/gradle.lockfile
@@ -74,6 +74,8 @@ com.nimbusds:content-type:2.1=compileClasspath,implementationDependenciesMetadat
com.nimbusds:lang-tag:1.5=compileClasspath,implementationDependenciesMetadata,productionRuntimeClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
com.nimbusds:nimbus-jose-jwt:9.9.3=compileClasspath,implementationDependenciesMetadata,productionRuntimeClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
com.nimbusds:oauth2-oidc-sdk:9.7=compileClasspath,implementationDependenciesMetadata,productionRuntimeClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+com.oracle.database.jdbc:ojdbc11:23.2.0.0=compileClasspath,implementationDependenciesMetadata,productionRuntimeClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+com.oracle.database.r2dbc:oracle-r2dbc:1.1.1=compileClasspath,implementationDependenciesMetadata,productionRuntimeClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
com.samskivert:jmustache:1.15=productionRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
com.squareup.okhttp3:mockwebserver:4.11.0=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
com.squareup.okhttp3:okhttp:4.10.0=productionRuntimeClasspath,runtimeClasspath
@@ -130,6 +132,7 @@ io.projectreactor.netty:reactor-netty-http:1.1.5=compileClasspath,implementation
io.projectreactor.netty:reactor-netty:1.1.5=compileClasspath,implementationDependenciesMetadata,productionRuntimeClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
io.projectreactor:reactor-core:3.5.4=compileClasspath,implementationDependenciesMetadata,productionRuntimeClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
io.projectreactor:reactor-test:3.5.4=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+io.r2dbc:r2dbc-spi:1.0.0.RELEASE=compileClasspath,implementationDependenciesMetadata,productionRuntimeClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
io.springfox:springfox-core:3.0.0=compileClasspath,implementationDependenciesMetadata,productionRuntimeClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
io.springfox:springfox-schema:3.0.0=compileClasspath,implementationDependenciesMetadata,productionRuntimeClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
io.springfox:springfox-spi:3.0.0=compileClasspath,implementationDependenciesMetadata,productionRuntimeClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index f021570..e71f2df 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -997,6 +997,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1674,6 +1690,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml
index f15997e..52205cc 100644
--- a/helm/values-dev.yaml
+++ b/helm/values-dev.yaml
@@ -34,9 +34,9 @@ microservice-chart:
servicePort: 8080
serviceAccount:
create: false
- annotations: {}
+ annotations: { }
name: ""
- podAnnotations: {}
+ podAnnotations: { }
podSecurityContext:
seccompProfile:
type: RuntimeDefault
@@ -71,13 +71,23 @@ microservice-chart:
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
+ PM_ORACLE_HOST: "10.70.73.22"
+ PM_ORACLE_PORT: "1523"
+ PM_ORACLE_DATABASE_NAME: "AGIDAD"
+ PM_ORACLE_USERNAME: "pagopa_SV"
+ MONGO_HOST: pagopa-d-weu-ecommerce-cosmos-account.mongo.cosmos.azure.com
+ MONGO_USERNAME: pagopa-d-weu-ecommerce-cosmos-account
+ MONGO_PORT: "10255"
+ MONGO_SSL_ENABLED: "true"
envSecret:
OTEL_EXPORTER_OTLP_HEADERS: elastic-otel-token-header
+ PM_ORACLE_PASSWORD: pm-oracle-db-password
+ MONGO_PASSWORD: mongo-ecommerce-password
keyvault:
name: "pagopa-d-ecommerce-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
- nodeSelector: {}
- tolerations: []
+ nodeSelector: { }
+ tolerations: [ ]
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml
index a3bc567..aeeade6 100644
--- a/helm/values-prod.yaml
+++ b/helm/values-prod.yaml
@@ -26,8 +26,18 @@ microservice-chart:
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
+ PM_ORACLE_HOST: ""
+ PM_ORACLE_PORT: ""
+ PM_ORACLE_DATABASE_NAME: ""
+ PM_ORACLE_USERNAME: ""
+ MONGO_HOST: pagopa-p-weu-ecommerce-cosmos-account.mongo.cosmos.azure.com
+ MONGO_USERNAME: pagopa-p-weu-ecommerce-cosmos-account
+ MONGO_PORT: "10255"
+ MONGO_SSL_ENABLED: "true"
envSecret:
OTEL_EXPORTER_OTLP_HEADERS: elastic-otel-token-header
+ PM_ORACLE_PASSWORD: pm-oracle-db-password
+ MONGO_PASSWORD: mongo-ecommerce-password
image:
repository: pagopapcommonacr.azurecr.io/pagopaecommercehelpdeskservice
tag: "0.0.0"
@@ -60,9 +70,9 @@ microservice-chart:
servicePort: 8080
serviceAccount:
create: false
- annotations: {}
+ annotations: { }
name: ""
- podAnnotations: {}
+ podAnnotations: { }
podSecurityContext:
seccompProfile:
type: RuntimeDefault
@@ -97,13 +107,23 @@ microservice-chart:
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
+ PM_ORACLE_HOST: ""
+ PM_ORACLE_PORT: ""
+ PM_ORACLE_DATABASE_NAME: ""
+ PM_ORACLE_USERNAME: ""
+ MONGO_HOST: pagopa-p-weu-ecommerce-cosmos-account.mongo.cosmos.azure.com
+ MONGO_USERNAME: pagopa-p-weu-ecommerce-cosmos-account
+ MONGO_PORT: "10255"
+ MONGO_SSL_ENABLED: "true"
envSecret:
OTEL_EXPORTER_OTLP_HEADERS: elastic-otel-token-header
+ PM_ORACLE_PASSWORD: pm-oracle-db-password
+ MONGO_PASSWORD: mongo-ecommerce-password
keyvault:
name: "pagopa-p-ecommerce-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
- nodeSelector: {}
- tolerations: []
+ nodeSelector: { }
+ tolerations: [ ]
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml
index 988321d..22def11 100644
--- a/helm/values-uat.yaml
+++ b/helm/values-uat.yaml
@@ -26,8 +26,18 @@ microservice-chart:
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
+ PM_ORACLE_HOST: "10.70.73.22"
+ PM_ORACLE_PORT: "1523"
+ PM_ORACLE_DATABASE_NAME: "AGIDAD"
+ PM_ORACLE_USERNAME: "pagopa_SV"
+ MONGO_HOST: pagopa-u-weu-ecommerce-cosmos-account.mongo.cosmos.azure.com
+ MONGO_USERNAME: pagopa-u-weu-ecommerce-cosmos-account
+ MONGO_PORT: "10255"
+ MONGO_SSL_ENABLED: "true"
envSecret:
OTEL_EXPORTER_OTLP_HEADERS: elastic-otel-token-header
+ PM_ORACLE_PASSWORD: pm-oracle-db-password
+ MONGO_PASSWORD: mongo-ecommerce-password
image:
repository: pagopaucommonacr.azurecr.io/pagopaecommercehelpdeskservice
tag: "0.0.0"
@@ -60,9 +70,9 @@ microservice-chart:
servicePort: 8080
serviceAccount:
create: false
- annotations: {}
+ annotations: { }
name: ""
- podAnnotations: {}
+ podAnnotations: { }
podSecurityContext:
seccompProfile:
type: RuntimeDefault
@@ -97,13 +107,23 @@ microservice-chart:
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
+ PM_ORACLE_HOST: "10.70.73.22"
+ PM_ORACLE_PORT: "1523"
+ PM_ORACLE_DATABASE_NAME: "AGIDAD"
+ PM_ORACLE_USERNAME: "pagopa_SV"
+ MONGO_HOST: pagopa-u-weu-ecommerce-cosmos-account.mongo.cosmos.azure.com
+ MONGO_USERNAME: pagopa-u-weu-ecommerce-cosmos-account
+ MONGO_PORT: "10255"
+ MONGO_SSL_ENABLED: "true"
envSecret:
OTEL_EXPORTER_OTLP_HEADERS: elastic-otel-token-header
+ PM_ORACLE_PASSWORD: pm-oracle-db-password
+ MONGO_PASSWORD: mongo-ecommerce-password
keyvault:
name: "pagopa-u-ecommerce-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
- nodeSelector: {}
- tolerations: []
+ nodeSelector: { }
+ tolerations: [ ]
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
diff --git a/src/main/kotlin/it/pagopa/ecommerce/helpdesk/configurations/OracleConfiguration.kt b/src/main/kotlin/it/pagopa/ecommerce/helpdesk/configurations/OracleConfiguration.kt
new file mode 100644
index 0000000..e988e42
--- /dev/null
+++ b/src/main/kotlin/it/pagopa/ecommerce/helpdesk/configurations/OracleConfiguration.kt
@@ -0,0 +1,32 @@
+package it.pagopa.ecommerce.helpdesk.configurations
+
+import io.r2dbc.spi.ConnectionFactories
+import io.r2dbc.spi.ConnectionFactory
+import io.r2dbc.spi.ConnectionFactoryOptions
+import java.nio.CharBuffer
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+
+@Configuration
+class OracleConfiguration {
+
+ @Bean
+ fun getPMConnectionFactory(
+ @Value("\${pm.oracle.host}") dbHost: String,
+ @Value("\${pm.oracle.port}") dbPort: Int,
+ @Value("\${pm.oracle.databaseName}") databaseName: String,
+ @Value("\${pm.oracle.userName}") username: String,
+ @Value("\${pm.oracle.password}") password: String
+ ): ConnectionFactory =
+ ConnectionFactories.get(
+ ConnectionFactoryOptions.builder()
+ .option(ConnectionFactoryOptions.DRIVER, "oracle")
+ .option(ConnectionFactoryOptions.HOST, dbHost)
+ .option(ConnectionFactoryOptions.PORT, dbPort)
+ .option(ConnectionFactoryOptions.DATABASE, databaseName)
+ .option(ConnectionFactoryOptions.USER, username)
+ .option(ConnectionFactoryOptions.PASSWORD, CharBuffer.wrap(password))
+ .build()
+ )
+}
diff --git a/src/main/kotlin/it/pagopa/ecommerce/helpdesk/services/EcommerceService.kt b/src/main/kotlin/it/pagopa/ecommerce/helpdesk/services/EcommerceService.kt
index 21dc39b..da46231 100644
--- a/src/main/kotlin/it/pagopa/ecommerce/helpdesk/services/EcommerceService.kt
+++ b/src/main/kotlin/it/pagopa/ecommerce/helpdesk/services/EcommerceService.kt
@@ -1,5 +1,6 @@
package it.pagopa.ecommerce.helpdesk.services
+import it.pagopa.ecommerce.commons.documents.v1.TransactionActivatedEvent
import it.pagopa.generated.ecommerce.helpdesk.model.*
import java.time.OffsetDateTime
import org.slf4j.LoggerFactory
@@ -18,7 +19,11 @@ class EcommerceService {
): Mono {
logger.info("[helpDesk ecommerce service] searchTransaction method")
return ecommerceSearchTransactionRequestDto
- .doOnNext { logger.info("Search type: ${it.type}") }
+ .doOnNext {
+ logger.info("Search type: ${it.type}")
+ val transactionEvent = TransactionActivatedEvent()
+ println(transactionEvent)
+ }
.map {
SearchTransactionResponseDto()
.page(PageInfoDto().current(0).results(3).total(1))
diff --git a/src/main/kotlin/it/pagopa/ecommerce/helpdesk/services/PmService.kt b/src/main/kotlin/it/pagopa/ecommerce/helpdesk/services/PmService.kt
index aebf1a4..6b0f375 100644
--- a/src/main/kotlin/it/pagopa/ecommerce/helpdesk/services/PmService.kt
+++ b/src/main/kotlin/it/pagopa/ecommerce/helpdesk/services/PmService.kt
@@ -1,13 +1,16 @@
package it.pagopa.ecommerce.helpdesk.services
+import io.r2dbc.spi.ConnectionFactory
import it.pagopa.generated.ecommerce.helpdesk.model.*
import java.time.OffsetDateTime
import org.slf4j.LoggerFactory
+import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
+import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
@Service
-class PmService {
+class PmService(@Autowired val connectionFactory: ConnectionFactory) {
private val logger = LoggerFactory.getLogger(javaClass)
@@ -17,67 +20,30 @@ class PmService {
pmSearchTransactionRequestDto: Mono
): Mono {
logger.info("[helpDesk pm service] searchTransaction method")
+
return pmSearchTransactionRequestDto
.doOnNext { logger.info("Search type: ${it.type}") }
+ .flatMapMany {
+ Flux.usingWhen(
+ connectionFactory.create(),
+ { connection ->
+ Flux.from(
+ connection
+ .createStatement("SELECT 'Hello, Oracle' FROM sys.dual")
+ .execute()
+ )
+ .flatMap { result -> result.map { row -> row[0, String::class.java] } }
+ .doOnNext { logger.info("Read from DB: $it") }
+ },
+ { it.close() }
+ )
+ }
+ .collectList()
.map {
SearchTransactionResponseDto()
.page(PageInfoDto().current(0).results(3).total(1))
.transactions(
listOf(
- TransactionResultDto()
- .product(ProductDto.PM)
- .transactionInfo(
- TransactionInfoDto()
- .amount(100)
- .fee(100)
- .creationDate(OffsetDateTime.now())
- .status("TEST")
- .grandTotal(200)
- )
- .paymentDetailInfo(
- PaymentDetailInfoDto()
- .paymentContextCode("paymentContextCode")
- .amount(100)
- .iuv("IUV")
- .creditorInstitution("creditor institution")
- .paFiscalCode("77777777777")
- )
- .paymentInfo(
- PaymentInfoDto().amount(100).origin("origin").subject("subject")
- )
- .pspInfo(
- PspInfoDto()
- .pspId("pspId")
- .businessName("business name")
- .idChannel("id channel")
- ),
- TransactionResultDto()
- .product(ProductDto.PM)
- .transactionInfo(
- TransactionInfoDto()
- .amount(100)
- .fee(100)
- .creationDate(OffsetDateTime.now())
- .status("TEST")
- .grandTotal(200)
- )
- .paymentDetailInfo(
- PaymentDetailInfoDto()
- .paymentContextCode("paymentContextCode")
- .amount(100)
- .iuv("IUV")
- .creditorInstitution("creditor institution")
- .paFiscalCode("77777777777")
- )
- .paymentInfo(
- PaymentInfoDto().amount(100).origin("origin").subject("subject")
- )
- .pspInfo(
- PspInfoDto()
- .pspId("pspId")
- .businessName("business name")
- .idChannel("id channel")
- ),
TransactionResultDto()
.product(ProductDto.PM)
.transactionInfo(
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 1654e48..82b2685 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -15,4 +15,13 @@ logging.level.root=\${DEFAULT_LOGGING_LEVEL:INFO}
logging.level.it.pagopa=\${APP_LOGGING_LEVEL:INFO}
logging.level.web=\${WEB_LOGGING_LEVEL:info}
# disable null values serialization
-spring.jackson.default-property-inclusion=NON_NULL
\ No newline at end of file
+spring.jackson.default-property-inclusion=NON_NULL
+#PM Oracle database configuration
+pm.oracle.host=\${PM_ORACLE_HOST}
+pm.oracle.port=\${PM_ORACLE_PORT}
+pm.oracle.databaseName=\${PM_ORACLE_DATABASE_NAME}
+pm.oracle.userName=\${PM_ORACLE_USERNAME}
+pm.oracle.password=\${PM_ORACLE_PASSWORD}
+#Ecommerce mongo database configuration
+spring.data.mongodb.uri=mongodb://\${MONGO_USERNAME}:\${MONGO_PASSWORD}@\${MONGO_HOST}:\${MONGO_PORT}/?ssl=\${MONGO_SSL_ENABLED}&readPreference=secondaryPreferred&maxStalenessSeconds=3600
+spring.data.mongodb.database=ecommerce
\ No newline at end of file
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
index c27d58d..0e37c7a 100644
--- a/src/test/resources/application.properties
+++ b/src/test/resources/application.properties
@@ -15,3 +15,12 @@ logging.level.it.pagopa=${APP_LOGGING_LEVEL:INFO}
logging.level.web=${WEB_LOGGING_LEVEL:info}
# disable null values serialization
spring.jackson.default-property-inclusion=NON_NULL
+#PM Oracle database configuration
+pm.oracle.host=127.0.0.1
+pm.oracle.port=1523
+pm.oracle.databaseName=pm
+pm.oracle.userName=test
+pm.oracle.password=test
+#Ecommerce mongo database configuration
+spring.data.mongodb.uri=mongodb://mongo:mongo@$mongo:6080/?ssl=true&replicaSet=globaldb
+spring.data.mongodb.database=ecommerce
\ No newline at end of file