closedhumanPR #211Payments

feat(payments): Prava sandbox payments adapter [chijian28]

- Adds nest-plugins-prava, a reusable NANDA Town payments plugin that implements quote / pay / verify_payment / refund against Prava's Agentic Payments Sandbox.

Author

Status
Closed without merging
Opened on
Aug 2
Branch
hackathon/chijian28-prava-payments

Description

The pitch.

## Summary
- Adds `nest-plugins-prava`, a reusable NANDA Town **payments** plugin that implements `quote` / `pay` / `verify_payment` / `refund` against Prava's Agentic Payments Sandbox.
- Supports `mock` (deterministic CI), `live` (real HTTP), and `hybrid` (real `POST /v1/sessions` + headless completion for agent sims).
- Local budget lock before the rail, typed failure mapping, secret scrubbing, idempotent `PaymentRef`s, optional journal for restart safety.
- Includes marketplace scenario `scenarios/prava_marketplace.yaml` (`payments: prava`), install README, demo script, and hostile failure/idempotency tests.

## Design notes
- NANDA agents speak a synchronous ledger API; Prava speaks sessions / payment-result / report-status. This adapter is the bridge.
- Failure cases covered: insufficient funds (never hits Prava), HTTP 5xx retries, 401/403 no-retry, schema validation, declined report-status, concurrent pay, duplicate refs, refund safety.
- Secrets stay out of receipts / `public_view()`; API keys only via env / constructor.

## Verification
```bash
uv sync
uv run nest plugins list | grep -A2 payments   # includes prava
uv run pytest packages/nest-plugins-prava/tests -m "not live" -v
# optional sandbox evidence (needs PRAVA_API_KEY):
PRAVA_API_KEY=sk_test_... PRAVA_MODE=hybrid \
  uv run pytest packages/nest-plugins-prava/tests/test_sandbox_live.py -m live -v
PRAVA_MODE=mock nest run scenarios/prava_marketplace.yaml -o traces/prava.jsonl
python packages/nest-plugins-prava/scripts/demo_fail_then_retry.py
```

Locally: **ruff check/format**, **pyright**, and **63 non-live tests** pass. Live/hybrid runs produce real sandbox `ses_` / `ord_` IDs (key not committed).

## Track
Project NANDA — Best Prava Adapter for NANDA Town (Prava Agentic Commerce Hackathon).

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/211/head:pr-211
git checkout pr-211