Fix invoice preview SDK schema - #50
Merged
Merged
Conversation
There was a problem hiding this comment.
APPROVE
Summary
이 PR은 Stripe SDK와의 호환성을 개선하기 위해 invoice preview 응답 스키마를 수정합니다. 변경사항은 잘 격리되어 있고 테스트 커버리지가 적절히 추가되었습니다.
변경사항 분석
1. Invoice Preview 스키마 확장
- Stripe Invoice의 표준 필드(
period_start,period_end,status_transitions,automatic_tax,payment_settings,billing_reason등)를 추가 - 새로운 헬퍼 함수들(
invoicePreviewPeriod,stripeInvoiceParent,stripeInvoiceStatusTransitions,stripeAutomaticTax,stripeInvoicePaymentSettings)이 잘 구조화되어 있음 - api.go:1963-2119
2. Discounts 배열 형식 변경
discounts필드를stripeListenvelope에서 직접 배열([]map[string]any)로 변경- 이는 Stripe의 실제 API 형식과 일치하며, SDK deserialization 호환성을 위해 필요한 변경
- subscription과 invoice 응답에서도 동일하게 적용되어 일관성 유지
- api.go:4943
3. Regression Tests 추가
- Preview schema defaults, period fields, tax defaults, status transitions, discount arrays에 대한 assertion 추가
- api_test.go:4490-4553
검증 관찰사항
- Billing state correctness:
invoicePreviewPeriod함수가 subscription의CurrentPeriodStart/CurrentPeriodEnd를 올바르게 사용하며, fallback 동작도 적절함 - Webhook reliability: webhook 관련 변경 없음
- Safety: 실제 결제 처리 경로 변경 없음, card data handling 없음
- Scenario/fixture contract: scenario/fixture 관련 변경 없음
- UI/API coherence: API 스키마 변경이 SDK deserialization을 목적으로 하며, 문서에 반영됨
문서 업데이트
- COMPATIBILITY.md에 invoice/preview 응답의 default fields와 array-shaped discounts가 문서화됨
결론
Blocking issue 없음. 변경사항은 SDK 호환성 개선이라는 명확한 목적을 가지며, 테스트 커버리지가 적절히 추가되었습니다.
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.
Summary
Verification