[#18] 코드 정리 및 일부 컨벤션 통일 #19

Merged
pricelees merged 24 commits from refactor/#18 into main 2025-07-22 09:05:31 +00:00
4 changed files with 11 additions and 11 deletions
Showing only changes of commit 201e11af86 - Show all commits

View File

@ -19,7 +19,7 @@ class PaymentService(
private val canceledPaymentRepository: CanceledPaymentRepository private val canceledPaymentRepository: CanceledPaymentRepository
) { ) {
@Transactional @Transactional
fun savePayment( fun createPayment(
paymentResponse: PaymentApproveResponse, paymentResponse: PaymentApproveResponse,
reservation: ReservationEntity reservation: ReservationEntity
): ReservationPaymentResponse = PaymentEntity( ): ReservationPaymentResponse = PaymentEntity(
@ -38,7 +38,7 @@ class PaymentService(
): Boolean = paymentRepository.existsByReservationId(reservationId) ): Boolean = paymentRepository.existsByReservationId(reservationId)
@Transactional @Transactional
fun saveCanceledPayment( fun createCanceledPayment(
cancelInfo: PaymentCancelResponse, cancelInfo: PaymentCancelResponse,
approvedAt: OffsetDateTime, approvedAt: OffsetDateTime,
paymentKey: String paymentKey: String
@ -52,7 +52,7 @@ class PaymentService(
@Transactional @Transactional
fun cancelPaymentByAdmin(reservationId: Long): PaymentCancelRequest { fun createCanceledPaymentByReservationId(reservationId: Long): PaymentCancelRequest {
val paymentKey: String = paymentRepository.findPaymentKeyByReservationId(reservationId) val paymentKey: String = paymentRepository.findPaymentKeyByReservationId(reservationId)
?: throw RoomescapeException( ?: throw RoomescapeException(
ErrorType.PAYMENT_NOT_FOUND, ErrorType.PAYMENT_NOT_FOUND,

View File

@ -24,7 +24,7 @@ class ReservationWithPaymentService(
): ReservationResponse { ): ReservationResponse {
val reservation: ReservationEntity = reservationService.addReservation(request, memberId) val reservation: ReservationEntity = reservationService.addReservation(request, memberId)
return paymentService.savePayment(paymentInfo, reservation) return paymentService.createPayment(paymentInfo, reservation)
.reservation .reservation
} }
@ -33,14 +33,14 @@ class ReservationWithPaymentService(
approvedAt: OffsetDateTime, approvedAt: OffsetDateTime,
paymentKey: String paymentKey: String
) { ) {
paymentService.saveCanceledPayment(cancelInfo, approvedAt, paymentKey) paymentService.createCanceledPayment(cancelInfo, approvedAt, paymentKey)
} }
fun removeReservationWithPayment( fun removeReservationWithPayment(
reservationId: Long, reservationId: Long,
memberId: Long memberId: Long
): PaymentCancelRequest { ): PaymentCancelRequest {
val paymentCancelRequest = paymentService.cancelPaymentByAdmin(reservationId) val paymentCancelRequest = paymentService.createCanceledPaymentByReservationId(reservationId)
reservationService.removeReservationById(reservationId, memberId) reservationService.removeReservationById(reservationId, memberId)
return paymentCancelRequest return paymentCancelRequest

View File

@ -29,7 +29,7 @@ class PaymentServiceTest : FunSpec({
every { paymentRepository.findPaymentKeyByReservationId(reservationId) } returns null every { paymentRepository.findPaymentKeyByReservationId(reservationId) } returns null
val exception = shouldThrow<RoomescapeException> { val exception = shouldThrow<RoomescapeException> {
paymentService.cancelPaymentByAdmin(reservationId) paymentService.createCanceledPaymentByReservationId(reservationId)
} }
assertSoftly(exception) { assertSoftly(exception) {
@ -51,7 +51,7 @@ class PaymentServiceTest : FunSpec({
} returns null } returns null
val exception = shouldThrow<RoomescapeException> { val exception = shouldThrow<RoomescapeException> {
paymentService.cancelPaymentByAdmin(reservationId) paymentService.createCanceledPaymentByReservationId(reservationId)
} }
assertSoftly(exception) { assertSoftly(exception) {
@ -79,7 +79,7 @@ class PaymentServiceTest : FunSpec({
cancelAmount = paymentEntity.totalAmount, cancelAmount = paymentEntity.totalAmount,
) )
val result: PaymentCancelRequest = paymentService.cancelPaymentByAdmin(reservationId) val result: PaymentCancelRequest = paymentService.createCanceledPaymentByReservationId(reservationId)
assertSoftly(result) { assertSoftly(result) {
this.paymentKey shouldBe paymentKey this.paymentKey shouldBe paymentKey

View File

@ -52,7 +52,7 @@ class ReservationWithPaymentServiceTest : FunSpec({
} returns reservationEntity } returns reservationEntity
every { every {
paymentService.savePayment(paymentApproveResponse, reservationEntity) paymentService.createPayment(paymentApproveResponse, reservationEntity)
} returns paymentEntity.toReservationPaymentResponse() } returns paymentEntity.toReservationPaymentResponse()
val result: ReservationResponse = reservationWithPaymentService.addReservationWithPayment( val result: ReservationResponse = reservationWithPaymentService.addReservationWithPayment(
@ -81,7 +81,7 @@ class ReservationWithPaymentServiceTest : FunSpec({
) )
every { every {
paymentService.cancelPaymentByAdmin(reservationEntity.id!!) paymentService.createCanceledPaymentByReservationId(reservationEntity.id!!)
} returns paymentCancelRequest } returns paymentCancelRequest
every { every {