From 565c6d7ffbf3bb2e0bcea801e40befe42ce828f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=98=EC=A0=9C=EB=B2=95?= Date: Fri, 20 Sep 2024 18:39:39 +0900 Subject: [PATCH 1/8] =?UTF-8?q?feat:=20application.yml=20DB=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=20=EC=84=A4=EC=A0=95=20=EB=B0=8F=20=EB=A1=9C=EA=B9=85?= =?UTF-8?q?=20=EB=A0=88=EB=B2=A8=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8b0930e7..45727403 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -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 \ No newline at end of file From ce9307cd4990521b408772e4bc5908136f35a5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=98=EC=A0=9C=EB=B2=95?= Date: Fri, 20 Sep 2024 18:40:06 +0900 Subject: [PATCH 2/8] =?UTF-8?q?feat:=20@EnableJpaAuditing=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ordertogether/team14_be/Team14BeApplication.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/ordertogether/team14_be/Team14BeApplication.java b/src/main/java/com/ordertogether/team14_be/Team14BeApplication.java index f7ee4ee4..fb2e4776 100644 --- a/src/main/java/com/ordertogether/team14_be/Team14BeApplication.java +++ b/src/main/java/com/ordertogether/team14_be/Team14BeApplication.java @@ -2,7 +2,9 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +@EnableJpaAuditing @SpringBootApplication public class Team14BeApplication { From e1ea22e6e185dbaa8c8fa4aea7d519c71633fc6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=98=EC=A0=9C=EB=B2=95?= Date: Fri, 20 Sep 2024 18:41:07 +0900 Subject: [PATCH 3/8] =?UTF-8?q?feat:=20BaseEntity=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team14_be/payment/domain/BaseEntity.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main/java/com/ordertogether/team14_be/payment/domain/BaseEntity.java diff --git a/src/main/java/com/ordertogether/team14_be/payment/domain/BaseEntity.java b/src/main/java/com/ordertogether/team14_be/payment/domain/BaseEntity.java new file mode 100644 index 00000000..af808584 --- /dev/null +++ b/src/main/java/com/ordertogether/team14_be/payment/domain/BaseEntity.java @@ -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; +} From d8223bfb1e7129515653ac07dee95bfb612ac63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=98=EC=A0=9C=EB=B2=95?= Date: Fri, 20 Sep 2024 18:42:25 +0900 Subject: [PATCH 4/8] =?UTF-8?q?feat:=20Product=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team14_be/payment/domain/Product.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/main/java/com/ordertogether/team14_be/payment/domain/Product.java diff --git a/src/main/java/com/ordertogether/team14_be/payment/domain/Product.java b/src/main/java/com/ordertogether/team14_be/payment/domain/Product.java new file mode 100644 index 00000000..eb4326ce --- /dev/null +++ b/src/main/java/com/ordertogether/team14_be/payment/domain/Product.java @@ -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; +} From a041aec430a04a3c2082d588b38e465094a7de44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=98=EC=A0=9C=EB=B2=95?= Date: Fri, 20 Sep 2024 18:42:57 +0900 Subject: [PATCH 5/8] =?UTF-8?q?feat:=20PaymentOrderStatus=20=EC=A0=95?= =?UTF-8?q?=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team14_be/payment/domain/PaymentOrderStatus.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrderStatus.java diff --git a/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrderStatus.java b/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrderStatus.java new file mode 100644 index 00000000..d09a7769 --- /dev/null +++ b/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrderStatus.java @@ -0,0 +1,9 @@ +package com.ordertogether.team14_be.payment.domain; + +/** 결제 상태 */ +public enum PaymentOrderStatus { + READY, + EXECUTING, + SUCCESS, + FAIL; +} From 4163ec0b2a86983c5ccb93880c0bae59038e8f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=98=EC=A0=9C=EB=B2=95?= Date: Fri, 20 Sep 2024 18:43:12 +0900 Subject: [PATCH 6/8] =?UTF-8?q?feat:=20PaymentOrder=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../payment/domain/PaymentOrder.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrder.java diff --git a/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrder.java b/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrder.java new file mode 100644 index 00000000..ec16b852 --- /dev/null +++ b/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrder.java @@ -0,0 +1,44 @@ +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; + + 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; // 재시도 허용 임계값 +} From 5cb9823635efd8ae9739b022b5b93bbcf5d04181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=98=EC=A0=9C=EB=B2=95?= Date: Fri, 20 Sep 2024 18:43:28 +0900 Subject: [PATCH 7/8] =?UTF-8?q?feat:=20PaymentEvent=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../payment/domain/PaymentEvent.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/main/java/com/ordertogether/team14_be/payment/domain/PaymentEvent.java diff --git a/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentEvent.java b/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentEvent.java new file mode 100644 index 00000000..5097603e --- /dev/null +++ b/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentEvent.java @@ -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; +} From 0896bfeb54a7031a189a3b79b6c6d3a4fcc31608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=98=EC=A0=9C=EB=B2=95?= Date: Fri, 20 Sep 2024 19:11:01 +0900 Subject: [PATCH 8/8] =?UTF-8?q?feat:=20PaymentOrder=20amount=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=ED=81=AC=EA=B8=B0=20?= =?UTF-8?q?=EC=A7=80=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ordertogether/team14_be/payment/domain/PaymentOrder.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrder.java b/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrder.java index ec16b852..47f7c92c 100644 --- a/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrder.java +++ b/src/main/java/com/ordertogether/team14_be/payment/domain/PaymentOrder.java @@ -32,6 +32,7 @@ public class PaymentOrder extends BaseEntity { @Column(nullable = false) private String orderId; + @Column(precision = 10, scale = 2) private BigDecimal amount; // 결제 금액 @Enumerated(EnumType.STRING)