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 + + + + +