[Issue]: Activity should log partial payment amount #140

Closed
opened 2026-06-27 18:46:12 +00:00 by shad0w · 3 comments
Owner

Raised by

Kaushal Pal Singh (kps@pelagiamarine.com, MANAGER) — via portal Report Issue button

Description

Partial payment of xyz confirmed instead of partial payment confirmed

Priority

P2 — Medium

Context

  • Page: /po/cmqs2r112007ruxawl0z5e5t2
  • Reported at: 2026-06-27T18:46:12.396Z
### Raised by Kaushal Pal Singh (kps@pelagiamarine.com, MANAGER) — via portal Report Issue button ### Description Partial payment of xyz confirmed instead of partial payment confirmed ### Priority P2 — Medium ### Context - Page: `/po/cmqs2r112007ruxawl0z5e5t2` - Reported at: 2026-06-27T18:46:12.396Z
shad0w added the
portal
label 2026-06-27 18:46:12 +00:00
shad0w added the
feature
claude-queue
triaged
labels 2026-06-27 18:51:36 +00:00
Author
Owner

Claude triage

Triage — Issue #140: Activity should log partial payment amount

Interpretation

When Accounts confirms a partial payment, the PO Activity (audit trail)
timeline shows a generic line:

Partial payment confirmed

The reporter (a Manager, viewing PO cmqs2r112007ruxawl0z5e5t2) wants the
amount of that partial payment included, e.g.:

Partial payment of ₹5,000 confirmed

This is purely a display enhancement. The amount is already persisted — when
markPaid() writes the PARTIAL_PAYMENT_CONFIRMED action it records
metadata.paymentAmount (the amount paid in this instalment) plus metadata.totalPaid
(running total) and metadata.paymentRef. Nothing in the payment flow, money
computation, or DB needs to change; only the activity-log rendering needs to read that
metadata and surface it.

Action items

  1. In components/po/po-detail.tsx, the Activity timeline (≈ line 575–589) renders each
    row's title from the static ACTION_LABELS map (≈ line 90–108), where
    PARTIAL_PAYMENT_CONFIRMED → "Partial payment confirmed".
  2. Produce a per-action label that, for PARTIAL_PAYMENT_CONFIRMED, interpolates the
    amount: read action.metadata.paymentAmount (already typed as
    Prisma.JsonValue on the action — see line 78) and format it with the existing
    formatCurrency(amount, po.currency) helper (already imported from @/lib/utils,
    line 8; pattern already used at lines 312–313, 556).
    • Suggested wording: "Partial payment of {formatCurrency(amount)} confirmed".
    • Fall back to the plain "Partial payment confirmed" label when
      paymentAmount is missing/non-numeric (e.g. older audit rows) so historical
      POs never render NaN/undefined.
  3. Leave all other action labels unchanged. (Optional, only if trivially clean: the same
    pattern could enrich PAYMENT_SENT with metadata, but the issue only asks for the
    partial case — keep scope tight.)

Files / areas involved

  • components/po/po-detail.tsx — Activity timeline render + ACTION_LABELS map (the
    only render site; grep confirms PARTIAL_PAYMENT_CONFIRMED is rendered only here).
  • app/(portal)/payments/actions.tsread only for confirmation that
    metadata.paymentAmount is already written (line 123–130); no change needed.
  • lib/utils.ts — reuse formatCurrency (no change).
  • Optional: a small unit test asserting the partial-payment row interpolates the amount
    and falls back gracefully when metadata is absent.

Open questions

  • Wording / currency: assume "Partial payment of <amount> confirmed" using the PO's
    own currency via formatCurrency(amount, po.currency). (Sensible default matching the
    reporter's "Partial payment of xyz confirmed" phrasing.)
  • Which amount: assume the per-instalment paymentAmount (matches the reporter's
    intent), not the running totalPaid. The running total can stay out of the label.
  • These are low-risk defaults; neither blocks an unattended run.

Risk / safety assessment

  • Single-file, display-only change reading data that is already stored. No DB
    migration, no schema change, no auth/permission change, no change to payment
    processing or money computation, no external system.
  • Verifiable by pnpm type-check / pnpm lint and a focused unit test on the label.
  • The "payments/money" caution applies to changing how money is handled/computed; here
    we only display a persisted value, so the queue exclusion is not triggered.

Routing rationale: localized, display-only audit-log change reading already-persisted
metadata.paymentAmount with clear acceptance and unit/type-check verifiability, touching
no migration/auth/payment-logic/external systems → claude-queue.

Routing: claude-queue | Type: feature

## Claude triage # Triage — Issue #140: Activity should log partial payment amount ## Interpretation When Accounts confirms a **partial** payment, the PO **Activity** (audit trail) timeline shows a generic line: > Partial payment confirmed The reporter (a Manager, viewing PO `cmqs2r112007ruxawl0z5e5t2`) wants the **amount** of that partial payment included, e.g.: > Partial payment of ₹5,000 confirmed This is purely a **display enhancement**. The amount is **already persisted** — when `markPaid()` writes the `PARTIAL_PAYMENT_CONFIRMED` action it records `metadata.paymentAmount` (the amount paid in this instalment) plus `metadata.totalPaid` (running total) and `metadata.paymentRef`. Nothing in the payment flow, money computation, or DB needs to change; only the activity-log rendering needs to read that metadata and surface it. ## Action items 1. In `components/po/po-detail.tsx`, the Activity timeline (≈ line 575–589) renders each row's title from the static `ACTION_LABELS` map (≈ line 90–108), where `PARTIAL_PAYMENT_CONFIRMED → "Partial payment confirmed"`. 2. Produce a per-action label that, for `PARTIAL_PAYMENT_CONFIRMED`, interpolates the amount: read `action.metadata.paymentAmount` (already typed as `Prisma.JsonValue` on the action — see line 78) and format it with the existing `formatCurrency(amount, po.currency)` helper (already imported from `@/lib/utils`, line 8; pattern already used at lines 312–313, 556). - Suggested wording: **"Partial payment of {formatCurrency(amount)} confirmed"**. - Fall back to the plain `"Partial payment confirmed"` label when `paymentAmount` is missing/non-numeric (e.g. older audit rows) so historical POs never render `NaN`/`undefined`. 3. Leave all other action labels unchanged. (Optional, only if trivially clean: the same pattern could enrich `PAYMENT_SENT` with `metadata`, but the issue only asks for the partial case — keep scope tight.) ## Files / areas involved - `components/po/po-detail.tsx` — Activity timeline render + `ACTION_LABELS` map (the only render site; `grep` confirms `PARTIAL_PAYMENT_CONFIRMED` is rendered only here). - `app/(portal)/payments/actions.ts` — **read only** for confirmation that `metadata.paymentAmount` is already written (line 123–130); **no change needed**. - `lib/utils.ts` — reuse `formatCurrency` (no change). - Optional: a small unit test asserting the partial-payment row interpolates the amount and falls back gracefully when metadata is absent. ## Open questions - **Wording / currency**: assume `"Partial payment of <amount> confirmed"` using the PO's own currency via `formatCurrency(amount, po.currency)`. (Sensible default matching the reporter's "Partial payment of xyz confirmed" phrasing.) - **Which amount**: assume the per-instalment `paymentAmount` (matches the reporter's intent), not the running `totalPaid`. The running total can stay out of the label. - These are low-risk defaults; neither blocks an unattended run. ## Risk / safety assessment - Single-file, display-only change reading data that is **already stored**. No DB migration, no schema change, no auth/permission change, no change to payment processing or money computation, no external system. - Verifiable by `pnpm type-check` / `pnpm lint` and a focused unit test on the label. - The "payments/money" caution applies to changing how money is *handled/computed*; here we only *display* a persisted value, so the queue exclusion is not triggered. Routing rationale: localized, display-only audit-log change reading already-persisted `metadata.paymentAmount` with clear acceptance and unit/type-check verifiability, touching no migration/auth/payment-logic/external systems → claude-queue. **Routing:** `claude-queue` | **Type:** `feature`
shad0w added
claude-working
and removed
claude-queue
labels 2026-06-27 18:51:36 +00:00
Author
Owner

[Claude] Started working on this issue on branch claude/issue-140.

<!-- ppms-bot --> [Claude] Started working on this issue on branch `claude/issue-140`.
shad0w added
claude-pr
and removed
claude-working
labels 2026-06-27 18:54:41 +00:00
Author
Owner

[Claude] Opened PR #141 with a proposed fix. Review and merge it, then create a release tag to deploy.

<!-- ppms-bot --> [Claude] Opened PR [#141](https://git.pelagiamarine.com/shad0w/pelagia-portal/pulls/141) with a proposed fix. Review and merge it, then create a release tag to deploy.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: shad0w/pelagia-portal#140
No description provided.