Problem
Request Scan does NOT show the Request Status (Paid, Partially Paid, Awaiting Payment, Overdue, Rejected, Accepted, Pending). Rather, it shows the raw Request State (pending, created, approved, or canceled).
Request Status vs Request State
- The Request State is the raw data stored to IPFS.
- The Request Status is derived based on the request's
balance, expectedAmount, dueDate, and state.
- The
balance is the sum of onchain Payment events with the corresponding payment reference.
- The
expectedAmount, dueDate, and state are read from IPFS.
Solution
Implement Request Status logic, similar to what's in Request Invoicing's checkStatus function