Skip to content

Commit

Permalink
feat: billing and order api
Browse files Browse the repository at this point in the history
  • Loading branch information
oproprioleonardo committed Dec 14, 2024
1 parent d7daa6a commit b849c92
Show file tree
Hide file tree
Showing 42 changed files with 590 additions and 547 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ public record CreateEnrollmentInput(
String document,
LocalDate birthDate,
String eventId,
String ticketSaleId,
String ticketId
String ticketSaleId
) {
public static CreateEnrollmentInput of(String userId, String name, String email, String document, LocalDate birthDate, String eventId, String ticketSaleId, String ticketId) {
return new CreateEnrollmentInput(userId, name, email, document, birthDate, eventId, ticketSaleId, ticketId);
public static CreateEnrollmentInput of(String userId, String name, String email, String document, LocalDate birthDate, String eventId, String ticketSaleId) {
return new CreateEnrollmentInput(userId, name, email, document, birthDate, eventId, ticketSaleId);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
package br.com.ifsp.tickets.app.administrative.enrollment.core.create;

import br.com.ifsp.tickets.app.administrative.enrollment.ITicketQRGenerator;
import br.com.ifsp.tickets.domain.communication.email.Email;
import br.com.ifsp.tickets.domain.communication.email.IEmailGateway;
import br.com.ifsp.tickets.domain.communication.message.IMessageGateway;
import br.com.ifsp.tickets.domain.communication.message.Message;
import br.com.ifsp.tickets.domain.communication.message.type.MessageSubject;
import br.com.ifsp.tickets.domain.communication.message.type.MessageType;
import br.com.ifsp.tickets.domain.administrative.company.Company;
import br.com.ifsp.tickets.domain.administrative.company.ICompanyGateway;
import br.com.ifsp.tickets.domain.administrative.enrollment.Enrollment;
Expand All @@ -15,16 +9,21 @@
import br.com.ifsp.tickets.domain.administrative.event.EventID;
import br.com.ifsp.tickets.domain.administrative.event.EventStatus;
import br.com.ifsp.tickets.domain.administrative.event.IEventGateway;
import br.com.ifsp.tickets.domain.administrative.ticket.ITicketGateway;
import br.com.ifsp.tickets.domain.administrative.ticket.Ticket;
import br.com.ifsp.tickets.domain.administrative.user.UserID;
import br.com.ifsp.tickets.domain.communication.email.Email;
import br.com.ifsp.tickets.domain.communication.email.IEmailGateway;
import br.com.ifsp.tickets.domain.communication.message.IMessageGateway;
import br.com.ifsp.tickets.domain.communication.message.Message;
import br.com.ifsp.tickets.domain.communication.message.type.MessageSubject;
import br.com.ifsp.tickets.domain.communication.message.type.MessageType;
import br.com.ifsp.tickets.domain.financial.product.ITicketSaleGateway;
import br.com.ifsp.tickets.domain.financial.product.TicketSale;
import br.com.ifsp.tickets.domain.financial.product.TicketSaleID;
import br.com.ifsp.tickets.domain.shared.exceptions.NotFoundException;
import br.com.ifsp.tickets.domain.shared.file.IFileStorage;
import br.com.ifsp.tickets.domain.shared.validation.handler.Notification;
import br.com.ifsp.tickets.domain.administrative.ticket.ITicketGateway;
import br.com.ifsp.tickets.domain.administrative.ticket.Ticket;
import br.com.ifsp.tickets.domain.administrative.ticket.TicketID;
import br.com.ifsp.tickets.domain.administrative.user.UserID;

import java.time.LocalDate;

Expand Down Expand Up @@ -59,7 +58,6 @@ public CreateEnrollmentOutput execute(CreateEnrollmentInput anIn) {
final String emailString = anIn.email();
final LocalDate birthDate = anIn.birthDate();
final String document = anIn.document();
final TicketID ticketID = TicketID.with(anIn.ticketId());

final EventID eventID = EventID.with(anIn.eventId());
final TicketSaleID ticketSaleID = TicketSaleID.with(anIn.ticketSaleId());
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package br.com.ifsp.tickets.app.administrative.ticket.retrieve.get;

import br.com.ifsp.tickets.app.administrative.ticket.retrieve.TicketOutput;
import br.com.ifsp.tickets.domain.administrative.enrollment.Enrollment;
import br.com.ifsp.tickets.domain.administrative.event.Event;
import br.com.ifsp.tickets.domain.administrative.event.IEventGateway;
import br.com.ifsp.tickets.domain.shared.exceptions.IllegalResourceAccessException;
Expand All @@ -25,7 +26,8 @@ public TicketOutput execute(GetTicketInput anIn) {
final User user = anIn.user();
final TicketID ticketID = TicketID.with(anIn.ticketID());
final Ticket ticket = this.ticketGateway.findById(ticketID).orElseThrow(() -> NotFoundException.with(Ticket.class, ticketID));
final boolean isUserTicket = ticket.getUserID().isPresent() ? ticket.getUserID().get().equals(user.getId()) : ticket.getDocument().equalsIgnoreCase(user.getDocument().getValue());
final Enrollment enrollment = ticket.getEnrollment();
final boolean isUserTicket = enrollment.getUserID().isPresent() ? enrollment.getUserID().get().equals(user.getId()) : enrollment.getDocument().equalsIgnoreCase(user.getDocument().getValue());
if (isUserTicket || user.canManageAnyTicket())
return TicketOutput.from(ticket);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
public record HandlePaymentOutput(
String id,
LocalDateTime paymentDate,
String externalReference
String externalId
) {

public static HandlePaymentOutput from(Payment payment) {
return new HandlePaymentOutput(payment.getId().toString(), payment.getPaymentDate(), payment.getAction(), payment.getExternalReference());
return new HandlePaymentOutput(payment.getId().toString(), payment.getApprovalDate(), payment.getExternalId());
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit b849c92

Please sign in to comment.