@@ -41,20 +41,38 @@ public ResponseEntity<ApiResponse<String>> success(
4141
4242 log .info ("[KAKAO SUCCESS] paymentId={}, pg_token={}" , paymentId , pgToken );
4343
44- String deepLink = UriComponentsBuilder .newInstance ()
45- .scheme ("myapp" ).host ("pay" ).path ("/success" )
46- .queryParam ("paymentId" , paymentId )
47- .queryParam ("pg_token" , pgToken )
48- .build (true ).toUriString ();
44+ String query = "paymentId=" + paymentId
45+ + "&pg_token=" + java .net .URLEncoder .encode (pgToken , java .nio .charset .StandardCharsets .UTF_8 );
4946
50- log .info ("DeepLink constructed: {}" , deepLink );
47+ String intentUrl = "intent://pay/success?" + query
48+ + "#Intent;scheme=myapp;package=com.example.sumte;end" ;
49+
50+ log .info ("Intent URL constructed: {}" , intentUrl );
5151
5252 HttpHeaders headers = new HttpHeaders ();
53- headers .setLocation (URI .create (deepLink ));
53+ headers .setLocation (java . net . URI .create (intentUrl ));
5454 log .info ("Responding 302 with Location: {}" , headers .getLocation ());
55+
56+ // 바디엔 확인용으로 동일 문자열 내려줌
5557 return ResponseEntity .status (HttpStatus .FOUND )
5658 .headers (headers )
57- .body (ApiResponse .success (deepLink ));
59+ .body (ApiResponse .success (intentUrl ));
60+
61+ // String deepLink = UriComponentsBuilder.newInstance()
62+ // .scheme("myapp").host("pay").path("/success")
63+ // .queryParam("paymentId", paymentId)
64+ // .queryParam("pg_token", pgToken)
65+ // .build(true).toUriString();
66+ //
67+ // log.info("DeepLink constructed: {}", deepLink);
68+
69+ // HttpHeaders headers = new HttpHeaders();
70+ // headers.setLocation(URI.create(deepLink));
71+ // log.info("Responding 302 with Location: {}", headers.getLocation());
72+ //
73+ // return ResponseEntity.status(HttpStatus.FOUND)
74+ // .headers(headers)
75+ // .body(ApiResponse.success(deepLink));
5876 }
5977
6078 @ GetMapping ("/pay/cancel" )
0 commit comments