From 22271b2c6949ce94d6e39a670d9cedfaf56bb9ec Mon Sep 17 00:00:00 2001 From: lja3723 Date: Mon, 18 Nov 2024 22:57:36 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=20api=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/KakaoPaymentRedirectController.java | 27 ++++++++++++++ .../api/ReservationRedirectController.java | 35 ------------------- src/main/resources/application.yml | 13 ++++--- 3 files changed, 36 insertions(+), 39 deletions(-) create mode 100644 src/main/java/org/ktc2/cokaen/wouldyouin/reservation/api/KakaoPaymentRedirectController.java delete mode 100644 src/main/java/org/ktc2/cokaen/wouldyouin/reservation/api/ReservationRedirectController.java diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/reservation/api/KakaoPaymentRedirectController.java b/src/main/java/org/ktc2/cokaen/wouldyouin/reservation/api/KakaoPaymentRedirectController.java new file mode 100644 index 00000000..9a32b79e --- /dev/null +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/reservation/api/KakaoPaymentRedirectController.java @@ -0,0 +1,27 @@ +package org.ktc2.cokaen.wouldyouin.reservation.api; + +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import org.ktc2.cokaen.wouldyouin.auth.Authorize; +import org.ktc2.cokaen.wouldyouin.auth.MemberIdentifier; +import org.ktc2.cokaen.wouldyouin.member.persist.MemberType; +import org.ktc2.cokaen.wouldyouin.reservation.api.dto.ReservationRequest; +import org.ktc2.cokaen.wouldyouin.reservation.application.ReservationService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +@Controller +@RequiredArgsConstructor +public class KakaoPaymentRedirectController { + + @Value("${oauth.payment.approval_url}") + private String approvalUrl; + + @PostMapping("/kakaopay/redirect") + public String createReservation1(@RequestParam("pg_token") String pgToken) { + return "redirect:" + approvalUrl + "?pg_token=" + pgToken; + } +} \ No newline at end of file diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/reservation/api/ReservationRedirectController.java b/src/main/java/org/ktc2/cokaen/wouldyouin/reservation/api/ReservationRedirectController.java deleted file mode 100644 index 2158888c..00000000 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/reservation/api/ReservationRedirectController.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.ktc2.cokaen.wouldyouin.reservation.api; - -import jakarta.validation.Valid; -import lombok.RequiredArgsConstructor; -import org.ktc2.cokaen.wouldyouin.auth.Authorize; -import org.ktc2.cokaen.wouldyouin.auth.MemberIdentifier; -import org.ktc2.cokaen.wouldyouin.member.persist.MemberType; -import org.ktc2.cokaen.wouldyouin.reservation.api.dto.ReservationRequest; -import org.ktc2.cokaen.wouldyouin.reservation.application.ReservationService; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; - -@Controller -@RequiredArgsConstructor -public class ReservationRedirectController { - - private final ReservationService reservationService; - - @PostMapping("/redirect1") - public String createReservation1( - @Valid @RequestBody ReservationRequest reservationRequest, - @Authorize({MemberType.normal, MemberType.curator}) MemberIdentifier identifier - ) { - return "redirect:" + reservationService.create(identifier, reservationRequest).getKakaoPayResponse().getNextRedirectAppUrl(); - } - - @PostMapping("/redirect2") - public String createReservation2( - @Valid @RequestBody ReservationRequest reservationRequest, - @Authorize({MemberType.normal, MemberType.curator}) MemberIdentifier identifier - ) { - return "redirect:" + reservationService.create(identifier, reservationRequest).getKakaoPayResponse().getAndroidAppScheme(); - } -} \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 82c42753..5e1f2309 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -93,9 +93,14 @@ oauth: - email - profile payment: - "approval_url": ${SERVER_DOMAIN_NAME}/api/events - "cancel_url": ${SERVER_DOMAIN_NAME}/api/events - "fail_url": ${SERVER_DOMAIN_NAME}/api/events + "approval_url": wouldyouin://booking/payment/check/payment_approve + "cancel_url": wouldyouin://booking/payment/check/payment_cancel + "fail_url": wouldyouin://booking/payment/check/payment_failed "secret_key": ${KAKAOPAY_SECRET_KEY} "kakao_pay_single_payment_url": online/v1/payment/ready - "kakao-pay-request-host": https://open-api.kakaopay.com \ No newline at end of file + "kakao-pay-request-host": https://open-api.kakaopay.com + + + + +