@chipmobilesdk/rn-payment 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +111 -0
- package/README.md +1 -1
- package/lib/commonjs/adapter/createStoreProvider.js +110 -0
- package/lib/commonjs/adapter/createStoreProvider.js.map +1 -0
- package/lib/commonjs/adapter/iap-adapter.js +393 -0
- package/lib/commonjs/adapter/iap-adapter.js.map +1 -0
- package/lib/commonjs/adapter/iapShapes.js +169 -0
- package/lib/commonjs/adapter/iapShapes.js.map +1 -0
- package/lib/commonjs/adapter/port.js +6 -0
- package/lib/commonjs/adapter/port.js.map +1 -0
- package/lib/commonjs/config/types.js +2 -0
- package/lib/commonjs/config/types.js.map +1 -0
- package/lib/commonjs/config/validate.js +181 -0
- package/lib/commonjs/config/validate.js.map +1 -0
- package/lib/commonjs/core/mutex.js +31 -0
- package/lib/commonjs/core/mutex.js.map +1 -0
- package/lib/commonjs/core/retry.js +37 -0
- package/lib/commonjs/core/retry.js.map +1 -0
- package/lib/commonjs/core/timers.js +207 -0
- package/lib/commonjs/core/timers.js.map +1 -0
- package/lib/commonjs/diagnostics/errors.js +83 -0
- package/lib/commonjs/diagnostics/errors.js.map +1 -0
- package/lib/commonjs/diagnostics/events.js +126 -0
- package/lib/commonjs/diagnostics/events.js.map +1 -0
- package/lib/commonjs/diagnostics/messageKeys.js +70 -0
- package/lib/commonjs/diagnostics/messageKeys.js.map +1 -0
- package/lib/commonjs/engine/connection.js +189 -0
- package/lib/commonjs/engine/connection.js.map +1 -0
- package/lib/commonjs/engine/engine.js +279 -0
- package/lib/commonjs/engine/engine.js.map +1 -0
- package/lib/commonjs/engine/finalize.js +325 -0
- package/lib/commonjs/engine/finalize.js.map +1 -0
- package/lib/commonjs/engine/foreground.js +26 -0
- package/lib/commonjs/engine/foreground.js.map +1 -0
- package/lib/commonjs/engine/internals.js +31 -0
- package/lib/commonjs/engine/internals.js.map +1 -0
- package/lib/commonjs/engine/pending.js +102 -0
- package/lib/commonjs/engine/pending.js.map +1 -0
- package/lib/commonjs/engine/products.js +198 -0
- package/lib/commonjs/engine/products.js.map +1 -0
- package/lib/commonjs/engine/purchase.js +395 -0
- package/lib/commonjs/engine/purchase.js.map +1 -0
- package/lib/commonjs/engine/purchaseFailure.js +77 -0
- package/lib/commonjs/engine/purchaseFailure.js.map +1 -0
- package/lib/commonjs/engine/receiptValidation.js +90 -0
- package/lib/commonjs/engine/receiptValidation.js.map +1 -0
- package/lib/commonjs/engine/state.js +201 -0
- package/lib/commonjs/engine/state.js.map +1 -0
- package/lib/commonjs/engine/subscriptions.js +122 -0
- package/lib/commonjs/engine/subscriptions.js.map +1 -0
- package/lib/commonjs/engine/sync.js +163 -0
- package/lib/commonjs/engine/sync.js.map +1 -0
- package/lib/commonjs/entitlements/aggregate.js +212 -0
- package/lib/commonjs/entitlements/aggregate.js.map +1 -0
- package/lib/commonjs/entitlements/mapping.js +41 -0
- package/lib/commonjs/entitlements/mapping.js.map +1 -0
- package/lib/commonjs/entitlements/policy.js +110 -0
- package/lib/commonjs/entitlements/policy.js.map +1 -0
- package/lib/commonjs/index.js +266 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/persistence/mmkv-store.js +149 -0
- package/lib/commonjs/persistence/mmkv-store.js.map +1 -0
- package/lib/commonjs/persistence/snapshot.js +229 -0
- package/lib/commonjs/persistence/snapshot.js.map +1 -0
- package/lib/commonjs/react/PaymentProvider.js +96 -0
- package/lib/commonjs/react/PaymentProvider.js.map +1 -0
- package/lib/commonjs/react/hooks.js +202 -0
- package/lib/commonjs/react/hooks.js.map +1 -0
- package/lib/commonjs/testing/conformance.js +136 -0
- package/lib/commonjs/testing/conformance.js.map +1 -0
- package/lib/commonjs/testing/fakeStore.js +281 -0
- package/lib/commonjs/testing/fakeStore.js.map +1 -0
- package/lib/commonjs/testing/index.js +45 -0
- package/lib/commonjs/testing/index.js.map +1 -0
- package/lib/module/adapter/createStoreProvider.js +106 -0
- package/lib/module/adapter/createStoreProvider.js.map +1 -0
- package/lib/module/adapter/iap-adapter.js +383 -0
- package/lib/module/adapter/iap-adapter.js.map +1 -0
- package/lib/module/adapter/iapShapes.js +160 -0
- package/lib/module/adapter/iapShapes.js.map +1 -0
- package/lib/module/adapter/port.js +4 -0
- package/lib/module/adapter/port.js.map +1 -0
- package/lib/module/config/types.js +2 -0
- package/lib/module/config/types.js.map +1 -0
- package/lib/module/config/validate.js +175 -0
- package/lib/module/config/validate.js.map +1 -0
- package/lib/module/core/mutex.js +22 -0
- package/lib/module/core/mutex.js.map +1 -0
- package/lib/module/core/retry.js +33 -0
- package/lib/module/core/retry.js.map +1 -0
- package/lib/module/core/timers.js +198 -0
- package/lib/module/core/timers.js.map +1 -0
- package/lib/module/diagnostics/errors.js +76 -0
- package/lib/module/diagnostics/errors.js.map +1 -0
- package/lib/module/diagnostics/events.js +117 -0
- package/lib/module/diagnostics/events.js.map +1 -0
- package/lib/module/diagnostics/messageKeys.js +64 -0
- package/lib/module/diagnostics/messageKeys.js.map +1 -0
- package/lib/module/engine/connection.js +185 -0
- package/lib/module/engine/connection.js.map +1 -0
- package/lib/module/engine/engine.js +274 -0
- package/lib/module/engine/engine.js.map +1 -0
- package/lib/module/engine/finalize.js +322 -0
- package/lib/module/engine/finalize.js.map +1 -0
- package/lib/module/engine/foreground.js +21 -0
- package/lib/module/engine/foreground.js.map +1 -0
- package/lib/module/engine/internals.js +26 -0
- package/lib/module/engine/internals.js.map +1 -0
- package/lib/module/engine/pending.js +95 -0
- package/lib/module/engine/pending.js.map +1 -0
- package/lib/module/engine/products.js +195 -0
- package/lib/module/engine/products.js.map +1 -0
- package/lib/module/engine/purchase.js +390 -0
- package/lib/module/engine/purchase.js.map +1 -0
- package/lib/module/engine/purchaseFailure.js +72 -0
- package/lib/module/engine/purchaseFailure.js.map +1 -0
- package/lib/module/engine/receiptValidation.js +87 -0
- package/lib/module/engine/receiptValidation.js.map +1 -0
- package/lib/module/engine/state.js +196 -0
- package/lib/module/engine/state.js.map +1 -0
- package/lib/module/engine/subscriptions.js +119 -0
- package/lib/module/engine/subscriptions.js.map +1 -0
- package/lib/module/engine/sync.js +158 -0
- package/lib/module/engine/sync.js.map +1 -0
- package/lib/module/entitlements/aggregate.js +204 -0
- package/lib/module/entitlements/aggregate.js.map +1 -0
- package/lib/module/entitlements/mapping.js +35 -0
- package/lib/module/entitlements/mapping.js.map +1 -0
- package/lib/module/entitlements/policy.js +104 -0
- package/lib/module/entitlements/policy.js.map +1 -0
- package/lib/module/index.js +59 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/persistence/mmkv-store.js +144 -0
- package/lib/module/persistence/mmkv-store.js.map +1 -0
- package/lib/module/persistence/snapshot.js +221 -0
- package/lib/module/persistence/snapshot.js.map +1 -0
- package/lib/module/react/PaymentProvider.js +90 -0
- package/lib/module/react/PaymentProvider.js.map +1 -0
- package/lib/module/react/hooks.js +192 -0
- package/lib/module/react/hooks.js.map +1 -0
- package/lib/module/testing/conformance.js +130 -0
- package/lib/module/testing/conformance.js.map +1 -0
- package/lib/module/testing/fakeStore.js +276 -0
- package/lib/module/testing/fakeStore.js.map +1 -0
- package/lib/module/testing/index.js +13 -0
- package/lib/module/testing/index.js.map +1 -0
- package/lib/typescript/commonjs/adapter/createStoreProvider.d.ts +45 -0
- package/lib/typescript/commonjs/adapter/createStoreProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/iap-adapter.d.ts +80 -0
- package/lib/typescript/commonjs/adapter/iap-adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/iapShapes.d.ts +94 -0
- package/lib/typescript/commonjs/adapter/iapShapes.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/port.d.ts +184 -0
- package/lib/typescript/commonjs/adapter/port.d.ts.map +1 -0
- package/lib/typescript/commonjs/config/types.d.ts +326 -0
- package/lib/typescript/commonjs/config/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/config/validate.d.ts +63 -0
- package/lib/typescript/commonjs/config/validate.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/mutex.d.ts +17 -0
- package/lib/typescript/commonjs/core/mutex.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/retry.d.ts +19 -0
- package/lib/typescript/commonjs/core/retry.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/timers.d.ts +142 -0
- package/lib/typescript/commonjs/core/timers.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/errors.d.ts +55 -0
- package/lib/typescript/commonjs/diagnostics/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts +158 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/messageKeys.d.ts +54 -0
- package/lib/typescript/commonjs/diagnostics/messageKeys.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/connection.d.ts +30 -0
- package/lib/typescript/commonjs/engine/connection.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/engine.d.ts +93 -0
- package/lib/typescript/commonjs/engine/engine.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/finalize.d.ts +53 -0
- package/lib/typescript/commonjs/engine/finalize.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/foreground.d.ts +15 -0
- package/lib/typescript/commonjs/engine/foreground.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/internals.d.ts +28 -0
- package/lib/typescript/commonjs/engine/internals.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/pending.d.ts +51 -0
- package/lib/typescript/commonjs/engine/pending.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/products.d.ts +82 -0
- package/lib/typescript/commonjs/engine/products.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/purchase.d.ts +61 -0
- package/lib/typescript/commonjs/engine/purchase.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/purchaseFailure.d.ts +15 -0
- package/lib/typescript/commonjs/engine/purchaseFailure.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/receiptValidation.d.ts +42 -0
- package/lib/typescript/commonjs/engine/receiptValidation.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/state.d.ts +46 -0
- package/lib/typescript/commonjs/engine/state.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/subscriptions.d.ts +61 -0
- package/lib/typescript/commonjs/engine/subscriptions.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/sync.d.ts +36 -0
- package/lib/typescript/commonjs/engine/sync.d.ts.map +1 -0
- package/lib/typescript/commonjs/entitlements/aggregate.d.ts +97 -0
- package/lib/typescript/commonjs/entitlements/aggregate.d.ts.map +1 -0
- package/lib/typescript/commonjs/entitlements/mapping.d.ts +27 -0
- package/lib/typescript/commonjs/entitlements/mapping.d.ts.map +1 -0
- package/lib/typescript/commonjs/entitlements/policy.d.ts +75 -0
- package/lib/typescript/commonjs/entitlements/policy.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +44 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/persistence/mmkv-store.d.ts +45 -0
- package/lib/typescript/commonjs/persistence/mmkv-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/persistence/snapshot.d.ts +106 -0
- package/lib/typescript/commonjs/persistence/snapshot.d.ts.map +1 -0
- package/lib/typescript/commonjs/react/PaymentProvider.d.ts +57 -0
- package/lib/typescript/commonjs/react/PaymentProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/react/hooks.d.ts +80 -0
- package/lib/typescript/commonjs/react/hooks.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance.d.ts +41 -0
- package/lib/typescript/commonjs/testing/conformance.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/fakeStore.d.ts +69 -0
- package/lib/typescript/commonjs/testing/fakeStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/index.d.ts +12 -0
- package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
- package/lib/typescript/module/adapter/createStoreProvider.d.ts +45 -0
- package/lib/typescript/module/adapter/createStoreProvider.d.ts.map +1 -0
- package/lib/typescript/module/adapter/iap-adapter.d.ts +80 -0
- package/lib/typescript/module/adapter/iap-adapter.d.ts.map +1 -0
- package/lib/typescript/module/adapter/iapShapes.d.ts +94 -0
- package/lib/typescript/module/adapter/iapShapes.d.ts.map +1 -0
- package/lib/typescript/module/adapter/port.d.ts +184 -0
- package/lib/typescript/module/adapter/port.d.ts.map +1 -0
- package/lib/typescript/module/config/types.d.ts +326 -0
- package/lib/typescript/module/config/types.d.ts.map +1 -0
- package/lib/typescript/module/config/validate.d.ts +63 -0
- package/lib/typescript/module/config/validate.d.ts.map +1 -0
- package/lib/typescript/module/core/mutex.d.ts +17 -0
- package/lib/typescript/module/core/mutex.d.ts.map +1 -0
- package/lib/typescript/module/core/retry.d.ts +19 -0
- package/lib/typescript/module/core/retry.d.ts.map +1 -0
- package/lib/typescript/module/core/timers.d.ts +142 -0
- package/lib/typescript/module/core/timers.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/errors.d.ts +55 -0
- package/lib/typescript/module/diagnostics/errors.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/events.d.ts +158 -0
- package/lib/typescript/module/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/messageKeys.d.ts +54 -0
- package/lib/typescript/module/diagnostics/messageKeys.d.ts.map +1 -0
- package/lib/typescript/module/engine/connection.d.ts +30 -0
- package/lib/typescript/module/engine/connection.d.ts.map +1 -0
- package/lib/typescript/module/engine/engine.d.ts +93 -0
- package/lib/typescript/module/engine/engine.d.ts.map +1 -0
- package/lib/typescript/module/engine/finalize.d.ts +53 -0
- package/lib/typescript/module/engine/finalize.d.ts.map +1 -0
- package/lib/typescript/module/engine/foreground.d.ts +15 -0
- package/lib/typescript/module/engine/foreground.d.ts.map +1 -0
- package/lib/typescript/module/engine/internals.d.ts +28 -0
- package/lib/typescript/module/engine/internals.d.ts.map +1 -0
- package/lib/typescript/module/engine/pending.d.ts +51 -0
- package/lib/typescript/module/engine/pending.d.ts.map +1 -0
- package/lib/typescript/module/engine/products.d.ts +82 -0
- package/lib/typescript/module/engine/products.d.ts.map +1 -0
- package/lib/typescript/module/engine/purchase.d.ts +61 -0
- package/lib/typescript/module/engine/purchase.d.ts.map +1 -0
- package/lib/typescript/module/engine/purchaseFailure.d.ts +15 -0
- package/lib/typescript/module/engine/purchaseFailure.d.ts.map +1 -0
- package/lib/typescript/module/engine/receiptValidation.d.ts +42 -0
- package/lib/typescript/module/engine/receiptValidation.d.ts.map +1 -0
- package/lib/typescript/module/engine/state.d.ts +46 -0
- package/lib/typescript/module/engine/state.d.ts.map +1 -0
- package/lib/typescript/module/engine/subscriptions.d.ts +61 -0
- package/lib/typescript/module/engine/subscriptions.d.ts.map +1 -0
- package/lib/typescript/module/engine/sync.d.ts +36 -0
- package/lib/typescript/module/engine/sync.d.ts.map +1 -0
- package/lib/typescript/module/entitlements/aggregate.d.ts +97 -0
- package/lib/typescript/module/entitlements/aggregate.d.ts.map +1 -0
- package/lib/typescript/module/entitlements/mapping.d.ts +27 -0
- package/lib/typescript/module/entitlements/mapping.d.ts.map +1 -0
- package/lib/typescript/module/entitlements/policy.d.ts +75 -0
- package/lib/typescript/module/entitlements/policy.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +44 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/persistence/mmkv-store.d.ts +45 -0
- package/lib/typescript/module/persistence/mmkv-store.d.ts.map +1 -0
- package/lib/typescript/module/persistence/snapshot.d.ts +106 -0
- package/lib/typescript/module/persistence/snapshot.d.ts.map +1 -0
- package/lib/typescript/module/react/PaymentProvider.d.ts +57 -0
- package/lib/typescript/module/react/PaymentProvider.d.ts.map +1 -0
- package/lib/typescript/module/react/hooks.d.ts +80 -0
- package/lib/typescript/module/react/hooks.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance.d.ts +41 -0
- package/lib/typescript/module/testing/conformance.d.ts.map +1 -0
- package/lib/typescript/module/testing/fakeStore.d.ts +69 -0
- package/lib/typescript/module/testing/fakeStore.d.ts.map +1 -0
- package/lib/typescript/module/testing/index.d.ts +12 -0
- package/lib/typescript/module/testing/index.d.ts.map +1 -0
- package/package.json +49 -13
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Android adapter over `react-native-iap` (Play Billing).
|
|
5
|
+
*
|
|
6
|
+
* **The only file in this package that touches the billing library.** Everything
|
|
7
|
+
* above it talks to `ProviderPort`, which is what keeps the binding replaceable
|
|
8
|
+
* and lets an iOS adapter be added without changing a consumer call (FR-002,
|
|
9
|
+
* FR-007). ESLint enforces that boundary.
|
|
10
|
+
*
|
|
11
|
+
* ## Verified against react-native-iap 16.7.3
|
|
12
|
+
*
|
|
13
|
+
* 0.3.0 was written before the binding was installed, from its documentation, and
|
|
14
|
+
* no purchase could complete on a device. Checked against the installed 16.7.3
|
|
15
|
+
* source for 0.3.1, two facts shape the purchase path:
|
|
16
|
+
*
|
|
17
|
+
* - The request is keyed by store: `google` / `apple`. 0.3.0 sent `android`, which
|
|
18
|
+
* the binding rejects (`empty-sku-list`) before Play opens. The request type is
|
|
19
|
+
* now the binding's own `RequestPurchaseProps`, so a renamed key fails to
|
|
20
|
+
* typecheck here instead of failing on a user's device.
|
|
21
|
+
* - On Android `requestPurchase` resolves with an **empty list** once the flow
|
|
22
|
+
* ends, whatever happened. The outcome (bought, pending, cancelled, failed)
|
|
23
|
+
* arrives only through `purchaseUpdatedListener` / `purchaseErrorListener`, so
|
|
24
|
+
* `launchPurchase` waits for those events.
|
|
25
|
+
*
|
|
26
|
+
* The module is still required lazily, and `IapModule` still names exactly the
|
|
27
|
+
* surface used. `__tests__/iap-adapter.test.ts` drives this file through a fake
|
|
28
|
+
* binding that behaves as 16.7.3 does; the rest of the suite uses the fake store.
|
|
29
|
+
*
|
|
30
|
+
* ## Known upstream defect this guards against
|
|
31
|
+
*
|
|
32
|
+
* openiap#408: the Android bridge did not clear its internal `isInitialized` flag
|
|
33
|
+
* on disconnect, so `connected` stayed true, later calls failed with
|
|
34
|
+
* `E_NOT_PREPARED`, and `reconnect()` reported success without rebuilding
|
|
35
|
+
* anything. This adapter therefore (a) tracks connection state itself rather than
|
|
36
|
+
* trusting the binding's flag, and (b) always performs a full
|
|
37
|
+
* `endConnection` + `initConnection` cycle instead of calling any reconnect
|
|
38
|
+
* shortcut.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
import { createListenerSet, lazyPeer } from '@chipmobilesdk/rn-core';
|
|
42
|
+
import { mapErrorCode, normalizeProduct, normalizePurchase } from "./iapShapes.js";
|
|
43
|
+
import { PaymentError, redact } from "../diagnostics/errors.js";
|
|
44
|
+
// Translation lives in `iapShapes`; it is published from here, where every
|
|
45
|
+
// consumer has always imported it from.
|
|
46
|
+
export { toProviderPurchaseState } from "./iapShapes.js";
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Exactly what this adapter needs from the binding.
|
|
50
|
+
*
|
|
51
|
+
* Declared narrowly on purpose: it documents the coupling, and it means a binding
|
|
52
|
+
* upgrade that changes one of these shapes fails to typecheck here instead of
|
|
53
|
+
* failing silently at runtime on a user's device.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* How long to wait for the outcome event after `requestPurchase` has resolved.
|
|
58
|
+
* The binding emits the event before or as it resolves, so this only bounds the
|
|
59
|
+
* case where none ever comes; it never runs while the user is in Play's UI.
|
|
60
|
+
*/
|
|
61
|
+
const RESULT_EVENT_GRACE_MS = 2_000;
|
|
62
|
+
|
|
63
|
+
/** Play's replacement modes, by the codes the engine passes (`engine/subscriptions.ts`). */
|
|
64
|
+
const REPLACEMENT_MODES = {
|
|
65
|
+
WITH_TIME_PRORATION: 'with-time-proration',
|
|
66
|
+
CHARGE_FULL_PRICE: 'charge-full-price',
|
|
67
|
+
CHARGE_PRORATED_PRICE: 'charge-prorated-price',
|
|
68
|
+
DEFERRED: 'deferred'
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** The request in the binding's 16.7 shape: keyed `google`, not `android`. */
|
|
72
|
+
export function toRequestProps(request) {
|
|
73
|
+
const google = {
|
|
74
|
+
skus: [request.storeProductId],
|
|
75
|
+
...(request.obfuscatedAccountId ? {
|
|
76
|
+
obfuscatedAccountId: request.obfuscatedAccountId
|
|
77
|
+
} : {})
|
|
78
|
+
};
|
|
79
|
+
if (request.productType !== 'subscription') {
|
|
80
|
+
return {
|
|
81
|
+
request: {
|
|
82
|
+
google
|
|
83
|
+
},
|
|
84
|
+
type: 'in-app'
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const replacementMode = request.prorationMode ? REPLACEMENT_MODES[request.prorationMode] : undefined;
|
|
88
|
+
return {
|
|
89
|
+
request: {
|
|
90
|
+
google: {
|
|
91
|
+
...google,
|
|
92
|
+
...(request.offerKey ? {
|
|
93
|
+
subscriptionOffers: [{
|
|
94
|
+
sku: request.storeProductId,
|
|
95
|
+
offerToken: request.offerKey
|
|
96
|
+
}]
|
|
97
|
+
} : {}),
|
|
98
|
+
// A plan change: the token of the purchase being replaced, and — for
|
|
99
|
+
// the replacement mode to apply — its product id (Billing 8.1+).
|
|
100
|
+
...(request.replacePurchaseToken ? {
|
|
101
|
+
purchaseToken: request.replacePurchaseToken
|
|
102
|
+
} : {}),
|
|
103
|
+
...(request.replacePurchaseToken && request.replaceStoreProductId && replacementMode ? {
|
|
104
|
+
subscriptionProductReplacementParams: {
|
|
105
|
+
oldProductId: request.replaceStoreProductId,
|
|
106
|
+
replacementMode
|
|
107
|
+
}
|
|
108
|
+
} : {})
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
type: 'subs'
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const iapPeer = lazyPeer('react-native-iap', () => {
|
|
115
|
+
// Inside `try`, so Metro bundles an app that leaves this optional peer out.
|
|
116
|
+
try {
|
|
117
|
+
return require('react-native-iap');
|
|
118
|
+
} catch (cause) {
|
|
119
|
+
throw cause;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
function loadModule() {
|
|
123
|
+
return iapPeer.require((peer, cause) => new PaymentError({
|
|
124
|
+
code: 'PAYMENT_UNAVAILABLE',
|
|
125
|
+
message: `${peer} is not installed or its native module is not linked`,
|
|
126
|
+
operation: 'initialize',
|
|
127
|
+
cause: redact(cause)
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
const ANDROID_CAPABILITIES = {
|
|
131
|
+
supportsSubscriptions: true,
|
|
132
|
+
supportsPlanChange: true,
|
|
133
|
+
supportsPriceChangeConfirmation: false,
|
|
134
|
+
/**
|
|
135
|
+
* False, and this is a platform fact rather than a gap in this adapter.
|
|
136
|
+
*
|
|
137
|
+
* Client-side Play Billing cannot separate grace period from account hold: a
|
|
138
|
+
* grace-period subscription is still returned as active, and one in account
|
|
139
|
+
* hold stops being returned at all — indistinguishable from expired, cancelled,
|
|
140
|
+
* or refunded. The entitlement layer reads this flag and reports
|
|
141
|
+
* `indeterminate` rather than inventing a distinction (research.md R5).
|
|
142
|
+
*/
|
|
143
|
+
reportsGraceAndHoldDistinctly: false,
|
|
144
|
+
supportsExternalTransactions: false,
|
|
145
|
+
/** This one really does move money, which is what arms the environment guard. */
|
|
146
|
+
createsRealTransactions: true,
|
|
147
|
+
/** The outcome event comes only when the user leaves Play's purchase UI. */
|
|
148
|
+
purchaseOutcomeIncludesStoreTime: true
|
|
149
|
+
};
|
|
150
|
+
export function createIapAdapter(options = {}) {
|
|
151
|
+
let iap = options.module;
|
|
152
|
+
|
|
153
|
+
/** Tracked here, never read from the binding — see the openiap#408 note above. */
|
|
154
|
+
let connected = false;
|
|
155
|
+
const connectionListeners = createListenerSet();
|
|
156
|
+
const purchaseListeners = createListenerSet();
|
|
157
|
+
/** Only an in-flight `launchPurchase` listens here; see there. */
|
|
158
|
+
const purchaseErrorListeners = createListenerSet();
|
|
159
|
+
let updateSub;
|
|
160
|
+
let errorSub;
|
|
161
|
+
const module = () => {
|
|
162
|
+
if (!iap) {
|
|
163
|
+
iap = loadModule();
|
|
164
|
+
}
|
|
165
|
+
return iap;
|
|
166
|
+
};
|
|
167
|
+
const notifyConnection = (next, reason) => {
|
|
168
|
+
if (connected === next) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
connected = next;
|
|
172
|
+
connectionListeners.notify(next, reason);
|
|
173
|
+
};
|
|
174
|
+
const attachListeners = () => {
|
|
175
|
+
// Every connect attaches, so whatever an earlier connect left must go first.
|
|
176
|
+
// Overwriting the handles orphaned the old native listeners, which kept
|
|
177
|
+
// firing — every purchase update reached the engine once per connect.
|
|
178
|
+
detachListeners();
|
|
179
|
+
const mod = module();
|
|
180
|
+
updateSub = mod.purchaseUpdatedListener(raw => {
|
|
181
|
+
purchaseListeners.notify(normalizePurchase(raw));
|
|
182
|
+
});
|
|
183
|
+
errorSub = mod.purchaseErrorListener(error => {
|
|
184
|
+
// A `not-prepared` error is the one signal the binding gives that the
|
|
185
|
+
// service went away underneath us, so it is treated as a disconnect
|
|
186
|
+
// rather than as a purchase failure.
|
|
187
|
+
if (mapErrorCode(error.code) === 'not_ready') {
|
|
188
|
+
notifyConnection(false, 'not_prepared');
|
|
189
|
+
}
|
|
190
|
+
purchaseErrorListeners.notify(error);
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
const detachListeners = () => {
|
|
194
|
+
updateSub?.remove();
|
|
195
|
+
updateSub = undefined;
|
|
196
|
+
errorSub?.remove();
|
|
197
|
+
errorSub = undefined;
|
|
198
|
+
};
|
|
199
|
+
return {
|
|
200
|
+
async connect() {
|
|
201
|
+
try {
|
|
202
|
+
const mod = module();
|
|
203
|
+
// Always a full cycle. The binding's own reconnect has reported success
|
|
204
|
+
// without rebuilding anything, so we never rely on it (openiap#408).
|
|
205
|
+
if (connected) {
|
|
206
|
+
await mod.endConnection().catch(() => undefined);
|
|
207
|
+
connected = false;
|
|
208
|
+
}
|
|
209
|
+
const ok = await mod.initConnection();
|
|
210
|
+
if (!ok) {
|
|
211
|
+
return {
|
|
212
|
+
ok: false,
|
|
213
|
+
reason: 'no_billing_service',
|
|
214
|
+
retryable: true
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
attachListeners();
|
|
218
|
+
notifyConnection(true);
|
|
219
|
+
return {
|
|
220
|
+
ok: true
|
|
221
|
+
};
|
|
222
|
+
} catch (error) {
|
|
223
|
+
const code = error.code;
|
|
224
|
+
// A missing or too-old Play Services install is not the same as a
|
|
225
|
+
// transient error, and the app shows different things for each (FR-021).
|
|
226
|
+
if (code === 'E_IAP_NOT_AVAILABLE' || code === 'iap-not-available') {
|
|
227
|
+
return {
|
|
228
|
+
ok: false,
|
|
229
|
+
reason: 'no_billing_service',
|
|
230
|
+
retryable: false
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
if (code === 'E_SERVICE_ERROR') {
|
|
234
|
+
return {
|
|
235
|
+
ok: false,
|
|
236
|
+
reason: 'billing_service_outdated',
|
|
237
|
+
retryable: true
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
ok: false,
|
|
242
|
+
reason: 'store_error',
|
|
243
|
+
retryable: true
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
async disconnect() {
|
|
248
|
+
detachListeners();
|
|
249
|
+
try {
|
|
250
|
+
await module().endConnection();
|
|
251
|
+
} catch {
|
|
252
|
+
// Already down; nothing to tear down.
|
|
253
|
+
}
|
|
254
|
+
notifyConnection(false, 'disconnect');
|
|
255
|
+
},
|
|
256
|
+
observeConnection(listener) {
|
|
257
|
+
return connectionListeners.add(listener);
|
|
258
|
+
},
|
|
259
|
+
async queryProducts(storeProductIds, productType) {
|
|
260
|
+
const raw = await module().fetchProducts({
|
|
261
|
+
skus: storeProductIds,
|
|
262
|
+
type: productType === 'subscription' ? 'subs' : 'in-app'
|
|
263
|
+
});
|
|
264
|
+
return raw.map(product => normalizeProduct(product, productType));
|
|
265
|
+
},
|
|
266
|
+
async queryOwned() {
|
|
267
|
+
const raw = await module().getAvailablePurchases();
|
|
268
|
+
// Pending purchases are mapped through, flagged rather than filtered: the
|
|
269
|
+
// engine needs to see them to raise the pending signal (FR-038).
|
|
270
|
+
return raw.map(normalizePurchase);
|
|
271
|
+
},
|
|
272
|
+
/**
|
|
273
|
+
* Settles on the first outcome event for this product: a purchase update
|
|
274
|
+
* (bought or pending) or a purchase error (cancelled, already owned, …).
|
|
275
|
+
*
|
|
276
|
+
* The binding's promise is not the outcome: on Android it resolves with an
|
|
277
|
+
* empty list when the flow ends, whatever happened. Its listeners also feed
|
|
278
|
+
* `observePurchases`, so the engine sees a bought purchase twice — here and
|
|
279
|
+
* as a store update — and grants it once (FR-044).
|
|
280
|
+
*/
|
|
281
|
+
launchPurchase(request) {
|
|
282
|
+
const sku = request.storeProductId;
|
|
283
|
+
return new Promise(resolve => {
|
|
284
|
+
let settled = false;
|
|
285
|
+
let grace;
|
|
286
|
+
const onPurchase = purchase => {
|
|
287
|
+
if (purchase.storeProductId === sku) {
|
|
288
|
+
finish({
|
|
289
|
+
ok: true,
|
|
290
|
+
purchase
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
const onError = error => {
|
|
295
|
+
if (error.productId && error.productId !== sku) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
finish({
|
|
299
|
+
ok: false,
|
|
300
|
+
reason: mapErrorCode(error.code),
|
|
301
|
+
detail: error.code
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
const fail = error => {
|
|
305
|
+
const code = error?.code;
|
|
306
|
+
finish({
|
|
307
|
+
ok: false,
|
|
308
|
+
reason: mapErrorCode(code),
|
|
309
|
+
detail: code
|
|
310
|
+
});
|
|
311
|
+
};
|
|
312
|
+
function finish(outcome) {
|
|
313
|
+
if (settled) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
settled = true;
|
|
317
|
+
clearTimeout(grace);
|
|
318
|
+
stopPurchase();
|
|
319
|
+
stopError();
|
|
320
|
+
resolve(outcome);
|
|
321
|
+
}
|
|
322
|
+
const stopPurchase = purchaseListeners.add(onPurchase);
|
|
323
|
+
const stopError = purchaseErrorListeners.add(onError);
|
|
324
|
+
try {
|
|
325
|
+
module().requestPurchase(toRequestProps(request)).then(() => {
|
|
326
|
+
if (!settled) {
|
|
327
|
+
grace = setTimeout(() => finish({
|
|
328
|
+
ok: false,
|
|
329
|
+
reason: 'store_error',
|
|
330
|
+
detail: 'no purchase event'
|
|
331
|
+
}), RESULT_EVENT_GRACE_MS);
|
|
332
|
+
}
|
|
333
|
+
}, fail);
|
|
334
|
+
} catch (error) {
|
|
335
|
+
fail(error);
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
},
|
|
339
|
+
observePurchases(listener) {
|
|
340
|
+
return purchaseListeners.add(listener);
|
|
341
|
+
},
|
|
342
|
+
async acknowledge(token) {
|
|
343
|
+
// Idempotent at the store: acknowledging an already-acknowledged purchase
|
|
344
|
+
// is accepted, which is what FR-044 relies on.
|
|
345
|
+
await module().finishTransaction({
|
|
346
|
+
purchase: {
|
|
347
|
+
purchaseToken: token
|
|
348
|
+
},
|
|
349
|
+
isConsumable: false
|
|
350
|
+
});
|
|
351
|
+
},
|
|
352
|
+
async consume(token) {
|
|
353
|
+
await module().finishTransaction({
|
|
354
|
+
purchase: {
|
|
355
|
+
purchaseToken: token
|
|
356
|
+
},
|
|
357
|
+
isConsumable: true
|
|
358
|
+
});
|
|
359
|
+
},
|
|
360
|
+
async openSubscriptionManagement(storeProductId) {
|
|
361
|
+
// The store's own screen. Platforms forbid a self-built cancellation
|
|
362
|
+
// screen, so there is deliberately no alternative path here (FR-066).
|
|
363
|
+
const mod = module();
|
|
364
|
+
if (!mod.deepLinkToSubscriptions) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
await mod.deepLinkToSubscriptions({
|
|
368
|
+
skuAndroid: storeProductId
|
|
369
|
+
});
|
|
370
|
+
},
|
|
371
|
+
async confirmPriceChange() {
|
|
372
|
+
// Play has no client-side price-change confirmation flow; it notifies the
|
|
373
|
+
// user itself. Reported as unsupported rather than faked, matching
|
|
374
|
+
// `supportsPriceChangeConfirmation: false` (FR-067).
|
|
375
|
+
return {
|
|
376
|
+
ok: false,
|
|
377
|
+
reason: 'store_error'
|
|
378
|
+
};
|
|
379
|
+
},
|
|
380
|
+
capabilities: () => ANDROID_CAPABILITIES
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
//# sourceMappingURL=iap-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createListenerSet","lazyPeer","mapErrorCode","normalizeProduct","normalizePurchase","PaymentError","redact","toProviderPurchaseState","RESULT_EVENT_GRACE_MS","REPLACEMENT_MODES","WITH_TIME_PRORATION","CHARGE_FULL_PRICE","CHARGE_PRORATED_PRICE","DEFERRED","toRequestProps","request","google","skus","storeProductId","obfuscatedAccountId","productType","type","replacementMode","prorationMode","undefined","offerKey","subscriptionOffers","sku","offerToken","replacePurchaseToken","purchaseToken","replaceStoreProductId","subscriptionProductReplacementParams","oldProductId","iapPeer","require","cause","loadModule","peer","code","message","operation","ANDROID_CAPABILITIES","supportsSubscriptions","supportsPlanChange","supportsPriceChangeConfirmation","reportsGraceAndHoldDistinctly","supportsExternalTransactions","createsRealTransactions","purchaseOutcomeIncludesStoreTime","createIapAdapter","options","iap","module","connected","connectionListeners","purchaseListeners","purchaseErrorListeners","updateSub","errorSub","notifyConnection","next","reason","notify","attachListeners","detachListeners","mod","purchaseUpdatedListener","raw","purchaseErrorListener","error","remove","connect","endConnection","catch","ok","initConnection","retryable","disconnect","observeConnection","listener","add","queryProducts","storeProductIds","fetchProducts","map","product","queryOwned","getAvailablePurchases","launchPurchase","Promise","resolve","settled","grace","onPurchase","purchase","finish","onError","productId","detail","fail","outcome","clearTimeout","stopPurchase","stopError","requestPurchase","then","setTimeout","observePurchases","acknowledge","token","finishTransaction","isConsumable","consume","openSubscriptionManagement","deepLinkToSubscriptions","skuAndroid","confirmPriceChange","capabilities"],"sourceRoot":"../../../src","sources":["adapter/iap-adapter.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,EAAEC,QAAQ,QAAQ,wBAAwB;AAKpE,SACCC,YAAY,EACZC,gBAAgB,EAChBC,iBAAiB,QAIX,gBAAa;AACpB,SAASC,YAAY,EAAEC,MAAM,QAAQ,0BAAuB;AAc5D;AACA;AACA,SAASC,uBAAuB,QAAQ,gBAAa;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA,MAAMC,qBAAqB,GAAG,KAAK;;AAEnC;AACA,MAAMC,iBAAqE,GAAG;EAC7EC,mBAAmB,EAAE,qBAAqB;EAC1CC,iBAAiB,EAAE,mBAAmB;EACtCC,qBAAqB,EAAE,uBAAuB;EAC9CC,QAAQ,EAAE;AACX,CAAC;;AAED;AACA,OAAO,SAASC,cAAcA,CAACC,OAAgC,EAAwB;EACtF,MAAMC,MAAM,GAAG;IACdC,IAAI,EAAE,CAACF,OAAO,CAACG,cAAc,CAAC;IAC9B,IAAIH,OAAO,CAACI,mBAAmB,GAAG;MAAEA,mBAAmB,EAAEJ,OAAO,CAACI;IAAoB,CAAC,GAAG,CAAC,CAAC;EAC5F,CAAC;EACD,IAAIJ,OAAO,CAACK,WAAW,KAAK,cAAc,EAAE;IA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;MAAe,CAAC,CAAC;IAClE,CAAC;IAED,MAAMmG,kBAAkBA,CAAA,EAAwC;MAC/D;MACA;MACA;MACA,OAAO;QAAE1C,EAAE,EAAE,KAAK;QAAEb,MAAM,EAAE;MAAc,CAAC;IAC5C,CAAC;IAEDwD,YAAY,EAAEA,CAAA,KAAM5E;EACrB,CAAC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The binding's shapes, and their translation into the port's vocabulary
|
|
5
|
+
* (PAY-12).
|
|
6
|
+
*
|
|
7
|
+
* The binding speaks Google Play: prices as micros in strings, offer tokens,
|
|
8
|
+
* numeric purchase states, store error codes. The port speaks this package's
|
|
9
|
+
* own. Keeping the translation here, with no I/O, no listeners and no module
|
|
10
|
+
* loading, is what makes it checkable against recorded payloads — and leaves
|
|
11
|
+
* the adapter next door about the calls it actually makes.
|
|
12
|
+
*
|
|
13
|
+
* The raw types are declared narrowly on purpose: they document the coupling,
|
|
14
|
+
* and a binding upgrade that changes one of these shapes fails to typecheck
|
|
15
|
+
* here rather than failing silently on a user's device.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** What `purchaseErrorListener` delivers. */
|
|
19
|
+
|
|
20
|
+
/** Play's `PurchaseState`: 0 unspecified, 1 purchased, 2 pending. */
|
|
21
|
+
const PLAY_STATE_PURCHASED = 1;
|
|
22
|
+
const PLAY_STATE_PENDING = 2;
|
|
23
|
+
|
|
24
|
+
// Required lazily (rn-core's lazy peer) so importing the package does not require
|
|
25
|
+
// the native module.
|
|
26
|
+
|
|
27
|
+
export function toMicros(value) {
|
|
28
|
+
if (typeof value === 'number') {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
if (typeof value === 'string') {
|
|
32
|
+
const parsed = Number.parseInt(value, 10);
|
|
33
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
34
|
+
}
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
export function normalizeProduct(raw, productType) {
|
|
38
|
+
const oneTime = raw.oneTimePurchaseOfferDetails;
|
|
39
|
+
const currencyCode = oneTime?.priceCurrencyCode ?? raw.currencyCode ?? raw.currency ?? '';
|
|
40
|
+
return {
|
|
41
|
+
storeProductId: raw.id ?? raw.productId ?? '',
|
|
42
|
+
productType,
|
|
43
|
+
title: raw.title ?? raw.name ?? '',
|
|
44
|
+
description: raw.description ?? '',
|
|
45
|
+
// Store-formatted, never built here: only the store knows the right currency
|
|
46
|
+
// symbol, separator, and placement for the user's locale (FR-028).
|
|
47
|
+
formattedPrice: oneTime?.formattedPrice ?? raw.displayPrice ?? raw.localizedPrice ?? '',
|
|
48
|
+
currencyCode,
|
|
49
|
+
priceAmountMicros: toMicros(oneTime?.priceAmountMicros ?? raw.price),
|
|
50
|
+
offers: (raw.subscriptionOfferDetails ?? []).map(offer => normalizeOffer(offer, currencyCode))
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function normalizeOffer(offer, fallbackCurrency) {
|
|
54
|
+
const phases = offer.pricingPhases?.pricingPhaseList ?? [];
|
|
55
|
+
// The last phase is the recurring price; earlier ones are trial or
|
|
56
|
+
// introductory. Play orders them that way.
|
|
57
|
+
const recurring = phases[phases.length - 1];
|
|
58
|
+
const intro = phases.length > 1 ? phases[0] : undefined;
|
|
59
|
+
const isFreeTrial = intro !== undefined && toMicros(intro.priceAmountMicros) === 0;
|
|
60
|
+
return {
|
|
61
|
+
offerKey: offer.offerToken ?? offer.offerId ?? offer.basePlanId ?? '',
|
|
62
|
+
billingPeriod: recurring?.billingPeriod ?? '',
|
|
63
|
+
formattedPrice: recurring?.formattedPrice ?? '',
|
|
64
|
+
priceAmountMicros: toMicros(recurring?.priceAmountMicros),
|
|
65
|
+
currencyCode: recurring?.priceCurrencyCode ?? fallbackCurrency,
|
|
66
|
+
trialPeriod: isFreeTrial ? intro?.billingPeriod : undefined,
|
|
67
|
+
introductoryPrice: intro && !isFreeTrial ? {
|
|
68
|
+
formattedPrice: intro.formattedPrice ?? '',
|
|
69
|
+
period: intro.billingPeriod ?? '',
|
|
70
|
+
cycles: intro.billingCycleCount ?? 1
|
|
71
|
+
} : undefined,
|
|
72
|
+
// Play decides eligibility by only returning offers the user qualifies for,
|
|
73
|
+
// so forwarding `true` reports the store's determination rather than
|
|
74
|
+
// computing our own (FR-026).
|
|
75
|
+
isEligible: true
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Reads the purchase state from whichever field the binding filled.
|
|
81
|
+
*
|
|
82
|
+
* Pending is preserved, never flattened to purchased: that distinction is what
|
|
83
|
+
* stops an entitlement being granted for money that has not arrived (FR-037).
|
|
84
|
+
* And an unrecognized or missing state is `unspecified`, never `purchased`.
|
|
85
|
+
*
|
|
86
|
+
* 0.1.0 read only Play's numeric state and treated anything else as purchased.
|
|
87
|
+
* The 16.x binding hands JavaScript the *string* state and does not carry the
|
|
88
|
+
* numeric one across, so on a device every pending purchase arrived as a string,
|
|
89
|
+
* fell through to the default, and was granted. Unit tests could not see it: they
|
|
90
|
+
* drive the fake store, which never passes through here.
|
|
91
|
+
*/
|
|
92
|
+
export function toProviderPurchaseState(raw) {
|
|
93
|
+
let numeric;
|
|
94
|
+
if (typeof raw.purchaseStateAndroid === 'number') {
|
|
95
|
+
numeric = raw.purchaseStateAndroid;
|
|
96
|
+
} else if (typeof raw.purchaseState === 'number') {
|
|
97
|
+
numeric = raw.purchaseState;
|
|
98
|
+
}
|
|
99
|
+
if (numeric !== undefined) {
|
|
100
|
+
if (numeric === PLAY_STATE_PENDING) {
|
|
101
|
+
return 'pending';
|
|
102
|
+
}
|
|
103
|
+
return numeric === PLAY_STATE_PURCHASED ? 'purchased' : 'unspecified';
|
|
104
|
+
}
|
|
105
|
+
switch (typeof raw.purchaseState === 'string' ? raw.purchaseState.toLowerCase() : '') {
|
|
106
|
+
case 'purchased':
|
|
107
|
+
case 'restored':
|
|
108
|
+
return 'purchased';
|
|
109
|
+
case 'pending':
|
|
110
|
+
case 'deferred':
|
|
111
|
+
return 'pending';
|
|
112
|
+
default:
|
|
113
|
+
return 'unspecified';
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
export function normalizePurchase(raw) {
|
|
117
|
+
return {
|
|
118
|
+
storeProductId: raw.productId ?? raw.ids?.[0] ?? '',
|
|
119
|
+
transactionId: raw.id ?? raw.transactionId ?? raw.purchaseToken ?? '',
|
|
120
|
+
token: raw.purchaseToken ?? '',
|
|
121
|
+
state: toProviderPurchaseState(raw),
|
|
122
|
+
purchasedAt: raw.transactionDate ?? Date.now(),
|
|
123
|
+
isAcknowledged: raw.isAcknowledgedAndroid ?? raw.isAcknowledged ?? false,
|
|
124
|
+
expiresAt: raw.expirationDateAndroid,
|
|
125
|
+
willAutoRenew: raw.autoRenewingAndroid ?? raw.isAutoRenewing,
|
|
126
|
+
// Opaque material for the app's backend. Carried here and handed to the
|
|
127
|
+
// validation hook only — never logged or put in an event (FR-074).
|
|
128
|
+
verificationPayload: raw.transactionReceipt ?? raw.dataAndroid
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Maps a binding error code onto the port's vocabulary, so no store code escapes. */
|
|
133
|
+
export function mapErrorCode(code) {
|
|
134
|
+
switch (code) {
|
|
135
|
+
case 'E_USER_CANCELLED':
|
|
136
|
+
case 'user-cancelled':
|
|
137
|
+
return 'user_cancelled';
|
|
138
|
+
case 'E_ALREADY_OWNED':
|
|
139
|
+
case 'already-owned':
|
|
140
|
+
case 'item-already-owned':
|
|
141
|
+
return 'already_owned';
|
|
142
|
+
case 'E_ITEM_UNAVAILABLE':
|
|
143
|
+
case 'item-unavailable':
|
|
144
|
+
case 'sku-not-found':
|
|
145
|
+
return 'unknown_product';
|
|
146
|
+
case 'E_NOT_PREPARED':
|
|
147
|
+
case 'not-prepared':
|
|
148
|
+
return 'not_ready';
|
|
149
|
+
case 'E_NETWORK_ERROR':
|
|
150
|
+
case 'network-error':
|
|
151
|
+
return 'network_error';
|
|
152
|
+
case 'E_DEFERRED_PAYMENT':
|
|
153
|
+
// Not a failure — a pending purchase. The caller resolves it from the
|
|
154
|
+
// purchase update rather than from this error.
|
|
155
|
+
return 'store_error';
|
|
156
|
+
default:
|
|
157
|
+
return 'store_error';
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=iapShapes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PLAY_STATE_PURCHASED","PLAY_STATE_PENDING","toMicros","value","parsed","Number","parseInt","isFinite","normalizeProduct","raw","productType","oneTime","oneTimePurchaseOfferDetails","currencyCode","priceCurrencyCode","currency","storeProductId","id","productId","title","name","description","formattedPrice","displayPrice","localizedPrice","priceAmountMicros","price","offers","subscriptionOfferDetails","map","offer","normalizeOffer","fallbackCurrency","phases","pricingPhases","pricingPhaseList","recurring","length","intro","undefined","isFreeTrial","offerKey","offerToken","offerId","basePlanId","billingPeriod","trialPeriod","introductoryPrice","period","cycles","billingCycleCount","isEligible","toProviderPurchaseState","numeric","purchaseStateAndroid","purchaseState","toLowerCase","normalizePurchase","ids","transactionId","purchaseToken","token","state","purchasedAt","transactionDate","Date","now","isAcknowledged","isAcknowledgedAndroid","expiresAt","expirationDateAndroid","willAutoRenew","autoRenewingAndroid","isAutoRenewing","verificationPayload","transactionReceipt","dataAndroid","mapErrorCode","code"],"sourceRoot":"../../../src","sources":["adapter/iapShapes.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0DA;;AAOA;AACA,MAAMA,oBAAoB,GAAG,CAAC;AAC9B,MAAMC,kBAAkB,GAAG,CAAC;;AAE5B;AACA;;AAEA,OAAO,SAASC,QAAQA,CAACC,KAAkC,EAAU;EACpE,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC9B,OAAOA,KAAK;EACb;EACA,I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C;AACF;;AAEA;AACA,OAAO,SAASC,YAAYA,CAACC,IAAwB,EAAyB;EAC7E,QAAQA,IAAI;IACX,KAAK,kBAAkB;IACvB,KAAK,gBAAgB;MACpB,OAAO,gBAAgB;IACxB,KAAK,iBAAiB;IACtB,KAAK,eAAe;IACpB,KAAK,oBAAoB;MACxB,OAAO,eAAe;IACvB,KAAK,oBAAoB;IACzB,KAAK,kBAAkB;IACvB,KAAK,eAAe;MACnB,OAAO,iBAAiB;IACzB,KAAK,gBAAgB;IACrB,KAAK,cAAc;MAClB,OAAO,WAAW;IACnB,KAAK,iBAAiB;IACtB,KAAK,eAAe;MACnB,OAAO,eAAe;IACvB,KAAK,oBAAoB;MACxB;MACA;MACA,OAAO,aAAa;IACrB;MACC,OAAO,aAAa;EACtB;AACD","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["adapter/port.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["config/types.ts"],"mappings":"","ignoreList":[]}
|