-
Notifications
You must be signed in to change notification settings - Fork 2
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 #110 from kakao-tech-campus-2nd-step3/feature/ISSU…
…E-86 결제 order entity 수정 및 결제 구현
- Loading branch information
Showing
55 changed files
with
1,052 additions
and
387 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
8 changes: 8 additions & 0 deletions
8
src/main/java/poomasi/domain/order/_aftersales/controller/CancelController.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 poomasi.domain.order._aftersales.controller; | ||
|
||
|
||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class CancelController { | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/poomasi/domain/order/_aftersales/controller/ExchangeController.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 poomasi.domain.order._aftersales.controller; | ||
|
||
|
||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class ExchangeController { | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/poomasi/domain/order/_aftersales/controller/RefundController.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 poomasi.domain.order._aftersales.controller; | ||
|
||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.access.annotation.Secured; | ||
import org.springframework.web.bind.annotation.*; | ||
import poomasi.domain.order._aftersales.dto.FullRefundRequest; | ||
import poomasi.domain.order._aftersales.dto.PartialRefundRequest; | ||
import poomasi.domain.order._aftersales.service.RefundService; | ||
|
||
@RestController | ||
@RequestMapping("/api/refund") | ||
@RequiredArgsConstructor | ||
public class RefundController { | ||
|
||
private final RefundService refundService; | ||
|
||
|
||
@Secured({"ROLE_CUSTOMER", "ROLE_FARMER"}) | ||
@GetMapping("/{refundId}") | ||
public void getRefund(@PathVariable("refundId") Long refundId) { | ||
|
||
} | ||
|
||
@Secured({"ROLE_CUSTOMER", "ROLE_FARMER"}) | ||
@PostMapping("/{orderProductDetailsId}") | ||
public void processFullRefund (@PathVariable("orderProductDetailsId") Long orderProductDetailsId, | ||
@RequestBody FullRefundRequest fullRefundRequest) { | ||
//TODO : order product details 내부 메서드 보고 | ||
//TODO : 환불 가능하지 받아 와야 함 | ||
} | ||
|
||
|
||
@Secured({"ROLE_CUSTOMER", "ROLE_FARMER"}) | ||
@PostMapping("/api/refund/{orderProductDetailsId}") | ||
public void processPartialRefund (@PathVariable("orderProductDetailsId") Long orderProductDetailsId, | ||
@RequestBody PartialRefundRequest partialRefundRequest) { | ||
|
||
|
||
|
||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/poomasi/domain/order/_aftersales/dto/FullRefundRequest.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,6 @@ | ||
package poomasi.domain.order._aftersales.dto; | ||
|
||
public record FullRefundRequest( | ||
String refundReason | ||
) { | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/poomasi/domain/order/_aftersales/dto/PartialRefundRequest.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 poomasi.domain.order._aftersales.dto; | ||
|
||
import java.math.BigDecimal; | ||
|
||
public record PartialRefundRequest( | ||
BigDecimal refundAmount, // type check 필요 | ||
String refundReason | ||
) { | ||
} |
77 changes: 77 additions & 0 deletions
77
src/main/java/poomasi/domain/order/_aftersales/entity/_abstract/AbstractAfterSales.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,77 @@ | ||
package poomasi.domain.order._aftersales.entity._abstract; | ||
|
||
import jakarta.persistence.*; | ||
import jdk.jfr.Timestamp; | ||
import org.hibernate.annotations.CreationTimestamp; | ||
import org.hibernate.annotations.UpdateTimestamp; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@MappedSuperclass | ||
public abstract class AbstractAfterSales { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(name = "created_at") | ||
@CreationTimestamp | ||
private LocalDateTime createdAt = LocalDateTime.now(); | ||
|
||
@Column(name = "updated_at") | ||
@UpdateTimestamp | ||
private LocalDateTime updateAt = LocalDateTime.now(); | ||
|
||
@Column(name = "deleted_at") | ||
@Timestamp | ||
private LocalDateTime deletedAt; | ||
|
||
} | ||
|
||
/* | ||
* package poomasi.domain.order._aftersales.entity; | ||
import jakarta.persistence.*; | ||
import jdk.jfr.Description; | ||
import org.hibernate.annotations.CreationTimestamp; | ||
import org.hibernate.annotations.UpdateTimestamp; | ||
import poomasi.domain.order._payment.entity.Payment; | ||
import java.math.BigDecimal; | ||
import java.time.LocalDateTime; | ||
@Entity | ||
@Table(name="refund_history") | ||
public class Refund { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
@CreationTimestamp | ||
@Column(name = "created_at") | ||
private LocalDateTime createdAt = LocalDateTime.now(); | ||
@Column(name = "updated_at") | ||
@UpdateTimestamp | ||
private LocalDateTime updatedAt = LocalDateTime.now(); | ||
@Description("삭제 시간") | ||
private LocalDateTime deletedAt; | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
private Payment payment; | ||
private BigDecimal refundAmount; | ||
@OneToOne(fetch = FetchType.LAZY) | ||
private OrderedProduct orderProductDetails; | ||
private String refundReason; | ||
} | ||
* | ||
* */ | ||
|
6 changes: 6 additions & 0 deletions
6
src/main/java/poomasi/domain/order/_aftersales/entity/_farm/FarmAfterSales.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,6 @@ | ||
package poomasi.domain.order._aftersales.entity._farm; | ||
|
||
import poomasi.domain.order._aftersales.entity._abstract.AbstractAfterSales; | ||
|
||
public class FarmAfterSales extends AbstractAfterSales { | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/poomasi/domain/order/_aftersales/entity/_product/ProductAfterSales.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,21 @@ | ||
package poomasi.domain.order._aftersales.entity._product; | ||
|
||
import jakarta.persistence.*; | ||
import poomasi.domain.order._aftersales.entity._abstract.AbstractAfterSales; | ||
import poomasi.domain.order.entity._product.ProductOrder; | ||
|
||
import java.util.List; | ||
|
||
@Entity | ||
@Table(name="product_after_sales") | ||
public class ProductAfterSales extends AbstractAfterSales { | ||
|
||
@OneToOne | ||
@JoinColumn(name = "product_order_id") | ||
private ProductOrder productOrder; | ||
|
||
@OneToMany | ||
private List<ProductAfterSalesDetail> productAfterSalesDetail; | ||
|
||
} | ||
|
42 changes: 42 additions & 0 deletions
42
src/main/java/poomasi/domain/order/_aftersales/entity/_product/ProductAfterSalesDetail.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 poomasi.domain.order._aftersales.entity._product; | ||
|
||
import jakarta.persistence.*; | ||
import jdk.jfr.Description; | ||
import poomasi.domain.order.entity._product.OrderedProduct; | ||
|
||
import java.math.BigDecimal; | ||
|
||
@Description("상품 판매 후 교환/환불/추소 history") | ||
@Entity | ||
@Table(name="product_after_sales_detail") | ||
public class ProductAfterSalesDetail { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne | ||
private ProductAfterSales productAfterSales; | ||
|
||
@OneToOne | ||
private OrderedProduct orderedProduct; | ||
|
||
|
||
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
@JoinColumn(name = "refund_exchange_detail_id", nullable = true) // 외래 키 설정 | ||
private RefundExchangeDetail refundExchangeDetail; | ||
|
||
@Description("ordered products의 환불/교환/취소 금액") | ||
private BigDecimal amount; | ||
|
||
@Description("환불/교환/취소 사유") | ||
private String reason; | ||
|
||
@Description("환불 받을 계좌번호") | ||
private String refundAccount; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private ProductAfterSalesType productAfterSalesType; | ||
|
||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/poomasi/domain/order/_aftersales/entity/_product/ProductAfterSalesType.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 poomasi.domain.order._aftersales.entity._product; | ||
|
||
public enum ProductAfterSalesType { | ||
EXCHANGE, | ||
CANCEL, | ||
REFUND | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/poomasi/domain/order/_aftersales/entity/_product/RefundExchangeDetail.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,29 @@ | ||
package poomasi.domain.order._aftersales.entity._product; | ||
|
||
|
||
import jakarta.persistence.*; | ||
import jdk.jfr.Description; | ||
|
||
@Entity | ||
@Table(name= "refund_exchange_detail") | ||
public class RefundExchangeDetail { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@OneToOne(mappedBy = "refundExchangeDetail") // 주인이 아닌 쪽에 mappedBy 설정 | ||
private ProductAfterSalesDetail productAfterSalesDetail; | ||
|
||
@Description("반품 회수지. 기본 값은 보낸 주소") | ||
private String pickupLocation; | ||
|
||
@Description("반송지. 기본 값은 받은 주소") | ||
private String returnAddress; | ||
|
||
@Description("반품/교환 시 운송장 번호") | ||
private String invoiceNumber; | ||
|
||
@Description("반품/교환 시 요청 사항") | ||
private String request; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/poomasi/domain/order/_aftersales/repository/ProductAfterSalesRepository.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 poomasi.domain.order._aftersales.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import poomasi.domain.order._aftersales.entity._product.ProductAfterSales; | ||
|
||
public interface ProductAfterSalesRepository extends JpaRepository<ProductAfterSales, Long> { | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/poomasi/domain/order/_aftersales/service/RefundService.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,22 @@ | ||
package poomasi.domain.order._aftersales.service; | ||
|
||
|
||
import com.siot.IamportRestClient.IamportClient; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import poomasi.domain.order._aftersales.repository.ProductAfterSalesRepository; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class RefundService { | ||
|
||
private final ProductAfterSalesRepository productAfterSalesRepository; | ||
private final IamportClient iamportClient; | ||
|
||
|
||
/* public void refundFull(){ | ||
iamportClient. | ||
}*/ | ||
|
||
|
||
} |
Oops, something went wrong.