Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
ec5c7ec
Add referral module structure
ebrahimmfadae Dec 5, 2021
6414eea
Add spring dependency
ebrahimmfadae Dec 5, 2021
36c827e
Add referral application entrance
ebrahimmfadae Dec 5, 2021
3dcc574
Add database structure
ebrahimmfadae Dec 6, 2021
e347f23
Add kafka event listener
ebrahimmfadae Dec 6, 2021
7a49d79
Add spring config
ebrahimmfadae Dec 6, 2021
94f7ea1
Add docker file
ebrahimmfadae Dec 6, 2021
d0fe403
Add event listener module
ebrahimmfadae Dec 7, 2021
c9fb3fa
Add referral service to docker compose
ebrahimmfadae Dec 7, 2021
d26feb6
Fix spring data source config
ebrahimmfadae Dec 7, 2021
89307a8
Add kafka event listener base structure
ebrahimmfadae Dec 7, 2021
fb065cb
Update CommissionReward.kt
ebrahimmfadae Dec 8, 2021
d9661ea
Add referral model
ebrahimmfadae Dec 8, 2021
f6f54e8
Add referral dao classes
ebrahimmfadae Dec 8, 2021
48cc706
Add database schema
ebrahimmfadae Dec 8, 2021
6b84669
Update core spis
ebrahimmfadae Dec 8, 2021
5c940c1
Add commission reward calculator service
ebrahimmfadae Dec 8, 2021
bec2aa7
Add uuid to referral table
ebrahimmfadae Dec 8, 2021
4b88d4c
Add config handler
ebrahimmfadae Dec 8, 2021
6ebb0c3
Update ReferralHandler.kt
ebrahimmfadae Dec 8, 2021
685f4b2
Update referrals table name
ebrahimmfadae Dec 8, 2021
6f91a3d
Implement commission calculator
ebrahimmfadae Dec 8, 2021
c50955f
Fix app config
ebrahimmfadae Dec 11, 2021
8b84e7d
Add commission reward persister base structure
ebrahimmfadae Dec 11, 2021
af21f43
Fix referral dependency issues
ebrahimmfadae Dec 11, 2021
d17ab94
Fix kafka issues
ebrahimmfadae Dec 11, 2021
d6017f2
Add referral base controller
ebrahimmfadae Dec 11, 2021
1fae9ca
Update referral code handler
ebrahimmfadae Dec 11, 2021
b56d0e8
Implement referral controller members
ebrahimmfadae Dec 12, 2021
e46016c
Implement referral code handler methods
ebrahimmfadae Dec 12, 2021
c8b4b0f
Add referent table
ebrahimmfadae Dec 13, 2021
e2ee20b
Implement referral code generator
ebrahimmfadae Dec 13, 2021
aeca4f7
Add commission controller
ebrahimmfadae Dec 13, 2021
720adde
Fix controller attributes
ebrahimmfadae Dec 13, 2021
b53528c
Improve referral controller
ebrahimmfadae Dec 13, 2021
338e068
Update referral controllers
ebrahimmfadae Dec 13, 2021
315e273
Fix referral code handler db functions
ebrahimmfadae Dec 13, 2021
1064026
Fix referral controller validations
ebrahimmfadae Dec 13, 2021
dc2ea54
Update referral code usage in code
ebrahimmfadae Dec 13, 2021
b8160a8
Implement commission reward controller
ebrahimmfadae Dec 14, 2021
e9af420
Refactor commission controller
ebrahimmfadae Dec 14, 2021
25142bb
Fix commission reward projection issue
ebrahimmfadae Dec 14, 2021
57b9c8b
Implement config handler
ebrahimmfadae Dec 14, 2021
7b1826a
Fix referral code handler
ebrahimmfadae Dec 14, 2021
f0e130f
Add commission rewards table schema
ebrahimmfadae Dec 14, 2021
b4360bb
Update referral object
ebrahimmfadae Dec 15, 2021
5cc7dc6
Rename referral to reference
ebrahimmfadae Dec 18, 2021
1b01b6d
Remove ineffective launch methods in referral listener
ebrahimmfadae Dec 18, 2021
184b927
Fix referral persister
ebrahimmfadae Dec 18, 2021
07cd8f4
Fix commission controller
ebrahimmfadae Dec 18, 2021
cdda03d
Add referral to nginx.conf
ebrahimmfadae Dec 18, 2021
e55eab8
Fix database schema
ebrahimmfadae Dec 19, 2021
86dac7d
Add security config
ebrahimmfadae Dec 19, 2021
66718e7
Fix referral controllers
ebrahimmfadae Dec 19, 2021
7a2f590
Refactor referral code entity
ebrahimmfadae Dec 19, 2021
0a568f1
Fix commission controller
ebrahimmfadae Dec 19, 2021
d8f3409
Implement commission persister
ebrahimmfadae Dec 19, 2021
4ce2deb
Fix not assigned referral codes
ebrahimmfadae Dec 19, 2021
eb1010b
Rename references table
ebrahimmfadae Dec 19, 2021
5f4078a
Add rest config
ebrahimmfadae Dec 20, 2021
59f21bb
Fix commission rewards
ebrahimmfadae Dec 20, 2021
89ad86f
Refactor reference entity
ebrahimmfadae Dec 20, 2021
7161e7b
Fix referral issues
ebrahimmfadae Dec 20, 2021
f80b4fc
Improve CommissionController.kt
ebrahimmfadae Dec 21, 2021
012f2ec
Add report controller
ebrahimmfadae Dec 21, 2021
901c0cd
Remove referent share from report
ebrahimmfadae Dec 21, 2021
cb22a49
Improve referral code controller
ebrahimmfadae Dec 21, 2021
2faf467
Refactor referral controllers
ebrahimmfadae Dec 21, 2021
68dcaf1
Fix report controller
ebrahimmfadae Dec 21, 2021
a5cd2d8
Fix table schema of commission reward
ebrahimmfadae Dec 22, 2021
be4b197
Add payment records entity to database
ebrahimmfadae Dec 22, 2021
cc8acd5
Add commission reward insert trigger
ebrahimmfadae Dec 25, 2021
f00d9c4
Add payment_status initial data
ebrahimmfadae Dec 25, 2021
7180424
Add payment handler
ebrahimmfadae Dec 26, 2021
ed4df9f
Merge branch 'dev' into issues/161/add-referral-module
ebrahimmfadae Dec 26, 2021
4ede6fe
Add referral loop checking
ebrahimmfadae Dec 27, 2021
543d7b3
Add mocked symbol price calculator interface
ebrahimmfadae Dec 27, 2021
eb0a288
Refactor schema.sql
ebrahimmfadae Dec 29, 2021
4bbaa5c
Redesign commission reward entity
ebrahimmfadae Dec 29, 2021
2dc9642
Add checkout handler initial implementation
ebrahimmfadae Jan 1, 2022
d9acb06
Add wallet proxy module
ebrahimmfadae Jan 2, 2022
507c9ad
Implement checkout handler
ebrahimmfadae Jan 2, 2022
6dc9704
Fix system wallet type for checkout
ebrahimmfadae Jan 3, 2022
26801fa
Add checkout controller
ebrahimmfadae Jan 3, 2022
934a352
Fix runtime issues
ebrahimmfadae Jan 3, 2022
75721ab
Fix commission reward date issues
ebrahimmfadae Jan 3, 2022
a1f9a39
Fix payment record schema
ebrahimmfadae Jan 3, 2022
5643217
Fix payment status initial data
ebrahimmfadae Jan 4, 2022
38e5a7c
Fix find payments query
ebrahimmfadae Jan 4, 2022
6ae51de
Fix update payment status queries
ebrahimmfadae Jan 4, 2022
f87a4a5
Fix commission reward id mapping issue
ebrahimmfadae Jan 4, 2022
336ef57
Fix transfer reference issue in wallet
ebrahimmfadae Jan 4, 2022
4575468
Add security contexts
ebrahimmfadae Jan 4, 2022
cea14de
Add real time checkouts
ebrahimmfadae Jan 4, 2022
310fa4e
Add payment schedule
ebrahimmfadae Jan 4, 2022
9918669
Add payment window to config
ebrahimmfadae Jan 4, 2022
0d1288b
Improve report controller
ebrahimmfadae Jan 5, 2022
8e62d0a
Add referral code unique index
ebrahimmfadae Jan 5, 2022
2acde3c
Refactor payment currency logic
ebrahimmfadae Jan 5, 2022
51350d0
Rename payment to checkout
ebrahimmfadae Jan 5, 2022
4c74960
Fix data init script
ebrahimmfadae Jan 5, 2022
bc40a7d
Fix table names
ebrahimmfadae Jan 5, 2022
b05fc64
Rename commission reward id
ebrahimmfadae Jan 5, 2022
5f6157b
Rename payment handler
ebrahimmfadae Jan 5, 2022
d22eaa8
Rename payment schedule
ebrahimmfadae Jan 5, 2022
20f11e6
Fix database schema bugs
ebrahimmfadae Jan 8, 2022
7fe2c7e
Add error handling for important parts
ebrahimmfadae Jan 8, 2022
ef1cc4a
Fix referral controller error handlers
ebrahimmfadae Jan 8, 2022
e093e07
Fix checkout time calculation
ebrahimmfadae Jan 8, 2022
25303f0
Fix ReferralCodeHandlerImpl.kt exceptions
ebrahimmfadae Jan 8, 2022
03ff762
Add accountant proxy to referral module
ebrahimmfadae Jan 15, 2022
1eeff0c
Fix postgres referral port conflict
ebrahimmfadae Jan 15, 2022
b70e453
Add symbol calculator to accountant proxy
ebrahimmfadae Jan 15, 2022
fe1f9d6
Fix symbol calculator
ebrahimmfadae Jan 15, 2022
a035587
Set initial pairConfig.rate to 0
ebrahimmfadae Jan 16, 2022
dc7699c
Add storage module's volume
ebrahimmfadae Jan 16, 2022
06abcf1
Merge branch 'dev' into issues/161/add-referral-module
ebrahimmfadae Feb 16, 2022
5b93c09
Merge branch 'dev' into issues/161/add-referral-module
ebrahimmfadae Feb 26, 2022
d786da7
Merge branch 'dev' into issues/161/add-referral-module
ebrahimmfadae Feb 26, 2022
2063981
referral: Use last price instead of static rate in SymbolPriceCalcula…
ebrahimmfadae Feb 26, 2022
8fa4aa6
referral: Update Dockerfile
ebrahimmfadae Feb 26, 2022
0a5dd2c
referral: Cleanup maven configs
ebrahimmfadae Feb 27, 2022
c792a1e
referral: Fix build issues
ebrahimmfadae Feb 27, 2022
a491928
referral: Add vault and docker-compose config
ebrahimmfadae Feb 27, 2022
d674000
referral: Expose database ports
ebrahimmfadae Feb 27, 2022
e1ab6b5
docker-compose: Refactor service dependencies
ebrahimmfadae Feb 27, 2022
1a5b520
redis: Remove redundant redis configs
ebrahimmfadae Feb 27, 2022
5affefa
consul: Fix matching-gateway address
ebrahimmfadae Feb 27, 2022
221dbd6
bc-gateway: Fix chain scan gateway address
ebrahimmfadae Feb 27, 2022
cc3b4fd
referral: Add accountant proxy dependency
ebrahimmfadae Feb 27, 2022
74843ad
referral: Fix create trigger statement
ebrahimmfadae Feb 27, 2022
fcf1e8c
vault: Fix chain-scan-gateway name
ebrahimmfadae Feb 27, 2022
3ffc103
referral: Enable allow-circular-references
ebrahimmfadae Feb 27, 2022
768f24e
bc-gateway: Add bsc to chains
ebrahimmfadae Feb 27, 2022
4831a9d
docker-compose: Add missing auth in depends_on fields
ebrahimmfadae Feb 27, 2022
a8152fe
bc-gateway: Fix chain_endpoints schema
ebrahimmfadae Feb 27, 2022
06cfd20
bc-gateway: Fix web client
ebrahimmfadae Feb 27, 2022
c98c5b6
bc-gateway: Fix security configs
ebrahimmfadae Feb 27, 2022
4553b1f
referral: Add postgres version fix
ebrahimmfadae Feb 27, 2022
5728b13
referral: Enable security config
ebrahimmfadae Feb 27, 2022
58327fb
referral: Disable authorization for public routes
ebrahimmfadae Feb 28, 2022
2e5ec66
referral: Fix authorization in security config
ebrahimmfadae Feb 28, 2022
9ae8e7f
referral: Remove `No referral entity found` exception in calculate()
ebrahimmfadae Feb 28, 2022
b35af94
referral: Fix id issue and increase referral code range
ebrahimmfadae Feb 28, 2022
027f0cf
referral: Add get my referral codes controller
ebrahimmfadae Feb 28, 2022
f279fa7
referral: Restrict getting references to admin only
ebrahimmfadae Feb 28, 2022
b0fae96
referral: Replace accountant proxy with api proxy
ebrahimmfadae Feb 28, 2022
e88c3b4
referral: Fix same asset fee bug
ebrahimmfadae Feb 28, 2022
3178361
referral: Fix findByReferrerUuid()
ebrahimmfadae Feb 28, 2022
659677e
referral: Rename referral-accountant-proxy to referral-api-proxy
ebrahimmfadae Feb 28, 2022
b95efa1
referral: Add maximum referral code limit
ebrahimmfadae Feb 28, 2022
89f854c
referral: Fix maximum referral code limit condition
ebrahimmfadae Feb 28, 2022
4b8c026
referral: Add swagger
ebrahimmfadae Mar 2, 2022
000865a
storage: Fix swagger
ebrahimmfadae Mar 2, 2022
90e4b79
springfox: Fix configurations
ebrahimmfadae Mar 2, 2022
3b610ef
referral: Add api doc to referral controller
ebrahimmfadae Mar 2, 2022
9798715
referral: Add api doc to commission controller
ebrahimmfadae Mar 2, 2022
210fcae
referral: Add api doc to report controller
ebrahimmfadae Mar 2, 2022
9cedfd3
referral: Add api doc to checkout controller
ebrahimmfadae Mar 2, 2022
fa4e995
springfox: Remove redundant @EnableSwagger2
ebrahimmfadae Mar 2, 2022
0138f94
referral: Fix checkout controller doc
ebrahimmfadae Mar 2, 2022
a52588d
referral: Fix commission controller doc
ebrahimmfadae Mar 2, 2022
8bc449a
referral: Fix referral controller doc
ebrahimmfadae Mar 2, 2022
e1c77d0
referral: Fix report controller doc
ebrahimmfadae Mar 2, 2022
de2ab1d
referral: Refactor referral controller doc
ebrahimmfadae Mar 3, 2022
753a7d2
referral: Explicitly determine required fields
ebrahimmfadae Mar 3, 2022
769cbd2
referral: Refactor reports controller
ebrahimmfadae Mar 3, 2022
5253173
referral: Refactor commissions controller
ebrahimmfadae Mar 3, 2022
6fc3f94
referral: Remove extra constraints from reports controller
ebrahimmfadae Mar 3, 2022
017d045
referral: Add config controller
ebrahimmfadae Mar 3, 2022
a10c0d5
referral: Remove all /hello permissions
ebrahimmfadae Mar 3, 2022
4e8a2b6
referral: Refactor kafka configs
ebrahimmfadae Mar 3, 2022
8214292
referral: Add payment currency to commission reward record
ebrahimmfadae Mar 3, 2022
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
3 changes: 0 additions & 3 deletions accountant/accountant-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ spring:
bootstrap-servers: ${KAFKA_IP_PORT:localhost:9092}
consumer:
group-id: accountant
redis:
hostname: ${REDIS_HOST:localhost}
port: 6379
r2dbc:
url: r2dbc:postgresql://${DB_IP_PORT:localhost}/opex_accountant
username: ${dbusername:opex}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ class PairConfig(
val leftSideWalletSymbol: String, //can be same as pair left side
val rightSideWalletSymbol: String, //can be same as pair right side
val leftSideFraction: Double,
val rightSideFraction: Double
val rightSideFraction: Double,
val rate: Double = 0.0
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2

@SpringBootApplication
@ComponentScan("co.nilin.opex")
@EnableSwagger2
class ApiApp

fun main(args: Array<String>) {
Expand Down
7 changes: 2 additions & 5 deletions api/api-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ spring:
bootstrap-servers: ${KAFKA_IP_PORT:localhost:9092}
consumer:
group-id: api
redis:
host: ${REDIS_HOST:localhost}
port: 6379
r2dbc:
url: r2dbc:postgresql://${DB_IP_PORT:localhost}/opex_api
username: ${dbusername:opex}
Expand Down Expand Up @@ -51,12 +48,12 @@ app:
accountant:
url: lb://opex-accountant
matching-gateway:
url: lb://opex-gateway
url: lb://opex-matching-gateway
wallet:
url: lb://opex-wallet
opex-bc-gateway:
url: lb://opex-bc-gateway
auth:
cert-url: lb://opex-auth/auth/realms/opex/protocol/openid-connect/certs

swagger.authUrl: https://api.opex.dev
swagger.authUrl: https://api.opex.dev
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class SecurityConfig(private val webClient: WebClient) {
fun springSecurityFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain? {
http.csrf().disable()
.authorizeExchange()
.pathMatchers("/hello").permitAll()
.pathMatchers("/actuator/**").permitAll()
.pathMatchers("/swagger-ui/**").permitAll()
.pathMatchers("/swagger-resources/**").permitAll()
Expand Down
4 changes: 0 additions & 4 deletions bc-gateway/bc-gateway-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor.kotlin</groupId>
<artifactId>reactor-kotlin-extensions</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class SecurityConfig(@Qualifier("loadBalanced") private val webClient: WebClient
fun springSecurityFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain? {
http.csrf().disable()
.authorizeExchange()
.pathMatchers("/actuator/**").permitAll()
.pathMatchers("/swagger-ui/**").permitAll()
.pathMatchers("/swagger-resources/**").permitAll()
.pathMatchers("/filter/**").hasAuthority("SCOPE_trust")
.pathMatchers("/admin/**").hasRole("SCOPE_trust", "system-admin")
.pathMatchers("/address/**").permitAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import org.springframework.web.reactive.function.client.WebClient

@Configuration
class WebClientConfig {

@Bean
@Qualifier("loadBalanced")
fun loadBalancedWebClient(loadBalancerFactory: ReactiveLoadBalancer.Factory<ServiceInstance>): WebClient {
Expand All @@ -26,7 +25,6 @@ class WebClientConfig {
}

@Bean

fun webClient(): WebClient {
return WebClient.builder()
.exchangeStrategies(
Expand All @@ -36,5 +34,4 @@ class WebClientConfig {
)
.build()
}

}
6 changes: 1 addition & 5 deletions bc-gateway/bc-gateway-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ spring:
bootstrap-servers: ${KAFKA_IP_PORT:localhost:9092}
consumer:
group-id: bc-gateway
redis:
host: ${REDIS_HOST:localhost}
port: 6379
r2dbc:
url: r2dbc:postgresql://${DB_IP_PORT:localhost}/opex_bc_gateway
username: ${dbusername:opex}
Expand Down Expand Up @@ -47,10 +44,9 @@ logging:
level:
org.apache.kafka: ERROR
co.nilin: DEBUG

swagger.authUrl: https://api.opex.dev
app:
auth:
cert-url: lb://opex-auth/auth/realms/opex/protocol/openid-connect/certs
wallet:
url: lb://opex-wallet
url: lb://opex-wallet
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import co.nilin.opex.bcgateway.ports.postgres.model.ChainEndpointModel
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.reactive.awaitFirstOrNull
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.stereotype.Component
import org.springframework.web.reactive.function.client.WebClient

@Component
class ChainEndpointHandlerImpl(
private val webClient: WebClient,
@Qualifier("loadBalanced") private val webClient: WebClient,
private val chainRepository: ChainRepository,
private val endpointRepository: ChainEndpointRepository
) : ChainEndpointHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ SELECT setval(pg_get_serial_sequence('address_types', 'id'), (SELECT MAX(id) FRO

INSERT INTO chain_address_types(chain_name, addr_type_id)
VALUES ('bitcoin', 1),
('ethereum', 2)
('ethereum', 2),
('bsc', 2)
ON CONFLICT DO NOTHING;

INSERT INTO currency_implementations(id,
Expand All @@ -40,13 +41,17 @@ ON CONFLICT DO NOTHING;
SELECT setval(pg_get_serial_sequence('currency_implementations', 'id'), (SELECT MAX(id) FROM currency_implementations));

INSERT INTO chain_endpoints(id, chain_name, endpoint_url)
VALUES (1, 'bitcoin', 'lb://gateway/bitcoin/transfers'),
(2, 'ethereum', 'lb://gateway/eth/transfers')
VALUES (1, 'bitcoin', 'lb://chain-scan-gateway/bitcoin/transfers'),
(2, 'ethereum', 'lb://chain-scan-gateway/eth/transfers'),
(3, 'bsc', 'lb://chain-scan-gateway/bsc/transfers')
ON CONFLICT DO NOTHING;

SELECT setval(pg_get_serial_sequence('chain_endpoints', 'id'), (SELECT MAX(id) FROM chain_endpoints));

INSERT INTO chain_sync_schedules
VALUES ('bitcoin', CURRENT_DATE, 600, 60),
('ethereum', CURRENT_DATE, 90, 60)
('ethereum', CURRENT_DATE, 90, 60),
('bsc', CURRENT_DATE, 90, 60)
ON CONFLICT DO NOTHING;

INSERT INTO wallet_sync_schedules
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ services:
- "5446:5432"
postgres-bc-gateway:
ports:
- "5447:5432"
- "5447:5432"
postgres-referral:
ports:
- "5448:5432"
5 changes: 4 additions & 1 deletion docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ services:
- "5436:5432"
postgres-bc-gateway:
ports:
- "5437:5432"
- "5437:5432"
postgres-referral:
ports:
- "5438:5432"
Loading