-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from nove1080/feat/7/payment-data-modeling
feat: 결제 시스템 Entity 설계 #7
- Loading branch information
Showing
7 changed files
with
177 additions
and
0 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
40 changes: 40 additions & 0 deletions
40
src/main/java/com/ordertogether/team14_be/payment/domain/BaseEntity.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,40 @@ | ||
package com.ordertogether.team14_be.payment.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.EntityListeners; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.MappedSuperclass; | ||
import java.time.LocalDateTime; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
import lombok.experimental.SuperBuilder; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
@MappedSuperclass | ||
@EntityListeners(AuditingEntityListener.class) | ||
@SuperBuilder | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@ToString | ||
@Getter | ||
public abstract class BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false, updatable = false) | ||
@CreatedDate | ||
private LocalDateTime createdAt; | ||
|
||
@Column(nullable = false) | ||
@LastModifiedDate | ||
private LocalDateTime updatedAt; | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/com/ordertogether/team14_be/payment/domain/PaymentEvent.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,33 @@ | ||
package com.ordertogether.team14_be.payment.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@Entity | ||
@Getter | ||
@SuperBuilder | ||
@ToString | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class PaymentEvent extends BaseEntity { | ||
|
||
@Column(nullable = false) | ||
private Long buyerId; // 구매자 식별자 | ||
|
||
@Column(nullable = false) | ||
private String orderId; | ||
|
||
private String orderName; | ||
|
||
@Column(nullable = false) | ||
private String paymentKey; // PSP 결제 식별자 | ||
|
||
@Builder.Default private Boolean isPaymentDone = false; | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrder.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,45 @@ | ||
package com.ordertogether.team14_be.payment.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.ManyToOne; | ||
import java.math.BigDecimal; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@Entity | ||
@Getter | ||
@SuperBuilder | ||
@ToString | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class PaymentOrder extends BaseEntity { | ||
|
||
@Column(nullable = false) | ||
private Long sellerId; // 판매자 식별자 | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
private Product productId; | ||
|
||
@Column(nullable = false) | ||
private String orderId; | ||
|
||
@Column(precision = 10, scale = 2) | ||
private BigDecimal amount; // 결제 금액 | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Builder.Default | ||
private PaymentOrderStatus paymentOrderStatus = PaymentOrderStatus.READY; | ||
|
||
@Builder.Default private Byte retryCount = 0; // 재시도 횟수 | ||
|
||
@Builder.Default private Byte retryThreshold = 5; // 재시도 허용 임계값 | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrderStatus.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,9 @@ | ||
package com.ordertogether.team14_be.payment.domain; | ||
|
||
/** 결제 상태 */ | ||
public enum PaymentOrderStatus { | ||
READY, | ||
EXECUTING, | ||
SUCCESS, | ||
FAIL; | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/ordertogether/team14_be/payment/domain/Product.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,26 @@ | ||
package com.ordertogether.team14_be.payment.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import java.math.BigDecimal; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@Entity | ||
@Getter | ||
@SuperBuilder | ||
@ToString | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Product extends BaseEntity { | ||
|
||
@Column(nullable = false) | ||
private String name; | ||
|
||
@Column(nullable = false) | ||
private BigDecimal price; | ||
} |
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,3 +1,25 @@ | ||
spring: | ||
application: | ||
name: Team14_BE | ||
|
||
datasource: | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
username: root | ||
password: | ||
url: jdbc:mysql://localhost:3306/delivery_sharing | ||
|
||
jpa: | ||
hibernate: | ||
ddl-auto: create | ||
properties: | ||
hibernate: | ||
format_sql: true | ||
|
||
logging: | ||
level: | ||
org: | ||
hibernate: | ||
SQL: debug | ||
orm: | ||
jdbc: | ||
bind: trace |