diff --git a/src/main/java/roomescape/payment/business/PaymentService.kt b/src/main/java/roomescape/payment/business/PaymentService.kt index 5be39033..a2e555b4 100644 --- a/src/main/java/roomescape/payment/business/PaymentService.kt +++ b/src/main/java/roomescape/payment/business/PaymentService.kt @@ -19,7 +19,7 @@ class PaymentService( private val canceledPaymentRepository: CanceledPaymentRepository ) { @Transactional - fun savePayment( + fun createPayment( paymentResponse: PaymentApproveResponse, reservation: ReservationEntity ): ReservationPaymentResponse = PaymentEntity( @@ -38,7 +38,7 @@ class PaymentService( ): Boolean = paymentRepository.existsByReservationId(reservationId) @Transactional - fun saveCanceledPayment( + fun createCanceledPayment( cancelInfo: PaymentCancelResponse, approvedAt: OffsetDateTime, paymentKey: String @@ -52,7 +52,7 @@ class PaymentService( @Transactional - fun cancelPaymentByAdmin(reservationId: Long): PaymentCancelRequest { + fun createCanceledPaymentByReservationId(reservationId: Long): PaymentCancelRequest { val paymentKey: String = paymentRepository.findPaymentKeyByReservationId(reservationId) ?: throw RoomescapeException( ErrorType.PAYMENT_NOT_FOUND, diff --git a/src/main/java/roomescape/reservation/business/ReservationWithPaymentService.kt b/src/main/java/roomescape/reservation/business/ReservationWithPaymentService.kt index b7ebd6b5..79418bf3 100644 --- a/src/main/java/roomescape/reservation/business/ReservationWithPaymentService.kt +++ b/src/main/java/roomescape/reservation/business/ReservationWithPaymentService.kt @@ -24,7 +24,7 @@ class ReservationWithPaymentService( ): ReservationResponse { val reservation: ReservationEntity = reservationService.addReservation(request, memberId) - return paymentService.savePayment(paymentInfo, reservation) + return paymentService.createPayment(paymentInfo, reservation) .reservation } @@ -33,14 +33,14 @@ class ReservationWithPaymentService( approvedAt: OffsetDateTime, paymentKey: String ) { - paymentService.saveCanceledPayment(cancelInfo, approvedAt, paymentKey) + paymentService.createCanceledPayment(cancelInfo, approvedAt, paymentKey) } fun removeReservationWithPayment( reservationId: Long, memberId: Long ): PaymentCancelRequest { - val paymentCancelRequest = paymentService.cancelPaymentByAdmin(reservationId) + val paymentCancelRequest = paymentService.createCanceledPaymentByReservationId(reservationId) reservationService.removeReservationById(reservationId, memberId) return paymentCancelRequest diff --git a/src/test/java/roomescape/payment/business/PaymentServiceTest.kt b/src/test/java/roomescape/payment/business/PaymentServiceTest.kt index 5774b772..a6ceaab2 100644 --- a/src/test/java/roomescape/payment/business/PaymentServiceTest.kt +++ b/src/test/java/roomescape/payment/business/PaymentServiceTest.kt @@ -29,7 +29,7 @@ class PaymentServiceTest : FunSpec({ every { paymentRepository.findPaymentKeyByReservationId(reservationId) } returns null val exception = shouldThrow { - paymentService.cancelPaymentByAdmin(reservationId) + paymentService.createCanceledPaymentByReservationId(reservationId) } assertSoftly(exception) { @@ -51,7 +51,7 @@ class PaymentServiceTest : FunSpec({ } returns null val exception = shouldThrow { - paymentService.cancelPaymentByAdmin(reservationId) + paymentService.createCanceledPaymentByReservationId(reservationId) } assertSoftly(exception) { @@ -79,7 +79,7 @@ class PaymentServiceTest : FunSpec({ cancelAmount = paymentEntity.totalAmount, ) - val result: PaymentCancelRequest = paymentService.cancelPaymentByAdmin(reservationId) + val result: PaymentCancelRequest = paymentService.createCanceledPaymentByReservationId(reservationId) assertSoftly(result) { this.paymentKey shouldBe paymentKey diff --git a/src/test/java/roomescape/reservation/business/ReservationWithPaymentServiceTest.kt b/src/test/java/roomescape/reservation/business/ReservationWithPaymentServiceTest.kt index 92e171d8..e3c8b8b4 100644 --- a/src/test/java/roomescape/reservation/business/ReservationWithPaymentServiceTest.kt +++ b/src/test/java/roomescape/reservation/business/ReservationWithPaymentServiceTest.kt @@ -52,7 +52,7 @@ class ReservationWithPaymentServiceTest : FunSpec({ } returns reservationEntity every { - paymentService.savePayment(paymentApproveResponse, reservationEntity) + paymentService.createPayment(paymentApproveResponse, reservationEntity) } returns paymentEntity.toReservationPaymentResponse() val result: ReservationResponse = reservationWithPaymentService.addReservationWithPayment( @@ -81,7 +81,7 @@ class ReservationWithPaymentServiceTest : FunSpec({ ) every { - paymentService.cancelPaymentByAdmin(reservationEntity.id!!) + paymentService.createCanceledPaymentByReservationId(reservationEntity.id!!) } returns paymentCancelRequest every {