pricelees 8befd45741 refactor: Time 관련 네이밍 개선
- ReservationTime -> Time으로 접두사 수정
- DTO 네이밍 개선(-> 이후 다른 도메인에도 반영 예정)
2025-07-22 14:26:08 +09:00

56 lines
1.7 KiB
Kotlin

package roomescape.payment.web
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import roomescape.payment.infrastructure.client.PaymentCancelResponseDeserializer
import roomescape.payment.infrastructure.persistence.PaymentEntity
import roomescape.reservation.web.ReservationResponse
import roomescape.reservation.web.toCreateResponse
import java.time.OffsetDateTime
data class PaymentApproveRequest(
val paymentKey: String,
val orderId: String,
val amount: Long,
val paymentType: String
)
@JsonIgnoreProperties(ignoreUnknown = true)
data class PaymentApproveResponse(
val paymentKey: String,
val orderId: String,
val approvedAt: OffsetDateTime,
val totalAmount: Long
)
data class PaymentCancelRequest(
val paymentKey: String,
val amount: Long,
val cancelReason: String
)
@JsonDeserialize(using = PaymentCancelResponseDeserializer::class)
data class PaymentCancelResponse(
val cancelStatus: String,
val cancelReason: String,
val cancelAmount: Long,
val canceledAt: OffsetDateTime
)
data class ReservationPaymentResponse(
val id: Long,
val orderId: String,
val paymentKey: String,
val totalAmount: Long,
val reservation: ReservationResponse,
val approvedAt: OffsetDateTime
)
fun PaymentEntity.toReservationPaymentResponse(): ReservationPaymentResponse = ReservationPaymentResponse(
id = this.id!!,
orderId = this.orderId,
paymentKey = this.paymentKey,
totalAmount = this.totalAmount,
reservation = this.reservation.toCreateResponse(),
approvedAt = this.approvedAt
)