From 201e11af866510d52bb750fed17c8fb6b459baa9 Mon Sep 17 00:00:00 2001 From: pricelees Date: Tue, 22 Jul 2025 13:39:59 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20payment=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=EC=97=90=EC=84=9C=EC=9D=98=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=BB=A8=EB=B2=A4=EC=85=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/roomescape/payment/business/PaymentService.kt | 6 +++--- .../reservation/business/ReservationWithPaymentService.kt | 6 +++--- .../java/roomescape/payment/business/PaymentServiceTest.kt | 6 +++--- .../business/ReservationWithPaymentServiceTest.kt | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) 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 {