Skip to content
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 : 티켓 타입 기획 수정 반영 #339

Merged
merged 3 commits into from
Feb 10, 2023

Conversation

kim-wonjin
Copy link
Member

개요

작업사항

  • 두둥티켓 타입 추가

  • 기존 ticketType -> approveType
    새로운 지불타입 -> payType 으로 네이밍

  • TicketType(현 승인타입) 은 결제, 발행티켓 등 쓰이는 곳이 많아서 최대한 네이밍 안건드리고,
    클라이언트 쪽에서 헷갈리지 않을 정도로만 처리했습니다.

  • 결과

    • 두둥티켓 : 승인방식만 가능 + 계좌번호 필요
    • 유료티켓 : 선착순방식만 가능 + 제휴호스트만 가능 + 1000원 이상만 가능
    • 무료티켓 : 두방식 모두 가능 + 가격 0원 고정
  • 재고 공개 옵션 입력값 추가

변경로직

  • 내용을 적어주세요.

@kim-wonjin kim-wonjin self-assigned this Feb 10, 2023
@kim-wonjin kim-wonjin added For: API [이슈 대상] 외부 API Type: Feature [이슈 목적] 새로운 기능 추가 Type: Refactor [이슈 목적] 프로덕션 코드 리팩토링 labels Feb 10, 2023
Copy link
Member

@ImNM ImNM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 지불 타입 아이디어좋네요!
저도 바꿀게 많이 줄었네요 덕분에 감사합니두둥!

if (!this.type.equals(TicketType.APPROVAL)) {
throw InvalidTicketTypeException.EXCEPTION;
}
if (this.accountNumber == null || this.accountNumber.isBlank()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StringUtils isEmpty 있을거에요!


private String value;

@JsonValue private String kr;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이러면 스웨거엔 한글로 뜰텐데
입력받을 땐 DUDOONG_TICKET
이렇게 입력받아야 하지않나염?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어라 저희 스웨거 한글로 통일한거 아녔나여??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅇㅇㅇ 근데
이러면 클라이언트가 한글로 입력하면 변환되나?
내려주는건 한글인데
스웨거 스키마 가면 죄다 한글이라서 뭐로 입력해야하는지 모르자넹

한글로 입력받을 수 있나? JsonCreater 같은걸로

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그냥 두둥티켓, 무료티켓, 유료티켓 이렇게 입력하게 해놧는디?
승인타입이랑 마찬가지로

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 그렇게 하면 받아짐? 굿굿 잘했넹 ㅇㅋㅇㅋ

Comment on lines 153 to 177
if (this.payType.equals(TicketPayType.DUDOONG_TICKET)) {
if (!this.type.equals(TicketType.APPROVAL)) {
throw InvalidTicketTypeException.EXCEPTION;
}
if (this.accountNumber == null || this.accountNumber.isBlank()) {
throw EmptyAccountNumberException.EXCEPTION;
}
}
// 유료티켓은 무조건 선착순 + 제휴 확인 + 1000원 이상
else if (this.payType.equals(TicketPayType.PRICE_TICKET)) {
if (!this.type.equals(TicketType.FIRST_COME_FIRST_SERVED)) {
throw InvalidTicketTypeException.EXCEPTION;
}
if (!isPartner) {
throw InvalidPartnerException.EXCEPTION;
}
if (this.price.isLessThan(Money.wons(1000))) {
throw InvalidTicketPriceException.EXCEPTION;
}
}
// 무료티켓은 무조건 0원
else {
if (!this.price.equals(Money.ZERO)) {
throw InvalidTicketPriceException.EXCEPTION;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TicketPayType 이넘안에서
메소드 하나 만들고 각 이넘 값마다 ( 두둥티켓 , 무료 티켓 , 유료티켓
오버라이딩을 밸리데이션을 안에서 해버리면
더 깔끔할것같긴해요

레퍼런스

근데 이건뭐 자율입니당
참고요! 안바꿔도 됨

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이부분은 좀 더 고민을 해보겠숩니당!

Comment on lines -21 to +22
if (!isPartner) {
ticketItem.validateTicketPrice();
}

ticketItem.validateTicketPayType(isPartner);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿 잘 집어넣으셨네용

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 314 Code Smells

16.1% 16.1% Coverage
0.0% 0.0% Duplication

Copy link
Member

@gengminy gengminy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@kim-wonjin kim-wonjin merged commit 4b3f96c into dev Feb 10, 2023
@kim-wonjin kim-wonjin deleted the refactor/327-create-ticket-item branch February 10, 2023 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For: API [이슈 대상] 외부 API Type: Feature [이슈 목적] 새로운 기능 추가 Type: Refactor [이슈 목적] 프로덕션 코드 리팩토링
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🔨[refactor] 티켓 타입 추가(두둥티켓)
3 participants