Skip to content

Passthrough proto - #804

Draft
guyjackson-ch wants to merge 6 commits into
masterfrom
passthrough-proto
Draft

Passthrough proto#804
guyjackson-ch wants to merge 6 commits into
masterfrom
passthrough-proto

Conversation

@guyjackson-ch

Copy link
Copy Markdown
Contributor

Description

This pull request introduces several important changes related to how dissolutions and their statuses are managed and retrieved, as well as improvements to API client handling and transaction management. The main highlights are the introduction of a status history for dissolutions, a new approach for retrieving authenticated API clients, and refactoring of transaction and dissolution logic for better clarity and maintainability.

Dissolution Status Tracking Enhancements:

  • Added a statusHistory field and a submittedAt timestamp to the Dissolution model, along with a new DissolutionStatusChanged class to track changes in dissolution status over time. The status-changing logic now records each change with a timestamp. ([[1]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-ba2199bab74d25d8838ad8d686816bafba020f28796c770499cb1559f9c8849bR42-R47), [[2]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-ba2199bab74d25d8838ad8d686816bafba020f28796c770499cb1559f9c8849bL126-R144), [[3]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-280229d9fd7871aaf18e84e402c0775a4bf7d3d588f947b6373829f3aea73dccR1-R30))
  • Introduced the SUBMITTED status in the DissolutionStatus enum, replacing the previous PROCESSED status for improved clarity. ([src/main/java/uk/gov/companieshouse/model/enums/DissolutionStatus.javaL8-R8](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-a3278734a02bcd2371748463e5528cc7130d6214cd291a08ccab71a72326a0fcL8-R8))

API Client and Transaction Handling Refactor:

  • Added an ApiClientProvider interface and a default RequestPassThroughApiClientProvider implementation to encapsulate the logic for retrieving an authenticated ApiClient using the Eric pass-through token from the current request. This abstracts away token handling from the rest of the codebase. ([[1]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-5f216fdcf88b274bc67632d05b98eac632deb91d030bceb30c5960f644952f77R1-R14), [[2]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-4b501443e6e2e1bbd4cd3da8f8566a85cf1b824f909d81146af4e09130e9a448R1-R38))
  • Refactored TransactionService to use ApiClientProvider instead of directly depending on ApiClientService and to remove the need to manually pass the pass-through token. Also added a hasVerdictBeenReached method to check if a dissolution filing has been accepted or rejected. ([[1]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-f8016a283346e055d32f0a7272d85612f7b502d355ac118767e89fae9f27b659L9-R29), [[2]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-f8016a283346e055d32f0a7272d85612f7b502d355ac118767e89fae9f27b659L44-R59))

Controller and Service Refactoring:

  • Simplified the DissolutionController by removing direct dependencies on PaymentService and Logger, delegating more responsibility to DissolutionService. The logic for resolving and updating dissolution application status based on payment has been moved into the service layer. ([[1]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-dc9a10e974121b8b94870870d2e05b49bc8776c995d15f18d174bf7d1abe0751L22-L36), [[2]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-dc9a10e974121b8b94870870d2e05b49bc8776c995d15f18d174bf7d1abe0751L53-L68), [[3]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-dc9a10e974121b8b94870870d2e05b49bc8776c995d15f18d174bf7d1abe0751L113-L135))
  • Updated DissolutionService to include new dependencies (PaymentService, TransactionService, DissolutionResponseMapper, Logger) and to support the new status tracking and retrieval logic. ([[1]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-ce9b9ec557a5bff07749ff3461bfe567a11d8a17420966125bff8a4cc47cb766R8-R10), [[2]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-ce9b9ec557a5bff07749ff3461bfe567a11d8a17420966125bff8a4cc47cb766R20-R24), [[3]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-ce9b9ec557a5bff07749ff3461bfe567a11d8a17420966125bff8a4cc47cb766R38-R53))

Repository and Constants Updates:

  • Added a new repository method to fetch the most recent dissolution by company number and status, and introduced a constant for the dissolution filing type prefix. ([[1]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-337c61af2a3268ccea69a981a0a39cf25f6c157d3e04b7f26ac80b37ac070271R30-R31), [[2]](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-39e4bbb4250d01bc026f8a991ec29033b757770007eb886572345fb8dfc2b9a2R51))

Supporting Enums and Utilities:

  • Introduced a new FilingStatus enum to avoid magic strings when dealing with transaction filing statuses. ([src/main/java/uk/gov/companieshouse/service/FilingStatus.javaR1-R28](https://github.com/companieshouse/dissolution-api/pull/804/files#diff-290b341e55c1ab566759726042d6360debaa1e193dd0b4796388c87ea7b6b2f5R1-R28))

These changes collectively improve the maintainability, clarity, and extensibility of the dissolution and transaction handling codebase, particularly around tracking dissolution status changes and managing authenticated API client access.

* payment status is reconciled before being returned.
*/
public Optional<DissolutionGetResponse> resolveDissolutionApplication(String userId, String companyNumber) {
var dissolutionDto = getByCompanyNumber(companyNumber)

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.

Can we rename getByCompanyNumber to something more descriptive like getActiveDissolution?

Would make it a lot easier to see the order of precedence for retrieving applications here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes agree

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.

2 participants