From 82774318029ebee9438b02e1fcb0d2fee16ca55e Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 00:26:31 +0900 Subject: [PATCH 01/18] =?UTF-8?q?feat=20:=20=EC=98=88=EC=95=BD=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../output/SendRejectedReservationMessagePort.kt | 6 ++++++ .../firebase/FirebaseNotificationAdapter.kt | 11 ++++++++--- .../firebase/FirebaseNotificationClient.kt | 8 ++++---- ...age.kt => ReservationStatusChangedMessage.kt} | 2 +- .../firebase/FirebaseNotificationAdapterTest.kt | 16 ++++++++++++++-- 5 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/output/SendRejectedReservationMessagePort.kt rename mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/{ReservationAcceptedMessage.kt => ReservationStatusChangedMessage.kt} (68%) diff --git a/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/output/SendRejectedReservationMessagePort.kt b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/output/SendRejectedReservationMessagePort.kt new file mode 100644 index 0000000..ae414e5 --- /dev/null +++ b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/output/SendRejectedReservationMessagePort.kt @@ -0,0 +1,6 @@ +package com.mealkitary.reservation.application.port.output + +interface SendRejectedReservationMessagePort { + + fun sendRejectedReservationMessage() +} diff --git a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapter.kt b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapter.kt index 846ad12..dad28f2 100644 --- a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapter.kt +++ b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapter.kt @@ -1,9 +1,10 @@ package com.mealkitary.common.firebase -import com.mealkitary.common.firebase.message.ReservationAcceptedMessage import com.mealkitary.common.firebase.message.ReservationCreatedMessage +import com.mealkitary.common.firebase.message.ReservationStatusChangedMessage import com.mealkitary.reservation.application.port.output.SendAcceptedReservationMessagePort import com.mealkitary.reservation.application.port.output.SendNewReservationMessagePort +import com.mealkitary.reservation.application.port.output.SendRejectedReservationMessagePort import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Component import java.util.UUID @@ -15,13 +16,17 @@ class FirebaseNotificationAdapter( @Value("\${client.fcm.token}") private val clientToken: String, private val client: FirebaseNotificationClient -) : SendNewReservationMessagePort, SendAcceptedReservationMessagePort { +) : SendNewReservationMessagePort, SendAcceptedReservationMessagePort, SendRejectedReservationMessagePort { override fun sendNewReservationMessage(reservationId: UUID, description: String) { client.send(ReservationCreatedMessage("새로운 예약이 들어왔어요!", description, reservationId, adminToken)) } override fun sendAcceptedReservationMessage() { - client.send(ReservationAcceptedMessage("예약이 승인됐어요!", clientToken)) + client.send(ReservationStatusChangedMessage("예약이 승인됐어요!", clientToken)) + } + + override fun sendRejectedReservationMessage() { + client.send(ReservationStatusChangedMessage("죄송합니다. 예약하신 가게의 사정으로 인해 예약이 거절됐어요.", clientToken)) } } diff --git a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationClient.kt b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationClient.kt index 314df32..6420d8d 100644 --- a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationClient.kt +++ b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationClient.kt @@ -2,8 +2,8 @@ package com.mealkitary.common.firebase import com.google.firebase.messaging.FirebaseMessaging import com.google.firebase.messaging.Message -import com.mealkitary.common.firebase.message.ReservationAcceptedMessage import com.mealkitary.common.firebase.message.ReservationCreatedMessage +import com.mealkitary.common.firebase.message.ReservationStatusChangedMessage import org.springframework.stereotype.Component @Component @@ -20,10 +20,10 @@ class FirebaseNotificationClient { sendToFcm(message) } - fun send(reservationAcceptedMessage: ReservationAcceptedMessage) { + fun send(reservationStatusChangedMessage: ReservationStatusChangedMessage) { val message = Message.builder() - .putData("title", reservationAcceptedMessage.title) - .setToken(reservationAcceptedMessage.token) + .putData("title", reservationStatusChangedMessage.title) + .setToken(reservationStatusChangedMessage.token) .build() sendToFcm(message) diff --git a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/ReservationAcceptedMessage.kt b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/ReservationStatusChangedMessage.kt similarity index 68% rename from mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/ReservationAcceptedMessage.kt rename to mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/ReservationStatusChangedMessage.kt index 755c2a6..022ec91 100644 --- a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/ReservationAcceptedMessage.kt +++ b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/ReservationStatusChangedMessage.kt @@ -1,6 +1,6 @@ package com.mealkitary.common.firebase.message -data class ReservationAcceptedMessage( +data class ReservationStatusChangedMessage( val title: String, val token: String ) diff --git a/mealkitary-infrastructure/adapter-firebase-notification/src/test/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapterTest.kt b/mealkitary-infrastructure/adapter-firebase-notification/src/test/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapterTest.kt index 7abe8d0..4bd86e9 100644 --- a/mealkitary-infrastructure/adapter-firebase-notification/src/test/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapterTest.kt +++ b/mealkitary-infrastructure/adapter-firebase-notification/src/test/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapterTest.kt @@ -1,7 +1,7 @@ package com.mealkitary.common.firebase -import com.mealkitary.common.firebase.message.ReservationAcceptedMessage import com.mealkitary.common.firebase.message.ReservationCreatedMessage +import com.mealkitary.common.firebase.message.ReservationStatusChangedMessage import io.kotest.core.spec.style.AnnotationSpec import io.kotest.matchers.shouldBe import io.mockk.every @@ -31,7 +31,7 @@ class FirebaseNotificationAdapterTest : AnnotationSpec() { @Test fun `notification adapter unit test - sendAcceptedReservationMessage`() { - val slot = slot() + val slot = slot() every { client.send(capture(slot)) } answers {} adapterUnderTest.sendAcceptedReservationMessage() @@ -40,4 +40,16 @@ class FirebaseNotificationAdapterTest : AnnotationSpec() { actual.token shouldBe "test-client-token" actual.title shouldBe "예약이 승인됐어요!" } + + @Test + fun `notification adapter unit test - sendRejectedReservationMessage`() { + val slot = slot() + every { client.send(capture(slot)) } answers {} + + adapterUnderTest.sendRejectedReservationMessage() + + val actual = slot.captured + actual.token shouldBe "test-client-token" + actual.title shouldBe "죄송합니다. 예약하신 가게의 사정으로 인해 예약이 거절됐어요." + } } From 7b5bc2fe0c89c05f095fa0bdd9107e834cc40014 Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 01:00:04 +0900 Subject: [PATCH 02/18] =?UTF-8?q?fix=20:=20=EB=A9=B1=EB=93=B1=ED=82=A4=20o?= =?UTF-8?q?rderId=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../paymentgateway/TossPaymentWebClient.kt | 3 +-- .../TossPaymentWebClientTest.kt | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClient.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClient.kt index 77d8a0e..b440604 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClient.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClient.kt @@ -9,7 +9,6 @@ import org.springframework.web.reactive.function.client.ClientResponse import org.springframework.web.reactive.function.client.WebClient import reactor.core.publisher.Mono import java.nio.charset.StandardCharsets -import java.util.UUID @Component class TossPaymentWebClient( @@ -26,7 +25,7 @@ class TossPaymentWebClient( it.acceptCharset = listOf(StandardCharsets.UTF_8) it.contentType = MediaType.APPLICATION_JSON it.setBasicAuth(codec.encode("$secretKey:")) - it.set("Idempotency-Key", UUID.randomUUID().toString()) + it.set("Idempotency-Key", payment.orderId) } .body(Mono.just(payment), TossPayment::class.java) .exchangeToMono { exceptionHandler(it) } diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientTest.kt index 3330668..f2fc155 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientTest.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientTest.kt @@ -43,6 +43,29 @@ class TossPaymentWebClientTest : AnnotationSpec() { mockWebServer.shutdown() } + @Test + fun `멱등키는 orderId이다`() { + val expectedPath = "/v1/payments/confirm" + mockWebServer.enqueue( + MockResponse() + .setResponseCode(200) + ) + + tossPaymentWebClient.requestConfirm( + TossPayment.of( + "paymentKey", + "reservation-01", + 20000 + ), + mockWebServer.url("").toString() + ) + + val recordedRequest = mockWebServer.takeRequest() + recordedRequest.method shouldBe "POST" + recordedRequest.path shouldBe expectedPath + recordedRequest.getHeader("Idempotency-Key").shouldBe("reservation-01") + } + @Test fun `200 OK를 받으면 아무 예외도 발생하지 않는다`() { val expectedPath = "/v1/payments/confirm" From 61c016b946a5cbcfe9b042cd1e7914ac9e1f376e Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 02:33:20 +0900 Subject: [PATCH 03/18] =?UTF-8?q?feat=20:=20=EA=B2=B0=EC=A0=9C=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../output/persistence/PaymentRepository.kt | 8 ++++- ...ingDataJpaReservationPersistenceAdapter.kt | 9 ++++- .../PersistenceIntegrationTestSupport.kt | 4 +++ ...ataJpaReservationPersistenceAdapterTest.kt | 33 +++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/PaymentRepository.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/PaymentRepository.kt index 30bea74..b9a06f5 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/PaymentRepository.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/PaymentRepository.kt @@ -1,7 +1,13 @@ package com.mealkitary.reservation.adapter.output.persistence import com.mealkitary.reservation.domain.payment.Payment +import org.springframework.data.jpa.repository.EntityGraph import org.springframework.data.jpa.repository.JpaRepository +import java.util.Optional import java.util.UUID -interface PaymentRepository : JpaRepository +interface PaymentRepository : JpaRepository { + + @EntityGraph(attributePaths = ["reservation"]) + fun findByReservationId(reservationId: UUID): Optional +} diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapter.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapter.kt index fe59ad1..22f7d75 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapter.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapter.kt @@ -3,6 +3,7 @@ package com.mealkitary.reservation.adapter.output.persistence import com.mealkitary.common.exception.EntityNotFoundException import com.mealkitary.reservation.application.port.input.ReservationResponse import com.mealkitary.reservation.application.port.input.ReservedProduct +import com.mealkitary.reservation.application.port.output.LoadPaymentPort import com.mealkitary.reservation.application.port.output.LoadReservationPort import com.mealkitary.reservation.application.port.output.SavePaymentPort import com.mealkitary.reservation.application.port.output.SaveReservationPort @@ -12,12 +13,13 @@ import org.springframework.stereotype.Repository import java.util.UUID private const val NOT_FOUND_RESERVATION_MESSAGE = "존재하지 않는 예약입니다." +private const val NOT_FOUND_PAYMENT_MESSAGE = "존재하지 않는 결제입니다." @Repository class SpringDataJpaReservationPersistenceAdapter( private val reservationRepository: ReservationRepository, private val paymentRepository: PaymentRepository -) : SaveReservationPort, SavePaymentPort, LoadReservationPort { +) : SaveReservationPort, SavePaymentPort, LoadReservationPort, LoadPaymentPort { override fun saveOne(reservation: Reservation): UUID { reservationRepository.save(reservation) @@ -36,6 +38,11 @@ class SpringDataJpaReservationPersistenceAdapter( .orElseThrow { throw EntityNotFoundException(NOT_FOUND_RESERVATION_MESSAGE) } } + override fun loadOnePaymentByReservationId(reservationId: UUID): Payment { + return paymentRepository.findByReservationId(reservationId) + .orElseThrow { throw EntityNotFoundException(NOT_FOUND_PAYMENT_MESSAGE) } + } + override fun queryOneReservationById(reservationId: UUID): ReservationResponse { val reservation = reservationRepository.findOneWithShopById(reservationId) .orElseThrow { throw EntityNotFoundException(NOT_FOUND_RESERVATION_MESSAGE) } diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/PersistenceIntegrationTestSupport.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/PersistenceIntegrationTestSupport.kt index 0d9967f..a1836a0 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/PersistenceIntegrationTestSupport.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/PersistenceIntegrationTestSupport.kt @@ -2,6 +2,7 @@ package com.mealkitary import com.mealkitary.reservation.application.service.AcceptReservationService import com.mealkitary.reservation.application.service.PayReservationService +import com.mealkitary.reservation.application.service.RejectReservationService import com.ninjasquad.springmockk.MockkBean import io.kotest.core.spec.style.AnnotationSpec import io.kotest.extensions.spring.SpringExtension @@ -28,4 +29,7 @@ abstract class PersistenceIntegrationTestSupport : AnnotationSpec() { @MockkBean private lateinit var acceptReservationService: AcceptReservationService + + @MockkBean + private lateinit var rejectReservationService: RejectReservationService } diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt index fd0fc2b..44f68b1 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt @@ -9,6 +9,7 @@ import com.mealkitary.reservation.domain.reservation.ReservationStatus import com.mealkitary.shop.adapter.output.persistence.ShopRepository import data.ReservationTestData import io.kotest.assertions.throwables.shouldThrow +import io.kotest.matchers.booleans.shouldBeTrue import io.kotest.matchers.shouldBe import io.kotest.matchers.throwable.shouldHaveMessage import java.util.UUID @@ -90,6 +91,31 @@ class SpringDataJpaReservationPersistenceAdapterTest( result.description shouldBe "부대찌개 외 1건" } + @Test + fun `db integration test - 결제를 조회한다`() { + val reservation = ReservationTestData.defaultReservation() + .withReservationStatus(ReservationStatus.NOTPAID) + .withShop(shopRepository.findOneWithProductsById(1L).orElseThrow()) + .build() + val payment = Payment.of( + "paymentKey", + reservation, + Money.from(2000) + ) + adapterUnderTest.saveOne(reservation) + val saved = adapterUnderTest.saveOne(payment) + em.flush() + em.clear() + + val result = adapterUnderTest.loadOnePaymentByReservationId(reservation.id) + + emf.persistenceUnitUtil.isLoaded(result.reservation).shouldBeTrue() + result.id shouldBe saved + result.paymentKey shouldBe "paymentKey" + result.amount shouldBe Money.from(2000) + result.reservation.id shouldBe reservation.id + } + @Test fun `db integration test - 예약 ID에 해당하는 예약을 조회할 때, 해당 예약이 존재하지 않으면 예외를 발생한다`() { shouldThrow { @@ -103,4 +129,11 @@ class SpringDataJpaReservationPersistenceAdapterTest( adapterUnderTest.queryOneReservationById(UUID.randomUUID()) } shouldHaveMessage "존재하지 않는 예약입니다." } + + @Test + fun `db integration test - 예약 ID를 이용해 결제를 조회할 때, 결제가 존재하지 않으면 예외를 발생한다`() { + shouldThrow { + adapterUnderTest.loadOnePaymentByReservationId(UUID.randomUUID()) + } shouldHaveMessage "존재하지 않는 결제입니다." + } } From c6342b4ccb28420a7e18ca69d6a95a2f25fe48a7 Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 04:06:57 +0900 Subject: [PATCH 04/18] =?UTF-8?q?feat=20:=20=EA=B2=B0=EC=A0=9C=20=EC=B7=A8?= =?UTF-8?q?=EC=86=8C=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reservation/domain/payment/Payment.kt | 7 ++- .../domain/payment/PaymentStatus.kt | 3 +- .../payment/service/CancelPaymentService.kt | 14 +++++ .../reservation/domain/payment/PaymentTest.kt | 32 +++++++--- .../service/CancelPaymentServiceTest.kt | 63 +++++++++++++++++++ 5 files changed, 105 insertions(+), 14 deletions(-) create mode 100644 mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/service/CancelPaymentService.kt create mode 100644 mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/service/CancelPaymentServiceTest.kt diff --git a/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/Payment.kt b/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/Payment.kt index 9c01656..711d96e 100644 --- a/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/Payment.kt +++ b/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/Payment.kt @@ -41,13 +41,14 @@ class Payment private constructor( } private fun checkAlreadyApproved() { - if (isApproved()) { + if (paymentStatus.isApproved()) { throw IllegalStateException("이미 승인된 결제는 다시 승인될 수 없습니다.") } } - fun isApproved(): Boolean { - return paymentStatus.isApproved() + fun cancel() { + reservation.reject() + paymentStatus = PaymentStatus.CANCELED } companion object { diff --git a/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/PaymentStatus.kt b/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/PaymentStatus.kt index f7b3069..74d7f64 100644 --- a/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/PaymentStatus.kt +++ b/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/PaymentStatus.kt @@ -3,7 +3,8 @@ package com.mealkitary.reservation.domain.payment enum class PaymentStatus { READY, - APPROVED; + APPROVED, + CANCELED; fun isApproved(): Boolean { return this == APPROVED diff --git a/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/service/CancelPaymentService.kt b/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/service/CancelPaymentService.kt new file mode 100644 index 0000000..d423102 --- /dev/null +++ b/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/service/CancelPaymentService.kt @@ -0,0 +1,14 @@ +package com.mealkitary.reservation.domain.payment.service + +import com.mealkitary.reservation.domain.payment.Payment +import com.mealkitary.reservation.domain.payment.PaymentGatewayService + +class CancelPaymentService( + private val paymentGatewayService: PaymentGatewayService +) { + + fun cancel(payment: Payment) { + payment.cancel() + paymentGatewayService.cancel(payment, "점주 측 예약 거부") + } +} diff --git a/mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/PaymentTest.kt b/mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/PaymentTest.kt index 5174a83..adf0502 100644 --- a/mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/PaymentTest.kt +++ b/mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/PaymentTest.kt @@ -5,8 +5,6 @@ import com.mealkitary.reservation.domain.reservation.ReservationStatus import data.ReservationTestData import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.AnnotationSpec -import io.kotest.matchers.booleans.shouldBeFalse -import io.kotest.matchers.booleans.shouldBeTrue import io.kotest.matchers.shouldBe import io.kotest.matchers.throwable.shouldHaveMessage @@ -39,7 +37,7 @@ class PaymentTest : AnnotationSpec() { } @Test - fun `결제가 승인되면, 예약의 상태는 paid로 변경된다`() { + fun `결제가 승인되면, 결제의 상태는 approved로 변경된다`() { val reservation = ReservationTestData.defaultReservation() .withReservationStatus(ReservationStatus.NOTPAID) .build() @@ -49,11 +47,11 @@ class PaymentTest : AnnotationSpec() { payment.approve() - reservation.reservationStatus shouldBe ReservationStatus.PAID + payment.paymentStatus shouldBe PaymentStatus.APPROVED } @Test - fun `결제가 승인되면, 결제의 상태는 approved로 변경된다`() { + fun `결제가 승인되면, 예약의 상태는 paid로 변경된다`() { val reservation = ReservationTestData.defaultReservation() .withReservationStatus(ReservationStatus.NOTPAID) .build() @@ -63,7 +61,7 @@ class PaymentTest : AnnotationSpec() { payment.approve() - payment.paymentStatus shouldBe PaymentStatus.APPROVED + reservation.reservationStatus shouldBe ReservationStatus.PAID } @Test @@ -82,16 +80,30 @@ class PaymentTest : AnnotationSpec() { } @Test - fun `결제가 이미 승인되어 있는지 조회한다`() { + fun `승인된 결제가 취소되면, 결제의 상태는 canceled로 변경된다`() { val reservation = ReservationTestData.defaultReservation() .withReservationStatus(ReservationStatus.NOTPAID) .build() val amount = Money.from(2000) val paymentKey = "abc123" val payment = Payment.of(paymentKey, reservation, amount) - - payment.isApproved().shouldBeFalse() payment.approve() - payment.isApproved().shouldBeTrue() + + payment.cancel() + + payment.paymentStatus shouldBe PaymentStatus.CANCELED + } + + @Test + fun `정상적으로 생성되지 않은 예약으로 결제를 생성할 수 없다`() { + val reservation = ReservationTestData.defaultReservation() + .withReservationStatus(ReservationStatus.NONE) + .build() + val amount = Money.from(2000) + val paymentKey = "abc123" + + shouldThrow { + Payment.of(paymentKey, reservation, amount) + } shouldHaveMessage "미결제인 상태에서만 이용 가능한 기능입니다." } } diff --git a/mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/service/CancelPaymentServiceTest.kt b/mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/service/CancelPaymentServiceTest.kt new file mode 100644 index 0000000..09da8a5 --- /dev/null +++ b/mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/service/CancelPaymentServiceTest.kt @@ -0,0 +1,63 @@ +package com.mealkitary.reservation.domain.payment.service + +import com.mealkitary.common.model.Money +import com.mealkitary.reservation.domain.payment.Payment +import com.mealkitary.reservation.domain.payment.PaymentGatewayService +import com.mealkitary.reservation.domain.payment.PaymentStatus +import com.mealkitary.reservation.domain.reservation.ReservationStatus +import data.ReservationTestData +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.AnnotationSpec +import io.kotest.matchers.shouldBe +import io.kotest.matchers.throwable.shouldHaveMessage +import io.mockk.Called +import io.mockk.every +import io.mockk.mockk +import io.mockk.verify + +class CancelPaymentServiceTest : AnnotationSpec() { + + private lateinit var paymentGatewayService: PaymentGatewayService + + @BeforeEach + fun setUp() { + paymentGatewayService = mockk() + } + + @Test + fun `승인된 결제라면 결제를 취소할 수 있다`() { + every { paymentGatewayService.cancel(any(), any()) } answers { } + val cancelPaymentService = CancelPaymentService(paymentGatewayService) + val payment = Payment.of( + "abc", + ReservationTestData.defaultReservation().withReservationStatus(ReservationStatus.NOTPAID).build(), + Money.from(2000) + ) + payment.approve() + + cancelPaymentService.cancel(payment) + + payment.paymentStatus shouldBe PaymentStatus.CANCELED + + verify(exactly = 1) { paymentGatewayService.cancel(any(), "점주 측 예약 거부") } + } + + @Test + fun `이미 취소된 결제라면, 취소 요청을 시도하지 않는다`() { + every { paymentGatewayService.cancel(any(), any()) } answers { } + val cancelPaymentService = CancelPaymentService(paymentGatewayService) + val payment = Payment.of( + "abc", + ReservationTestData.defaultReservation().withReservationStatus(ReservationStatus.NOTPAID).build(), + Money.from(2000) + ) + payment.approve() + payment.cancel() + + shouldThrow { + cancelPaymentService.cancel(payment) + } shouldHaveMessage "이미 거절된 예약입니다." + + verify { paymentGatewayService wasNot Called } + } +} From 84cc0c0ac25fa38389f068eea939d22c72dd98c7 Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 04:08:59 +0900 Subject: [PATCH 05/18] =?UTF-8?q?refactor=20:=20confirmPaymentService=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20=EB=A1=9C=EC=A7=81=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/payment/ConfirmPaymentService.kt | 19 --------------- .../payment/service/ConfirmPaymentService.kt | 14 +++++++++++ .../ConfirmPaymentServiceTest.kt | 23 ++++--------------- 3 files changed, 18 insertions(+), 38 deletions(-) delete mode 100644 mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/ConfirmPaymentService.kt create mode 100644 mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/service/ConfirmPaymentService.kt rename mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/{ => service}/ConfirmPaymentServiceTest.kt (72%) diff --git a/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/ConfirmPaymentService.kt b/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/ConfirmPaymentService.kt deleted file mode 100644 index 77dbd93..0000000 --- a/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/ConfirmPaymentService.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.mealkitary.reservation.domain.payment - -class ConfirmPaymentService( - private val paymentGatewayService: PaymentGatewayService -) { - - fun confirm(payment: Payment) { - checkAlreadyApproved(payment) - - paymentGatewayService.confirm(payment) - payment.approve() - } - - private fun checkAlreadyApproved(payment: Payment) { - if (payment.isApproved()) { - throw IllegalStateException("이미 승인된 결제는 다시 승인될 수 없습니다.") - } - } -} diff --git a/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/service/ConfirmPaymentService.kt b/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/service/ConfirmPaymentService.kt new file mode 100644 index 0000000..ff93f06 --- /dev/null +++ b/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/service/ConfirmPaymentService.kt @@ -0,0 +1,14 @@ +package com.mealkitary.reservation.domain.payment.service + +import com.mealkitary.reservation.domain.payment.Payment +import com.mealkitary.reservation.domain.payment.PaymentGatewayService + +class ConfirmPaymentService( + private val paymentGatewayService: PaymentGatewayService +) { + + fun confirm(payment: Payment) { + payment.approve() + paymentGatewayService.confirm(payment) + } +} diff --git a/mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/ConfirmPaymentServiceTest.kt b/mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/service/ConfirmPaymentServiceTest.kt similarity index 72% rename from mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/ConfirmPaymentServiceTest.kt rename to mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/service/ConfirmPaymentServiceTest.kt index 14d5211..4147f7d 100644 --- a/mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/ConfirmPaymentServiceTest.kt +++ b/mealkitary-domain/src/test/kotlin/com/mealkitary/reservation/domain/payment/service/ConfirmPaymentServiceTest.kt @@ -1,11 +1,13 @@ -package com.mealkitary.reservation.domain.payment +package com.mealkitary.reservation.domain.payment.service import com.mealkitary.common.model.Money +import com.mealkitary.reservation.domain.payment.Payment +import com.mealkitary.reservation.domain.payment.PaymentGatewayService +import com.mealkitary.reservation.domain.payment.PaymentStatus import com.mealkitary.reservation.domain.reservation.ReservationStatus import data.ReservationTestData import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.AnnotationSpec -import io.kotest.matchers.booleans.shouldBeFalse import io.kotest.matchers.shouldBe import io.kotest.matchers.throwable.shouldHaveMessage import io.mockk.Called @@ -54,21 +56,4 @@ class ConfirmPaymentServiceTest : AnnotationSpec() { verify { paymentGatewayService wasNot Called } } - - @Test - fun `pg 서비스에서 오류가 발생하면 결제를 승인할 수 없다`() { - every { paymentGatewayService.confirm(any()) } throws (Exception()) - val confirmPaymentService = ConfirmPaymentService(paymentGatewayService) - val payment = Payment.of( - "abc", - ReservationTestData.defaultReservation().withReservationStatus(ReservationStatus.NOTPAID).build(), - Money.from(2000) - ) - - try { - confirmPaymentService.confirm(payment) - } catch (e: Exception) { - payment.isApproved().shouldBeFalse() - } - } } From a4fe89d61cec0455a3587293ccae51ee5710e34b Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 04:10:28 +0900 Subject: [PATCH 06/18] =?UTF-8?q?feat=20:=20=EC=98=88=EC=95=BD=20=EA=B1=B0?= =?UTF-8?q?=EC=A0=88=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../port/input/RejectReservationUseCase.kt | 8 + .../port/output/LoadPaymentPort.kt | 9 ++ .../service/RejectReservationService.kt | 30 ++++ .../service/RejectReservationServiceTest.kt | 148 ++++++++++++++++++ .../domain/payment/PaymentGatewayService.kt | 2 + 5 files changed, 197 insertions(+) create mode 100644 mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/input/RejectReservationUseCase.kt create mode 100644 mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/output/LoadPaymentPort.kt create mode 100644 mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/service/RejectReservationService.kt create mode 100644 mealkitary-application/src/test/kotlin/com/mealkitary/reservation/application/service/RejectReservationServiceTest.kt diff --git a/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/input/RejectReservationUseCase.kt b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/input/RejectReservationUseCase.kt new file mode 100644 index 0000000..488bf24 --- /dev/null +++ b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/input/RejectReservationUseCase.kt @@ -0,0 +1,8 @@ +package com.mealkitary.reservation.application.port.input + +import java.util.UUID + +interface RejectReservationUseCase { + + fun reject(reservationId: UUID) +} diff --git a/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/output/LoadPaymentPort.kt b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/output/LoadPaymentPort.kt new file mode 100644 index 0000000..3b65f18 --- /dev/null +++ b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/output/LoadPaymentPort.kt @@ -0,0 +1,9 @@ +package com.mealkitary.reservation.application.port.output + +import com.mealkitary.reservation.domain.payment.Payment +import java.util.UUID + +interface LoadPaymentPort { + + fun loadOnePaymentByReservationId(reservationId: UUID): Payment +} diff --git a/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/service/RejectReservationService.kt b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/service/RejectReservationService.kt new file mode 100644 index 0000000..3df2f1a --- /dev/null +++ b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/service/RejectReservationService.kt @@ -0,0 +1,30 @@ +package com.mealkitary.reservation.application.service + +import com.mealkitary.reservation.application.port.input.RejectReservationUseCase +import com.mealkitary.reservation.application.port.output.LoadPaymentPort +import com.mealkitary.reservation.application.port.output.SendRejectedReservationMessagePort +import com.mealkitary.reservation.domain.payment.PaymentGatewayService +import com.mealkitary.reservation.domain.payment.service.CancelPaymentService +import org.springframework.stereotype.Service +import org.springframework.transaction.annotation.Transactional +import java.util.UUID + +@Service +@Transactional(readOnly = true) +class RejectReservationService( + private val loadPaymentPort: LoadPaymentPort, + private val sendRejectedReservationMessagePort: SendRejectedReservationMessagePort, + paymentGatewayService: PaymentGatewayService +) : RejectReservationUseCase { + + private val cancelPaymentService = CancelPaymentService(paymentGatewayService) + + @Transactional + override fun reject(reservationId: UUID) { + val payment = loadPaymentPort.loadOnePaymentByReservationId(reservationId) + + cancelPaymentService.cancel(payment) + + sendRejectedReservationMessagePort.sendRejectedReservationMessage() + } +} diff --git a/mealkitary-application/src/test/kotlin/com/mealkitary/reservation/application/service/RejectReservationServiceTest.kt b/mealkitary-application/src/test/kotlin/com/mealkitary/reservation/application/service/RejectReservationServiceTest.kt new file mode 100644 index 0000000..b6b3545 --- /dev/null +++ b/mealkitary-application/src/test/kotlin/com/mealkitary/reservation/application/service/RejectReservationServiceTest.kt @@ -0,0 +1,148 @@ +package com.mealkitary.reservation.application.service + +import com.mealkitary.common.model.Money +import com.mealkitary.reservation.application.port.output.LoadPaymentPort +import com.mealkitary.reservation.application.port.output.SendRejectedReservationMessagePort +import com.mealkitary.reservation.domain.payment.Payment +import com.mealkitary.reservation.domain.payment.PaymentGatewayService +import com.mealkitary.reservation.domain.payment.PaymentStatus +import com.mealkitary.reservation.domain.reservation.ReservationStatus +import data.ReservationTestData +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.AnnotationSpec +import io.kotest.matchers.shouldBe +import io.kotest.matchers.throwable.shouldHaveMessage +import io.mockk.clearAllMocks +import io.mockk.every +import io.mockk.mockk +import io.mockk.verify + +class RejectReservationServiceTest : AnnotationSpec() { + + private val loadPaymentPort = mockk() + private val sendRejectedReservationMessagePort = mockk() + private val paymentGatewayService = mockk() + + private val rejectReservationService = + RejectReservationService(loadPaymentPort, sendRejectedReservationMessagePort, paymentGatewayService) + + @AfterEach + fun tearDown() { + clearAllMocks() + } + + @Test + fun `service unit test - 예약이 정상적으로 거부되면 예약의 상태가 거부됨으로 변경된다`() { + val reservation = ReservationTestData.defaultReservation() + .withReservationStatus(ReservationStatus.NOTPAID) + .build() + val payment = Payment.of( + "paymentKey", + reservation, + Money.from(2000) + ) + payment.approve() + stubbingPayment(payment) + + rejectReservationService.reject(reservation.id) + + reservation.reservationStatus shouldBe ReservationStatus.REJECTED + } + + @Test + fun `service unit test - 예약이 정상적으로 거부되면 결제의 상태가 취소됨으로 변경된다`() { + val reservation = ReservationTestData.defaultReservation() + .withReservationStatus(ReservationStatus.NOTPAID) + .build() + val payment = Payment.of( + "paymentKey", + reservation, + Money.from(2000) + ) + payment.approve() + stubbingPayment(payment) + + rejectReservationService.reject(reservation.id) + + payment.paymentStatus shouldBe PaymentStatus.CANCELED + } + + @Test + fun `service unit test - 예약이 정상적으로 거부되면 예약 거부 알림이 전송된다`() { + val reservation = ReservationTestData.defaultReservation() + .withReservationStatus(ReservationStatus.NOTPAID) + .build() + val payment = Payment.of( + "paymentKey", + reservation, + Money.from(2000) + ) + payment.approve() + stubbingPayment(payment) + + rejectReservationService.reject(reservation.id) + + verify(exactly = 1) { sendRejectedReservationMessagePort.sendRejectedReservationMessage() } + } + + @Test + fun `service unit test - 미결제 상태의 예약을 거부하면 예외를 발생한다`() { + val reservation = ReservationTestData.defaultReservation() + .withReservationStatus(ReservationStatus.NOTPAID) + .build() + val payment = Payment.of( + "paymentKey", + reservation, + Money.from(2000) + ) + stubbingPayment(payment) + + shouldThrow { + rejectReservationService.reject(reservation.id) + } shouldHaveMessage "미결제 상태인 예약은 거부할 수 없습니다." + } + + @Test + fun `service unit test - 이미 승인된 예약은 거부될 수 없다`() { + val reservation = ReservationTestData.defaultReservation() + .withReservationStatus(ReservationStatus.NOTPAID) + .build() + val payment = Payment.of( + "paymentKey", + reservation, + Money.from(2000) + ) + payment.approve() + stubbingPayment(payment) + reservation.accept() + + shouldThrow { + rejectReservationService.reject(reservation.id) + } shouldHaveMessage "이미 예약 확정된 건에 대해서 거부할 수 없습니다." + } + + @Test + fun `service unit test - 이미 거부된 예약을 다시 거부할 수 없다`() { + val reservation = ReservationTestData.defaultReservation() + .withReservationStatus(ReservationStatus.NOTPAID) + .build() + val payment = Payment.of( + "paymentKey", + reservation, + Money.from(2000) + ) + payment.approve() + stubbingPayment(payment) + rejectReservationService.reject(reservation.id) + + shouldThrow { + rejectReservationService.reject(reservation.id) + } shouldHaveMessage "이미 거절된 예약입니다." + } + + private fun stubbingPayment(payment: Payment) { + every { loadPaymentPort.loadOnePaymentByReservationId(any()) } answers { payment } + every { paymentGatewayService.cancel(any(), any()) } answers { } + every { sendRejectedReservationMessagePort.sendRejectedReservationMessage() } answers {} + } +} diff --git a/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/PaymentGatewayService.kt b/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/PaymentGatewayService.kt index 5f1f315..c6e5a11 100644 --- a/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/PaymentGatewayService.kt +++ b/mealkitary-domain/src/main/kotlin/com/mealkitary/reservation/domain/payment/PaymentGatewayService.kt @@ -3,4 +3,6 @@ package com.mealkitary.reservation.domain.payment interface PaymentGatewayService { fun confirm(payment: Payment) + + fun cancel(payment: Payment, cancelReason: String) } From 91b49db2478395fc0dd7bde11e01ca32d97c69a3 Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 04:11:12 +0900 Subject: [PATCH 07/18] =?UTF-8?q?refactor=20:=20pay=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=20=EA=B0=80=EB=8F=85=EC=84=B1=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/service/PayReservationService.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/service/PayReservationService.kt b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/service/PayReservationService.kt index 03b0b46..5ec78b4 100644 --- a/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/service/PayReservationService.kt +++ b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/service/PayReservationService.kt @@ -6,9 +6,9 @@ import com.mealkitary.reservation.application.port.input.PayReservationUseCase import com.mealkitary.reservation.application.port.output.LoadReservationPort import com.mealkitary.reservation.application.port.output.SavePaymentPort import com.mealkitary.reservation.application.port.output.SendNewReservationMessagePort -import com.mealkitary.reservation.domain.payment.ConfirmPaymentService import com.mealkitary.reservation.domain.payment.Payment import com.mealkitary.reservation.domain.payment.PaymentGatewayService +import com.mealkitary.reservation.domain.payment.service.ConfirmPaymentService import com.mealkitary.reservation.domain.reservation.Reservation import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @@ -21,7 +21,6 @@ class PayReservationService( private val savePaymentPort: SavePaymentPort, private val sendNewReservationMessagePort: SendNewReservationMessagePort, paymentGatewayService: PaymentGatewayService - ) : PayReservationUseCase { private val confirmPaymentService = ConfirmPaymentService(paymentGatewayService) @@ -30,18 +29,16 @@ class PayReservationService( override fun pay(payReservationRequest: PayReservationRequest): UUID { val reservation = loadReservationPort.loadOneReservationById(payReservationRequest.reservationId) val payment = createPayment(payReservationRequest, reservation) + val savedId = savePaymentPort.saveOne(payment) confirmPaymentService.confirm(payment) - sendNewReservationMessage(reservation) + sendNewReservationMessagePort + .sendNewReservationMessage(reservation.id, reservation.buildDescription()) - return savePaymentPort.saveOne(payment) + return savedId } private fun createPayment(payReservationRequest: PayReservationRequest, reservation: Reservation) = Payment.of(payReservationRequest.paymentKey, reservation, Money.from(payReservationRequest.amount)) - - private fun sendNewReservationMessage(reservation: Reservation) { - sendNewReservationMessagePort.sendNewReservationMessage(reservation.id, reservation.buildDescription()) - } } From 9fcbf9cf34195196b57d764e99c05c208058c35c Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 05:14:33 +0900 Subject: [PATCH 08/18] =?UTF-8?q?feat=20:=20=ED=86=A0=EC=8A=A4=20PG=20?= =?UTF-8?q?=EA=B2=B0=EC=A0=9C=20=EC=B7=A8=EC=86=8C=20=EC=9A=94=EC=B2=AD=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TossPaymentCancelPayload.kt | 14 ++ .../TossPaymentGatewayService.kt | 26 ++- .../paymentgateway/TossPaymentWebClient.kt | 27 ++- .../TossPaymentGatewayServiceTest.kt | 50 ++++ .../TossPaymentWebClientCancelTest.kt | 213 ++++++++++++++++++ ....kt => TossPaymentWebClientConfirmTest.kt} | 2 +- 6 files changed, 319 insertions(+), 13 deletions(-) create mode 100644 mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentCancelPayload.kt create mode 100644 mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientCancelTest.kt rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/{TossPaymentWebClientTest.kt => TossPaymentWebClientConfirmTest.kt} (99%) diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentCancelPayload.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentCancelPayload.kt new file mode 100644 index 0000000..189666c --- /dev/null +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentCancelPayload.kt @@ -0,0 +1,14 @@ +package com.mealkitary.reservation.adapter.output.paymentgateway + +private const val CANCEL_REASON_LIMIT_LENGTH = 200 + +data class TossPaymentCancelPayload( + val cancelReason: String +) { + + init { + if (cancelReason.length > CANCEL_REASON_LIMIT_LENGTH) { + throw IllegalArgumentException("취소 사유의 최대 길이는 ${CANCEL_REASON_LIMIT_LENGTH}자입니다.") + } + } +} diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayService.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayService.kt index fe4feef..f92465e 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayService.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayService.kt @@ -4,18 +4,32 @@ import com.mealkitary.reservation.domain.payment.Payment import com.mealkitary.reservation.domain.payment.PaymentGatewayService import org.springframework.stereotype.Component +private const val TOSSPAYMENTS_API_BASE_URL = "https://api.tosspayments.com" + @Component class TossPaymentGatewayService( private val tossPaymentWebClient: TossPaymentWebClient ) : PaymentGatewayService { override fun confirm(payment: Payment) { - val tossPayment = TossPayment.of( - paymentKey = payment.paymentKey, - orderId = payment.reservation.id.toString(), - amount = payment.amount.value - ) + val tossPayment = mapToTossPayment(payment) - tossPaymentWebClient.requestConfirm(tossPayment, "https://api.tosspayments.com") + tossPaymentWebClient.requestConfirm(tossPayment, TOSSPAYMENTS_API_BASE_URL) } + + override fun cancel(payment: Payment, cancelReason: String) { + val tossPayment = mapToTossPayment(payment) + + tossPaymentWebClient.requestCancel( + tossPayment, + TossPaymentCancelPayload(cancelReason), + TOSSPAYMENTS_API_BASE_URL + ) + } + + private fun mapToTossPayment(payment: Payment) = TossPayment.of( + paymentKey = payment.paymentKey, + orderId = payment.reservation.id.toString(), + amount = payment.amount.value + ) } diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClient.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClient.kt index b440604..08636f6 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClient.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClient.kt @@ -2,6 +2,7 @@ package com.mealkitary.reservation.adapter.output.paymentgateway import com.mealkitary.common.exception.EntityNotFoundException import org.springframework.beans.factory.annotation.Value +import org.springframework.http.HttpHeaders import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.stereotype.Component @@ -21,17 +22,31 @@ class TossPaymentWebClient( fun requestConfirm(payment: TossPayment, baseUrl: String) { webClient.post() .uri("$baseUrl/v1/payments/confirm") - .headers { - it.acceptCharset = listOf(StandardCharsets.UTF_8) - it.contentType = MediaType.APPLICATION_JSON - it.setBasicAuth(codec.encode("$secretKey:")) - it.set("Idempotency-Key", payment.orderId) - } + .headers { setHeader(it, payment) } .body(Mono.just(payment), TossPayment::class.java) .exchangeToMono { exceptionHandler(it) } .block() } + fun requestCancel(payment: TossPayment, payload: TossPaymentCancelPayload, baseUrl: String) { + webClient.post() + .uri("$baseUrl/v1/payments/${payment.paymentKey}/cancel") + .headers { setHeader(it, payment) } + .body(Mono.just(payload), TossPaymentCancelPayload::class.java) + .exchangeToMono { exceptionHandler(it) } + .block() + } + + private fun setHeader( + headers: HttpHeaders, + payment: TossPayment + ) { + headers.acceptCharset = listOf(StandardCharsets.UTF_8) + headers.contentType = MediaType.APPLICATION_JSON + headers.setBasicAuth(codec.encode("$secretKey:")) + headers.set("Idempotency-Key", payment.orderId) + } + private fun exceptionHandler(response: ClientResponse): Mono { return when (response.statusCode()) { HttpStatus.OK -> Mono.empty() diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayServiceTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayServiceTest.kt index cc9af7c..8102add 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayServiceTest.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayServiceTest.kt @@ -4,7 +4,9 @@ import com.mealkitary.common.model.Money import com.mealkitary.reservation.domain.payment.Payment import com.mealkitary.reservation.domain.reservation.ReservationStatus import data.ReservationTestData +import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.AnnotationSpec +import io.kotest.matchers.throwable.shouldHaveMessage import io.mockk.every import io.mockk.mockk import io.mockk.verify @@ -53,4 +55,52 @@ class TossPaymentGatewayServiceTest : AnnotationSpec() { verify { tossPaymentWebClient.requestConfirm(any(), "https://api.tosspayments.com") } } + + @Test + fun `HTTP 클라이언트에게 취소 요청을 한다`() { + val tossPaymentWebClient = mockk() + val tossPaymentGatewayService = TossPaymentGatewayService(tossPaymentWebClient) + every { tossPaymentWebClient.requestCancel(any(), any(), any()) } answers {} + val payment = Payment.of( + "paymentKey", + ReservationTestData.defaultReservation() + .withReservationStatus(ReservationStatus.NOTPAID) + .build(), + Money.from(2000) + ) + + tossPaymentGatewayService.cancel(payment, "단순 변심") + + verify { + tossPaymentWebClient.requestCancel( + TossPayment.of( + "paymentKey", + payment.reservation.id.toString(), + 2000 + ), + TossPaymentCancelPayload("단순 변심"), + "https://api.tosspayments.com" + ) + } + } + + @Test + fun `취소 사유의 최대 길이는 200자이다`() { + val tossPaymentWebClient = mockk() + val tossPaymentGatewayService = TossPaymentGatewayService(tossPaymentWebClient) + every { tossPaymentWebClient.requestCancel(any(), any(), any()) } answers {} + + shouldThrow { + tossPaymentGatewayService.cancel( + Payment.of( + "paymentKey", + ReservationTestData.defaultReservation() + .withReservationStatus(ReservationStatus.NOTPAID) + .build(), + Money.from(2000) + ), + "*".repeat(201) + ) + } shouldHaveMessage "취소 사유의 최대 길이는 200자입니다." + } } diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientCancelTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientCancelTest.kt new file mode 100644 index 0000000..0b13640 --- /dev/null +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientCancelTest.kt @@ -0,0 +1,213 @@ +package com.mealkitary.reservation.adapter.output.paymentgateway + +import com.fasterxml.jackson.databind.ObjectMapper +import com.mealkitary.common.exception.EntityNotFoundException +import com.mealkitary.reservation.adapter.output.paymentgateway.codec.UrlSafeBase64Codec +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.AnnotationSpec +import io.kotest.matchers.shouldBe +import io.kotest.matchers.string.shouldNotBeBlank +import io.kotest.matchers.throwable.shouldHaveMessage +import okhttp3.mockwebserver.MockResponse +import okhttp3.mockwebserver.MockWebServer +import org.springframework.http.HttpHeaders +import org.springframework.http.MediaType +import org.springframework.web.reactive.function.client.WebClient + +class TossPaymentWebClientCancelTest : AnnotationSpec() { + + private lateinit var mockWebServer: MockWebServer + private lateinit var webClient: WebClient + private lateinit var tossPaymentWebClient: TossPaymentWebClient + private val objectMapper = ObjectMapper() + + @BeforeEach + fun setUp() { + mockWebServer = MockWebServer() + mockWebServer.start() + webClient = WebClient.builder() + .baseUrl(mockWebServer.url("").toString()) + .codecs { configurer -> + configurer.defaultCodecs().maxInMemorySize(5 * 1024 * 1024) + } + .defaultHeaders { headers -> + headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) + headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) + } + .build() + tossPaymentWebClient = TossPaymentWebClient(UrlSafeBase64Codec(), webClient, "secretKey") + } + + @AfterEach + fun teardown() { + mockWebServer.shutdown() + } + + @Test + fun `멱등키는 orderId이다`() { + val expectedPath = "/v1/payments/paymentKey/cancel" + mockWebServer.enqueue( + MockResponse() + .setResponseCode(200) + ) + + tossPaymentWebClient.requestCancel( + TossPayment.of( + "paymentKey", + "reservation-01", + 20000 + ), + TossPaymentCancelPayload("단순 변심"), + mockWebServer.url("").toString() + ) + + val recordedRequest = mockWebServer.takeRequest() + recordedRequest.method shouldBe "POST" + recordedRequest.path shouldBe expectedPath + recordedRequest.getHeader("Idempotency-Key").shouldBe("reservation-01") + } + + @Test + fun `200 OK를 받으면 아무 예외도 발생하지 않는다`() { + val expectedPath = "/v1/payments/paymentKey/cancel" + mockWebServer.enqueue( + MockResponse() + .setResponseCode(200) + ) + + tossPaymentWebClient.requestCancel( + TossPayment.of( + "paymentKey", + "reservation-01", + 20000 + ), + TossPaymentCancelPayload("단순 변심"), + mockWebServer.url("").toString() + ) + + val recordedRequest = mockWebServer.takeRequest() + recordedRequest.method shouldBe "POST" + recordedRequest.path shouldBe expectedPath + recordedRequest.body.toString().contains("단순 변심") + recordedRequest.getHeader("Authorization").shouldNotBeBlank() + recordedRequest.getHeader("Idempotency-Key").shouldNotBeBlank() + } + + @Test + fun `400 에러가 발생하면 IllegalArgumentException으로 처리한다`() { + val expectedMessage = "잘못된 요청입니다." + val body = TossErrorResponse("BAD_REQUEST", expectedMessage) + mockWebServer.enqueue( + MockResponse() + .setBody(objectMapper.writeValueAsString(body)) + .setResponseCode(400) + .addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + ) + + shouldThrow { + tossPaymentWebClient.requestCancel( + TossPayment.of( + "paymentKey", + "reservation-01", + 20000 + ), + TossPaymentCancelPayload("단순 변심"), + mockWebServer.url("").toString() + ) + } shouldHaveMessage expectedMessage + } + + @Test + fun `404 에러가 발생하면 EntityNotFoundException으로 처리한다`() { + val expectedMessage = "존재하지 않는 결제입니다." + val body = TossErrorResponse("NOT_FOUND", expectedMessage) + mockWebServer.enqueue( + MockResponse() + .setBody(objectMapper.writeValueAsString(body)) + .setResponseCode(404) + .addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + ) + + shouldThrow { + tossPaymentWebClient.requestCancel( + TossPayment.of( + "paymentKey", + "reservation-01", + 20000 + ), + TossPaymentCancelPayload("단순 변심"), + mockWebServer.url("").toString() + ) + } shouldHaveMessage expectedMessage + } + + // TODO: 401, 403, 500 처리 미흡 + @Test + fun `401 에러가 발생하면 RuntimeException으로 처리한다`() { + val body = TossErrorResponse("UNAUTHORIZED_KEY", "인증되지 않은 시크릿 키 혹은 클라이언트 키 입니다.") + mockWebServer.enqueue( + MockResponse() + .setBody(objectMapper.writeValueAsString(body)) + .setResponseCode(401) + .addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + ) + + shouldThrow { + tossPaymentWebClient.requestCancel( + TossPayment.of( + "paymentKey", + "reservation-01", + 20000 + ), + TossPaymentCancelPayload("단순 변심"), + mockWebServer.url("").toString() + ) + } + } + + @Test + fun `403 에러가 발생하면 RuntimeException으로 처리한다`() { + val body = TossErrorResponse("FORBIDDEN_REQUEST", "허용되지 않은 요청입니다.") + mockWebServer.enqueue( + MockResponse() + .setBody(objectMapper.writeValueAsString(body)) + .setResponseCode(403) + .addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + ) + + shouldThrow { + tossPaymentWebClient.requestCancel( + TossPayment.of( + "paymentKey", + "reservation-01", + 20000 + ), + TossPaymentCancelPayload("단순 변심"), + mockWebServer.url("").toString() + ) + } + } + + @Test + fun `500 에러가 발생하면 RuntimeException으로 처리한다`() { + val body = TossErrorResponse("UNKNOWN_PAYMENT_ERROR", "결제에 실패했습니다.") + mockWebServer.enqueue( + MockResponse() + .setBody(objectMapper.writeValueAsString(body)) + .setResponseCode(500) + .addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + ) + + shouldThrow { + tossPaymentWebClient.requestCancel( + TossPayment.of( + "paymentKey", + "reservation-01", + 20000 + ), + TossPaymentCancelPayload("단순 변심"), + mockWebServer.url("").toString() + ) + } + } +} diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientConfirmTest.kt similarity index 99% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientTest.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientConfirmTest.kt index f2fc155..99f0436 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientTest.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientConfirmTest.kt @@ -14,7 +14,7 @@ import org.springframework.http.HttpHeaders import org.springframework.http.MediaType import org.springframework.web.reactive.function.client.WebClient -class TossPaymentWebClientTest : AnnotationSpec() { +class TossPaymentWebClientConfirmTest : AnnotationSpec() { private lateinit var mockWebServer: MockWebServer private lateinit var webClient: WebClient From 84b45a460f0053802c4358bb199d55b1e26b786b Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 08:39:40 +0900 Subject: [PATCH 09/18] =?UTF-8?q?feat=20:=20=EC=98=88=EC=95=BD=20=EA=B1=B0?= =?UTF-8?q?=EC=A0=88=20API=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../input/web/RejectReservationController.kt | 23 ++++++++++ .../mealkitary/WebIntegrationTestSupport.kt | 6 +++ .../web/RejectReservationControllerTest.kt | 45 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationController.kt create mode 100644 mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationControllerTest.kt diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationController.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationController.kt new file mode 100644 index 0000000..8329915 --- /dev/null +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationController.kt @@ -0,0 +1,23 @@ +package com.mealkitary.reservation.adapter.input.web + +import com.mealkitary.common.utils.UUIDUtils +import com.mealkitary.reservation.application.port.input.RejectReservationUseCase +import org.springframework.http.ResponseEntity +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController + +@RestController +@RequestMapping("/reservations") +class RejectReservationController( + private val rejectReservationUseCase: RejectReservationUseCase +) { + + @PostMapping("/{reservationId}/reject") + fun rejectReservation(@PathVariable("reservationId") reservationId: String): ResponseEntity { + rejectReservationUseCase.reject(UUIDUtils.fromString(reservationId)) + + return ResponseEntity.noContent().build() + } +} diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt index 2d4aaba..2846775 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt @@ -4,10 +4,12 @@ import com.fasterxml.jackson.databind.ObjectMapper import com.mealkitary.reservation.adapter.input.web.AcceptReservationController import com.mealkitary.reservation.adapter.input.web.GetReservationController import com.mealkitary.reservation.adapter.input.web.PayReservationController +import com.mealkitary.reservation.adapter.input.web.RejectReservationController import com.mealkitary.reservation.adapter.input.web.ReserveProductController import com.mealkitary.reservation.application.port.input.AcceptReservationUseCase import com.mealkitary.reservation.application.port.input.GetReservationQuery import com.mealkitary.reservation.application.port.input.PayReservationUseCase +import com.mealkitary.reservation.application.port.input.RejectReservationUseCase import com.mealkitary.reservation.application.port.input.ReserveProductUseCase import com.mealkitary.shop.adapter.input.web.GetProductController import com.mealkitary.shop.adapter.input.web.GetReservableTimeController @@ -27,6 +29,7 @@ import org.springframework.test.web.servlet.MockMvc ReserveProductController::class, PayReservationController::class, AcceptReservationController::class, + RejectReservationController::class, GetReservationController::class, GetShopController::class, GetReservableTimeController::class, @@ -52,6 +55,9 @@ abstract class WebIntegrationTestSupport : AnnotationSpec() { @MockkBean protected lateinit var acceptReservationUseCase: AcceptReservationUseCase + @MockkBean + protected lateinit var rejectReservationUseCase: RejectReservationUseCase + @MockkBean protected lateinit var getReservationQuery: GetReservationQuery diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationControllerTest.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationControllerTest.kt new file mode 100644 index 0000000..22c28d4 --- /dev/null +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationControllerTest.kt @@ -0,0 +1,45 @@ +package com.mealkitary.reservation.adapter.input.web + +import com.mealkitary.WebIntegrationTestSupport +import com.mealkitary.common.exception.EntityNotFoundException +import io.mockk.every +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders +import org.springframework.test.web.servlet.result.MockMvcResultMatchers +import java.util.UUID + +class RejectReservationControllerTest : WebIntegrationTestSupport() { + + @Test + fun `api integration test - rejectReservation`() { + val id = UUID.randomUUID() + every { rejectReservationUseCase.reject(any()) } answers {} + + mvc.perform( + MockMvcRequestBuilders.post("/reservations/{reservationId}/reject", id.toString()) + ) + .andExpect(MockMvcResultMatchers.status().isNoContent) + } + + @Test + fun `api integration test - 예약 식별자가 UUID 형태가 아니라면 400 에러를 발생한다`() { + mvc.perform( + MockMvcRequestBuilders.post("/reservations/{reservationId}/reject", "invalid-uuid-test") + ) + .andExpect(MockMvcResultMatchers.status().isBadRequest) + .andExpect(MockMvcResultMatchers.jsonPath("$.status").value("400")) + .andExpect(MockMvcResultMatchers.jsonPath("$.message").value("잘못된 UUID 형식입니다.")) + } + + @Test + fun `api integration test - 내부에서 EntityNotFound 에러가 발생하면 404 에러를 발생한다`() { + val id = UUID.randomUUID() + every { rejectReservationUseCase.reject(any()) }.throws(EntityNotFoundException("존재하지 않는 예약입니다.")) + + mvc.perform( + MockMvcRequestBuilders.post("/reservations/{reservationId}/reject", id.toString()) + ) + .andExpect(MockMvcResultMatchers.status().isNotFound) + .andExpect(MockMvcResultMatchers.jsonPath("$.status").value("404")) + .andExpect(MockMvcResultMatchers.jsonPath("$.message").value("존재하지 않는 예약입니다.")) + } +} From 11531ca5a58dfa2769afc6d0afb9869324a98937 Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 08:44:53 +0900 Subject: [PATCH 10/18] =?UTF-8?q?test=20:=20=EC=98=88=EC=95=BD=20=EA=B1=B0?= =?UTF-8?q?=EC=A0=88=20API=20=EB=AC=B8=EC=84=9C=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RejectReservationControllerDocsTest.kt | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 mealkitary-api/src/test/kotlin/com/docs/reservation/RejectReservationControllerDocsTest.kt diff --git a/mealkitary-api/src/test/kotlin/com/docs/reservation/RejectReservationControllerDocsTest.kt b/mealkitary-api/src/test/kotlin/com/docs/reservation/RejectReservationControllerDocsTest.kt new file mode 100644 index 0000000..fa016dc --- /dev/null +++ b/mealkitary-api/src/test/kotlin/com/docs/reservation/RejectReservationControllerDocsTest.kt @@ -0,0 +1,44 @@ +package com.docs.reservation + +import com.docs.RestDocsSupport +import com.mealkitary.reservation.adapter.input.web.RejectReservationController +import com.mealkitary.reservation.application.port.input.RejectReservationUseCase +import io.mockk.every +import io.mockk.mockk +import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document +import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders +import org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest +import org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse +import org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint +import org.springframework.restdocs.request.RequestDocumentation.parameterWithName +import org.springframework.restdocs.request.RequestDocumentation.pathParameters +import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status +import java.util.UUID + +class RejectReservationControllerDocsTest : RestDocsSupport() { + + private val rejectReservationUseCase = mockk() + + @Test + fun `api docs test - rejectReservation`() { + val id = UUID.randomUUID() + every { rejectReservationUseCase.reject(any()) }.answers { } + + mvc.perform( + RestDocumentationRequestBuilders.post("/reservations/{reservationId}/reject", id) + ) + .andExpect(status().isNoContent) + .andDo( + document( + "reservation-post-reject", + preprocessRequest(prettyPrint()), + preprocessResponse(prettyPrint()), + pathParameters( + parameterWithName("reservationId").description("거절 대상 예약의 식별자") + ), + ) + ) + } + + override fun initController() = RejectReservationController(rejectReservationUseCase) +} From 21144e273198771cefd488f1b0326cbbdf2ddd10 Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 08:46:50 +0900 Subject: [PATCH 11/18] =?UTF-8?q?docs=20:=20=EC=98=88=EC=95=BD=20=EA=B1=B0?= =?UTF-8?q?=EC=A0=88=20API=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mealkitary-api/src/docs/asciidoc/reservation.adoc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mealkitary-api/src/docs/asciidoc/reservation.adoc b/mealkitary-api/src/docs/asciidoc/reservation.adoc index f12fb67..c371a20 100644 --- a/mealkitary-api/src/docs/asciidoc/reservation.adoc +++ b/mealkitary-api/src/docs/asciidoc/reservation.adoc @@ -78,3 +78,18 @@ include::{snippets}/reservation-post-accept/path-parameters.adoc[] ===== 응답 include::{snippets}/reservation-post-accept/http-response.adoc[] + +==== 예약 거절 + +결제된 예약에 대해서 예약 거절 처리합니다. +결제된 예약이 아닌 경우, 거절 처리할 수 없습니다. + +===== 요청 + +include::{snippets}/reservation-post-reject/curl-request.adoc[] +include::{snippets}/reservation-post-reject/http-request.adoc[] +include::{snippets}/reservation-post-reject/path-parameters.adoc[] + +===== 응답 + +include::{snippets}/reservation-post-reject/http-response.adoc[] From fc06e3f89dc02643460a4757bda417f90fc5277a Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 08:47:22 +0900 Subject: [PATCH 12/18] =?UTF-8?q?fix=20:=20=ED=94=84=EB=A1=9C=EC=A0=9D?= =?UTF-8?q?=ED=8A=B8=20=EB=B2=84=EC=A0=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index be1c805..3f25b86 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ ktlintVersion=11.0.0 springBootVersion=2.7.11 springDependencyManagementVersion=1.0.15.RELEASE # project -applicationVersion=0.3.1 +applicationVersion=0.4.0 projectGroup=com.mealkitary # test kotestVersion=4.4.3 From f5e4933f4a96e1236ed64a511d19eea4c640eb88 Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 20:15:18 +0900 Subject: [PATCH 13/18] =?UTF-8?q?refactor=20:=20fcm=20=EB=AA=A8=EB=93=88?= =?UTF-8?q?=20=ED=8C=A8=ED=82=A4=EC=A7=80=20=EA=B5=AC=EC=A1=B0=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{common => }/firebase/FirebaseNotificationAdapter.kt | 6 +++--- .../{common => }/firebase/FirebaseNotificationClient.kt | 6 +++--- .../firebase/FirebaseNotificationInitializer.kt | 2 +- .../firebase/message/ReservationCreatedMessage.kt | 2 +- .../firebase/message/ReservationStatusChangedMessage.kt | 2 +- .../firebase/FirebaseNotificationAdapterTest.kt | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) rename mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/{common => }/firebase/FirebaseNotificationAdapter.kt (87%) rename mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/{common => }/firebase/FirebaseNotificationClient.kt (84%) rename mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/{common => }/firebase/FirebaseNotificationInitializer.kt (94%) rename mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/{common => }/firebase/message/ReservationCreatedMessage.kt (78%) rename mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/{common => }/firebase/message/ReservationStatusChangedMessage.kt (66%) rename mealkitary-infrastructure/adapter-firebase-notification/src/test/kotlin/com/mealkitary/{common => }/firebase/FirebaseNotificationAdapterTest.kt (90%) diff --git a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapter.kt b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/FirebaseNotificationAdapter.kt similarity index 87% rename from mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapter.kt rename to mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/FirebaseNotificationAdapter.kt index dad28f2..0cd0791 100644 --- a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapter.kt +++ b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/FirebaseNotificationAdapter.kt @@ -1,7 +1,7 @@ -package com.mealkitary.common.firebase +package com.mealkitary.firebase -import com.mealkitary.common.firebase.message.ReservationCreatedMessage -import com.mealkitary.common.firebase.message.ReservationStatusChangedMessage +import com.mealkitary.firebase.message.ReservationCreatedMessage +import com.mealkitary.firebase.message.ReservationStatusChangedMessage import com.mealkitary.reservation.application.port.output.SendAcceptedReservationMessagePort import com.mealkitary.reservation.application.port.output.SendNewReservationMessagePort import com.mealkitary.reservation.application.port.output.SendRejectedReservationMessagePort diff --git a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationClient.kt b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/FirebaseNotificationClient.kt similarity index 84% rename from mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationClient.kt rename to mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/FirebaseNotificationClient.kt index 6420d8d..75c6426 100644 --- a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationClient.kt +++ b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/FirebaseNotificationClient.kt @@ -1,9 +1,9 @@ -package com.mealkitary.common.firebase +package com.mealkitary.firebase import com.google.firebase.messaging.FirebaseMessaging import com.google.firebase.messaging.Message -import com.mealkitary.common.firebase.message.ReservationCreatedMessage -import com.mealkitary.common.firebase.message.ReservationStatusChangedMessage +import com.mealkitary.firebase.message.ReservationCreatedMessage +import com.mealkitary.firebase.message.ReservationStatusChangedMessage import org.springframework.stereotype.Component @Component diff --git a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationInitializer.kt b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/FirebaseNotificationInitializer.kt similarity index 94% rename from mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationInitializer.kt rename to mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/FirebaseNotificationInitializer.kt index 11146dc..f8955d8 100644 --- a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/FirebaseNotificationInitializer.kt +++ b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/FirebaseNotificationInitializer.kt @@ -1,4 +1,4 @@ -package com.mealkitary.common.firebase +package com.mealkitary.firebase import com.google.auth.oauth2.GoogleCredentials import com.google.firebase.FirebaseApp diff --git a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/ReservationCreatedMessage.kt b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/message/ReservationCreatedMessage.kt similarity index 78% rename from mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/ReservationCreatedMessage.kt rename to mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/message/ReservationCreatedMessage.kt index 6b80a48..396e4bd 100644 --- a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/ReservationCreatedMessage.kt +++ b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/message/ReservationCreatedMessage.kt @@ -1,4 +1,4 @@ -package com.mealkitary.common.firebase.message +package com.mealkitary.firebase.message import java.util.UUID diff --git a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/ReservationStatusChangedMessage.kt b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/message/ReservationStatusChangedMessage.kt similarity index 66% rename from mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/ReservationStatusChangedMessage.kt rename to mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/message/ReservationStatusChangedMessage.kt index 022ec91..c208f8c 100644 --- a/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/common/firebase/message/ReservationStatusChangedMessage.kt +++ b/mealkitary-infrastructure/adapter-firebase-notification/src/main/kotlin/com/mealkitary/firebase/message/ReservationStatusChangedMessage.kt @@ -1,4 +1,4 @@ -package com.mealkitary.common.firebase.message +package com.mealkitary.firebase.message data class ReservationStatusChangedMessage( val title: String, diff --git a/mealkitary-infrastructure/adapter-firebase-notification/src/test/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapterTest.kt b/mealkitary-infrastructure/adapter-firebase-notification/src/test/kotlin/com/mealkitary/firebase/FirebaseNotificationAdapterTest.kt similarity index 90% rename from mealkitary-infrastructure/adapter-firebase-notification/src/test/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapterTest.kt rename to mealkitary-infrastructure/adapter-firebase-notification/src/test/kotlin/com/mealkitary/firebase/FirebaseNotificationAdapterTest.kt index 4bd86e9..f59ea00 100644 --- a/mealkitary-infrastructure/adapter-firebase-notification/src/test/kotlin/com/mealkitary/common/firebase/FirebaseNotificationAdapterTest.kt +++ b/mealkitary-infrastructure/adapter-firebase-notification/src/test/kotlin/com/mealkitary/firebase/FirebaseNotificationAdapterTest.kt @@ -1,7 +1,7 @@ -package com.mealkitary.common.firebase +package com.mealkitary.firebase -import com.mealkitary.common.firebase.message.ReservationCreatedMessage -import com.mealkitary.common.firebase.message.ReservationStatusChangedMessage +import com.mealkitary.firebase.message.ReservationCreatedMessage +import com.mealkitary.firebase.message.ReservationStatusChangedMessage import io.kotest.core.spec.style.AnnotationSpec import io.kotest.matchers.shouldBe import io.mockk.every From 1aa2806f7b07ad5c852823875d3e19af39624a7d Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 20:16:52 +0900 Subject: [PATCH 14/18] =?UTF-8?q?refactor=20:=20=ED=86=A0=EC=8A=A4=20PG=20?= =?UTF-8?q?=EB=AA=A8=EB=93=88=20=ED=8C=A8=ED=82=A4=EC=A7=80=20=EA=B5=AC?= =?UTF-8?q?=EC=A1=B0=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/output => }/paymentgateway/TossErrorResponse.kt | 2 +- .../adapter/output => }/paymentgateway/TossPayment.kt | 2 +- .../output => }/paymentgateway/TossPaymentCancelPayload.kt | 2 +- .../adapter/output => }/paymentgateway/TossPaymentCodec.kt | 2 +- .../output => }/paymentgateway/TossPaymentGatewayService.kt | 2 +- .../output => }/paymentgateway/TossPaymentWebClient.kt | 2 +- .../adapter/output => }/paymentgateway/WebClientConfig.kt | 2 +- .../output => }/paymentgateway/codec/UrlSafeBase64Codec.kt | 4 ++-- .../paymentgateway/TossPaymentGatewayServiceTest.kt | 2 +- .../adapter/output => }/paymentgateway/TossPaymentTest.kt | 2 +- .../paymentgateway/TossPaymentWebClientCancelTest.kt | 4 ++-- .../paymentgateway/TossPaymentWebClientConfirmTest.kt | 4 ++-- .../paymentgateway/codec/UrlSafeBase64CodecTest.kt | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/TossErrorResponse.kt (51%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/TossPayment.kt (97%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/TossPaymentCancelPayload.kt (83%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/TossPaymentCodec.kt (62%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/TossPaymentGatewayService.kt (94%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/TossPaymentWebClient.kt (97%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/WebClientConfig.kt (95%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/codec/UrlSafeBase64Codec.kt (79%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/TossPaymentGatewayServiceTest.kt (98%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/TossPaymentTest.kt (97%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/TossPaymentWebClientCancelTest.kt (98%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/TossPaymentWebClientConfirmTest.kt (97%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/{reservation/adapter/output => }/paymentgateway/codec/UrlSafeBase64CodecTest.kt (90%) diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossErrorResponse.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossErrorResponse.kt similarity index 51% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossErrorResponse.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossErrorResponse.kt index bab83e9..777d9e3 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossErrorResponse.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossErrorResponse.kt @@ -1,3 +1,3 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway +package com.mealkitary.paymentgateway data class TossErrorResponse(val code: String, val message: String) diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPayment.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPayment.kt similarity index 97% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPayment.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPayment.kt index 84513b6..aad1e55 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPayment.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPayment.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway +package com.mealkitary.paymentgateway private const val MAX_PAYMENT_KEY_LENGTH = 200 private const val MIN_ORDER_ID_LENGTH = 6 diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentCancelPayload.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentCancelPayload.kt similarity index 83% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentCancelPayload.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentCancelPayload.kt index 189666c..ec515c7 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentCancelPayload.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentCancelPayload.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway +package com.mealkitary.paymentgateway private const val CANCEL_REASON_LIMIT_LENGTH = 200 diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentCodec.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentCodec.kt similarity index 62% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentCodec.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentCodec.kt index 1e354d8..1299a1a 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentCodec.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentCodec.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway +package com.mealkitary.paymentgateway interface TossPaymentCodec { diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayService.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayService.kt similarity index 94% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayService.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayService.kt index f92465e..9e03c15 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayService.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayService.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway +package com.mealkitary.paymentgateway import com.mealkitary.reservation.domain.payment.Payment import com.mealkitary.reservation.domain.payment.PaymentGatewayService diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClient.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClient.kt similarity index 97% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClient.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClient.kt index 08636f6..e3e6eb7 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClient.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClient.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway +package com.mealkitary.paymentgateway import com.mealkitary.common.exception.EntityNotFoundException import org.springframework.beans.factory.annotation.Value diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/WebClientConfig.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/WebClientConfig.kt similarity index 95% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/WebClientConfig.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/WebClientConfig.kt index 24af2e5..77c87d4 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/WebClientConfig.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/WebClientConfig.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway +package com.mealkitary.paymentgateway import io.netty.channel.ChannelOption import io.netty.handler.timeout.ReadTimeoutHandler diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/codec/UrlSafeBase64Codec.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/codec/UrlSafeBase64Codec.kt similarity index 79% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/codec/UrlSafeBase64Codec.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/codec/UrlSafeBase64Codec.kt index 6360ecd..b34c3b7 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/codec/UrlSafeBase64Codec.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/codec/UrlSafeBase64Codec.kt @@ -1,6 +1,6 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway.codec +package com.mealkitary.paymentgateway.codec -import com.mealkitary.reservation.adapter.output.paymentgateway.TossPaymentCodec +import com.mealkitary.paymentgateway.TossPaymentCodec import org.springframework.stereotype.Component import java.util.Base64 diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayServiceTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayServiceTest.kt similarity index 98% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayServiceTest.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayServiceTest.kt index 8102add..27e169d 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentGatewayServiceTest.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayServiceTest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway +package com.mealkitary.paymentgateway import com.mealkitary.common.model.Money import com.mealkitary.reservation.domain.payment.Payment diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentTest.kt similarity index 97% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentTest.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentTest.kt index 5a1d487..ae398bd 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentTest.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentTest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway +package com.mealkitary.paymentgateway import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.AnnotationSpec diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientCancelTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientCancelTest.kt similarity index 98% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientCancelTest.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientCancelTest.kt index 0b13640..3aad305 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientCancelTest.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientCancelTest.kt @@ -1,8 +1,8 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway +package com.mealkitary.paymentgateway import com.fasterxml.jackson.databind.ObjectMapper import com.mealkitary.common.exception.EntityNotFoundException -import com.mealkitary.reservation.adapter.output.paymentgateway.codec.UrlSafeBase64Codec +import com.mealkitary.paymentgateway.codec.UrlSafeBase64Codec import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.AnnotationSpec import io.kotest.matchers.shouldBe diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientConfirmTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientConfirmTest.kt similarity index 97% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientConfirmTest.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientConfirmTest.kt index 99f0436..bb30336 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/TossPaymentWebClientConfirmTest.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientConfirmTest.kt @@ -1,8 +1,8 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway +package com.mealkitary.paymentgateway import com.fasterxml.jackson.databind.ObjectMapper import com.mealkitary.common.exception.EntityNotFoundException -import com.mealkitary.reservation.adapter.output.paymentgateway.codec.UrlSafeBase64Codec +import com.mealkitary.paymentgateway.codec.UrlSafeBase64Codec import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.AnnotationSpec import io.kotest.matchers.shouldBe diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/codec/UrlSafeBase64CodecTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/codec/UrlSafeBase64CodecTest.kt similarity index 90% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/codec/UrlSafeBase64CodecTest.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/codec/UrlSafeBase64CodecTest.kt index 49ae412..eb9e156 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/reservation/adapter/output/paymentgateway/codec/UrlSafeBase64CodecTest.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/codec/UrlSafeBase64CodecTest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.paymentgateway.codec +package com.mealkitary.paymentgateway.codec import io.kotest.core.spec.style.AnnotationSpec import io.kotest.matchers.shouldBe From 746821717f5eca4d23141c53db2fe7a4d09f8ee1 Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 20:19:16 +0900 Subject: [PATCH 15/18] =?UTF-8?q?refactor=20:=20=ED=86=A0=EC=8A=A4=20PG=20?= =?UTF-8?q?=EB=AA=A8=EB=93=88=20=ED=8E=98=EC=9D=B4=EB=A1=9C=EB=93=9C=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mealkitary/paymentgateway/TossPaymentGatewayService.kt | 2 ++ .../com/mealkitary/paymentgateway/TossPaymentWebClient.kt | 3 +++ .../paymentgateway/{ => payload}/TossErrorResponse.kt | 2 +- .../com/mealkitary/paymentgateway/{ => payload}/TossPayment.kt | 2 +- .../paymentgateway/{ => payload}/TossPaymentCancelPayload.kt | 2 +- .../mealkitary/paymentgateway/TossPaymentGatewayServiceTest.kt | 2 ++ .../paymentgateway/TossPaymentWebClientCancelTest.kt | 3 +++ .../paymentgateway/TossPaymentWebClientConfirmTest.kt | 2 ++ .../mealkitary/paymentgateway/{ => payload}/TossPaymentTest.kt | 2 +- 9 files changed, 16 insertions(+), 4 deletions(-) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/{ => payload}/TossErrorResponse.kt (60%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/{ => payload}/TossPayment.kt (98%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/{ => payload}/TossPaymentCancelPayload.kt (88%) rename mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/{ => payload}/TossPaymentTest.kt (98%) diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayService.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayService.kt index 9e03c15..42927de 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayService.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayService.kt @@ -1,5 +1,7 @@ package com.mealkitary.paymentgateway +import com.mealkitary.paymentgateway.payload.TossPayment +import com.mealkitary.paymentgateway.payload.TossPaymentCancelPayload import com.mealkitary.reservation.domain.payment.Payment import com.mealkitary.reservation.domain.payment.PaymentGatewayService import org.springframework.stereotype.Component diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClient.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClient.kt index e3e6eb7..57abf34 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClient.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClient.kt @@ -1,6 +1,9 @@ package com.mealkitary.paymentgateway import com.mealkitary.common.exception.EntityNotFoundException +import com.mealkitary.paymentgateway.payload.TossErrorResponse +import com.mealkitary.paymentgateway.payload.TossPayment +import com.mealkitary.paymentgateway.payload.TossPaymentCancelPayload import org.springframework.beans.factory.annotation.Value import org.springframework.http.HttpHeaders import org.springframework.http.HttpStatus diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossErrorResponse.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/payload/TossErrorResponse.kt similarity index 60% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossErrorResponse.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/payload/TossErrorResponse.kt index 777d9e3..bb88df4 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossErrorResponse.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/payload/TossErrorResponse.kt @@ -1,3 +1,3 @@ -package com.mealkitary.paymentgateway +package com.mealkitary.paymentgateway.payload data class TossErrorResponse(val code: String, val message: String) diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPayment.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/payload/TossPayment.kt similarity index 98% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPayment.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/payload/TossPayment.kt index aad1e55..7fdebfc 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPayment.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/payload/TossPayment.kt @@ -1,4 +1,4 @@ -package com.mealkitary.paymentgateway +package com.mealkitary.paymentgateway.payload private const val MAX_PAYMENT_KEY_LENGTH = 200 private const val MIN_ORDER_ID_LENGTH = 6 diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentCancelPayload.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/payload/TossPaymentCancelPayload.kt similarity index 88% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentCancelPayload.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/payload/TossPaymentCancelPayload.kt index ec515c7..e592a43 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/TossPaymentCancelPayload.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/main/kotlin/com/mealkitary/paymentgateway/payload/TossPaymentCancelPayload.kt @@ -1,4 +1,4 @@ -package com.mealkitary.paymentgateway +package com.mealkitary.paymentgateway.payload private const val CANCEL_REASON_LIMIT_LENGTH = 200 diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayServiceTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayServiceTest.kt index 27e169d..4777f86 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayServiceTest.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentGatewayServiceTest.kt @@ -1,6 +1,8 @@ package com.mealkitary.paymentgateway import com.mealkitary.common.model.Money +import com.mealkitary.paymentgateway.payload.TossPayment +import com.mealkitary.paymentgateway.payload.TossPaymentCancelPayload import com.mealkitary.reservation.domain.payment.Payment import com.mealkitary.reservation.domain.reservation.ReservationStatus import data.ReservationTestData diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientCancelTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientCancelTest.kt index 3aad305..f827bcb 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientCancelTest.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientCancelTest.kt @@ -3,6 +3,9 @@ package com.mealkitary.paymentgateway import com.fasterxml.jackson.databind.ObjectMapper import com.mealkitary.common.exception.EntityNotFoundException import com.mealkitary.paymentgateway.codec.UrlSafeBase64Codec +import com.mealkitary.paymentgateway.payload.TossErrorResponse +import com.mealkitary.paymentgateway.payload.TossPayment +import com.mealkitary.paymentgateway.payload.TossPaymentCancelPayload import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.AnnotationSpec import io.kotest.matchers.shouldBe diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientConfirmTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientConfirmTest.kt index bb30336..ab8cac3 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientConfirmTest.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentWebClientConfirmTest.kt @@ -3,6 +3,8 @@ package com.mealkitary.paymentgateway import com.fasterxml.jackson.databind.ObjectMapper import com.mealkitary.common.exception.EntityNotFoundException import com.mealkitary.paymentgateway.codec.UrlSafeBase64Codec +import com.mealkitary.paymentgateway.payload.TossErrorResponse +import com.mealkitary.paymentgateway.payload.TossPayment import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.AnnotationSpec import io.kotest.matchers.shouldBe diff --git a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentTest.kt b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/payload/TossPaymentTest.kt similarity index 98% rename from mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentTest.kt rename to mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/payload/TossPaymentTest.kt index ae398bd..5e53a4f 100644 --- a/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/TossPaymentTest.kt +++ b/mealkitary-infrastructure/adapter-paymentgateway-tosspayments/src/test/kotlin/com/mealkitary/paymentgateway/payload/TossPaymentTest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.paymentgateway +package com.mealkitary.paymentgateway.payload import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.AnnotationSpec From b3ebb21b55e20d3e02f573f7e1bcea2932c7926a Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 20:21:55 +0900 Subject: [PATCH 16/18] =?UTF-8?q?refactor=20:=20=EC=98=81=EC=86=8D?= =?UTF-8?q?=EC=84=B1=20=EB=AA=A8=EB=93=88=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{adapter/output => }/persistence/PaymentRepository.kt | 2 +- .../{adapter/output => }/persistence/ReservationRepository.kt | 2 +- .../persistence/SpringDataJpaReservationPersistenceAdapter.kt | 2 +- .../shop/{adapter/output => }/persistence/ShopRepository.kt | 2 +- .../persistence/SpringDataJpaShopPersistenceAdapter.kt | 2 +- .../SpringDataJpaReservationPersistenceAdapterTest.kt | 4 ++-- .../persistence/SpringDataJpaShopPersistenceAdapterTest.kt | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/{adapter/output => }/persistence/PaymentRepository.kt (86%) rename mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/{adapter/output => }/persistence/ReservationRepository.kt (87%) rename mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/{adapter/output => }/persistence/SpringDataJpaReservationPersistenceAdapter.kt (97%) rename mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/{adapter/output => }/persistence/ShopRepository.kt (89%) rename mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/{adapter/output => }/persistence/SpringDataJpaShopPersistenceAdapter.kt (96%) rename mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/{adapter/output => }/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt (97%) rename mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/shop/{adapter/output => }/persistence/SpringDataJpaShopPersistenceAdapterTest.kt (98%) diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/PaymentRepository.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/PaymentRepository.kt similarity index 86% rename from mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/PaymentRepository.kt rename to mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/PaymentRepository.kt index b9a06f5..9812caf 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/PaymentRepository.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/PaymentRepository.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.persistence +package com.mealkitary.reservation.persistence import com.mealkitary.reservation.domain.payment.Payment import org.springframework.data.jpa.repository.EntityGraph diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/ReservationRepository.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/ReservationRepository.kt similarity index 87% rename from mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/ReservationRepository.kt rename to mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/ReservationRepository.kt index f46b295..53c76f5 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/ReservationRepository.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/ReservationRepository.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.persistence +package com.mealkitary.reservation.persistence import com.mealkitary.reservation.domain.reservation.Reservation import org.springframework.data.jpa.repository.EntityGraph diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapter.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapter.kt similarity index 97% rename from mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapter.kt rename to mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapter.kt index 22f7d75..1d8ffb1 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapter.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapter.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.persistence +package com.mealkitary.reservation.persistence import com.mealkitary.common.exception.EntityNotFoundException import com.mealkitary.reservation.application.port.input.ReservationResponse diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/adapter/output/persistence/ShopRepository.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/persistence/ShopRepository.kt similarity index 89% rename from mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/adapter/output/persistence/ShopRepository.kt rename to mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/persistence/ShopRepository.kt index 1a27cae..5bc76e4 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/adapter/output/persistence/ShopRepository.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/persistence/ShopRepository.kt @@ -1,4 +1,4 @@ -package com.mealkitary.shop.adapter.output.persistence +package com.mealkitary.shop.persistence import com.mealkitary.shop.domain.shop.Shop import org.springframework.data.jpa.repository.EntityGraph diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/adapter/output/persistence/SpringDataJpaShopPersistenceAdapter.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/persistence/SpringDataJpaShopPersistenceAdapter.kt similarity index 96% rename from mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/adapter/output/persistence/SpringDataJpaShopPersistenceAdapter.kt rename to mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/persistence/SpringDataJpaShopPersistenceAdapter.kt index 4c6b38a..e0955ee 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/adapter/output/persistence/SpringDataJpaShopPersistenceAdapter.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/shop/persistence/SpringDataJpaShopPersistenceAdapter.kt @@ -1,4 +1,4 @@ -package com.mealkitary.shop.adapter.output.persistence +package com.mealkitary.shop.persistence import com.mealkitary.common.exception.EntityNotFoundException import com.mealkitary.shop.application.port.output.LoadProductPort diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt similarity index 97% rename from mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt rename to mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt index 44f68b1..17b0243 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/adapter/output/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.output.persistence +package com.mealkitary.reservation.persistence import com.mealkitary.PersistenceIntegrationTestSupport import com.mealkitary.common.exception.EntityNotFoundException @@ -6,7 +6,7 @@ import com.mealkitary.common.model.Money import com.mealkitary.reservation.domain.payment.Payment import com.mealkitary.reservation.domain.reservation.Reservation import com.mealkitary.reservation.domain.reservation.ReservationStatus -import com.mealkitary.shop.adapter.output.persistence.ShopRepository +import com.mealkitary.shop.persistence.ShopRepository import data.ReservationTestData import io.kotest.assertions.throwables.shouldThrow import io.kotest.matchers.booleans.shouldBeTrue diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/shop/adapter/output/persistence/SpringDataJpaShopPersistenceAdapterTest.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/shop/persistence/SpringDataJpaShopPersistenceAdapterTest.kt similarity index 98% rename from mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/shop/adapter/output/persistence/SpringDataJpaShopPersistenceAdapterTest.kt rename to mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/shop/persistence/SpringDataJpaShopPersistenceAdapterTest.kt index a52e67a..17e2bfc 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/shop/adapter/output/persistence/SpringDataJpaShopPersistenceAdapterTest.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/shop/persistence/SpringDataJpaShopPersistenceAdapterTest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.shop.adapter.output.persistence +package com.mealkitary.shop.persistence import com.mealkitary.PersistenceIntegrationTestSupport import com.mealkitary.common.exception.EntityNotFoundException From fa402950cfbf2eb249386ea2ef72d0617018bd5a Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 20:35:01 +0900 Subject: [PATCH 17/18] =?UTF-8?q?refactor=20:=20shop=20=EC=9B=B9=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EA=B5=AC=EC=A1=B0=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/{adapter/input => }/web/GetProductController.kt | 2 +- .../{adapter/input => }/web/GetReservableTimeController.kt | 2 +- .../shop/{adapter/input => }/web/GetShopController.kt | 2 +- .../kotlin/com/docs/shop/GetProductControllerDocsTest.kt | 2 +- .../com/docs/shop/GetReservableTimeControllerDocsTest.kt | 2 +- .../test/kotlin/com/docs/shop/GetShopControllerDocsTest.kt | 2 +- .../test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt | 6 +++--- .../{adapter/input => }/web/GetProductControllerTest.kt | 2 +- .../input => }/web/GetReservableTimeControllerTest.kt | 2 +- .../shop/{adapter/input => }/web/GetShopControllerTest.kt | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) rename mealkitary-api/src/main/kotlin/com/mealkitary/shop/{adapter/input => }/web/GetProductController.kt (94%) rename mealkitary-api/src/main/kotlin/com/mealkitary/shop/{adapter/input => }/web/GetReservableTimeController.kt (94%) rename mealkitary-api/src/main/kotlin/com/mealkitary/shop/{adapter/input => }/web/GetShopController.kt (92%) rename mealkitary-api/src/test/kotlin/com/mealkitary/shop/{adapter/input => }/web/GetProductControllerTest.kt (97%) rename mealkitary-api/src/test/kotlin/com/mealkitary/shop/{adapter/input => }/web/GetReservableTimeControllerTest.kt (97%) rename mealkitary-api/src/test/kotlin/com/mealkitary/shop/{adapter/input => }/web/GetShopControllerTest.kt (96%) diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/shop/adapter/input/web/GetProductController.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/shop/web/GetProductController.kt similarity index 94% rename from mealkitary-api/src/main/kotlin/com/mealkitary/shop/adapter/input/web/GetProductController.kt rename to mealkitary-api/src/main/kotlin/com/mealkitary/shop/web/GetProductController.kt index b856531..6ae5f0f 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/shop/adapter/input/web/GetProductController.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/shop/web/GetProductController.kt @@ -1,4 +1,4 @@ -package com.mealkitary.shop.adapter.input.web +package com.mealkitary.shop.web import com.mealkitary.common.utils.HttpResponseUtils import com.mealkitary.shop.application.port.input.GetProductQuery diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/shop/adapter/input/web/GetReservableTimeController.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/shop/web/GetReservableTimeController.kt similarity index 94% rename from mealkitary-api/src/main/kotlin/com/mealkitary/shop/adapter/input/web/GetReservableTimeController.kt rename to mealkitary-api/src/main/kotlin/com/mealkitary/shop/web/GetReservableTimeController.kt index 95f060a..8d7f5c3 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/shop/adapter/input/web/GetReservableTimeController.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/shop/web/GetReservableTimeController.kt @@ -1,4 +1,4 @@ -package com.mealkitary.shop.adapter.input.web +package com.mealkitary.shop.web import com.mealkitary.common.utils.HttpResponseUtils import com.mealkitary.shop.application.port.input.GetReservableTimeQuery diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/shop/adapter/input/web/GetShopController.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/shop/web/GetShopController.kt similarity index 92% rename from mealkitary-api/src/main/kotlin/com/mealkitary/shop/adapter/input/web/GetShopController.kt rename to mealkitary-api/src/main/kotlin/com/mealkitary/shop/web/GetShopController.kt index f01772d..325523d 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/shop/adapter/input/web/GetShopController.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/shop/web/GetShopController.kt @@ -1,4 +1,4 @@ -package com.mealkitary.shop.adapter.input.web +package com.mealkitary.shop.web import com.mealkitary.common.utils.HttpResponseUtils import com.mealkitary.shop.application.port.input.GetShopQuery diff --git a/mealkitary-api/src/test/kotlin/com/docs/shop/GetProductControllerDocsTest.kt b/mealkitary-api/src/test/kotlin/com/docs/shop/GetProductControllerDocsTest.kt index 68ff96a..9d46e87 100644 --- a/mealkitary-api/src/test/kotlin/com/docs/shop/GetProductControllerDocsTest.kt +++ b/mealkitary-api/src/test/kotlin/com/docs/shop/GetProductControllerDocsTest.kt @@ -1,9 +1,9 @@ package com.docs.shop import com.docs.RestDocsSupport -import com.mealkitary.shop.adapter.input.web.GetProductController import com.mealkitary.shop.application.port.input.GetProductQuery import com.mealkitary.shop.application.port.input.ProductResponse +import com.mealkitary.shop.web.GetProductController import io.mockk.every import io.mockk.mockk import org.springframework.http.MediaType diff --git a/mealkitary-api/src/test/kotlin/com/docs/shop/GetReservableTimeControllerDocsTest.kt b/mealkitary-api/src/test/kotlin/com/docs/shop/GetReservableTimeControllerDocsTest.kt index 38ede60..0fd2f16 100644 --- a/mealkitary-api/src/test/kotlin/com/docs/shop/GetReservableTimeControllerDocsTest.kt +++ b/mealkitary-api/src/test/kotlin/com/docs/shop/GetReservableTimeControllerDocsTest.kt @@ -1,8 +1,8 @@ package com.docs.shop import com.docs.RestDocsSupport -import com.mealkitary.shop.adapter.input.web.GetReservableTimeController import com.mealkitary.shop.application.port.input.GetReservableTimeQuery +import com.mealkitary.shop.web.GetReservableTimeController import io.mockk.every import io.mockk.mockk import org.springframework.http.MediaType diff --git a/mealkitary-api/src/test/kotlin/com/docs/shop/GetShopControllerDocsTest.kt b/mealkitary-api/src/test/kotlin/com/docs/shop/GetShopControllerDocsTest.kt index 82bd57f..b7c13b7 100644 --- a/mealkitary-api/src/test/kotlin/com/docs/shop/GetShopControllerDocsTest.kt +++ b/mealkitary-api/src/test/kotlin/com/docs/shop/GetShopControllerDocsTest.kt @@ -1,9 +1,9 @@ package com.docs.shop import com.docs.RestDocsSupport -import com.mealkitary.shop.adapter.input.web.GetShopController import com.mealkitary.shop.application.port.input.GetShopQuery import com.mealkitary.shop.application.port.input.ShopResponse +import com.mealkitary.shop.web.GetShopController import io.mockk.every import io.mockk.mockk import org.springframework.http.MediaType diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt index 2846775..a60b5ec 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt @@ -11,12 +11,12 @@ import com.mealkitary.reservation.application.port.input.GetReservationQuery import com.mealkitary.reservation.application.port.input.PayReservationUseCase import com.mealkitary.reservation.application.port.input.RejectReservationUseCase import com.mealkitary.reservation.application.port.input.ReserveProductUseCase -import com.mealkitary.shop.adapter.input.web.GetProductController -import com.mealkitary.shop.adapter.input.web.GetReservableTimeController -import com.mealkitary.shop.adapter.input.web.GetShopController import com.mealkitary.shop.application.port.input.GetProductQuery import com.mealkitary.shop.application.port.input.GetReservableTimeQuery import com.mealkitary.shop.application.port.input.GetShopQuery +import com.mealkitary.shop.web.GetProductController +import com.mealkitary.shop.web.GetReservableTimeController +import com.mealkitary.shop.web.GetShopController import com.ninjasquad.springmockk.MockkBean import io.kotest.core.spec.style.AnnotationSpec import io.kotest.extensions.spring.SpringExtension diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/shop/adapter/input/web/GetProductControllerTest.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/shop/web/GetProductControllerTest.kt similarity index 97% rename from mealkitary-api/src/test/kotlin/com/mealkitary/shop/adapter/input/web/GetProductControllerTest.kt rename to mealkitary-api/src/test/kotlin/com/mealkitary/shop/web/GetProductControllerTest.kt index 62263bf..f12ebcc 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/shop/adapter/input/web/GetProductControllerTest.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/shop/web/GetProductControllerTest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.shop.adapter.input.web +package com.mealkitary.shop.web import com.mealkitary.WebIntegrationTestSupport import com.mealkitary.common.exception.EntityNotFoundException diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/shop/adapter/input/web/GetReservableTimeControllerTest.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/shop/web/GetReservableTimeControllerTest.kt similarity index 97% rename from mealkitary-api/src/test/kotlin/com/mealkitary/shop/adapter/input/web/GetReservableTimeControllerTest.kt rename to mealkitary-api/src/test/kotlin/com/mealkitary/shop/web/GetReservableTimeControllerTest.kt index bdc7681..26702ac 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/shop/adapter/input/web/GetReservableTimeControllerTest.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/shop/web/GetReservableTimeControllerTest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.shop.adapter.input.web +package com.mealkitary.shop.web import com.mealkitary.WebIntegrationTestSupport import com.mealkitary.common.exception.EntityNotFoundException diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/shop/adapter/input/web/GetShopControllerTest.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/shop/web/GetShopControllerTest.kt similarity index 96% rename from mealkitary-api/src/test/kotlin/com/mealkitary/shop/adapter/input/web/GetShopControllerTest.kt rename to mealkitary-api/src/test/kotlin/com/mealkitary/shop/web/GetShopControllerTest.kt index 668f042..3ddc8e7 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/shop/adapter/input/web/GetShopControllerTest.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/shop/web/GetShopControllerTest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.shop.adapter.input.web +package com.mealkitary.shop.web import com.mealkitary.WebIntegrationTestSupport import com.mealkitary.shop.application.port.input.ShopResponse From 702562342a57267a1a53fd39c13eb29a3289e2c5 Mon Sep 17 00:00:00 2001 From: le2sky Date: Fri, 8 Sep 2023 20:37:58 +0900 Subject: [PATCH 18/18] =?UTF-8?q?refactor=20:=20reservation=20=EC=9B=B9=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EA=B5=AC=EC=A1=B0=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../input => }/web/AcceptReservationController.kt | 2 +- .../input => }/web/GetReservationController.kt | 2 +- .../input => }/web/PayReservationController.kt | 4 ++-- .../input => }/web/RejectReservationController.kt | 2 +- .../input => }/web/ReserveProductController.kt | 4 ++-- .../input => }/web/request/PayReservationWebRequest.kt | 2 +- .../input => }/web/request/ReserveProductWebRequest.kt | 2 +- .../input => }/web/request/ReservedWebProduct.kt | 2 +- .../reservation/AcceptReservationControllerDocsTest.kt | 2 +- .../reservation/GetReservationControllerDocsTest.kt | 2 +- .../reservation/PayReservationControllerDocsTest.kt | 4 ++-- .../reservation/RejectReservationControllerDocsTest.kt | 2 +- .../reservation/ReserveProductControllerDocsTest.kt | 6 +++--- .../kotlin/com/mealkitary/WebIntegrationTestSupport.kt | 10 +++++----- .../input => }/web/AcceptReservationControllerTest.kt | 2 +- .../input => }/web/GetReservationControllerTest.kt | 2 +- .../input => }/web/PayReservationControllerTest.kt | 4 ++-- .../input => }/web/RejectReservationControllerTest.kt | 2 +- .../input => }/web/ReserveProductControllerTest.kt | 6 +++--- 19 files changed, 31 insertions(+), 31 deletions(-) rename mealkitary-api/src/main/kotlin/com/mealkitary/reservation/{adapter/input => }/web/AcceptReservationController.kt (94%) rename mealkitary-api/src/main/kotlin/com/mealkitary/reservation/{adapter/input => }/web/GetReservationController.kt (93%) rename mealkitary-api/src/main/kotlin/com/mealkitary/reservation/{adapter/input => }/web/PayReservationController.kt (90%) rename mealkitary-api/src/main/kotlin/com/mealkitary/reservation/{adapter/input => }/web/RejectReservationController.kt (94%) rename mealkitary-api/src/main/kotlin/com/mealkitary/reservation/{adapter/input => }/web/ReserveProductController.kt (87%) rename mealkitary-api/src/main/kotlin/com/mealkitary/reservation/{adapter/input => }/web/request/PayReservationWebRequest.kt (91%) rename mealkitary-api/src/main/kotlin/com/mealkitary/reservation/{adapter/input => }/web/request/ReserveProductWebRequest.kt (93%) rename mealkitary-api/src/main/kotlin/com/mealkitary/reservation/{adapter/input => }/web/request/ReservedWebProduct.kt (92%) rename mealkitary-api/src/test/kotlin/com/mealkitary/reservation/{adapter/input => }/web/AcceptReservationControllerTest.kt (97%) rename mealkitary-api/src/test/kotlin/com/mealkitary/reservation/{adapter/input => }/web/GetReservationControllerTest.kt (98%) rename mealkitary-api/src/test/kotlin/com/mealkitary/reservation/{adapter/input => }/web/PayReservationControllerTest.kt (97%) rename mealkitary-api/src/test/kotlin/com/mealkitary/reservation/{adapter/input => }/web/RejectReservationControllerTest.kt (97%) rename mealkitary-api/src/test/kotlin/com/mealkitary/reservation/{adapter/input => }/web/ReserveProductControllerTest.kt (96%) diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/AcceptReservationController.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/AcceptReservationController.kt similarity index 94% rename from mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/AcceptReservationController.kt rename to mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/AcceptReservationController.kt index 67eba74..2c01ea9 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/AcceptReservationController.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/AcceptReservationController.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.input.web +package com.mealkitary.reservation.web import com.mealkitary.common.utils.UUIDUtils import com.mealkitary.reservation.application.port.input.AcceptReservationUseCase diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/GetReservationController.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/GetReservationController.kt similarity index 93% rename from mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/GetReservationController.kt rename to mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/GetReservationController.kt index d86c7a5..d427904 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/GetReservationController.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/GetReservationController.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.input.web +package com.mealkitary.reservation.web import com.mealkitary.common.utils.UUIDUtils import com.mealkitary.reservation.application.port.input.GetReservationQuery diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/PayReservationController.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/PayReservationController.kt similarity index 90% rename from mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/PayReservationController.kt rename to mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/PayReservationController.kt index 2aaaedb..ec558a4 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/PayReservationController.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/PayReservationController.kt @@ -1,9 +1,9 @@ -package com.mealkitary.reservation.adapter.input.web +package com.mealkitary.reservation.web import com.mealkitary.common.utils.HttpResponseUtils import com.mealkitary.common.utils.UUIDUtils -import com.mealkitary.reservation.adapter.input.web.request.PayReservationWebRequest import com.mealkitary.reservation.application.port.input.PayReservationUseCase +import com.mealkitary.reservation.web.request.PayReservationWebRequest import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.PostMapping diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationController.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/RejectReservationController.kt similarity index 94% rename from mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationController.kt rename to mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/RejectReservationController.kt index 8329915..9aacec3 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationController.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/RejectReservationController.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.input.web +package com.mealkitary.reservation.web import com.mealkitary.common.utils.UUIDUtils import com.mealkitary.reservation.application.port.input.RejectReservationUseCase diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/ReserveProductController.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/ReserveProductController.kt similarity index 87% rename from mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/ReserveProductController.kt rename to mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/ReserveProductController.kt index a1e2fb6..b9f1446 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/ReserveProductController.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/ReserveProductController.kt @@ -1,8 +1,8 @@ -package com.mealkitary.reservation.adapter.input.web +package com.mealkitary.reservation.web import com.mealkitary.common.utils.HttpResponseUtils -import com.mealkitary.reservation.adapter.input.web.request.ReserveProductWebRequest import com.mealkitary.reservation.application.port.input.ReserveProductUseCase +import com.mealkitary.reservation.web.request.ReserveProductWebRequest import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/request/PayReservationWebRequest.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/request/PayReservationWebRequest.kt similarity index 91% rename from mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/request/PayReservationWebRequest.kt rename to mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/request/PayReservationWebRequest.kt index 478cae5..845820d 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/request/PayReservationWebRequest.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/request/PayReservationWebRequest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.input.web.request +package com.mealkitary.reservation.web.request import com.mealkitary.reservation.application.port.input.PayReservationRequest import java.util.UUID diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/request/ReserveProductWebRequest.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/request/ReserveProductWebRequest.kt similarity index 93% rename from mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/request/ReserveProductWebRequest.kt rename to mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/request/ReserveProductWebRequest.kt index 0af462b..af1f35f 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/request/ReserveProductWebRequest.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/request/ReserveProductWebRequest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.input.web.request +package com.mealkitary.reservation.web.request import com.mealkitary.common.validation.DateValid import com.mealkitary.reservation.application.port.input.ReserveProductRequest diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/request/ReservedWebProduct.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/request/ReservedWebProduct.kt similarity index 92% rename from mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/request/ReservedWebProduct.kt rename to mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/request/ReservedWebProduct.kt index 7cbabce..6e4584c 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/adapter/input/web/request/ReservedWebProduct.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/request/ReservedWebProduct.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.input.web.request +package com.mealkitary.reservation.web.request import com.mealkitary.reservation.application.port.input.ReservedProduct import javax.validation.constraints.NotBlank diff --git a/mealkitary-api/src/test/kotlin/com/docs/reservation/AcceptReservationControllerDocsTest.kt b/mealkitary-api/src/test/kotlin/com/docs/reservation/AcceptReservationControllerDocsTest.kt index a65ae4d..7ca1a78 100644 --- a/mealkitary-api/src/test/kotlin/com/docs/reservation/AcceptReservationControllerDocsTest.kt +++ b/mealkitary-api/src/test/kotlin/com/docs/reservation/AcceptReservationControllerDocsTest.kt @@ -1,8 +1,8 @@ package com.docs.reservation import com.docs.RestDocsSupport -import com.mealkitary.reservation.adapter.input.web.AcceptReservationController import com.mealkitary.reservation.application.port.input.AcceptReservationUseCase +import com.mealkitary.reservation.web.AcceptReservationController import io.mockk.every import io.mockk.mockk import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document diff --git a/mealkitary-api/src/test/kotlin/com/docs/reservation/GetReservationControllerDocsTest.kt b/mealkitary-api/src/test/kotlin/com/docs/reservation/GetReservationControllerDocsTest.kt index 8b7db99..c1ed274 100644 --- a/mealkitary-api/src/test/kotlin/com/docs/reservation/GetReservationControllerDocsTest.kt +++ b/mealkitary-api/src/test/kotlin/com/docs/reservation/GetReservationControllerDocsTest.kt @@ -1,10 +1,10 @@ package com.docs.reservation import com.docs.RestDocsSupport -import com.mealkitary.reservation.adapter.input.web.GetReservationController import com.mealkitary.reservation.application.port.input.GetReservationQuery import com.mealkitary.reservation.application.port.input.ReservationResponse import com.mealkitary.reservation.application.port.input.ReservedProduct +import com.mealkitary.reservation.web.GetReservationController import io.mockk.every import io.mockk.mockk import org.springframework.http.MediaType diff --git a/mealkitary-api/src/test/kotlin/com/docs/reservation/PayReservationControllerDocsTest.kt b/mealkitary-api/src/test/kotlin/com/docs/reservation/PayReservationControllerDocsTest.kt index 63fa813..30d8d52 100644 --- a/mealkitary-api/src/test/kotlin/com/docs/reservation/PayReservationControllerDocsTest.kt +++ b/mealkitary-api/src/test/kotlin/com/docs/reservation/PayReservationControllerDocsTest.kt @@ -1,9 +1,9 @@ package com.docs.reservation import com.docs.RestDocsSupport -import com.mealkitary.reservation.adapter.input.web.PayReservationController -import com.mealkitary.reservation.adapter.input.web.request.PayReservationWebRequest import com.mealkitary.reservation.application.port.input.PayReservationUseCase +import com.mealkitary.reservation.web.PayReservationController +import com.mealkitary.reservation.web.request.PayReservationWebRequest import io.mockk.every import io.mockk.mockk import org.springframework.http.MediaType diff --git a/mealkitary-api/src/test/kotlin/com/docs/reservation/RejectReservationControllerDocsTest.kt b/mealkitary-api/src/test/kotlin/com/docs/reservation/RejectReservationControllerDocsTest.kt index fa016dc..4777a4c 100644 --- a/mealkitary-api/src/test/kotlin/com/docs/reservation/RejectReservationControllerDocsTest.kt +++ b/mealkitary-api/src/test/kotlin/com/docs/reservation/RejectReservationControllerDocsTest.kt @@ -1,8 +1,8 @@ package com.docs.reservation import com.docs.RestDocsSupport -import com.mealkitary.reservation.adapter.input.web.RejectReservationController import com.mealkitary.reservation.application.port.input.RejectReservationUseCase +import com.mealkitary.reservation.web.RejectReservationController import io.mockk.every import io.mockk.mockk import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document diff --git a/mealkitary-api/src/test/kotlin/com/docs/reservation/ReserveProductControllerDocsTest.kt b/mealkitary-api/src/test/kotlin/com/docs/reservation/ReserveProductControllerDocsTest.kt index 1c1581e..b29c4a9 100644 --- a/mealkitary-api/src/test/kotlin/com/docs/reservation/ReserveProductControllerDocsTest.kt +++ b/mealkitary-api/src/test/kotlin/com/docs/reservation/ReserveProductControllerDocsTest.kt @@ -1,10 +1,10 @@ package com.docs.reservation import com.docs.RestDocsSupport -import com.mealkitary.reservation.adapter.input.web.ReserveProductController -import com.mealkitary.reservation.adapter.input.web.request.ReserveProductWebRequest -import com.mealkitary.reservation.adapter.input.web.request.ReservedWebProduct import com.mealkitary.reservation.application.port.input.ReserveProductUseCase +import com.mealkitary.reservation.web.ReserveProductController +import com.mealkitary.reservation.web.request.ReserveProductWebRequest +import com.mealkitary.reservation.web.request.ReservedWebProduct import io.mockk.every import io.mockk.mockk import org.springframework.http.MediaType diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt index a60b5ec..337dfb9 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/WebIntegrationTestSupport.kt @@ -1,16 +1,16 @@ package com.mealkitary import com.fasterxml.jackson.databind.ObjectMapper -import com.mealkitary.reservation.adapter.input.web.AcceptReservationController -import com.mealkitary.reservation.adapter.input.web.GetReservationController -import com.mealkitary.reservation.adapter.input.web.PayReservationController -import com.mealkitary.reservation.adapter.input.web.RejectReservationController -import com.mealkitary.reservation.adapter.input.web.ReserveProductController import com.mealkitary.reservation.application.port.input.AcceptReservationUseCase import com.mealkitary.reservation.application.port.input.GetReservationQuery import com.mealkitary.reservation.application.port.input.PayReservationUseCase import com.mealkitary.reservation.application.port.input.RejectReservationUseCase import com.mealkitary.reservation.application.port.input.ReserveProductUseCase +import com.mealkitary.reservation.web.AcceptReservationController +import com.mealkitary.reservation.web.GetReservationController +import com.mealkitary.reservation.web.PayReservationController +import com.mealkitary.reservation.web.RejectReservationController +import com.mealkitary.reservation.web.ReserveProductController import com.mealkitary.shop.application.port.input.GetProductQuery import com.mealkitary.shop.application.port.input.GetReservableTimeQuery import com.mealkitary.shop.application.port.input.GetShopQuery diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/AcceptReservationControllerTest.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/AcceptReservationControllerTest.kt similarity index 97% rename from mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/AcceptReservationControllerTest.kt rename to mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/AcceptReservationControllerTest.kt index c1c930a..294775d 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/AcceptReservationControllerTest.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/AcceptReservationControllerTest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.input.web +package com.mealkitary.reservation.web import com.mealkitary.WebIntegrationTestSupport import com.mealkitary.common.exception.EntityNotFoundException diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/GetReservationControllerTest.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/GetReservationControllerTest.kt similarity index 98% rename from mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/GetReservationControllerTest.kt rename to mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/GetReservationControllerTest.kt index 30b66ed..6251ea9 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/GetReservationControllerTest.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/GetReservationControllerTest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.input.web +package com.mealkitary.reservation.web import com.mealkitary.WebIntegrationTestSupport import com.mealkitary.common.exception.EntityNotFoundException diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/PayReservationControllerTest.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/PayReservationControllerTest.kt similarity index 97% rename from mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/PayReservationControllerTest.kt rename to mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/PayReservationControllerTest.kt index 716a689..5116be3 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/PayReservationControllerTest.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/PayReservationControllerTest.kt @@ -1,8 +1,8 @@ -package com.mealkitary.reservation.adapter.input.web +package com.mealkitary.reservation.web import com.mealkitary.WebIntegrationTestSupport import com.mealkitary.common.exception.EntityNotFoundException -import com.mealkitary.reservation.adapter.input.web.request.PayReservationWebRequest +import com.mealkitary.reservation.web.request.PayReservationWebRequest import io.mockk.every import org.springframework.http.MediaType import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationControllerTest.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/RejectReservationControllerTest.kt similarity index 97% rename from mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationControllerTest.kt rename to mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/RejectReservationControllerTest.kt index 22c28d4..2b12a67 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/RejectReservationControllerTest.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/RejectReservationControllerTest.kt @@ -1,4 +1,4 @@ -package com.mealkitary.reservation.adapter.input.web +package com.mealkitary.reservation.web import com.mealkitary.WebIntegrationTestSupport import com.mealkitary.common.exception.EntityNotFoundException diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/ReserveProductControllerTest.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/ReserveProductControllerTest.kt similarity index 96% rename from mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/ReserveProductControllerTest.kt rename to mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/ReserveProductControllerTest.kt index bcd9270..47d3568 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/adapter/input/web/ReserveProductControllerTest.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/ReserveProductControllerTest.kt @@ -1,9 +1,9 @@ -package com.mealkitary.reservation.adapter.input.web +package com.mealkitary.reservation.web import com.mealkitary.WebIntegrationTestSupport import com.mealkitary.common.exception.EntityNotFoundException -import com.mealkitary.reservation.adapter.input.web.request.ReserveProductWebRequest -import com.mealkitary.reservation.adapter.input.web.request.ReservedWebProduct +import com.mealkitary.reservation.web.request.ReserveProductWebRequest +import com.mealkitary.reservation.web.request.ReservedWebProduct import io.mockk.every import org.springframework.http.MediaType import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post