diff --git a/payment-service/src/main/java/com/finpay/payment_service/models/PaymentGateway.java b/payment-service/src/main/java/com/finpay/payment_service/models/PaymentGateway.java new file mode 100644 index 0000000..774a153 --- /dev/null +++ b/payment-service/src/main/java/com/finpay/payment_service/models/PaymentGateway.java @@ -0,0 +1,30 @@ +package com.finpay.payment_service.models; + +import lombok.*; +import java.util.Set; +import java.util.UUID; + +@Entity +@Table(name = "payment_gateways") +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class PaymentGateway { + + @Id + @GeneratedValue + private UUID id; + + @Column(nullable = false, unique = true) + private String name; // e.g., Stripe, PayPal, Square + + @Column(nullable = false) + private String apiEndpoint; + + @Column(nullable = false) + private String apiKey; + + @OneToMany(mappedBy = "paymentGateway", cascade = CascadeType.ALL, orphanRemoval = true) + private Set payments; +} diff --git a/payment-service/src/main/java/com/finpay/payment_service/models/PaymentMethod.java b/payment-service/src/main/java/com/finpay/payment_service/models/PaymentMethod.java new file mode 100644 index 0000000..3c8324a --- /dev/null +++ b/payment-service/src/main/java/com/finpay/payment_service/models/PaymentMethod.java @@ -0,0 +1,24 @@ +package com.finpay.payment_service.models; + +import lombok.*; +import java.util.Set; +import java.util.UUID; + +@Entity +@Table(name = "payment_methods") +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class PaymentMethod { + + @Id + @GeneratedValue + private UUID id; + + @Column(nullable = false, unique = true) + private String type; // e.g., CREDIT_CARD, BANK_TRANSFER, DIGITAL_WALLET + + @OneToMany(mappedBy = "paymentMethod", cascade = CascadeType.ALL, orphanRemoval = true) + private Set payments; +} diff --git a/payment-service/src/main/java/com/finpay/payment_service/models/Refund.java b/payment-service/src/main/java/com/finpay/payment_service/models/Refund.java new file mode 100644 index 0000000..de23413 --- /dev/null +++ b/payment-service/src/main/java/com/finpay/payment_service/models/Refund.java @@ -0,0 +1,38 @@ +package com.finpay.payment_service.models; + +import lombok.*; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.UUID; + +@Entity +@Table(name = "refunds") +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class Refund { + + @Id + @GeneratedValue + private UUID id; + + @Column(nullable = false, unique = true) + private String refundReference; // Unique reference for the refund + + @Enumerated(EnumType.STRING) + @Column(nullable = false) + private RefundStatus status; + + @Column(nullable = false) + private BigDecimal amount; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "payment_id") + private Payment payment; + + @Column(nullable = false) + private LocalDateTime createdAt; + + private LocalDateTime updatedAt; +} diff --git a/payment-service/src/main/java/com/finpay/payment_service/models/RefundStatus.java b/payment-service/src/main/java/com/finpay/payment_service/models/RefundStatus.java new file mode 100644 index 0000000..c4fd9f4 --- /dev/null +++ b/payment-service/src/main/java/com/finpay/payment_service/models/RefundStatus.java @@ -0,0 +1,7 @@ +package com.finpay.payment_service.models; + +public enum RefundStatus { + INITIATED, + COMPLETED, + FAILED +} diff --git a/payment-service/src/main/java/com/finpay/payment_service/models/TransactionStatus.java b/payment-service/src/main/java/com/finpay/payment_service/models/TransactionStatus.java new file mode 100644 index 0000000..c2b8390 --- /dev/null +++ b/payment-service/src/main/java/com/finpay/payment_service/models/TransactionStatus.java @@ -0,0 +1,7 @@ +package com.finpay.payment_service.models; + +public enum TransactionStatus { + SUCCESS, + FAILURE, + PENDING +} diff --git a/payment-service/src/main/java/com/finpay/payment_service/models/TransactionType.java b/payment-service/src/main/java/com/finpay/payment_service/models/TransactionType.java new file mode 100644 index 0000000..1ad22f3 --- /dev/null +++ b/payment-service/src/main/java/com/finpay/payment_service/models/TransactionType.java @@ -0,0 +1,7 @@ +package com.finpay.payment_service.models; + +public enum TransactionType { + INITIATION, + RETRY, + REFUND +}