Conversation
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.
階段 27-2|IAP 流程協調器(Orchestrator)
目標
在
PurchaseService之上新增一層 PurchaseOrchestrator,集中處理:查價快取、購買流程、驗證 API 呼叫(先串 mock endpoint)、權益發放呼叫、冪等。
規格
preloadCatalogPrices(List<String> storeIds)skuId後統一呼叫PurchaseService.queryProductspurchase(String storeId)skuId→ 呼叫PurchaseService.buypurchaseStream成功事件 → 呼叫「驗證 API」(mock endpoint URL 由 Config 注入)ok=true時才呼叫 EntitlementManager.grant(階段 27-3)restoreNonConsumables()PurchaseService.restore行為loading,purchasing(productId),verifying(orderId?),success(storeId),error(code,message)驗收實例化需求
storeIds連續呼叫preloadCatalogPrices兩次PurchaseService.queryProductsstore.card_click_permpurchase→ Mock 購買成功 → Mock 驗證 APIok=trueEntitlementManager.grant('card_click_perm'),Orchestrator 推播successstore.card_click_permpurchase→ Mock 購買成功 → Mock 驗證回ok=false, reason='sku_not_allowed'grant、Orchestrator 推播error('verify_failed')restoreNonConsumables()PurchaseService.restore推回card_click_perm成功事件grant('card_click_perm')並推播success(冪等保護由 階段 27-3)