국가 컨텍스트로 캔 조회

This commit is contained in:
2026-01-14 15:21:33 +09:00
parent 6683b40425
commit b07eada277
4 changed files with 10 additions and 38 deletions

View File

@@ -3,7 +3,7 @@ package kr.co.vividnext.sodalive.can
import kr.co.vividnext.sodalive.can.charge.ChargeStatus
import kr.co.vividnext.sodalive.can.payment.PaymentGateway
import kr.co.vividnext.sodalive.can.use.CanUsage
import kr.co.vividnext.sodalive.common.GeoCountry
import kr.co.vividnext.sodalive.common.CountryContext
import kr.co.vividnext.sodalive.member.Member
import org.springframework.data.domain.Pageable
import org.springframework.stereotype.Service
@@ -11,10 +11,13 @@ import java.time.ZoneId
import java.time.format.DateTimeFormatter
@Service
class CanService(private val repository: CanRepository) {
fun getCans(geoCountry: GeoCountry): List<CanResponse> {
val currency = when (geoCountry) {
GeoCountry.KR -> "KRW"
class CanService(
private val repository: CanRepository,
private val countryContext: CountryContext
) {
fun getCans(): List<CanResponse> {
val currency = when (countryContext.countryCode) {
"KR" -> "KRW"
else -> "USD"
}
return repository.findAllByStatusAndCurrency(status = CanStatus.SALE, currency = currency)