-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 거래 내역은 경매 식별자, 구매(입찰) 가격, 구매 수량, 거래 유형(입찰, 환불), 구매자, 판매자, 생성일자를 포함한다. #178
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
deb48a2
style: AuctionInfo에서 사용되지 않는 status 값에 대한 java doc 설명 제
chhs2131 c2254cc
feat: 생성 및 수정시간을 관리하는 BaseTimeEntity 클래스 추가
chhs2131 fea6876
feat: 거래 내역 DTO에 '거래 일자(createdAt)' 항목을 추가
chhs2131 730171c
refactor: BaseTimeEntity의 패키지 위치를 변경한다.
chhs2131 4b629d8
refactor: 거래이력 생성 및 수저 시간을 도메인 내부에서 관리
chhs2131 a063109
Merge remote-tracking branch 'refs/remotes/origin/dev' into feat/111
chhs2131 c47b734
fix: Test의 BidHistory가 생성될 때 생성시간, 변경시간이 Null로 생성되던 케이스 수
chhs2131 86ee1ee
refactor: 환불을 진행할 때, 거래내역에게 상태 변화를 요청하여 처리한다.
chhs2131 2c5bda0
refactor: 환불 요청 시간을 외부에서 받아 BidHistory에 기록한다.
chhs2131 4abd8ee
fix: 환불 시, 사용자 포인트가 영속적으로 관리되지 못하던 문제 수정
chhs2131 6ab62a4
Merge branch 'dev' into feat/111
chhs2131 f20a417
feat: 거래내역 내부에서 업데이트 시간을 직접적으로 관리하지 않는다.
chhs2131 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
39 changes: 34 additions & 5 deletions
39
src/test/java/com/wootecam/luckyvickyauction/core/payment/domain/BidHistoryTest.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,22 +1,51 @@ | ||
package com.wootecam.luckyvickyauction.core.payment.domain; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
||
import com.wootecam.luckyvickyauction.global.exception.BadRequestException; | ||
import com.wootecam.luckyvickyauction.global.exception.ErrorCode; | ||
import java.time.ZonedDateTime; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class BidHistoryTest { | ||
class BidHistoryTest { | ||
|
||
@Test | ||
void 거래_내역이_환불_상태인지_확인할_수_있다() { | ||
void 성공적으로_환불_표시를_하고_업데이트_시간을_갱신_한다() { | ||
// given | ||
ZonedDateTime now = ZonedDateTime.now(); | ||
BidHistory refundBidHistory = BidHistory.builder() | ||
.bidStatus(BidStatus.REFUND) | ||
.id(1L) | ||
.auctionId(1L) | ||
.productName("test") | ||
.price(100L) | ||
.quantity(1L) | ||
.bidStatus(BidStatus.BID) | ||
.createdAt(now) | ||
.updatedAt(now) | ||
.build(); | ||
|
||
// when | ||
boolean isRefundStatus = refundBidHistory.isRefundStatus(); | ||
refundBidHistory.markAsRefund(now.plusMinutes(1)); | ||
|
||
// then | ||
assertThat(isRefundStatus).isTrue(); | ||
assertThat(refundBidHistory.getBidStatus()).isEqualTo(BidStatus.REFUND); | ||
assertThat(refundBidHistory.getUpdatedAt()).isEqualTo(now.plusMinutes(1)); | ||
} | ||
|
||
@Test | ||
void 이미_환불된_경매에_환불_표시를_하면_예외가_발생한다() { | ||
// given | ||
ZonedDateTime now = ZonedDateTime.now(); | ||
BidHistory refundBidHistory = BidHistory.builder() | ||
.bidStatus(BidStatus.REFUND) | ||
.build(); | ||
|
||
// expect | ||
assertThatThrownBy(() -> refundBidHistory.markAsRefund(now)) | ||
.isInstanceOf(BadRequestException.class) | ||
.hasMessage("이미 환불된 입찰 내역입니다.") | ||
.satisfies(exception -> assertThat(exception).hasFieldOrPropertyWithValue("errorCode", ErrorCode.B005)); | ||
|
||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제안 : 이미 환불 처리가 되었는데 환불 요청을 하는 것이면 예외를 터트리는 것보다 그냥 return 하는 것은 어떨까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋은 의견입니다! 사실 '거래 내역' 입장에서는 자신의 상태가
환불됨
->환불됨
으로 변경된다고 해서 예외로 인식하지 않아도 될 것 같아요!하지만 해당 로직이 PaymentService에서 사용되던 것을 BidHistory 내부로 이전한 것이라, PaymentService와 PaymentServiceTest 등에도 영향이 있어, 별도의 태스크를 생성하고 그곳에서 처리하는 것이 좋을 것 같습니다..!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어떤 이름의 이슈를 생성할지 모르겠네요. 일단 Priority2의 리펙터링 이슈를 생성할께요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.