Skip to content

Commit

Permalink
style: remove unless field
Browse files Browse the repository at this point in the history
  • Loading branch information
oproprioleonardo committed Oct 15, 2024
1 parent c3c098e commit 0e88b6a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import br.com.ifsp.tickets.domain.ticket.ITicketGateway;
import br.com.ifsp.tickets.domain.ticket.Ticket;
import br.com.ifsp.tickets.domain.ticket.TicketID;
import br.com.ifsp.tickets.domain.user.User;
import br.com.ifsp.tickets.domain.user.UserID;

import java.time.LocalDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@
import br.com.ifsp.tickets.app.payment.preference.create.CreatePreferenceUseCase;
import br.com.ifsp.tickets.app.payment.retrieve.GetPaymentUseCase;
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;

public class PaymentServiceFactory {
private static PaymentService paymentService;

public static PaymentService create(
ITicketGateway ticketGateway,
ITicketSaleGateway ticketSaleGateway,
IPaymentGateway paymentGateway) {
if (paymentService == null) {
final CreatePreferenceUseCase createPreferenceUseCase = new CreatePreferenceUseCase(ticketGateway, ticketSaleGateway);
final CreatePreferenceUseCase createPreferenceUseCase = new CreatePreferenceUseCase(ticketSaleGateway);
final CreatePaymentUseCase paymentUseCase = new CreatePaymentUseCase(paymentGateway);
final GetPaymentUseCase getPaymentUseCase = new GetPaymentUseCase();
paymentService = new PaymentService(createPreferenceUseCase, getPaymentUseCase, paymentUseCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import br.com.ifsp.tickets.domain.event.sale.TicketSale;
import br.com.ifsp.tickets.domain.event.sale.TicketSaleID;
import br.com.ifsp.tickets.domain.shared.exceptions.NotFoundException;
import br.com.ifsp.tickets.domain.ticket.ITicketGateway;
import br.com.ifsp.tickets.domain.ticket.Ticket;
import br.com.ifsp.tickets.domain.ticket.TicketID;
import br.com.ifsp.tickets.domain.user.User;
import com.mercadopago.client.common.IdentificationRequest;
Expand All @@ -16,12 +14,11 @@
import java.util.ArrayList;
import java.util.List;

public class CreatePreferenceUseCase implements ICreatePreferenceUseCase{
private final ITicketGateway ticketGateway;
public class CreatePreferenceUseCase implements ICreatePreferenceUseCase {

private final ITicketSaleGateway ticketSaleGateway;

public CreatePreferenceUseCase(ITicketGateway ticketGateway, ITicketSaleGateway ticketSaleGateway) {
this.ticketGateway = ticketGateway;
public CreatePreferenceUseCase(ITicketSaleGateway ticketSaleGateway) {
this.ticketSaleGateway = ticketSaleGateway;
}

Expand Down Expand Up @@ -74,9 +71,9 @@ public CreatePreferenceOutput execute(CreatePreferenceInput anIn) {
.build();

Preference preference = null;
try{
try {
preference = client.create(preferenceRequest);
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
return new CreatePreferenceOutput(preference.getInitPoint(), ticketId.getValue().toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
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 lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -15,12 +12,12 @@
@Configuration
@RequiredArgsConstructor(onConstructor_ = @__(@Autowired))
public class PaymentConfig {
private final ITicketGateway ticketGateway;

private final ITicketSaleGateway ticketSaleGateway;
private final IPaymentGateway paymentGateway;

@Bean
public PaymentService paymentService() {
return PaymentServiceFactory.create(ticketGateway, ticketSaleGateway, paymentGateway);
return PaymentServiceFactory.create(ticketSaleGateway, paymentGateway);
}
}

0 comments on commit 0e88b6a

Please sign in to comment.