-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
218bff4
commit 109cda3
Showing
10 changed files
with
36 additions
and
59 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
19 changes: 19 additions & 0 deletions
19
infrastructure/src/main/java/br/com/ifsp/tickets/infra/config/app/MercadoPagoConfig.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,19 @@ | ||
package br.com.ifsp.tickets.infra.config.app; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import javax.annotation.PostConstruct; | ||
|
||
@Configuration | ||
public class MercadoPagoConfig { | ||
|
||
@Value("${mercadopago.access.token}") | ||
private String mercadoPagoAccessToken; | ||
|
||
@PostConstruct | ||
public void initialize() { | ||
com.mercadopago.MercadoPagoConfig.setAccessToken(mercadoPagoAccessToken); | ||
} | ||
} |
22 changes: 6 additions & 16 deletions
22
.../config/app/MercadoPagoConfiguration.java → ...ckets/infra/config/app/PaymentConfig.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 |
---|---|---|
@@ -1,36 +1,26 @@ | ||
package br.com.ifsp.tickets.infra.config.app; | ||
|
||
import br.com.ifsp.tickets.app.event.EventService; | ||
import br.com.ifsp.tickets.app.event.EventServiceFactory; | ||
import br.com.ifsp.tickets.app.payment.PaymentService; | ||
import br.com.ifsp.tickets.app.payment.PaymentServiceFactory; | ||
import br.com.ifsp.tickets.domain.event.sale.ITicketSaleGateway; | ||
import br.com.ifsp.tickets.domain.ticket.ITicketGateway; | ||
import br.com.ifsp.tickets.domain.ticket.payment.IPaymentGateway; | ||
import br.com.ifsp.tickets.infra.contexts.event.sale.payment.PaymentGateway; | ||
import com.mercadopago.MercadoPagoConfig; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import javax.annotation.PostConstruct; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor(onConstructor_ = @__(@Autowired)) | ||
public class MercadoPagoConfiguration { | ||
private final ITicketSaleGateway ticketSaleGateway; | ||
public class PaymentConfig { | ||
private final ITicketGateway ticketGateway; | ||
private final ITicketSaleGateway ticketSaleGateway; | ||
private final IPaymentGateway paymentGateway; | ||
|
||
@Value("${mercadopago.access.token}") | ||
private String mercadoPagoAccessToken; | ||
|
||
@PostConstruct | ||
public void initialize() { | ||
MercadoPagoConfig.setAccessToken(mercadoPagoAccessToken); | ||
} | ||
|
||
@Bean | ||
public PaymentService preferenceService() { | ||
public PaymentService paymentService() { | ||
return PaymentServiceFactory.create(ticketGateway, ticketSaleGateway, paymentGateway); | ||
} | ||
} |
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
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
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
6 changes: 2 additions & 4 deletions
6
...r/com/ifsp/tickets/infra/contexts/event/sale/ticket/persistence/TicketSaleRepository.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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
package br.com.ifsp.tickets.infra.contexts.event.sale.ticket.persistence; | ||
|
||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.PageRequest; | ||
import org.springframework.data.jpa.domain.Specification; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.UUID; | ||
|
||
public interface TicketSaleRepository extends JpaRepository<TicketSaleJpaEntity, UUID> { | ||
Page<TicketSaleJpaEntity> findAllByEventID(UUID eventID, PageRequest request); | ||
Page<TicketSaleJpaEntity> findAll(Specification<TicketSaleJpaEntity> specification, PageRequest request); | ||
Page<TicketSaleJpaEntity> findAllByEventId(UUID eventID, Pageable pageable); | ||
} |
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 |
---|---|---|
|
@@ -8,4 +8,5 @@ | |
Application: TicketsIFSP-API | ||
Version: v1.0.0 | ||
Authors: | ||
- Leonardo | ||
- Leonardo | ||
- Gustavo |