-
Notifications
You must be signed in to change notification settings - Fork 0
♻️ refactor : 결제 서비스 주소 변경 #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…/swagger ♻️ refactor : OrderFeignPort 수정
Walkthrough이 변경사항은 CORS 허용 오리진 추가, Feign 클라이언트의 주문 서비스 URL 및 엔드포인트 수정, 그리고 주문 완료 메서드의 파라미터 타입 일치를 위한 코드 수정을 포함합니다. 외부 서비스와의 연동 방식 및 접근 제어 설정이 조정되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant PaymentService
participant OrderFeignPort
participant OrderService
PaymentService->>OrderFeignPort: completeOrder(Long orderId)
OrderFeignPort->>OrderService: PUT /api/v1/orders/{orderId}/submit
OrderService-->>OrderFeignPort: 응답 반환
OrderFeignPort-->>PaymentService: 응답 반환
Possibly related PRs
Suggested labels
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
payment-service/src/main/java/gcu/web/paymentservice/common/config/WebMvcConfig.java (1)
13-16: CORS 설정 보안 검토 권장현재 CORS 설정은 여러 오리진을 허용하고 모든 헤더와 인증 정보를 허용합니다. 프로덕션 환경에서는 보안을 강화하기 위해 필요한 헤더만 명시적으로 허용하고, 인증 정보의 처리를 신중하게 검토하는 것이 좋습니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
payment-service/src/main/java/gcu/web/paymentservice/common/config/WebMvcConfig.java(1 hunks)payment-service/src/main/java/gcu/web/paymentservice/platform/adapter/out/external/order/OrderFeignPort.java(2 hunks)payment-service/src/main/java/gcu/web/paymentservice/platform/application/service/PaymentService.java(1 hunks)
🔇 Additional comments (2)
payment-service/src/main/java/gcu/web/paymentservice/platform/adapter/out/external/order/OrderFeignPort.java (1)
19-20: API 엔드포인트 및 파라미터 타입 변경주문 완료 API의 엔드포인트가
POST /api/v1/orders/{orderId}에서PUT /api/v1/orders/{orderId}/submit으로 변경되었고,orderId파라미터 타입이String에서Long으로 변경되었습니다. 이는 유효한 리소스 설계 관점에서 좋은 변화이며, HTTP 메서드 사용이 RESTful 원칙에 더 부합합니다.payment-service/src/main/java/gcu/web/paymentservice/common/config/WebMvcConfig.java (1)
13-13: 로컬 개발 환경용 CORS 설정 추가
http://localhost:5173을 허용된 오리진 목록에 추가한 것은 로컬 개발 환경을 위한 적절한 변경입니다. 이는 Vite와 같은 최신 프론트엔드 개발 도구에서 사용하는 기본 포트입니다.
|
|
||
|
|
||
| @FeignClient(name = "order-service", url = "http://34.127.7.212:8101") | ||
| @FeignClient(name = "order-service", url = "http://54.66.149.225:8100") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
서비스 URL 업데이트 확인됨
주문 서비스의 URL이 http://34.127.7.212:8101에서 http://54.66.149.225:8100으로 변경되었습니다. 이 변경사항이 모든 환경(개발, 테스트, 프로덕션)에서 일관되게 적용되었는지 확인하세요.
다음 스크립트를 실행하여 다른 서비스에서도 이 새 URL을 참조하고 있는지 확인하세요:
🏁 Script executed:
#!/bin/bash
# 프로젝트에서 이전 URL 참조 검색
rg -i "34.127.7.212:8101" --type javaLength of output: 37
다른 환경 설정 파일에도 이전 URL이 남아있을 수 있으므로, 코드뿐 아니라 설정 파일 전체를 대상으로 재검색해 주세요.
🏁 Script executed:
#!/bin/bash
# 전체 파일에서 이전 서비스 URL(34.127.7.212:8101) 참조 검색 (Java, YAML, Properties 등)
rg -F "34.127.7.212:8101" -nLength of output: 181
이전 서비스 URL 참조 수정 필요
서비스 URL이 http://34.127.7.212:8101에서 http://54.66.149.225:8100으로 변경되었으나, 아래 파일에 아직 이전 URL이 남아 있습니다. 모든 참조를 새 URL로 업데이트해주세요.
- payment-service/src/main/resources/static/index.html (라인 52)
수정 예시:
- <a href="http://34.127.7.212:8101/swagger-ui/index.html#/" class="link-button">스웨거로 이동하기</a>
+ <a href="http://54.66.149.225:8100/swagger-ui/index.html#/" class="link-button">스웨거로 이동하기</a>Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In
payment-service/src/main/java/gcu/web/paymentservice/platform/adapter/out/external/order/OrderFeignPort.java
at line 9, the FeignClient annotation URL has been updated to
"http://54.66.149.225:8100". Ensure that all other references to the old URL
"http://34.127.7.212:8101" in the entire project, including configuration files
and static resources like payment-service/src/main/resources/static/index.html
line 52, are also updated to the new URL to maintain consistency across all
environments.
|
|
||
| // 주문 정보 전달 | ||
| orderFeignPort.completeOrder(saved.getOrderId()); | ||
| orderFeignPort.completeOrder(Long.valueOf(saved.getOrderId())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
타입 변환 시 예외 처리 필요
String에서 Long으로 변환 시 orderId가 숫자 형식이 아닌 경우 NumberFormatException이 발생할 수 있습니다. 이 예외를 적절히 처리하는 것이 좋습니다.
다음과 같이 수정하는 것을 권장합니다:
- orderFeignPort.completeOrder(Long.valueOf(saved.getOrderId()));
+ try {
+ orderFeignPort.completeOrder(Long.valueOf(saved.getOrderId()));
+ } catch (NumberFormatException e) {
+ log.error("주문 ID 형식 오류: {}", saved.getOrderId(), e);
+ throw new IllegalStateException(ErrorCode.BAD_REQUEST.getMessage());
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| orderFeignPort.completeOrder(Long.valueOf(saved.getOrderId())); | |
| try { | |
| orderFeignPort.completeOrder(Long.valueOf(saved.getOrderId())); | |
| } catch (NumberFormatException e) { | |
| log.error("주문 ID 형식 오류: {}", saved.getOrderId(), e); | |
| throw new IllegalStateException(ErrorCode.BAD_REQUEST.getMessage()); | |
| } |
🤖 Prompt for AI Agents
In
payment-service/src/main/java/gcu/web/paymentservice/platform/application/service/PaymentService.java
at line 66, the code converts orderId from String to Long without handling
potential NumberFormatException if the orderId is not a valid number. To fix
this, wrap the Long.valueOf conversion in a try-catch block to catch
NumberFormatException and handle it appropriately, such as logging the error and
preventing the method from proceeding with an invalid orderId.
PR 개요
♻️ refactor : 결제 서비스 주소 변경
스크린샷
Summary by CodeRabbit