Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daolove0323 committed Nov 21, 2024
1 parent 37ccb3b commit 3de0044
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public String readyPaymentTest() {
KakaoPayRequest kakaoPayRequest = KakaoPayRequest.builder()
.cid("TC0ONETIME")
.partnerUserId("10")
.itemName("상품명")
.itemName("왜안돼!!")
.quantity("1")
.totalAmount("1000000")
.taxFreeAmount("0")
Expand All @@ -109,7 +109,7 @@ public String readyPaymentTest() {
payment.setTid(kakaoPayResponse.getTid());
paymentRepository.save(payment);
paymentRepository.flush();
return kakaoPayResponse.getAndroidAppScheme() + "?orderId=" + payment.getPartnerOrderId();
return kakaoPayResponse.getNextRedirectAppUrl() + "?orderId=" + payment.getPartnerOrderId();
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package org.ktc2.cokaen.wouldyouin.reservation.api;

import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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._common.api.ApiResponse;
import org.ktc2.cokaen.wouldyouin._common.api.ApiResponseBody;
import org.ktc2.cokaen.wouldyouin.payment.application.PaymentService;
import org.ktc2.cokaen.wouldyouin.reservation.api.dto.ReservationRequest;
import org.ktc2.cokaen.wouldyouin.reservation.api.dto.KakaoPayReservationResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

Expand All @@ -32,30 +29,17 @@ public class KakaoPaymentRedirectController {

private final PaymentService paymentService;


@GetMapping("/redirectTest")
public String redirectTest() {
return "redirect:" + approvalDeepLink + "?reservationId=7";
}

@GetMapping("/kakaopay")
public String redirectKakaopay(RedirectAttributes redirectAttribute) {
@GetMapping("/why")
public String payTest() {
return "redirect:" + paymentService.readyPaymentTest();
}

// @PostMapping("/api/reservations")
// public String createReservation(
// @Valid @RequestBody ReservationRequest reservationRequest,
// @Authorize({MemberType.normal, MemberType.curator}) MemberIdentifier identifier
// ) {
// return paymentService.readyPayment(identifier, reservationRequest);
// }

@GetMapping("/kakaopay/redirect/approval")
public String redirectKakaopayApproval(
@RequestParam("pg_token") String pgToken, @RequestParam Long orderId) {
log.debug("실행되는지 확인 테스트");
return "redirect:" + "wouldyouin://booking/kakao/check/payment_approve" + "?reservationId=" + "1";
log.debug("실행되는지 확인 테스트 pg: {}, id: {}", pgToken, orderId);
return "redirect:/payview";
// return "redirect:" + "wouldyouin://booking/kakao/check/payment_approve" + "?reservationId=" + "1";
// paymentService.approvePayment(orderId, pgToken);
// Long reservationId = paymentService.approvePayment(orderId, pgToken);
// return "redirect:" + "wouldyouin://booking/kakao/check/payment_approve" + "?reservationId=" + reservationId;
Expand Down

0 comments on commit 3de0044

Please sign in to comment.