fix(can): 특정 회원(2, 4, 44144) 접속 시 getCans 통화를 JPY로 강제
- CanService.getCans 시그니처를 isNotSelectedCurrency(Boolean) → forcedCurrency(String?)로 변경해 의도 명확화 - 통화 결정 로직을 forcedCurrency 우선 적용 후, 국가 코드(KR=KRW, 그 외=USD)로 fallback - CanController에서 회원 ID가 2, 4, 44144인 경우 forcedCurrency="JPY"로 설정하여 서비스 호출
This commit is contained in:
@@ -17,8 +17,12 @@ class CanController(private val service: CanService) {
|
||||
fun getCans(
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
): ApiResponse<List<CanResponse>> {
|
||||
val isNotSelectedCurrency = member != null && member.id == 2L
|
||||
return ApiResponse.ok(service.getCans(isNotSelectedCurrency = isNotSelectedCurrency))
|
||||
val forcedCurrency = if (member != null && (member.id == 2L || member.id == 4L || member.id == 44144L)) {
|
||||
"JPY"
|
||||
} else {
|
||||
null
|
||||
}
|
||||
return ApiResponse.ok(service.getCans(forcedCurrency = forcedCurrency))
|
||||
}
|
||||
|
||||
@GetMapping("/status")
|
||||
|
||||
@@ -14,14 +14,10 @@ class CanService(
|
||||
private val repository: CanRepository,
|
||||
private val countryContext: CountryContext
|
||||
) {
|
||||
fun getCans(isNotSelectedCurrency: Boolean): List<CanResponse> {
|
||||
val currency = if (isNotSelectedCurrency) {
|
||||
null
|
||||
} else {
|
||||
when (countryContext.countryCode) {
|
||||
"KR" -> "KRW"
|
||||
else -> "USD"
|
||||
}
|
||||
fun getCans(forcedCurrency: String? = null): List<CanResponse> {
|
||||
val currency = forcedCurrency ?: when (countryContext.countryCode) {
|
||||
"KR" -> "KRW"
|
||||
else -> "USD"
|
||||
}
|
||||
return repository.findAllByStatusAndCurrency(status = CanStatus.SALE, currency = currency)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user