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: 2 additions & 0 deletions accountant/accountant-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,5 @@ app:
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}
2 changes: 2 additions & 0 deletions api/api-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ app:
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}
api:
crypto:
key: ${api_crypto_key:0e1fd29572ec8c85970d76e3433e96ee}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,6 @@ app:
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}
pre-auth-client-secret: ${PRE_AUTH_CLIENT_SECRET}
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,5 @@ app:
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}
2 changes: 2 additions & 0 deletions bc-gateway/bc-gateway-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ app:
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}
swagger:
authUrl: ${SWAGGER_AUTH_URL:https://api.opex.dev/auth}/realms/opex/protocol/openid-connect/token}

Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class CurrencyHandlerImplV2(
return@executeAndAwait null
}

if (!request.depositDescription.isNullOrEmpty() && !request.withdrawDescription.isNullOrEmpty()) {
if (!request.depositDescription.isNullOrEmpty() || !request.withdrawDescription.isNullOrEmpty()) {
currencyOnChainGatewayLocalizationRepository.save(
CurrencyOnChainGatewayLocalizationModel(
gatewayId = gateway.id!!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ package co.nilin.opex.common.proxy

import co.nilin.opex.common.config.CommonWebClient
import co.nilin.opex.common.data.MessageTranslation
import co.nilin.opex.common.utils.typeRef
import kotlinx.coroutines.reactive.awaitFirst
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.core.ParameterizedTypeReference
import org.springframework.stereotype.Component


@Component
@ConditionalOnProperty(name = ["app.custom-message.enabled"], havingValue = "true", matchIfMissing = false)
class CustomMessageClient(
@Qualifier("CommonWebClient") private val webClient: CommonWebClient
@Qualifier("CommonWebClient") private val webClient: CommonWebClient
) {
@Value("\${app.custom-message.base-url}")
private lateinit var customMessageBaseUrl: String
Expand All @@ -22,9 +22,9 @@ class CustomMessageClient(
it.queryParam("last-update", lastUpdate)
it.build()
}.retrieve()
.onStatus({ t -> t.isError }, { it.createException() })
.bodyToMono(typeRef<List<MessageTranslation>>())
.log()
.awaitFirst()
.onStatus({ t -> t.isError }, { it.createException() })
.bodyToMono(typeRef<List<MessageTranslation>>())
.log()
.awaitFirst()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ package co.nilin.opex.common.proxy

import co.nilin.opex.common.config.CommonWebClient
import co.nilin.opex.common.data.WebConfig
import co.nilin.opex.common.utils.typeRef
import kotlinx.coroutines.reactive.awaitFirst
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.core.ParameterizedTypeReference
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.stereotype.Component

inline fun <reified T : Any?> typeRef(): ParameterizedTypeReference<T> = object : ParameterizedTypeReference<T>() {}

@Component
class ConfigClient(
@ConditionalOnProperty(name = ["app.custom-user-language.enabled"], havingValue = "true", matchIfMissing = false)
class CustomUserLanguageClient(
@Qualifier("CommonWebClient") private val webClient: CommonWebClient
) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package co.nilin.opex.common.service

import co.nilin.opex.common.data.WebConfig
import co.nilin.opex.common.proxy.ConfigClient
import co.nilin.opex.common.proxy.CustomUserLanguageClient
import kotlinx.coroutines.runBlocking
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.stereotype.Service

Expand All @@ -11,9 +12,10 @@ object GlobalWebConfigCache {
var webConfig: WebConfig? = null
}

@ConditionalOnProperty(name = ["app.custom-user-language.enabled"], havingValue = "true", matchIfMissing = false)
@Service
class WebConfigService(
private val configClient: ConfigClient,
private val configClient: CustomUserLanguageClient,
) {

@Scheduled(fixedDelay = 5 * 60 * 1000)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package co.nilin.opex.common.utils

import org.springframework.core.ParameterizedTypeReference

inline fun <reified T : Any?> typeRef(): ParameterizedTypeReference<T> = object : ParameterizedTypeReference<T>() {}
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,9 @@ app:
url: lb://opex-auth
cert-url: http://keycloak:8080/realms/opex/protocol/openid-connect/certs
client-id: none
client-secret: none
client-secret: none
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}
2 changes: 2 additions & 0 deletions docker-compose-otc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ services:
- AUTH_JWK_ENDPOINT=${JWK_ENDPOINT}
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
Expand Down Expand Up @@ -99,6 +100,7 @@ services:
- OMNI_URL=${OMNI_URL}
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
Expand Down
36 changes: 36 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ services:
- SWAGGER_AUTH_URL=$KEYCLOAK_FRONTEND_URL
- TRADE_VOLUME_CALCULATION_CURRENCY=${TRADE_VOLUME_CALCULATION_CURRENCY}
- WITHDRAW_VOLUME_CALCULATION_CURRENCY=${WITHDRAW_VOLUME_CALCULATION_CURRENCY}
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
networks:
- default
depends_on:
Expand Down Expand Up @@ -310,6 +313,9 @@ services:
- KAFKA_IP_PORT=kafka-1:29092,kafka-2:29092,kafka-3:29092
- REDIS_HOST=redis
- SYMBOLS=BTC_USDT,ETH_USDT,BTC_IRT,ETH_IRT,USDT_IRT,ETH_BUSD,BTC_BUSD,BNB_BUSD
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
networks:
- default
depends_on:
Expand All @@ -329,6 +335,9 @@ services:
- KAFKA_IP_PORT=kafka-1:29092,kafka-2:29092,kafka-3:29092
- REDIS_HOST=redis-duo
- SYMBOLS=SOL_USDT,DOGE_USDT,TON_USDT
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
networks:
- default
depends_on:
Expand All @@ -352,6 +361,9 @@ services:
- VAULT_HOST=vault
- SYMBOLS=BTC_USDT,ETH_USDT,BTC_IRT,ETH_IRT,USDT_IRT,ETH_BUSD,BTC_BUSD,BNB_BUSD
- TOKEN_ISSUER_URL=${KC_ISSUER_URL}
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
networks:
- default
depends_on:
Expand Down Expand Up @@ -407,6 +419,9 @@ services:
- PRE_AUTH_CLIENT_SECRET=${KC_PRE_AUTH_CLIENT_SECRET}
- TOKEN_ISSUER_URL=${KC_ISSUER_URL}
- CAPTCHA_ENABLED=${CAPTCHA_ENABLED}
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
volumes:
- auth-gateway-keys:/app/keys
depends_on:
Expand Down Expand Up @@ -438,6 +453,9 @@ services:
- WITHDRAW_BANK_ACCOUNT_VALIDATION=${WITHDRAW_BANK_ACCOUNT_VALIDATION}
- TOTAL_ASSET_CALCULATION_CURRENCY=${TOTAL_ASSET_CALCULATION_CURRENCY}
- TOKEN_ISSUER_URL=${KC_ISSUER_URL}
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
depends_on:
- kafka-1
- kafka-2
Expand All @@ -463,6 +481,9 @@ services:
- VAULT_HOST=vault
- SWAGGER_AUTH_URL=$KEYCLOAK_FRONTEND_URL
- TOKEN_ISSUER_URL=${KC_ISSUER_URL}
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
depends_on:
- kafka-1
- kafka-2
Expand Down Expand Up @@ -493,6 +514,9 @@ services:
- TOTAL_ASSET_CALCULATION_CURRENCY=${TOTAL_ASSET_CALCULATION_CURRENCY}
- TOKEN_ISSUER_URL=${KC_ISSUER_URL}
- APP_BASE_URL=${APP_BASE_URL}
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
depends_on:
- consul
- vault
Expand All @@ -516,6 +540,9 @@ services:
- SWAGGER_AUTH_URL=$KEYCLOAK_FRONTEND_URL
- ADDRESS_EXP_TIME=100
- TOKEN_ISSUER_URL=${KC_ISSUER_URL}
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
depends_on:
- kafka-1
- kafka-2
Expand Down Expand Up @@ -551,6 +578,9 @@ services:
- SMTP_PROXY_ENABLED=${SMTP_PROXY_ENABLED}
- TOKEN_ISSUER_URL=${KC_ISSUER_URL}
- OTP_CODE_RESPONSE_ENABLED=${OTP_CODE_RESPONSE_ENABLED}
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
depends_on:
- consul
- postgres-otp
Expand Down Expand Up @@ -579,6 +609,9 @@ services:
- TOKEN_ISSUER_URL=${KC_ISSUER_URL}
- MOBILE_IDENTITY_INQUIRY=${MOBILE_IDENTITY_INQUIRY}
- PERSONAL_IDENTITY_INQUIRY=${PERSONAL_IDENTITY_INQUIRY}
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
depends_on:
- kafka-1
- kafka-2
Expand All @@ -603,6 +636,9 @@ services:
- BACKEND_USER=${BACKEND_USER}
- VAULT_HOST=vault
- SWAGGER_AUTH_URL=$KEYCLOAK_FRONTEND_URL
- CUSTOM_MESSAGE_URL=${CUSTOM_MESSAGE_URL}
- CUSTOM_MESSAGE_ENABLED=${CUSTOM_MESSAGE_ENABLED}
- CUSTOM_USER_LANGUAGE_ENABLED=${CUSTOM_USER_LANGUAGE_ENABLED}
depends_on:
- kafka-1
- kafka-2
Expand Down
2 changes: 2 additions & 0 deletions market/market-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,7 @@ app:
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}
swagger:
authUrl: ${SWAGGER_AUTH_URL:https://api.opex.dev/auth}/realms/opex/protocol/openid-connect/token}
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ app:
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ app:
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}
swagger:
authUrl: ${SWAGGER_AUTH_URL:https://api.opex.dev/auth}/realms/opex/protocol/openid-connect/token}

Expand Down
2 changes: 2 additions & 0 deletions otp/otp-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ otp:
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}
2 changes: 2 additions & 0 deletions profile/profile-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ app:
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}

management:
endpoints:
Expand Down
2 changes: 2 additions & 0 deletions wallet/wallet-app/src/main/resources/application-otc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ app:
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}
logging:
level:
root: INFO
Expand Down
2 changes: 2 additions & 0 deletions wallet/wallet-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ app:
custom-message:
enabled: ${CUSTOM_MESSAGE_ENABLED:false}
base-url: ${CUSTOM_MESSAGE_URL}
custom-user-language:
enabled: ${CUSTOM_USER_LANGUAGE_ENABLED:false}
logging:
level:
root: INFO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ interface OffChainGatewayRepository : ReactiveCrudRepository<OffChainGatewayMode
gl.withdraw_description,
g.display_order
from currency_off_chain_gateway g
left join currency_off_chain_gateway_localization gl on g.id = gl.gateway_id and gl.language = :lang
left join currency_off_chain_gateway_localization gl on g.id = gl.gateway_id and gl.language = :language
where g.currency_symbol = :currencySymbol and g.gateway_uuid = :gatewayUuid
""")
fun findByGatewayUuidAndCurrencySymbol(
uuid: String,
symbol: String,
gatewayUuid: String,
currencySymbol: String,
language: String? = UserLanguage.getDefaultLanguage()
): Mono<OffChainGatewayView>?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class OffChainGatewayManagerImpl(
val gateway = offChainGatewayRepository.save(input.toModel()).awaitFirstOrNull()
?: throw OpexError.BadRequest.exception("Error in saving gateway")

if (!currencyGateway.depositDescription.isNullOrEmpty() && !currencyGateway.withdrawDescription.isNullOrEmpty()) {
if (!currencyGateway.depositDescription.isNullOrEmpty() || !currencyGateway.withdrawDescription.isNullOrEmpty()) {
offChainGatewayLocalizationRepository.save(
OffChainGatewayLocalizationModel(
gatewayId = gateway.id!!,
Expand Down
Loading