-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
models complete, invoice to be managed via service-to-service communi…
…cation without creating an entity in the Payment Service.
- Loading branch information
1 parent
a5b90b7
commit ff2dda4
Showing
6 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
payment-service/src/main/java/com/finpay/payment_service/models/PaymentGateway.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,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<Payment> payments; | ||
} |
24 changes: 24 additions & 0 deletions
24
payment-service/src/main/java/com/finpay/payment_service/models/PaymentMethod.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,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<Payment> payments; | ||
} |
38 changes: 38 additions & 0 deletions
38
payment-service/src/main/java/com/finpay/payment_service/models/Refund.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,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; | ||
} |
7 changes: 7 additions & 0 deletions
7
payment-service/src/main/java/com/finpay/payment_service/models/RefundStatus.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,7 @@ | ||
package com.finpay.payment_service.models; | ||
|
||
public enum RefundStatus { | ||
INITIATED, | ||
COMPLETED, | ||
FAILED | ||
} |
7 changes: 7 additions & 0 deletions
7
payment-service/src/main/java/com/finpay/payment_service/models/TransactionStatus.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,7 @@ | ||
package com.finpay.payment_service.models; | ||
|
||
public enum TransactionStatus { | ||
SUCCESS, | ||
FAILURE, | ||
PENDING | ||
} |
7 changes: 7 additions & 0 deletions
7
payment-service/src/main/java/com/finpay/payment_service/models/TransactionType.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,7 @@ | ||
package com.finpay.payment_service.models; | ||
|
||
public enum TransactionType { | ||
INITIATION, | ||
RETRY, | ||
REFUND | ||
} |