Repository navigation
토큰 인앱결제(IAP) 구현 - #53
Merged
Merged
Conversation
- PurchasableProduct, PurchasedTokenBalance, PurchaseResult 엔티티 생성 - PurchaseRepository 프로토콜 정의 - FetchPurchasableProductsUseCase, PurchaseTokenUseCase, FetchTokenBalanceUseCase 구현 - 각 UseCase별 2개씩 총 6개 테스트 케이스 작성 및 GAMSSTests 타겟에 등록
…purchase # Conflicts: # GAMSS.xcodeproj/project.pbxproj
- Mock 로컬 지급 처리를 제거하고 signedTransaction(JWS)을 서버에 보내 검증·지급받도록 변경 - 지급/잔액은 서버 응답(grantedTokens/paidBalance)을 그대로 신뢰 — 클라이언트 측 중복 지급 방지 로직 제거(서버가 transaction.id 기준으로 처리) - 서버 응답에 따라 transaction.finish() 호출 여부를 가름: 성공/PURCHASE_INVALID/PURCHASE_CANCELLED만 finish, 그 외(인증/권한/상품/서버 오류)는 finish하지 않고 다음 실행 때 Transaction.unfinished로 재시도 - NetworkError.httpError에 서버 error.code를 함께 실어, 같은 HTTP status라도 다른 비즈니스 에러를 구분 가능하게 함
token_300000 -> token_300K, token_500000 -> token_500K, token_1000000 -> token_1m. 가격은 그대로.
… -> token_300k/500k)
Collaborator
Author
|
UI 작업은 아직 mock이어서 이후 PR에서 수정할 예정입니당 |
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.
요약
토큰 패키지 인앱결제(IAP) 기능을 추가합니다. StoreKit2 기반 상품 조회/구매 플로우와 서버 측 영수증 검증/지급(
POST /api/payments/apple)까지 실제로 동작합니다.PurchaseRepository프로토콜 +DefaultPurchaseRepository(StoreKit2 통합) + UseCase 3종 +TokenPurchaseView/ViewModeltoken_300k(30만, 990원) /token_500k(50만, 1,500원) /token_1m(100만, 3,000원) — App Store Connect에 Consumable로 등록, 실제 Sandbox 구매까지 확인 완료#if DEBUG로 감싸서, 설정 화면의 "토큰 충전 (디버그)" 메뉴는 디버그 빌드에서만 보입니다. 정식 진입점(유저가 실제로 충전하러 들어가는 흐름) 연결은 별도 PR로 분리합니다.appAccountToken을 StoreKit에 실어 보내 서버가 계정을 식별하고,signedTransaction(JWS)을 그대로 서버에 보내 검증·지급받습니다. 지급량/잔액은 서버 응답(grantedTokens/paidBalance)을 그대로 신뢰합니다.transaction.finish()호출 여부는 서버 응답에 따라 갈립니다 — 성공,PURCHASE_INVALID,PURCHASE_CANCELLED만 finish 처리하고, 그 외(인증/권한/상품/서버 오류)는 finish하지 않아 다음 실행 때Transaction.unfinished가 재전송합니다. 이 분기는DefaultPurchaseRepository.purchaseResult(for:)로 분리해 StoreKit 없이 유닛테스트했습니다.테스트 플랜
/api/payments/apple검증 → 잔액 반영까지 end-to-end 확인추후 작업 (이번 PR 범위 밖)
UserDefaults캐시 대신 서버 조회로 교체