NaverPromotion

네이버 프로모션 모델. 네이버 할인 정보 파싱 및 계산.

클래스 정의

data class NaverPromotion(
    val id: String,
    val name: String,
    val amount: Long,
    val adult: Boolean,
    val child: Boolean,
    val infant: Boolean,
)

필드

필드타입설명
idString프로모션 ID
nameString프로모션명
amountLong할인 금액 (편도 기준)
adultBoolean성인 적용 여부
childBoolean아동 적용 여부
infantBoolean유아 적용 여부

메서드

getAmount(tripType, passengerType)

fun getAmount(tripType: TripType, passengerType: PassengerType): Long?

승객 유형별 할인 금액 반환. 왕복 시 2배.

getTotalAmount(tripType, adult, child, infant)

fun getTotalAmount(tripType: TripType, adult: Int, child: Int, infant: Int): Long

전체 승객 할인 총액 계산.

of(naverDiscountInfo) (Companion)

fun of(naverDiscountInfo: String): NaverPromotion?

문자열 파싱하여 NaverPromotion 생성.

포맷: {id}::{name}::{amount}::{adult}::{child}::{infant}

사용처

  • 네이버 항공 연동
  • 네이버 할인 가격 계산