-
Notifications
You must be signed in to change notification settings - Fork 1
[#26]feature: 카드사별 프로모션 관리 #27
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
Conversation
1. db 에서는 카드사별 프로모션 데이터를 json으로 관리한다. 2. CardBinPromotion 매핑 시 payProvier 에 따라 해당카드사 프로모션 객체로 변환한다.
| * - 조회 후 PromotionDataPostProcessor에서 PayProvider에 맞게 재변환 | ||
| */ | ||
| @JdbcTypeCode(SqlTypes.JSON) | ||
| @Column(name = "promotion_data", nullable = false, columnDefinition = "json") |
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.
json으로 저장한다는건, 안에 있는 내용을 특별히 들여다 볼 필요는 없다는 것과 같은 의미인건가요? 😄
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.
카드사에서 내려준 프로모션 정보는 json으로 관리하고
그 기반으로 사용자에게 혜택정보 제공을 위한 별도 컬럼으로 분리했습니다(카드사마다 관리파라미터가 다르다고 가정했습니다)
현재로서는 json 정보가 위 시점 이후로는 다루지 않고 있습니다.
사실은.. 저번 멘토링때 카드사별로 카드빈객체를 관리한다는 말씀에 db는 json, 서버에서는 각 객체를 정의해둔 상태입니다.
단순 기록용으로만 남게된다면 json컬럼은 삭제하는게 맞을 거 같습니다!
🤔혹시 결제 요청 시에 프로모션에 맞는 키값(?) 이 필요하나요?
| } | ||
|
|
||
| @Override | ||
| public BasePromotionData convertToEntityAttribute(String dbData) { |
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 objectMapper.readValue(json, clazz); | ||
| } | ||
|
|
||
| private Class<? extends BasePromotionData> getPromotionDataClass(PayProvider payProvider) { |
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.
음 ... 그냥 아이디어인데, 차라리 이걸 그냥 스트링으로 받아서 알아서 처리하는건? 혹은 그냥 map으로 받는건? 어떤가요?
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.
네 문자열로 받아서 서비스단에서 처리하는게 좋을 거 같습니다 🤩
엔티티 레이어에서 변환하려니 임시 래퍼클래스꺼지 생성되고..
반드시 엔티티에서 처리하지 않아도 되는 부분인 거 같습니다!
저 지금 엔티티,도메인 강박 지옥에 빠진 ..거 같습니다🥲
f-lab-lyan
left a comment
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.
수고하셨습니다. 👍
#26