-
Notifications
You must be signed in to change notification settings - Fork 6
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
refactor : 두둥티켓 계좌정보 분리 #378
Merged
+79
−27
Merged
Changes from 1 commit
Commits
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
25 changes: 25 additions & 0 deletions
25
DuDoong-Domain/src/main/java/band/gosrock/domain/common/vo/AccountInfoVo.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,25 @@ | ||
package band.gosrock.domain.common.vo; | ||
|
||
|
||
import band.gosrock.domain.domains.ticket_item.domain.TicketItem; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class AccountInfoVo { | ||
|
||
private final String bankName; | ||
|
||
private final String accountNumber; | ||
|
||
private final String accountHolder; | ||
|
||
public static AccountInfoVo from(TicketItem ticketItem) { | ||
return AccountInfoVo.builder() | ||
.bankName(ticketItem.getBankName()) | ||
.accountNumber(ticketItem.getAccountNumber()) | ||
.accountHolder(ticketItem.getAccountHolder()) | ||
.build(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
|
||
import band.gosrock.domain.common.model.BaseTimeEntity; | ||
import band.gosrock.domain.common.vo.AccountInfoVo; | ||
import band.gosrock.domain.common.vo.Money; | ||
import band.gosrock.domain.common.vo.RefundInfoVo; | ||
import band.gosrock.domain.domains.event.domain.Event; | ||
|
@@ -53,9 +54,15 @@ public class TicketItem extends BaseTimeEntity { | |
@Enumerated(EnumType.STRING) | ||
private TicketType type; | ||
|
||
// 은행명 | ||
private String bankName; | ||
|
||
// 계좌번호 | ||
private String accountNumber; | ||
|
||
// 예금주 | ||
private String accountHolder; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. accountInfoVo를 TicketItem 내부에 |
||
// 재고 공개 여부 | ||
private Boolean isQuantityPublic; | ||
|
||
|
@@ -90,7 +97,9 @@ public TicketItem( | |
Long supplyCount, | ||
Long purchaseLimit, | ||
TicketType type, | ||
String bankName, | ||
String accountNumber, | ||
String accountHolder, | ||
Boolean isQuantityPublic, | ||
Boolean isSellable, | ||
LocalDateTime saleStartAt, | ||
|
@@ -104,7 +113,9 @@ public TicketItem( | |
this.supplyCount = supplyCount; | ||
this.purchaseLimit = purchaseLimit; | ||
this.type = type; | ||
this.bankName = bankName; | ||
this.accountNumber = accountNumber; | ||
this.accountHolder = accountHolder; | ||
this.isQuantityPublic = isQuantityPublic; | ||
this.isSellable = isSellable; | ||
this.saleStartAt = saleStartAt; | ||
|
@@ -149,13 +160,15 @@ public void validateEventId(Long eventId) { | |
} | ||
|
||
public void validateTicketPayType(Boolean isPartner) { | ||
// 두둥티켓은 무조건 승인 + 계좌번호 필요 | ||
// 두둥티켓은 무조건 승인 + 계좌정보 필요 | ||
if (this.payType.equals(TicketPayType.DUDOONG_TICKET)) { | ||
if (!this.type.equals(TicketType.APPROVAL)) { | ||
throw InvalidTicketTypeException.EXCEPTION; | ||
} | ||
if (StringUtils.isEmpty(this.accountNumber)) { | ||
throw EmptyAccountNumberException.EXCEPTION; | ||
if (StringUtils.isEmpty(this.accountNumber) | ||
|| StringUtils.isEmpty(this.accountHolder) | ||
|| StringUtils.isEmpty(this.bankName)) { | ||
throw EmptyAccountInfoException.EXCEPTION; | ||
} | ||
} | ||
// 유료티켓은 무조건 선착순 + 제휴 확인 + 1000원 이상 | ||
|
@@ -178,6 +191,10 @@ else if (this.payType.equals(TicketPayType.PRICE_TICKET)) { | |
} | ||
} | ||
|
||
public AccountInfoVo toAccountInfoVo() { | ||
return AccountInfoVo.from(this); | ||
} | ||
|
||
public RefundInfoVo getRefundInfoVo() { | ||
return event.toRefundInfoVo(); | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
...ain/java/band/gosrock/domain/domains/ticket_item/exception/EmptyAccountInfoException.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 band.gosrock.domain.domains.ticket_item.exception; | ||
|
||
|
||
import band.gosrock.common.exception.DuDoongCodeException; | ||
|
||
public class EmptyAccountInfoException extends DuDoongCodeException { | ||
|
||
public static final DuDoongCodeException EXCEPTION = new EmptyAccountInfoException(); | ||
|
||
private EmptyAccountInfoException() { | ||
super(TicketItemErrorCode.EMPTY_ACCOUT_INFO); | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
...n/java/band/gosrock/domain/domains/ticket_item/exception/EmptyAccountNumberException.java
This file was deleted.
Oops, something went wrong.
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
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.
@NotNull
말고@Positive
아니면@Min
을 이용해서 음수 처리도 해주면 좋을 거 같아요