Skip to content

PO-2656 add history and notes tab to major creditor - #2914

Open
GarethLangley1 wants to merge 10 commits into
masterfrom
PO-2656
Open

PO-2656 add history and notes tab to major creditor#2914
GarethLangley1 wants to merge 10 commits into
masterfrom
PO-2656

Conversation

@GarethLangley1

Copy link
Copy Markdown
Contributor

Jira link

See PO-2656

Change description

  • Added a new History and notes tab to the major creditor account details flow, following the existing tab structure used in account enquiry.
  • Added the initial major creditor History and notes tab UI scaffold with the shared Show filter section, including Date from, Date to, and Filter, with no table rendering yet (this is to implemented under PO-2658).
  • Reused the shared history-and-notes filter form and updated it so category options are only rendered when categories are actually supplied.
  • Wired the major creditor tab into the frontend data flow so selecting the tab triggers GET /major-creditor-accounts/{id}/history for the current account.
  • Added support for optional major creditor history date filters, with blank values omitted from the request and requests only sent when the user selects Filter.
  • Implemented frontend conversion of submitted local dates into RFC3339 UTC timestamps before sending dateFrom and dateTo query params.
  • Reused the shared date-range validation pattern so an error is shown when Date from is later than Date to.
  • Added major creditor history service/cache plumbing, including the new cache entry and tab-to-cache mapping needed to support the tab’s initial unfiltered load pattern.
  • Kept the major creditor feature layer date-only by removing category-specific UI/config from that tab, while leaving the lower-level API service contract aligned with the endpoint’s optional itemTypes support.

Testing done

  • Added and updated mocks/specs around the new tab, payload building, shared date conversion utility, and Opal fines service integration.

Security Vulnerability Assessment

CVE Suppression: Are there any CVEs present in the codebase (either newly introduced or pre-existing) that are being intentionally suppressed or ignored by this commit?

  • Yes
  • No

Checklist

  • commit messages are meaningful and follow good commit message guidelines
  • README and other documentation has been updated / added (if needed)
  • tests have been updated / new tests has been added (if needed)
  • Does this PR introduce a breaking change

@GarethLangley1
GarethLangley1 requested a review from a team July 24, 2026 15:26
@GarethLangley1 GarethLangley1 changed the title Po 2656 PO-2656 add history and notes tab to major creditor Jul 27, 2026

@Arnabsubedi233 Arnabsubedi233 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small comment, the rest looks good

@Arnabsubedi233 Arnabsubedi233 Jul 27, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we have to convert to timestamp for the dates well atleast we should not do, because we are not capturing time ,only dates, so we should just be sending a date object not datetime. I think if you look at how fines-acc-defendant-history-and-notes transformation has been built, it should be similar to that when it comes to the dates.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm aware this wasn't your change, but I'm wondering if this could use the date service instead via the common-ui-lib 🤔

[P1]: Shared date handling
Problem: This adds custom frontend date parsing and UTC timestamp conversion in finesAccDateToRfc3339UtcTimestamp.
Why: We are trying to keep date parsing/formatting rules inside the shared date service/lib so timezone, validation, and formatting behaviour stays consistent across OPAL.
Fix: Replace the manual split('/'), Date.UTC, and toISOString() logic with the shared DateService/lib date conversion helper, or add the missing helper there if it does not already exist.

Suggestion:

const parsedDate = this.dateService.getFromFormat(date, 'dd/MM/yyyy');

if (!this.dateService.isValidDate(parsedDate)) {
  // handle invalid date consistently
}

return parsedDate
  .setZone('utc', { keepLocalTime: true })
  .startOf('day')
  .toISO();

Comment on lines +1 to +4
export interface IFinesAccMajorCreditorDetailsHistoryAndNotesFilterPayload {
dateFrom?: string;
dateTo?: string;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export interface IFinesAccMajorCreditorDetailsHistoryAndNotesFilterPayload {
dateFrom?: string;
dateTo?: string;
}
export interface IFinesAccMajorCreditorDetailsHistoryAndNotesFilterPayload {
dateFrom: string | null;
dateTo: string| null;
}

Comment on lines +1516 to +1519
const options: {
observe: 'response';
params?: Record<string, string>;
} = { observe: 'response' };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2]: Safe read retry policy
Problem: The new major-creditor history GET builds its HTTP options inline and does not use the existing safe-read retry wrapper.
Why: Other account-detail GETs use withRetrySafeReadOptions, so this endpoint will behave differently on transient timeout/gateway failures.
Fix: Initialise the options with this.withRetrySafeReadOptions({ observe: 'response' as const }), matching the minor-creditor history endpoint.

Could we extract the following into a private method and call it from these methods to reduce duplication?

const options: {
      observe: 'response';
      params?: Record<string, string>;
    } = this.withRetrySafeReadOptions({ observe: 'response' as const });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants