closedhumanPR #215Payments

Hackathon/chainaim sathya prava payments

What it does:

Author

chainaim-sathya avatar

@chainaim-sathya

github profile →
Status
Closed without merging
Opened on
Aug 2
Branch
hackathon/chainaim-sathya-prava-payments

Description

The pitch.

What it does:

Connects the user-Intent for agentic commerce to Delivery Versus Payments constructs.  

and is the conformance layer that defines what the intent of the transaction is to a comittable refererance to clamp the actions fro loosely-guided LLM as brain. 

Conforms to the NANDA uv checks 

Gate is enforced per tick and every verdict is recorded. 

Chainaim translates intent in to Visa Intelligent commerce definitions and certifies the  digest along the jouney from the user intent where it caputres a bigger surface area for vertical domains beyond the payment networks themselves, basically helping them grow.


Conforms to the NANDA `uv` checks.

## Skill document

**https://prava-payment-production.up.railway.app/skill.md**

Source in this PR: `apps/skill-service/skill.md`, served verbatim by `GET /skill.md`.

## The case this exists for

An agent asked for a navy kurti under ₹500 buys a **maroon** one at ₹450 instead.
Cheaper than the quote, under the Visa decline threshold, under the mandate cap, right
merchant — so every amount-based control in the stack lets it through. They all ask
*how much*. None asks *what*.

## Judge test — two calls, no setup, under ten seconds

```bash
curl "https://prava-payment-production.up.railway.app/demo/purchase?case=good"
curl "https://prava-payment-production.up.railway.app/demo/purchase?case=drift"
```

| case | expect |
|---|---|
| `good` | `"verdict":"settled"`, `"settled_amount_minor":523`, `check_delivery` step with `"ok":true` |
| `drift` | `"verdict":"refused"`, `"reason":"colour_not_in_intent"`, `"code":"INTENT_NONCONFORMANT"`, `"settled_amount_minor":0`, `failed_checks` entry with `"expected":"green\|pink\|navy"` / `"actual":"maroon"` |

Print the `display` field verbatim — it is already a readable transcript.

## Endpoints

- https://prava-payment-production.up.railway.app/
- https://prava-payment-production.up.railway.app/health
- https://prava-payment-production.up.railway.app/skill.md
- https://prava-payment-production.up.railway.app/cases
- https://prava-payment-production.up.railway.app/demo/purchase?case=good
- https://prava-payment-production.up.railway.app/demo/purchase?case=drift
- https://prava-payment-production.up.railway.app/demo/purchase?case=overcap
- https://prava-payment-production.up.railway.app/docs

`POST /purchase` runs the same cycle with your own settings — see `/docs`.

### The checks

Run before any network call. Each is skipped if the term is missing.

| Check | Compares |
|---|---|
| `colour_not_in_intent` | colour is in the allowed list |
| `price_over_ceiling` | listed price is under the ceiling |
| `merchant_mismatch` | merchant matches |
| `identity_mismatch` | delivered product id matches the sku |
| `amount_mismatch` | charged amount matches the settlement amount |
| `over_decline_threshold` | amount is under the Visa decline threshold |

The first four are what catch a cheaper swap. The last two cannot.

### Prava calls behind each step

| step | Prava call |
|---|---|
| `quote` | none — local price list; Prava prices nothing |
| `pay` | `POST /v1/mandates/{id}/charge`, then `POST /v1/mandates/{id}/charges/{txn}/report` |
| `verify_payment` | `GET /v1/mandates/{id}`, then find the charge by `reference` |
| `refund` | raises — Prava has no refund endpoint |

`PaymentRef` goes to Prava unchanged as its `reference`, which Prava treats as an
idempotency key, so a replay is refused by the rail rather than by our bookkeeping.
`verify_payment` reads Prava's ledger, not local state — a network failure returns
`PENDING`, not `FAILED`.

## Where it lives in this PR

| path | what |
|---|---|
| `packages/nest-plugins-reference/nest_plugins_reference/payments/prava.py` | the payments plugin |
| `.../payments/prava_intent.py` | the conformance checks |
| `.../payments/prava_client.py` | Prava mandate API client |
| `packages/nest-core/nest_core/scenarios_builti

…

Try it

Open PR on GitHubView diff

Checkout locally

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