-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
75 changed files
with
1,890 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
services: | ||
postgres-easypay: | ||
image: postgres:16 | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
POSTGRES_DB: easypay | ||
POSTGRES_USER: easypay | ||
POSTGRES_PASSWORD: easypay | ||
|
||
postgres-smartbank: | ||
image: postgres:16 | ||
ports: | ||
- "5433:5432" | ||
environment: | ||
POSTGRES_DB: smartbank | ||
POSTGRES_USER: smartbank | ||
POSTGRES_PASSWORD: smartbank | ||
|
||
postgres-fraudetect: | ||
image: postgres:16 | ||
ports: | ||
- "5434:5432" | ||
environment: | ||
POSTGRES_DB: fraudetect | ||
POSTGRES_USER: fraudetect | ||
POSTGRES_PASSWORD: fraudetect | ||
|
||
postgres-merchantbo: | ||
image: postgres:16 | ||
ports: | ||
- "5435:5432" | ||
environment: | ||
POSTGRES_DB: merchantbo | ||
POSTGRES_USER: merchantbo | ||
POSTGRES_PASSWORD: merchantbo | ||
|
||
kafka: | ||
image: docker.redpanda.com/redpandadata/redpanda:v24.1.3 | ||
command: | ||
- redpanda | ||
- start | ||
- --kafka-addr internal://0.0.0.0:9092,external://0.0.0.0:19092 | ||
# Address the broker advertises to clients that connect to the Kafka API. | ||
# Use the internal addresses to connect to the Redpanda brokers' | ||
# from inside the same Docker network. | ||
# Use the external addresses to connect to the Redpanda brokers' | ||
# from outside the Docker network. | ||
- --advertise-kafka-addr internal://kafka:9092,external://localhost:19092 | ||
- --pandaproxy-addr internal://0.0.0.0:8082,external://0.0.0.0:18082 | ||
# Address the broker advertises to clients that connect to the HTTP Proxy. | ||
- --advertise-pandaproxy-addr internal://kafka:8082,external://localhost:18082 | ||
- --schema-registry-addr internal://0.0.0.0:8081,external://0.0.0.0:18081 | ||
# Redpanda brokers use the RPC API to communicate with each other internally. | ||
- --rpc-addr kafka:33145 | ||
- --advertise-rpc-addr kafka:33145 | ||
# Mode dev-container uses well-known configuration properties for development in containers. | ||
- --mode dev-container | ||
# Tells Seastar (the framework Redpanda uses under the hood) to use 1 core on the system. | ||
- --smp 1 | ||
- --default-log-level=info | ||
ports: | ||
- 18081:18081 | ||
- 18082:18082 | ||
- 19092:19092 | ||
- 19644:9644 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
config-server/src/main/resources/config-server/easypay-service.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
spring: | ||
config: | ||
activate: | ||
on-profile: default | ||
eureka: | ||
instance: | ||
instance-id: ${spring.application.name}:${random.uuid} | ||
|
||
--- | ||
spring: | ||
config: | ||
activate: | ||
on-profile: default | ||
datasource: | ||
url: jdbc:postgresql://localhost:5432/easypay | ||
username: easypay | ||
password: easypay | ||
driverClassName: org.postgresql.Driver | ||
sql: | ||
init: | ||
schema-locations: classpath*:db/postgresql/schema.sql | ||
data-locations: classpath*:db/postgresql/data.sql | ||
mode: ALWAYS |
23 changes: 23 additions & 0 deletions
23
config-server/src/main/resources/config-server/fraudetect-service.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
spring: | ||
config: | ||
activate: | ||
on-profile: default | ||
eureka: | ||
instance: | ||
instance-id: ${spring.application.name}:${random.uuid} | ||
|
||
--- | ||
spring: | ||
config: | ||
activate: | ||
on-profile: default | ||
datasource: | ||
url: jdbc:postgresql://localhost:5434/fraudetect | ||
username: fraudetect | ||
password: fraudetect | ||
driverClassName: org.postgresql.Driver | ||
sql: | ||
init: | ||
schema-locations: optional:classpath*:db/postgresql/schema.sql | ||
data-locations: optional:classpath*:db/postgresql/data.sql | ||
mode: ALWAYS |
23 changes: 23 additions & 0 deletions
23
config-server/src/main/resources/config-server/merchant-backoffice.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
spring: | ||
config: | ||
activate: | ||
on-profile: default | ||
eureka: | ||
instance: | ||
instance-id: ${spring.application.name}:${random.uuid} | ||
|
||
--- | ||
spring: | ||
config: | ||
activate: | ||
on-profile: default | ||
datasource: | ||
url: jdbc:postgresql://localhost:5435/merchantbo | ||
username: merchantbo | ||
password: merchantbo | ||
driverClassName: org.postgresql.Driver | ||
sql: | ||
init: | ||
schema-locations: optional:classpath*:db/postgresql/schema.sql | ||
data-locations: optional:classpath*:db/postgresql/data.sql | ||
mode: ALWAYS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
HELP.md | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
plugins { | ||
java | ||
id("org.springframework.boot") version "3.2.5" | ||
id("io.spring.dependency-management") version "1.1.4" | ||
// id("org.graalvm.buildtools.native") version "0.9.28" | ||
} | ||
|
||
group = "com.worldline.easypay" | ||
version = "0.0.1-SNAPSHOT" | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_21 | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
extra["springCloudVersion"] = "2023.0.1" | ||
extra["springDocVersion"] = "2.5.0" | ||
|
||
dependencies { | ||
implementation("org.springframework.boot:spring-boot-starter-actuator") | ||
implementation("org.springframework.boot:spring-boot-starter-web") | ||
implementation("org.springframework.boot:spring-boot-starter-validation") | ||
implementation("org.springframework.boot:spring-boot-starter-data-jpa") | ||
implementation("org.springframework.cloud:spring-cloud-starter-config") | ||
implementation("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client") | ||
implementation("org.springframework.cloud:spring-cloud-starter-loadbalancer") | ||
implementation("org.springframework.cloud:spring-cloud-starter-openfeign") | ||
// implementation("io.github.danielliu1123:httpexchange-spring-boot-starter:3.2.5") | ||
implementation("org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j") | ||
|
||
implementation("org.springframework.cloud:spring-cloud-stream") | ||
implementation("org.springframework.cloud:spring-cloud-stream-binder-kafka") | ||
implementation("org.springframework.kafka:spring-kafka") | ||
|
||
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:${property("springDocVersion")}") | ||
developmentOnly("org.springframework.boot:spring-boot-devtools") | ||
runtimeOnly("com.h2database:h2") | ||
runtimeOnly("org.postgresql:postgresql") | ||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
} | ||
|
||
dependencyManagement { | ||
imports { | ||
mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}") | ||
} | ||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
create table card_ref (blacklisted boolean, id bigserial not null, card_number varchar(255) unique, card_type varchar(255) check (card_type in ('UNKNOWN','VISA','MASTERCARD','AMERICAN_EXPRESS','DINERS_CLUB','DISCOVER','JCB','CHINA_UNION_PAY')), primary key (id)); | ||
create table payment (amount integer, authorized boolean, bank_called boolean, date_time timestamp(6), response_time bigint, authorization_id uuid, id uuid not null, card_number varchar(255), card_type varchar(255) check (card_type in ('UNKNOWN','VISA','MASTERCARD','AMERICAN_EXPRESS','DINERS_CLUB','DISCOVER','JCB','CHINA_UNION_PAY')), expiry_date varchar(255), pos_id varchar(255), processing_mode varchar(255) check (processing_mode in ('STANDARD','FALLBACK')), response_code varchar(255) check (response_code in ('ACCEPTED','INACTIVE_POS','INVALID_CARD_NUMBER','BLACK_LISTED_CARD_NUMBER','UNKNWON_CARD_TYPE','AUTHORIZATION_DENIED','AMOUNT_EXCEEDED')), primary key (id)); | ||
create table pos_ref (active boolean, id bigserial not null, location varchar(255), pos_id varchar(255) unique, primary key (id)); | ||
create table card_ref (blacklisted boolean, id bigserial not null, card_number varchar(255) unique, card_type varchar(255) check (card_type in ('UNKNOWN','VISA','MASTERCARD','AMERICAN_EXPRESS','DINERS_CLUB','DISCOVER','JCB','CHINA_UNION_PAY')), primary key (id)); | ||
create table payment (amount integer, authorized boolean, bank_called boolean, date_time timestamp(6), response_time bigint, authorization_id uuid, id uuid not null, card_number varchar(255), card_type varchar(255) check (card_type in ('UNKNOWN','VISA','MASTERCARD','AMERICAN_EXPRESS','DINERS_CLUB','DISCOVER','JCB','CHINA_UNION_PAY')), expiry_date varchar(255), pos_id varchar(255), processing_mode varchar(255) check (processing_mode in ('STANDARD','FALLBACK')), response_code varchar(255) check (response_code in ('ACCEPTED','INACTIVE_POS','INVALID_CARD_NUMBER','BLACK_LISTED_CARD_NUMBER','UNKNWON_CARD_TYPE','AUTHORIZATION_DENIED','AMOUNT_EXCEEDED')), primary key (id)); | ||
create table pos_ref (active boolean, id bigserial not null, location varchar(255), pos_id varchar(255) unique, primary key (id)); | ||
create table card_ref (blacklisted boolean, id bigserial not null, card_number varchar(255) unique, card_type varchar(255) check (card_type in ('UNKNOWN','VISA','MASTERCARD','AMERICAN_EXPRESS','DINERS_CLUB','DISCOVER','JCB','CHINA_UNION_PAY')), primary key (id)); | ||
create table payment (amount integer, authorized boolean, bank_called boolean, date_time timestamp(6), response_time bigint, authorization_id uuid, id uuid not null, card_number varchar(255), card_type varchar(255) check (card_type in ('UNKNOWN','VISA','MASTERCARD','AMERICAN_EXPRESS','DINERS_CLUB','DISCOVER','JCB','CHINA_UNION_PAY')), expiry_date varchar(255), pos_id varchar(255), processing_mode varchar(255) check (processing_mode in ('STANDARD','FALLBACK')), response_code varchar(255) check (response_code in ('ACCEPTED','INACTIVE_POS','INVALID_CARD_NUMBER','BLACK_LISTED_CARD_NUMBER','UNKNWON_CARD_TYPE','AUTHORIZATION_DENIED','AMOUNT_EXCEEDED')), primary key (id)); | ||
create table pos_ref (active boolean, id bigserial not null, location varchar(255), pos_id varchar(255) unique, primary key (id)); |
20 changes: 20 additions & 0 deletions
20
easypay-service/src/main/java/com/worldline/easypay/EasypayServiceApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.worldline.easypay; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | ||
import org.springframework.cloud.openfeign.EnableFeignClients; | ||
|
||
import com.worldline.easypay.payment.control.bank.BankAuthorClient; | ||
|
||
|
||
@SpringBootApplication | ||
@EnableDiscoveryClient | ||
@EnableFeignClients | ||
public class EasypayServiceApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(EasypayServiceApplication.class, args); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
easypay-service/src/main/java/com/worldline/easypay/cardref/boundary/CardRefResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.worldline.easypay.cardref.boundary; | ||
|
||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.worldline.easypay.cardref.control.CardService; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
|
||
@RestController | ||
@RequestMapping("/cards") | ||
public class CardRefResource { | ||
|
||
CardService cardService; | ||
|
||
public CardRefResource(CardService cardService) { | ||
this.cardService = cardService; | ||
} | ||
|
||
@GetMapping | ||
@Operation(description = "List all cards declared as reference data in the system", summary = "List all cards") | ||
public ResponseEntity<List<CardRefResponse>> findAll() { | ||
return ResponseEntity.ok(cardService.listAll()); | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
easypay-service/src/main/java/com/worldline/easypay/cardref/boundary/CardRefResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.worldline.easypay.cardref.boundary; | ||
|
||
public record CardRefResponse( | ||
String cardNumber, | ||
String cardType, | ||
Boolean blackListed) { | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
easypay-service/src/main/java/com/worldline/easypay/cardref/control/CardService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.worldline.easypay.cardref.control; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import com.worldline.easypay.cardref.boundary.CardRefResponse; | ||
import com.worldline.easypay.cardref.entity.CardRef; | ||
import com.worldline.easypay.cardref.entity.CardRefRepository; | ||
|
||
@Service | ||
public class CardService { | ||
|
||
CardRefRepository repository; | ||
|
||
public CardService(CardRefRepository repository) { | ||
this.repository = repository; | ||
} | ||
|
||
public List<CardRefResponse> listAll() { | ||
return repository.findAll().stream().map(this::toResponse).toList(); | ||
} | ||
|
||
private CardRefResponse toResponse(CardRef cardRef) { | ||
return new CardRefResponse(cardRef.cardNumber, cardRef.cardType.toString(), cardRef.blackListed); | ||
} | ||
} |
Oops, something went wrong.