generated from pricelees/issue-pr-template
[#30] 코드 구조 개선 #31
@ -22,6 +22,14 @@ class PaymentService(
|
|||||||
private val paymentFinder: PaymentFinder,
|
private val paymentFinder: PaymentFinder,
|
||||||
private val paymentWriter: PaymentWriter
|
private val paymentWriter: PaymentWriter
|
||||||
) {
|
) {
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
fun existsByReservationId(reservationId: Long): Boolean {
|
||||||
|
log.info { "[PaymentService.existsByReservationId] 시작: reservationId=$reservationId" }
|
||||||
|
|
||||||
|
return paymentFinder.existsPaymentByReservationId(reservationId)
|
||||||
|
.also { log.info { "[PaymentService.existsByReservationId] 완료: reservationId=$reservationId, isPaid=$it" } }
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun createPayment(
|
fun createPayment(
|
||||||
approvedPaymentInfo: PaymentApproveResponse,
|
approvedPaymentInfo: PaymentApproveResponse,
|
||||||
@ -41,14 +49,6 @@ class PaymentService(
|
|||||||
.also { log.info { "[PaymentService.createPayment] 완료: paymentKey=${it.paymentKey}, reservationId=${reservation.id}, paymentId=${it.id}" } }
|
.also { log.info { "[PaymentService.createPayment] 완료: paymentKey=${it.paymentKey}, reservationId=${reservation.id}, paymentId=${it.id}" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
|
||||||
fun existsByReservationId(reservationId: Long): Boolean {
|
|
||||||
log.info { "[PaymentService.isReservationPaid] 시작: reservationId=$reservationId" }
|
|
||||||
|
|
||||||
return paymentFinder.existsPaymentByReservationId(reservationId)
|
|
||||||
.also { log.info { "[PaymentService.isReservationPaid] 완료: reservationId=$reservationId, isPaid=$it" } }
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun createCanceledPayment(
|
fun createCanceledPayment(
|
||||||
canceledPaymentInfo: PaymentCancelResponse,
|
canceledPaymentInfo: PaymentCancelResponse,
|
||||||
@ -72,7 +72,7 @@ class PaymentService(
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun createCanceledPayment(reservationId: Long): PaymentCancelRequest {
|
fun createCanceledPayment(reservationId: Long): PaymentCancelRequest {
|
||||||
log.info { "[PaymentService.createCanceledPaymentByReservationId] 시작: reservationId=$reservationId" }
|
log.info { "[PaymentService.createCanceledPayment] 시작: reservationId=$reservationId" }
|
||||||
|
|
||||||
val payment: PaymentEntity = paymentFinder.findByReservationId(reservationId)
|
val payment: PaymentEntity = paymentFinder.findByReservationId(reservationId)
|
||||||
val canceled: CanceledPaymentEntity = paymentWriter.createCanceled(
|
val canceled: CanceledPaymentEntity = paymentWriter.createCanceled(
|
||||||
@ -82,7 +82,7 @@ class PaymentService(
|
|||||||
)
|
)
|
||||||
|
|
||||||
return PaymentCancelRequest(canceled.paymentKey, canceled.cancelAmount, canceled.cancelReason)
|
return PaymentCancelRequest(canceled.paymentKey, canceled.cancelAmount, canceled.cancelReason)
|
||||||
.also { log.info { "[PaymentService.createCanceledPaymentByReservationId] 완료: reservationId=$reservationId, paymentKey=${it.paymentKey}" } }
|
.also { log.info { "[PaymentService.createCanceledPayment] 완료: reservationId=$reservationId, paymentKey=${it.paymentKey}" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user