generated from pricelees/issue-pr-template
refactor: payment 패키지에서의 메서드 컨벤션 수정
This commit is contained in:
parent
50a0478326
commit
201e11af86
@ -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,
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user