Танилцуулга / Phase plan
Phase plan
PayGrid-ыг Phase 0 (spec only) → Phase 4 (international) хүртэл хэрэгжүүлэх roadmap. Total spec-to-production: ~12-18 сар. Total cost: ~$1.5-2M. Annual operating cost (Phase 3+): ~$500K.
1. Phase 0 — Spec only Дууссан
Deliverable: paygrid-mn/PLAN/ folder — engineering spec (16 баримт, ~245KB).
Acceptance: AI session reads all 15 files, produces STATUS-AFTER-READ.md + CLARIFICATION-QUESTIONS.md, awaits human sign-off. ✓
2. Phase 1 — MVP scaffold (4 долоо хоног) Идэвхтэй
Goal: Skeleton дотооддоо ажиллах, compile хийх, health endpoint, basic API contract.
Sprint 1 (Week 1)
- Repo:
github.com/paygrid-mn/paygrid-backend(Go module init) - CI: GitHub Actions — lint, vet, gosec, test
- Docker: distroless build
- Postgres: migrations init (atlas / goose)
- Redis: connection
- Health endpoint:
/v1/health/live,/v1/health/ready - mTLS dev cert chain
- Structured logging (zerolog)
Sprint 2 (Week 2)
- DB schema: participants, participant_keys, participant_endpoints, aliases, alias_attestations, audit_log shards
- sqlc query generation
- Basic CRUD: participants, aliases (register, resolve, revoke)
- OpenAPI 3.x spec scaffold
Sprint 3 (Week 3)
- DB schema: payments, payment_events, ledger_entries, settlement_batches
- Berlin Group NextGenPSD2 OpenAPI import
- Generated server stubs (oapi-codegen)
- POST
/v1/payments/sepa-credit-transfers(validation only) - GET
/v1/payments/{id}/status - Idempotency-key Redis-backed
Sprint 4 (Week 4)
- E2E test harness
- Mock Bank PISP API
- Mock Wallet client
- E2E test: alias resolve + dummy pacs.008 routing
- Sandbox env deploy (single-host)
- Documentation: README, runbook stubs
Acceptance criteria
make testpassesmake e2epasses (mock bank ↔ PayGrid ↔ mock wallet)- OpenAPI spec at
/.well-known/openapi/paygrid-v1.yaml - Health check returns 200
- Sandbox deployable to staging server
3. Phase 2 — Bridge live (12 долоо хоног) Төлөвлөгөөтэй
Goal: PayGrid bridge live with 3 банк + 1 хэтэвч, real e-ID Mongolia SCA, hash-chained audit, FRM rules basic.
Sprint 5-6 — Real e-ID Mongolia integration
- X-Road client subsystem registered at
cs.gerege.mn - mTLS to
rp.gerege.mn - e-ID Mongolia client library (Go)
- DEMO_MODE for tests
- Sandbox tested with eidmongol.mn sandbox
- Use case: PayGrid signs daily settlement instruction
Sprint 7-8 — FRM Engine
- frm_rules table + engine
- Velocity rules (per-IBAN, per-IP)
- Sanctions screening (OFAC, UN, EU, Mongolbank)
- PEP screening
- Real-time tx scoring
- Hard block + soft challenge actions
- Webhook delivery on FRM alert
Sprint 9-10 — Hash-chained audit log
- 16-shard
audit_log_*tables audit_log_insert()function- Hash chain verification tooling
- Daily integrity check job
- Audit log export endpoint
- Signed exports via e-ID Mongolia
- 7-жил retention plan
Sprint 11-12 — Settlement Engine MVP
- paygrid-clearing service (separate worker)
- Real-time leg: process pacs.008 from banks
- Forward pacs.008 to creditor PSP
- Webhook delivery + retry
- Bilateral nostro position tracking
- Hourly batch generation (mock Switch submit)
- EOD reconciliation
Sprint 13-14 — Pilot Bank onboarding
- Onboard Khan Bank (technical pilot)
- Khan Bank exposes NextGenPSD2 PISP API (Mongol profile)
- mTLS cert exchange
- Production sandbox testing
- 30-хоног sandbox parity testing
- Limit ramp: Day 1 = 10M ₮/day
Sprint 15-16 — Pilot Wallet onboarding + go-live
- Onboard Gerege Wallet
- Mutual sandbox testing
- Production go-live (limited)
- Monitoring + alerting setup
- On-call rotation
- Phase 2 retrospective
Acceptance criteria
- Real Bank ↔ Wallet payment via PayGrid succeeds in production
- End-to-end p95 < 15 сек
- All audit log entries hash-chained verifiable
- FRM screens 100% of tx
- Sanctions match → hard block confirmed
- Settlement EOD reconciles to 0 discrepancy
4. Phase 2.5 — PSD2 Dynamic Linking + QR Switch + Hardening (4 долоо хоног)
PSD2
- PSD2 RTS Article 5 Dynamic Linking JWS bind
- Wallet → PayGrid binding_jws verify
- Bank → PayGrid attestation JWS verify
- TSA token integration (RFC 3161)
- Cert chain validation hardening
- OCSP stapling
QR Switch
- EMVCo TLV encoder/decoder library
- Static MPQR generation API
- Dynamic MPQR generation API
/v1/qr/resolveendpoint- pay_uri builder/parser
- QR image renderer (PNG/SVG)
- DB tables: qr_codes, qr_scan_events
- FRM screen on resolve
- Sandbox testing with Wallet partners
Hardening
- DR test execution
- Performance test: 50 TPS sustained
5. Phase 3 — Public Launch + Scale (24 долоо хоног)
- Sprint 17-20: Onboard 2 more banks (Golomt, TDB)
- Sprint 21-24: Onboard 2 more wallets (Most Money, Pocket)
- Sprint 25-28: Cross-wallet P2P + CPQR launch + MNQR public standard
- Sprint 29-32: VRP / Direct Debit Mandate framework
- Sprint 33-36: Production HSM cluster (active-active)
- Sprint 37-40: Mongolbank Switch real integration
- Sprint 37-40b: QPay coexistence + migration path
- Sprint 41-44: Mongolbank approval as Payment System Operator
Acceptance criteria
- All 7+ commercial banks onboarded
- All 5+ major wallets/NBFIs onboarded
- 100 TPS sustained, 500 TPS peak
- Mongolbank approves PayGrid as Payment System Operator
- ETSI-aligned cert profile audit pass
- SOC 2 Type II report
6. Phase 4 — International + Advanced (Year 2+)
- OIDC bridge for non-X-Road RPs (foreign integration)
- eIDAS Cross-Border recognition (EU bilateral)
- Multi-currency settlement (USD, CNY, RUB, EUR)
- VRP advanced features
- Cross-border PISP (China UnionPay, Korea Open Banking)
- Mongolian Trust Services Regulation passing (PayGrid as TSP)
- AI-powered FRM (ML scoring)
7. Critical path / dependency graph
8. Resource estimate
Team
| Phase | Team |
|---|---|
| Phase 1 (4 долоо хоног) | 1 Tech lead, 2 Backend (Go), 1 DevOps/SRE, 1 PM, 1 Security reviewer (part-time) |
| Phase 2 (12 долоо хоног) | +1 Backend (settlement), +1 FRM/data engineer, +1 QA |
| Phase 3 (24 долоо хоног) | +1 DevOps (HSM), +1 Customer success, +1 Compliance/audit |
Cost
| Phase | Cost | Note |
|---|---|---|
| Phase 1 (1 сар) | ~$50K | Team + cloud + dev tools |
| Phase 2 (3 сар) | ~$200K | Team + e-ID + initial vendor onboarding |
| Phase 2.5 (1 сар) | ~$80K | TSA / OCSP / DR setup |
| Phase 3 (6 сар) | ~$1M+ | HSM cluster + Switch integration + bank onboarding |
| Phase 4 (Year 2+) | varies | — |
Total spec-to-production: ~$1.5-2M over 12-18 сар. Annual operating cost (Phase 3+): ~$500K.
9. Risks
| Risk | Mitigation |
|---|---|
| Mongolbank approval delay | Engage early, parallel-track regulatory + technical |
| Bank PISP API readiness varies | Phase 2 mock; Phase 2-3 sandbox parity testing |
| HSM vendor lock-in | PKCS#11 abstraction from Day 1 |
| Single bank pilot fails | Have 2 backup banks (TDB, State Bank) |
| Wallet partner withdraws | Onboard 2nd wallet in parallel |
| e-ID Mongolia capacity | Coordinate with eidmongol team for scaling |
| Switch integration delays | Mock layer continues while waiting |
| Insider threat | RBAC + M-of-N + audit + WebAuthn |
10. Go / no-go criteria per phase
Phase 1 → Phase 2
- All E2E tests pass
- Code review by 2 senior engineers
- Security review (gosec, manual)
- Documentation complete
- Phase 2 staffed
Phase 2 → Phase 2.5
- Pilot bank + wallet live for 30 хоног
- Zero critical incidents
- p95 latency < 15 сек
- FRM hit rate > 95%
- Audit log integrity verified
Phase 2.5 → Phase 3
- DR test passed
- Penetration test report (no critical)
- 50 TPS sustained for 1 цаг
- Mongolbank quarterly review meeting
Phase 3 → Phase 4
- All commercial banks onboarded
- 90-хоног production stability
- SOC 2 Type II report
- ISO 27001 in progress
- Mongolbank approves Payment System Operator status
Эх сурвалж: PLAN/11-PHASE-PLAN.md.
Дараагийн хуудас: Стандартууд →