Repository navigation
fix(payment): PayPal 응답과 장애 계약을 바로잡는다 - #446
Merged
Merged
Conversation
- capture 응답에서 금액 검증이 가능하도록 Prefer: return=representation 을 요청한다. - 주문 조회와 authorization void 연결 오류를 PayPalUnavailableException 으로 감싸 복구 경로에 전달한다. - MockWebServer 가 PayPal 기본 minimal 응답을 재현하고, 닫힌 포트 회귀 테스트를 추가한다. - 검증: payment-module 단위 테스트 통과; clean check 596 tests / 0 failures. Closes #444
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 요청 (Pull Request)
목적
paymentState=UNKNOWN이었고, 복구 worker가 주문을 다시 조회한 뒤에야PAID가 됐다(관측 최대 25초). (2) 승인 반영 중 PayPal 연결이 지연·실패하면 HTTP 500이 나고, 결제가AUTHORIZATION_PENDING에 고착됐다(180초 내 미수렴).변경 범위
Prefer: return=representation추가, 테스트 stub이 PayPal 기본(minimal) 응답을 재현하도록 변경.getOrder·voidAuthorization의RestClientException을 다른 호출과 같이PayPalUnavailableException으로 감싼다.근거와 설계
id, links, status뿐이었고,Prefer: return=representation이면amount를 포함한 전체 표현이 왔다. ATLAS는 capture 응답의amount로providerAmountMatches를 검사하므로, 헤더가 없으면 성공 capture가UNKNOWN이 된다.post()에 넣어 주문 생성·승인·capture·환불이 같은 계약을 쓴다. 감싸지 않은 두 호출은 서비스의PAYMENT_PROVIDER_UNAVAILABLE → UNKNOWN처리를 건너뛰어 500이 됐다. 같은 예외 계약을 적용해 기존 복구 경로를 탄다.CAPTURED로 기록된다.PayPalIntegrationTestSupport)이 실제 PayPal처럼Prefer가 없으면 minimal 응답을 준다.UNKNOWN(5.4s, 6.0s) → 수정 후CAPTURED(5.05.5s),43.5s. 표본이 작아 지연 분포는 판단하지 않는다. 환불은 실제 Sandbox에서 확인하지 않았다.PAID수렴 0.1s 이내. 승인 반영 단계 장애(3s 지연·응답 유실·reset, 조건당 3건): 수정 전 500·고착 → 수정 후 9/9PAID, PayPal capture 각 1건, 수렴 0.1시각화
추적
Prefer헤더(return=minimal 기본, return=representation)변경 요약
Prefer: return=representation추가, stub 이 PayPal 기본 minimal 응답을 재현, 주문 조회·void 장애를 provider 장애로 감쌈.검증
com.atlas.payment.*+BuyerFlowIntegrationTest95건 중 22건 실패(회귀 감지 확인), 헤더 포함 시 95건 통과.PayPalRestClientFailureTest(닫힌 포트 실제 연결): 감싸기 전 3건 중 2건 실패, 수정 후 통과../gradlew clean check: 전체clean check: 596 tests / 0 failures.PayPalRestClientFailureTest3 tests 통과..위험·후속 작업
검토 체크리스트
Closes #N또는Refs #N형식이 plain text임.