Skip to content

FINERACT-2772: Tax group - User should be able to set end date if start date was in the past - #6293

Open
rymghosn wants to merge 1 commit into
apache:developfrom
foodeveloper:port/CBS-212-tax-group-findoneby-null-fix-and-businessdate
Open

FINERACT-2772: Tax group - User should be able to set end date if start date was in the past#6293
rymghosn wants to merge 1 commit into
apache:developfrom
foodeveloper:port/CBS-212-tax-group-findoneby-null-fix-and-businessdate

Conversation

@rymghosn

Copy link
Copy Markdown
Contributor

TaxGroup.findOneBy(TaxGroupMappings) threw TaxMappingNotFoundException as soon as the first existing mapping in the set didn't match the one being looked up, instead of checking the rest of the set. With a tax group that has more than one component mapping, this meant editing/adding a component could randomly fail with an Internal Server Error depending on iteration order, even though a matching mapping existed further down the set. The same method could also throw an NPE via groupMappings.getId().equals(...) when an existing mapping's id was itself null.

This PR:

  • Fixes findOneBy to scan the full set of existing mappings and only throw TaxMappingNotFoundException if none of them match, using Objects.equals to avoid the NPE on a null id.
  • Exposes a businessDate field on TaxGroupData (populated from DateUtils.getBusinessLocalDate() when fetching a single tax group), so a client can validate a new tax component's start date against the system business date before submitting, instead of relying on the server round-trip to reject it.

Changes

  • TaxGroup#findOneBy: iterate over all mappings before giving up, Objects.equals instead of .getId().equals(...)
  • TaxGroupData: new businessDate field + withBusinessDate(TaxGroupData, LocalDate) factory (mirrors the existing template(...)
    copy-factory pattern); existing lookup()/template() factories updated to carry the field through
  • TaxGroupMapper: businessDate marked ignore in the MapStruct mapping (it's computed, not entity data)
  • TaxReadPlatformServiceImpl#retrieveTaxGroupData: populates businessDate on the returned TaxGroupData
    PR:(https://issues.apache.org/jira/browse/FINERACT-2772)

…e on TaxGroupData

TaxGroup.findOneBy() threw TaxMappingNotFoundException as soon as the
first existing mapping didn't match instead of checking the rest, and
could NPE via getId().equals(...) when an existing mapping's id was
null. Both surfaced as intermittent Internal Server Errors when adding
a new component to a tax group that already had multiple mappings.

Also exposes the read-side businessDate on TaxGroupData so clients can
validate a new component's start date against it before submitting.
@rymghosn
rymghosn force-pushed the port/CBS-212-tax-group-findoneby-null-fix-and-businessdate branch from 84672c1 to 9201672 Compare August 19, 2026 10:47
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.

1 participant