Skip to content

Commit

Permalink
Merge pull request #187 from fourix4/dev
Browse files Browse the repository at this point in the history
결제 성공 시 redirect 설정
  • Loading branch information
llynn97 authored Jul 27, 2024
2 parents 7674368 + a4e1216 commit 8b712a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public Response<Void> checkInSeat(@RequestBody SeatCheckInRequestDto dto, Authen

@PatchMapping("/booking/checkout")
public Response<Void> checkOutSeat(@RequestBody SeatCheckOutRequestDto dto) { // 퇴실
System.out.println("bookingId: "+ dto.getBooking_id());
bookingService.checkOutSeat(dto.getBooking_id());
return Response.success();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
import com.example.CatchStudy.global.exception.ErrorCode;
import com.example.CatchStudy.service.BookingService;
import com.example.CatchStudy.service.PaymentService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
Expand Down Expand Up @@ -38,8 +41,10 @@ public void fail(@PathVariable("paymentId") Long paymentId) {
}

@GetMapping("/payment/success/{userId}/{paymentId}")
public String afterPayRequest(@RequestParam("pg_token") String pgToken, @PathVariable("userId") Long userId, @PathVariable("paymentId") Long paymentId) { //결제 성공
public void afterPayRequest(@RequestParam("pg_token") String pgToken, @PathVariable("userId") Long userId, @PathVariable("paymentId") Long paymentId, HttpServletResponse response) throws IOException { //결제 성공
paymentService.kakaoPayApprove(pgToken,userId,paymentId);
return "redirect:http://localhost:3000/payment-success";
String redirectUrl = "http://localhost:3000/payment-success";
response.sendRedirect(redirectUrl);
//return "redirect:http://localhost:3000/payment-success";
}
}

0 comments on commit 8b712a6

Please sign in to comment.