Imported payments have no payment_source #54

Closed
opened 2026-05-16 21:43:12 -05:00 by null · 0 comments
Owner

Severity: MED 🟡

Affected Files

  • services/spreadsheetImportService.js — line 1439
  • routes/payments.js — payment creation paths
  • routes/bills.js — bill-related payment paths

Problem

All import-created payments insert null for payment_source:

// spreadsheetImportService.js line ~1439
INSERT INTO payments (bill_id, user_id, amount, paid_date, method, notes, month, year, ...)
// — no payment_source column

Every other creation path passes 'manual' or an explicit source:

  • Quick-pay: payment_source = 'manual'
  • Toggle-paid: payment_source = 'manual'
  • Bulk-pay: payment_source = 'manual'
  • Manual payment: payment_source = 'manual'

The history view and audit records show a blank source for all imported payments — inconsistent and harder to trace.

Impact

  • Payment history shows blank source for imported payments
  • Cannot distinguish import-originated payments from manually entered ones
  • Inconsistent with every other payment creation path

Fix

Set payment_source = 'file_import' for all spreadsheet-imported payments. This aligns with the payment_source enum values (manual, file_import, provider_sync).

// In createPaymentFromImport()
payment_source: 'file_import'

Also update importRelatedPaidMonthsForNewBill() if it creates payments.

Acceptance Criteria

  • All imported payments have payment_source = 'file_import'
  • Payment history shows correct source for imported payments
  • No regression in manual payment source tracking
## Severity: MED 🟡 ## Affected Files - `services/spreadsheetImportService.js` — line 1439 - `routes/payments.js` — payment creation paths - `routes/bills.js` — bill-related payment paths ## Problem All import-created payments insert `null` for `payment_source`: ```javascript // spreadsheetImportService.js line ~1439 INSERT INTO payments (bill_id, user_id, amount, paid_date, method, notes, month, year, ...) // — no payment_source column ``` Every other creation path passes `'manual'` or an explicit source: - Quick-pay: `payment_source = 'manual'` - Toggle-paid: `payment_source = 'manual'` - Bulk-pay: `payment_source = 'manual'` - Manual payment: `payment_source = 'manual'` The history view and audit records show a blank source for all imported payments — inconsistent and harder to trace. ## Impact - Payment history shows blank source for imported payments - Cannot distinguish import-originated payments from manually entered ones - Inconsistent with every other payment creation path ## Fix Set `payment_source = 'file_import'` for all spreadsheet-imported payments. This aligns with the `payment_source` enum values (`manual`, `file_import`, `provider_sync`). ```javascript // In createPaymentFromImport() payment_source: 'file_import' ``` Also update `importRelatedPaidMonthsForNewBill()` if it creates payments. ## Acceptance Criteria - [ ] All imported payments have `payment_source = 'file_import'` - [ ] Payment history shows correct source for imported payments - [ ] No regression in manual payment source tracking
null added the
priority:medium
backend
labels 2026-05-16 21:43:12 -05:00
null closed this issue 2026-06-03 22:21:46 -05:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
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: null/BillTracker#54
No description provided.