Skip to content

Commit e4dc498

Browse files
committed
feat: payment full implementation
1 parent 83c1ad2 commit e4dc498

29 files changed

+319
-68
lines changed

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Java 17 optimized image
2+
FROM bellsoft/liberica-runtime-container:jre-17-slim-musl
3+
4+
# Creates and switches to non-root user
5+
ENV APP_USER=backend
6+
# Busybox syntax, which is available in the image
7+
RUN addgroup -S $APP_USER && adduser -D -g "" -G $APP_USER $APP_USER
8+
USER backend
9+
10+
# Copy .jar to container
11+
ARG JAR_FILE=target/app.jar
12+
ENV APP_FOLDER=/opt/app
13+
WORKDIR $APP_FOLDER
14+
COPY $JAR_FILE app.jar
15+
16+
# Execute application
17+
ENTRYPOINT ["java", "-jar", "app.jar"]
18+
19+
EXPOSE 8080

compose-dev.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This compose file is for development only!
2+
name: soat-tech-challenge-service-payment
3+
services:
4+
db:
5+
image: "postgres:15.4"
6+
environment:
7+
- "POSTGRES_DB=backend"
8+
- "POSTGRES_PASSWORD=backend"
9+
- "POSTGRES_USER=backend"
10+
ports:
11+
- 5432:5432

pom.xml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,25 @@
1010
</parent>
1111
<groupId>br.com.grupo63.techchallenge</groupId>
1212
<artifactId>service-payment</artifactId>
13-
<version>0.0.1-SNAPSHOT</version>
13+
<version>4.0.0</version>
1414
<name>service-payment</name>
1515
<description>FIAP SOAT1 2023 - Group 63 - Payment microservice</description>
1616
<properties>
1717
<java.version>17</java.version>
1818
</properties>
19+
20+
<repositories>
21+
<repository>
22+
<id>jitpack.io</id>
23+
<url>https://jitpack.io</url>
24+
</repository>
25+
</repositories>
26+
1927
<dependencies>
2028
<dependency>
21-
<groupId>br.com.grupo63.techchallenge</groupId>
22-
<artifactId>soat-tech-challenge-common</artifactId>
23-
<version>1.0.0</version>
29+
<groupId>com.github.soat-tech-challenge</groupId>
30+
<artifactId>service-common</artifactId>
31+
<version>4.1.0</version>
2432
</dependency>
2533
<dependency>
2634
<groupId>org.springframework.boot</groupId>
@@ -94,6 +102,11 @@
94102
<artifactId>h2</artifactId>
95103
<scope>test</scope>
96104
</dependency>
105+
<dependency>
106+
<groupId>org.springframework.cloud</groupId>
107+
<artifactId>spring-cloud-starter-openfeign</artifactId>
108+
<version>4.0.4</version>
109+
</dependency>
97110
</dependencies>
98111

99112
<build>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.cloud.openfeign.EnableFeignClients;
56

67
@SpringBootApplication
8+
@EnableFeignClients
79
public class ServicePaymentApplication {
810

911
public static void main(String[] args) {
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class PaymentAPIController extends AbstractAPIController {
3030
@PostMapping("/initialize")
3131
public QRCodeResponseDTO startPayment(
3232
@Parameter(description = "Id do pedido") @RequestParam Long orderId
33-
) throws NotFoundException, ValidationException {
33+
) throws NotFoundException {
3434
return controller.startPayment(orderId);
3535
}
3636

File renamed without changes.
File renamed without changes.
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,18 @@
1313
@Service
1414
public class PaymentController {
1515

16-
private final OrderUseCase orderUseCase;
1716
private final PaymentUseCase useCase;
1817

19-
public QRCodeResponseDTO startPayment(Long orderId) throws NotFoundException, ValidationException {
20-
Order entity = orderUseCase.read(orderId);
21-
return PaymentPresenter.toDto(useCase.startPayment(entity));
18+
public QRCodeResponseDTO startPayment(Long orderId) throws NotFoundException {
19+
return PaymentPresenter.toDto(useCase.startPayment(orderId));
2220
}
2321

2422
public void finishPayment(Long orderId) throws NotFoundException, ValidationException {
25-
Order entity = orderUseCase.read(orderId);
26-
useCase.finishPayment(entity);
23+
useCase.finishPayment(orderId);
2724
}
2825

2926
public PaymentStatusResponseDTO getPaymentStatus(Long orderId) throws NotFoundException, ValidationException {
30-
Order entity = orderUseCase.read(orderId);
31-
return PaymentPresenter.toDto(useCase.getPaymentStatus(entity));
27+
return PaymentPresenter.toDto(useCase.getPaymentStatus(orderId));
3228
}
3329

3430
}
File renamed without changes.

0 commit comments

Comments
 (0)