Files
mercadodevida/work/artifacts/F-190/implementer.md
2026-08-23 07:48:20 +02:00

1.9 KiB

F-190 — Implementer Evidence

Feature

Reporting updates from POS sales and returns.

Change Summary

1. src/modules/reporting/application/reporting-service.ts

Updated dataAvailability flags in 3 return-statement sites (summary, sales, products) to reflect that reporting_payment_lines now captures payment method and refund data:

Field Before After Reason
paymentMethod 'unavailable' 'available' F-190: reporting_payment_lines has provider per payment row
refunds 'unavailable' 'available' F-190: reporting_payment_lines has refund/partial_refund status rows

netSales and margin remain 'unavailable' (correct, no cost data or shipping-per-order yet).

Also added F-190 attribution comment at the top of the file.

2. Test updates

Updated 3 test assertions in reporting-service.test.ts and reporting.routes.test.ts that were asserting the old 'unavailable' values.

Existing code (no changes needed)

The following already works correctly and requires no modification:

  • ReceiveRestPaymentUseCase (F-188) already writes reporting_payment_lines with status='payment' when a PENDING order transitions to COMPLETED.
  • ApplyPosReturnUseCase (F-189) already writes reporting_payment_lines with status='refund' or 'partial_refund' for each return.
  • CreatePosSaleUseCase already writes reporting_payment_lines with status='payment' for each initial payment.
  • ReportingService.runSummaryQuery uses orders_items for gross_sales_cents, which correctly reflects returns (REFUNDED/PARTIALLY_REFUNDED are excluded from SALES_STATES).

Verification

Check Result
npm test 269 passed, 96 skipped
npx tsc --noEmit 0 errors
./scripts/verify.sh OK