generated from pricelees/issue-pr-template
[#18] 코드 정리 및 일부 컨벤션 통일 #19
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
@ -29,7 +29,7 @@ class PaymentServiceTest : FunSpec({
|
||||
every { paymentRepository.findPaymentKeyByReservationId(reservationId) } returns null
|
||||
|
||||
val exception = shouldThrow<RoomescapeException> {
|
||||
paymentService.cancelPaymentByAdmin(reservationId)
|
||||
paymentService.createCanceledPaymentByReservationId(reservationId)
|
||||
}
|
||||
|
||||
assertSoftly(exception) {
|
||||
@ -51,7 +51,7 @@ class PaymentServiceTest : FunSpec({
|
||||
} returns null
|
||||
|
||||
val exception = shouldThrow<RoomescapeException> {
|
||||
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
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user