Closes #369 · Closes #378 · Closes #383 · Closes #384
This PR implements four issues in a single branch:
- #369 — Completes the HD Wallet & Stellar account logic with a balance helper
- #378 — Configures a canary deployment flow with staging gate and automatic rollback
- #383 — Ships a native Python SDK (sync + async, PyPI-ready)
- #384 — Ships a native Go SDK (typed structs, context support,
go getcompatible)
The BIP44 key derivation, trustline automation, and AES-256-GCM encryption of child keys were already implemented. This PR adds the remaining acceptance criterion — a balance helper.
fluxapay_backend/src/services/StellarService.ts
- Added
getAccountBalance(publicKey): Promise<number>— returns the USDC balance for any Stellar address; returns0gracefully for accounts that don't exist or have no USDC trustline
fluxapay_backend/src/services/__tests__/StellarService.test.ts
- 3 new tests: USDC balance present, no trustline (returns 0), account 404 (returns 0)
All acceptance criteria met:
- ✅ Secure BIP44 child key derivation from master seed (
HDWalletService) - ✅ Automated trustline creation for new accounts (
StellarService.prepareAccount) - ✅ AES-256-GCM encryption of child key indices at rest (
HDWalletService.encryptKeyData) - ✅ Balance helper for checking USDC on any Stellar account (
StellarService.getAccountBalance)
.github/workflows/canary-deploy.yml — 3-stage pipeline on every push to main:
| Stage | Job | Behaviour |
|---|---|---|
| 1 | deploy-staging |
Builds image and deploys to staging environment |
| 2 | integration-tests-staging |
Runs full unit + contract + smoke tests against staging |
| 3 | deploy-production |
Only runs if stage 2 passes |
| — | rollback-staging |
Auto-triggered (if: failure()) — reverts staging, production is never touched |
docker-compose.staging.yml — staging environment identical to production topology (postgres + backend), all secrets injected via env vars.
All acceptance criteria met:
- ✅ Staging environment mirrors production
- ✅ Integration tests run against staging before production push
- ✅ Automatic rollback if staging tests fail
fluxapay_python_sdk/fluxapay/__init__.py
FluxaPay— synchronous client (context manager support)AsyncFluxaPay— async client viahttpx(async context manager support)- Resources on both clients:
payments(create, get, get_status, list) andsettlements(list, get, summary) verify_webhook_signature()— standalone HMAC-SHA256 helper with replay-protection- Typed dataclasses:
Payment,PaymentStatus,Invoice,WebhookEvent,FluxaPayError
fluxapay_python_sdk/pyproject.toml — PyPI-ready (pip install fluxapay), requires Python ≥ 3.9, single runtime dependency (httpx)
fluxapay_python_sdk/tests/test_sdk.py — 12 tests, all passing ✅
All acceptance criteria met:
- ✅ Client class for Payment and Settlement resources
- ✅ Synchronous (
FluxaPay) and asynchronous (AsyncFluxaPay) support - ✅ PyPI package ready for distribution (
pyproject.toml+python -m build)
fluxapay_go_sdk/fluxapay/client.go
Clientwith functional options:WithBaseURL,WithHTTPClientPaymentsResource—Create,Get,GetStatus,List(all acceptcontext.Context)SettlementsResource—List,Get,SummaryWebhooksResource—Verify(HMAC-SHA256 + replay-protection),Parse- Typed structs:
Payment,PaymentStatus,PaymentList,Settlement,SettlementList,WebhookEvent,CreatePaymentParams,ListPaymentsParams,ListSettlementsParams *Errortype withStatusCode,Message,Rawfields
fluxapay_go_sdk/go.mod — module path github.com/MetroLogic/fluxapay/fluxapay_go_sdk
fluxapay_go_sdk/fluxapay/client_test.go — 10 tests using httptest.Server
All acceptance criteria met:
- ✅ Typed structs for all API resources
- ✅
context.Contextsupport on every request - ✅
go get github.com/MetroLogic/fluxapay/fluxapay_go_sdkcompatible module
.github/workflows/sdk-release-python-go.yml — release workflow:
- Tag
python-sdk-vX.Y.Z→ runs tests → publishes to PyPI viapypa/gh-action-pypi-publish - Tag
go-sdk-vX.Y.Z→ runsgo vet,go test ./...,go build ./...
| File | Status |
|---|---|
fluxapay_backend/src/services/StellarService.ts |
Modified |
fluxapay_backend/src/services/__tests__/StellarService.test.ts |
Modified |
.github/workflows/canary-deploy.yml |
New |
docker-compose.staging.yml |
New |
fluxapay_python_sdk/fluxapay/__init__.py |
New |
fluxapay_python_sdk/pyproject.toml |
New |
fluxapay_python_sdk/tests/test_sdk.py |
New |
fluxapay_python_sdk/README.md |
New |
fluxapay_go_sdk/fluxapay/client.go |
New |
fluxapay_go_sdk/fluxapay/client_test.go |
New |
fluxapay_go_sdk/go.mod |
New |
fluxapay_go_sdk/README.md |
New |
.github/workflows/sdk-release-python-go.yml |
New |