-
Notifications
You must be signed in to change notification settings - Fork 5
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 #31 from marinesnow34/payment
Feat: 토스 주문 요청 결제 ID 생성 구현
- Loading branch information
Showing
25 changed files
with
472 additions
and
110 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
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
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
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
91 changes: 91 additions & 0 deletions
91
src/main/java/com/readyvery/readyverydemo/domain/Order.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,91 @@ | ||
package com.readyvery.readyverydemo.domain; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.OneToOne; | ||
import jakarta.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Getter | ||
@Entity | ||
@Builder | ||
@Table(name = "ORDERS") | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Slf4j | ||
public class Order { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "order_idx") | ||
private Long id; | ||
|
||
// 총 결제 가격 | ||
@Column | ||
private Long amount; | ||
|
||
// 결제 키 값 | ||
@Column | ||
private String paymentKey; | ||
|
||
// 주문 id | ||
@Column | ||
private String orderId; | ||
|
||
// 주문 명 | ||
@Column | ||
private String orderName; | ||
|
||
// 토스 결제 가격 | ||
@Column | ||
private Long totalAmount; | ||
|
||
// 결제 방법 | ||
@Column | ||
private String method; | ||
|
||
// 주문 번호 | ||
@Column | ||
private String orderNumber; | ||
|
||
// 주문 상태 | ||
@Column | ||
@Enumerated(EnumType.STRING) | ||
private Progress progress; | ||
|
||
// 가게 아이템 연관 관계 | ||
@OneToMany(mappedBy = "order") | ||
private List<OrderItem> orderItems = new ArrayList<OrderItem>(); | ||
|
||
// 가게 연관 관계 | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "store_idx") | ||
private Store store; | ||
|
||
// 유저 연관 관계 | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_idx") | ||
private UserInfo userInfo; | ||
|
||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "coupon_idx") | ||
private Coupon coupon; | ||
|
||
@OneToOne(mappedBy = "order", fetch = FetchType.LAZY) | ||
private Receipt receipt; | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/com/readyvery/readyverydemo/domain/OrderItem.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,49 @@ | ||
package com.readyvery.readyverydemo.domain; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Getter | ||
@Entity | ||
@Builder | ||
@Table(name = "ORDER_ITEM") | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Slf4j | ||
public class OrderItem { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "order_item_idx") | ||
private Long id; | ||
|
||
@Column | ||
private Long count; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "order_idx") | ||
private Order order; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "foodie_idx") | ||
private Foodie foodie; | ||
|
||
@OneToMany(mappedBy = "orderItem") | ||
private List<OrderItemOption> orderItemOptions = new ArrayList<OrderItemOption>(); | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/com/readyvery/readyverydemo/domain/OrderItemOption.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,42 @@ | ||
package com.readyvery.readyverydemo.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Getter | ||
@Entity | ||
@Builder | ||
@Table(name = "ORDER_ITEM_OPTION") | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Slf4j | ||
public class OrderItemOption { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "order_item_option_idx") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "order_item_idx") | ||
private OrderItem orderItem; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "foodie_option_idx") | ||
private FoodieOption foodieOption; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "foodie_option_category_idx") | ||
private FoodieOptionCategory foodieOptionCategory; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/readyvery/readyverydemo/domain/Progress.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,18 @@ | ||
package com.readyvery.readyverydemo.domain; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum Progress { | ||
CANCEL("CANCEL", "주문 취소"), | ||
REQUEST("REQUEST", "토스 결제 요청"), | ||
ORDER("ORDER", "주문 접수"), | ||
MAKE("MAKE", "음식 제조 중"), | ||
COMPLETE("COMPLETE", "배달 완료"), | ||
PICKUP("PICKUP", "픽업 완료"); | ||
|
||
private final String key; | ||
private final String value; | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/readyvery/readyverydemo/domain/Receipt.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,27 @@ | ||
package com.readyvery.readyverydemo.domain; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.OneToOne; | ||
import jakarta.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Getter | ||
@Entity | ||
@Builder | ||
@Table(name = "RECEIPT") | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Slf4j | ||
public class Receipt { | ||
@Id | ||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "order_idx") | ||
private Order order; | ||
} |
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
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
8 changes: 8 additions & 0 deletions
8
src/main/java/com/readyvery/readyverydemo/domain/repository/OrderRepository.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,8 @@ | ||
package com.readyvery.readyverydemo.domain.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import com.readyvery.readyverydemo.domain.Order; | ||
|
||
public interface OrderRepository extends JpaRepository<Order, Long> { | ||
} |
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
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
Oops, something went wrong.