-
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 remote-tracking branch 'origin/week10' into week10
- Loading branch information
Showing
60 changed files
with
1,584 additions
and
920 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
src/main/java/poomasi/domain/order/_aftersales/controller/AfterSalesController.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,80 @@ | ||
package poomasi.domain.order._aftersales.controller; | ||
|
||
|
||
import com.siot.IamportRestClient.exception.IamportResponseException; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.annotation.Secured; | ||
import org.springframework.web.bind.annotation.*; | ||
import poomasi.domain.order._aftersales.dto.cancel.request.FarmCancelRequest; | ||
import poomasi.domain.order._aftersales.dto.cancel.request.ProductCancelRequest; | ||
import poomasi.domain.order._aftersales.dto.refund.request.ProductRefundRequest; | ||
import poomasi.domain.order._aftersales.dto.refund.request.ProductRefundRequestApprovalRequest; | ||
import poomasi.domain.order._aftersales.dto.refund.request.ProductRefundRequestDeniedRequest; | ||
import poomasi.domain.order._aftersales.service.FarmAfterSalesService; | ||
import poomasi.domain.order._aftersales.service.ProductAfterSalesService; | ||
|
||
import java.io.IOException; | ||
|
||
@RestController | ||
@RequestMapping("/api/aftersales") | ||
@RequiredArgsConstructor | ||
public class AfterSalesController { | ||
|
||
private final ProductAfterSalesService productAfterSalesService; | ||
private final FarmAfterSalesService farmAfterSalesService; | ||
|
||
//-------------------------product cancel---------------------// | ||
@Secured({"ROLE_CUSTOMER", "ROLE_FARMER"}) | ||
@PostMapping("/product/cancel") | ||
public ResponseEntity<?> productCancel(@RequestBody ProductCancelRequest productCancelRequest) throws IOException, IamportResponseException { | ||
return ResponseEntity.ok( | ||
productAfterSalesService.cancel(productCancelRequest) | ||
); | ||
} | ||
|
||
//-------------------------product refund---------------------// | ||
@Secured({"ROLE_CUSTOMER", "ROLE_FARMER"}) | ||
@PostMapping("/refund-request") | ||
public ResponseEntity<?> requestRefund(@RequestBody ProductRefundRequest productRefundRequest) { | ||
return ResponseEntity.ok( | ||
productAfterSalesService. | ||
createRefundRequest(productRefundRequest) | ||
); | ||
} | ||
|
||
@Secured({"ROLE_FARMER"}) | ||
@PostMapping("/approve-refund-request") | ||
public ResponseEntity<?> approveRefundRequest(@RequestBody ProductRefundRequestApprovalRequest productRefundRequestApprovalRequest) throws IOException, IamportResponseException { | ||
return ResponseEntity.ok( | ||
productAfterSalesService.processRefundApproval(productRefundRequestApprovalRequest) | ||
); | ||
} | ||
|
||
|
||
@Secured({"ROLE_FARMER"}) | ||
@PostMapping("/deniedrefund-request") | ||
public ResponseEntity<?> deniedRefundRequest(@RequestBody ProductRefundRequestDeniedRequest productRefundRequestDeniedRequest) { | ||
return ResponseEntity.ok( | ||
productAfterSalesService.processRefundDenied(productRefundRequestDeniedRequest) | ||
); | ||
} | ||
|
||
|
||
//-------------------------farm cancel---------------------// | ||
@Secured({"ROLE_CUSTOMER", "ROLE_FARMER"}) | ||
@PostMapping("/farm/cancel") | ||
public ResponseEntity<?> farmCancel(@RequestBody FarmCancelRequest farmCancelRequest) throws IOException, IamportResponseException { | ||
return ResponseEntity.ok( | ||
farmAfterSalesService.farmCancel(farmCancelRequest) | ||
); | ||
} | ||
|
||
|
||
//------------웹훅 api 받아서 해야 함---------// | ||
|
||
|
||
|
||
|
||
|
||
} |
8 changes: 0 additions & 8 deletions
8
src/main/java/poomasi/domain/order/_aftersales/controller/CancelController.java
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
src/main/java/poomasi/domain/order/_aftersales/controller/ExchangeController.java
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
src/main/java/poomasi/domain/order/_aftersales/controller/RefundController.java
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/main/java/poomasi/domain/order/_aftersales/dto/FullRefundRequest.java
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
src/main/java/poomasi/domain/order/_aftersales/dto/PartialRefundRequest.java
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
src/main/java/poomasi/domain/order/_aftersales/dto/cancel/request/FarmCancelRequest.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,4 @@ | ||
package poomasi.domain.order._aftersales.dto.cancel.request; | ||
|
||
public record FarmCancelRequest(Long reservationId) { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/poomasi/domain/order/_aftersales/dto/cancel/request/ProductCancelRequest.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,4 @@ | ||
package poomasi.domain.order._aftersales.dto.cancel.request; | ||
|
||
public record ProductCancelRequest(Long orderedProductId, Integer cancelRequestQuantity, String cancelReason) { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/poomasi/domain/order/_aftersales/dto/cancel/response/FarmCancelResponse.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,4 @@ | ||
package poomasi.domain.order._aftersales.dto.cancel.response; | ||
|
||
public record FarmCancelResponse(Long reservationId, String status) { | ||
} |
16 changes: 16 additions & 0 deletions
16
...main/java/poomasi/domain/order/_aftersales/dto/cancel/response/ProductCancelResponse.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,16 @@ | ||
package poomasi.domain.order._aftersales.dto.cancel.response; | ||
|
||
import poomasi.domain.order._aftersales.entity._product.ProductAfterSalesStatus; | ||
import poomasi.domain.order.entity._product.OrderedProductStatus; | ||
|
||
import java.math.BigDecimal; | ||
|
||
public record ProductCancelResponse( | ||
Long orderedProductId, | ||
OrderedProductStatus orderedProductStatus, | ||
|
||
Long productAfterSalesDetailId, | ||
Integer cancelQuantity, | ||
ProductAfterSalesStatus productAfterSalesStatus, | ||
BigDecimal finalCancelAmount) { | ||
} |
4 changes: 4 additions & 0 deletions
4
...in/java/poomasi/domain/order/_aftersales/dto/exchange/request/ProductExchangeRequest.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,4 @@ | ||
package poomasi.domain.order._aftersales.dto.exchange.request; | ||
|
||
public record ProductExchangeRequest(Long orderedProductId, String exchangeReason) { | ||
} |
4 changes: 4 additions & 0 deletions
4
.../java/poomasi/domain/order/_aftersales/dto/exchange/response/ProductExchangeResponse.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,4 @@ | ||
package poomasi.domain.order._aftersales.dto.exchange.response; | ||
|
||
public record ProductExchangeResponse(Long orderedProductId, String message) { | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/poomasi/domain/order/_aftersales/dto/refund/request/ProductRefundRequest.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,13 @@ | ||
package poomasi.domain.order._aftersales.dto.refund.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Positive; | ||
import jakarta.validation.constraints.Size; | ||
|
||
public record ProductRefundRequest( | ||
@NotNull Long orderedProductId, // 필수 필드 | ||
@Positive Integer refundRequestQuantity, //필수 | ||
@Size(max = 500) String refundReason, // 필수 필드 | ||
@Size(max = 20) String request // nullable 필드 | ||
) { | ||
} |
5 changes: 5 additions & 0 deletions
5
...masi/domain/order/_aftersales/dto/refund/request/ProductRefundRequestApprovalRequest.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,5 @@ | ||
package poomasi.domain.order._aftersales.dto.refund.request; | ||
|
||
public record ProductRefundRequestApprovalRequest(Long productAfterSalesDetailId, | ||
String invoiceNumber) { | ||
} |
5 changes: 5 additions & 0 deletions
5
...oomasi/domain/order/_aftersales/dto/refund/request/ProductRefundRequestDeniedRequest.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,5 @@ | ||
package poomasi.domain.order._aftersales.dto.refund.request; | ||
|
||
public record ProductRefundRequestDeniedRequest(Long productAfterSalesDetailId, | ||
String refundDeinedReason) { | ||
} |
12 changes: 12 additions & 0 deletions
12
...si/domain/order/_aftersales/dto/refund/response/ProductRefundRequestApprovalResponse.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,12 @@ | ||
package poomasi.domain.order._aftersales.dto.refund.response; | ||
|
||
import java.math.BigDecimal; | ||
|
||
public record ProductRefundRequestApprovalResponse( | ||
Long orderedProductId, | ||
Integer count, | ||
BigDecimal refundAmount, | ||
Long productAfterSalesDetailId, | ||
String invoiceNumber | ||
) { | ||
} |
8 changes: 8 additions & 0 deletions
8
...masi/domain/order/_aftersales/dto/refund/response/ProductRefundRequestDeniedResponse.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.dto.refund.response; | ||
|
||
import poomasi.domain.order._aftersales.entity._product.ProductAfterSalesStatus; | ||
|
||
public record ProductRefundRequestDeniedResponse(Long productAfterSalesDetailId, | ||
ProductAfterSalesStatus productAfterSalesStatus, | ||
String productRefundDeniedReason) { | ||
} |
19 changes: 19 additions & 0 deletions
19
...va/poomasi/domain/order/_aftersales/dto/refund/response/ProductRefundRequestResponse.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,19 @@ | ||
package poomasi.domain.order._aftersales.dto.refund.response; | ||
|
||
import poomasi.domain.order._aftersales.entity._product.ProductAfterSalesStatus; | ||
import poomasi.domain.order.entity._product.OrderedProductStatus; | ||
|
||
import java.math.BigDecimal; | ||
|
||
public record ProductRefundRequestResponse( | ||
Long orderedProductId, | ||
OrderedProductStatus orderedProductStatus, | ||
|
||
Long productAfterSalesDetailId, | ||
Integer refundQuantity, | ||
ProductAfterSalesStatus productAfterSalesTypem, | ||
BigDecimal finalRefundAmount | ||
) { | ||
} | ||
|
||
|
77 changes: 0 additions & 77 deletions
77
src/main/java/poomasi/domain/order/_aftersales/entity/_abstract/AbstractAfterSales.java
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package poomasi.domain.order._aftersales.entity._farm; | ||
|
||
import poomasi.domain.order._aftersales.entity._abstract.AbstractAfterSales; | ||
|
||
public class FarmAfterSales extends AbstractAfterSales { | ||
|
||
public class FarmAfterSales { | ||
} |
21 changes: 0 additions & 21 deletions
21
src/main/java/poomasi/domain/order/_aftersales/entity/_product/ProductAfterSales.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.