Skip to content

feat(android): serve top-ups, payments and balance to the core - #1337

Draft
filvecchiato wants to merge 1 commit into
payments/by-idfrom
hosts/android-payments
Draft

filvecchiato wants to merge 1 commit into
payments/by-idfrom
hosts/android-payments

Conversation

@filvecchiato

Copy link
Copy Markdown
Collaborator

Part of #1268 and #778. Stacked on #1314.

The Android host serves the core's top-up, payment and balance platforms from the engines the app already has. No new engine code.

  • Shell (android/truapi-host): TopUpHostBridge, PaymentHostBridge and BalanceHostBridge, plus setTopUp/notifyTopUpStatus, setPayments/notifyPaymentStatus and setBalance/notifyBalance on TrUAPIHostRuntime, following the contacts pattern.
  • App (TrUAPIPaymentPlatforms, installed in TrUAPIHostRuntimeProvider):
    • top-up → TopUpService.start / status
    • payment → RequestPaymentUseCase (the existing approval and privacy flow) and its ExternalPaymentService status
    • balance → the spendable balance (spendableByProducts)
  • No balance prompt in the host: the core owns BalanceAccess. For core calls, RequestPaymentUseCase takes ShortfallDisclosure.CALLER: a shortfall is always reported as InsufficientBalance, and the core decides what the product sees. The legacy bridge keeps its own behaviour.
  • Shared code: subscribeSpendableByProducts() and DerivationIndex.toDomain() are used by both the legacy and the core paths.
  • Status forwarding: one collector per (product, id) pushes the engine's statuses to the core until the final one. It starts on a successful top-up or payment, or on the core's first ask after a restart.
  • Purses: only the main purse; any other answers Unknown.
  • Tests: mockk tests for the adapters, plus a CALLER case in RealRequestPaymentUseCaseTest.

Not compiled locally (no JDK on the machine); CI's Android host jobs are the first build.

@filvecchiato filvecchiato added the no-changeset No published artifact changes; changeset not required label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

This pull request touches an app, which is not built by default. Add a label for each build you want:

  • Android build, android-device-build: attaches an APK that installs on an Android phone or an emulator.

Each starts as soon as it is added and follows the branch from then on.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Bundle size report

Compared with main at 63a450d.

Raw Gzip Brotli
truapi-host 7.82 MiB (+9.9 KiB, +0.1%) 5.64 MiB (+3.6 KiB, +0.1%) 5.37 MiB (-137 B)
truapi-provider 4.03 MiB 1.27 MiB 959.8 KiB
truapi 6.02 MiB (+12.4 KiB, +0.2%) 849.7 KiB (+1.7 KiB, +0.2%) 696.2 KiB (+1.2 KiB, +0.2%)
Total 17.86 MiB (+22.3 KiB, +0.1%) 7.74 MiB (+5.3 KiB, +0.1%) 6.99 MiB (+1.1 KiB)

WebAssembly modules

Raw Gzip Brotli
truapi-host/wasm/web/truapi_server_bg.wasm 2.71 MiB (+9.9 KiB, +0.4%) 969.0 KiB (+3.6 KiB, +0.4%) 730.8 KiB (-152 B)
truapi-host/wasm/web/truapi_verifiable_bg.wasm 4.89 MiB 4.64 MiB 4.61 MiB
truapi-provider/truapi_provider_bg.wasm 3.99 MiB 1.26 MiB 952.1 KiB
Changed files (9)
Raw Gzip Brotli
truapi-host/wasm/web/truapi_server_bg.wasm 2.71 MiB (+9.9 KiB, +0.4%) 969.0 KiB (+3.6 KiB, +0.4%) 730.8 KiB (-152 B)
truapi/playground/codegen/truapi-dts.js 286.1 KiB (+4.4 KiB, +1.6%) 49.5 KiB (+747 B, +1.5%) 39.9 KiB (+536 B, +1.3%)
truapi/explorer/codegen/types.js 216.5 KiB (+4.1 KiB, +2.0%) 29.9 KiB (+522 B, +1.7%) 24.0 KiB (+382 B, +1.6%)
truapi/playground/codegen/services.js 99.3 KiB (+1.5 KiB, +1.6%) 15.0 KiB (+204 B, +1.3%) 12.6 KiB (+145 B, +1.1%)
truapi/generated/types.js 62.8 KiB (+987 B, +1.6%) 7.6 KiB (+98 B, +1.3%) 6.5 KiB (+83 B, +1.3%)
truapi/generated/client.js 70.6 KiB (+900 B, +1.3%) 10.6 KiB (+141 B, +1.3%) 8.9 KiB (+134 B, +1.5%)
truapi/generated/wire-decode.js 28.4 KiB (+424 B, +1.5%) 3.0 KiB (+23 B, +0.8%) 2.5 KiB (+18 B, +0.7%)
truapi/generated/wire-table.js 8.9 KiB (+107 B, +1.2%) 1.6 KiB (+11 B, +0.7%) 1.2 KiB (+6 B, +0.5%)
truapi-host/wasm/web/truapi_server.js 58.0 KiB (+3 B) 10.6 KiB (+8 B, +0.1%) 9.1 KiB (+15 B, +0.2%)

Commit: 4200153

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

CI Status: not green, 3 items need attention.

  • host-android-detekt: failure
  • ts-host: failure
  • host-wasm: failure
All job results
job result
android-bindings success
bundle-size success
changes success
changeset-guard skipped
cli-package skipped
codegen success
e2e skipped
explorer success
headless-install success
host-android-bindings success
host-android-detekt failure
host-wasm failure
ios-bindings success
ios-swift skipped
licenses success
playground success
provider-android-bindings skipped
release-guard success
rust success
ts-client success
ts-debugger success
ts-host failure
wasm-provider success
workflow-lint skipped

Signing credentials: failure as of 2026-10-08, a release may fail

Commit 42001537 · run log

@filvecchiato filvecchiato linked an issue Oct 9, 2026 that may be closed by this pull request
2 tasks

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

host-android Touches the Android host tree no-changeset No published artifact changes; changeset not required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hosts: top-ups, payment requests and balance over TrUAPI

1 participant