Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace contract dates with policy #2950

Conversation

paullatzelsperger
Copy link
Member

@paullatzelsperger paullatzelsperger commented May 11, 2023

What this PR changes/adds

This PR does a couple of things:

  • removes start and end date from ContractOffer
  • removes validity from ContractDefinition and related DTOs
  • adds a function to evaluate in-force period policies

Why it does that

validity periods of contracts should be represented by policies

Further notes

  • I did add an e2e test in AbsractEndToEndTransfer.java, but because Rejection Messages are not properly handled in IDS, I @Disabled those tests. Once the tests use the new DSP, we should be able to re-enable them.
  • This is a very large changeset, so reviewers are advised to focus mainly on the following classes:
    • ContractExpiryCheckFunction.java: contains the permission function to validate a time-limiting policy
    • ContractValidationServiceImpl.java: where the policy is supposed to be evaluated
    • ContractOffer.java: removed the start- and end-date as well as the offerstart and end date
    • ContractAgreement.java: removed the start- and end-date

Linked Issue(s)

Closes #2758

Checklist

  • added appropriate tests?
  • performed checkstyle check locally?
  • added/updated copyright headers?
  • documented public classes/methods?
  • added/updated relevant documentation?
  • assigned appropriate label? (exclude from changelog with label no-changelog)
  • formatted title correctly? (take a look at the CONTRIBUTING and Etiquette for pull requests for details)

@paullatzelsperger paullatzelsperger self-assigned this May 11, 2023
@paullatzelsperger paullatzelsperger temporarily deployed to Azure-dev May 11, 2023 09:11 — with GitHub Actions Inactive
@codecov-commenter
Copy link

codecov-commenter commented May 11, 2023

Codecov Report

Patch coverage: 64.10% and project coverage change: +0.05 🎉

Comparison is base (ad9ed18) 66.19% compared to head (fdc439f) 66.24%.

❗ Current head fdc439f differs from pull request most recent head 754dd77. Consider uploading reports for the commit 754dd77 to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2950      +/-   ##
==========================================
+ Coverage   66.19%   66.24%   +0.05%     
==========================================
  Files        1039     1041       +2     
  Lines       21281    21227      -54     
  Branches     1259     1258       -1     
==========================================
- Hits        14086    14062      -24     
+ Misses       6672     6642      -30     
  Partials      523      523              
Impacted Files Coverage Δ
...iation/ConsumerContractNegotiationManagerImpl.java 96.61% <ø> (-0.06%) ⬇️
...iation/ProviderContractNegotiationManagerImpl.java 96.03% <ø> (-0.08%) ⬇️
...tAgreementFromIdsContractAgreementTransformer.java 81.63% <ø> (+2.38%) ⬆️
...actAgreementToIdsContractAgreementTransformer.java 80.48% <ø> (+4.97%) ⬆️
...OfferFromIdsContractOfferOrRequestTransformer.java 76.31% <ø> (+2.50%) ⬆️
...ct/ContractOfferToIdsContractOfferTransformer.java 83.33% <ø> (+10.83%) ⬆️
.../contractagreement/model/ContractAgreementDto.java 100.00% <ø> (ø)
...actAgreementToContractAgreementDtoTransformer.java 100.00% <ø> (ø)
...JsonObjectFromContractAgreementDtoTransformer.java 100.00% <ø> (ø)
...definition/model/ContractDefinitionRequestDto.java 100.00% <ø> (ø)
... and 26 more

... and 13 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@paullatzelsperger paullatzelsperger temporarily deployed to Azure-dev May 11, 2023 09:40 — with GitHub Actions Inactive
@paullatzelsperger paullatzelsperger temporarily deployed to Azure-dev May 11, 2023 10:07 — with GitHub Actions Inactive
@paullatzelsperger paullatzelsperger temporarily deployed to Azure-dev May 11, 2023 17:32 — with GitHub Actions Inactive
@paullatzelsperger paullatzelsperger temporarily deployed to Azure-dev May 11, 2023 17:32 — with GitHub Actions Inactive
private Duration asDuration(String rightValueStr) {
var matcher = Pattern.compile(EXPRESSION_REGEX).matcher(rightValueStr);
if (matcher.matches()) {
var number = Integer.parseInt(matcher.group(REGEX_GROUP_NUMERIC));

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException

Potential uncaught 'java.lang.NumberFormatException'.
Copy link
Contributor

Choose a reason for hiding this comment

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

@paullatzelsperger should we catch and handle this or let it bubble? We could also address in another PR

@paullatzelsperger paullatzelsperger force-pushed the feature/2758_replace_contractdates_with_policy branch from 776554a to 7bc6624 Compare May 11, 2023 17:47
@paullatzelsperger paullatzelsperger temporarily deployed to Azure-dev May 11, 2023 17:48 — with GitHub Actions Inactive
@paullatzelsperger paullatzelsperger force-pushed the feature/2758_replace_contractdates_with_policy branch from 7bc6624 to 269ce7e Compare May 11, 2023 19:02
@paullatzelsperger paullatzelsperger temporarily deployed to Azure-dev May 11, 2023 19:03 — with GitHub Actions Inactive
@paullatzelsperger paullatzelsperger temporarily deployed to Azure-dev May 11, 2023 19:09 — with GitHub Actions Inactive
@paullatzelsperger paullatzelsperger temporarily deployed to Azure-dev May 12, 2023 06:36 — with GitHub Actions Inactive
@paullatzelsperger paullatzelsperger marked this pull request as ready for review May 12, 2023 06:57
@paullatzelsperger paullatzelsperger temporarily deployed to Azure-dev May 12, 2023 07:13 — with GitHub Actions Inactive
@paullatzelsperger paullatzelsperger temporarily deployed to Azure-dev May 12, 2023 07:43 — with GitHub Actions Inactive
Copy link
Contributor

@jimmarino jimmarino left a comment

Choose a reason for hiding this comment

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

Awesome stuff, especially removing code ;-) One small comment but that can either stay the same or be addressed later.

private Duration asDuration(String rightValueStr) {
var matcher = Pattern.compile(EXPRESSION_REGEX).matcher(rightValueStr);
if (matcher.matches()) {
var number = Integer.parseInt(matcher.group(REGEX_GROUP_NUMERIC));
Copy link
Contributor

Choose a reason for hiding this comment

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

@paullatzelsperger should we catch and handle this or let it bubble? We could also address in another PR

@paullatzelsperger
Copy link
Member Author

@paullatzelsperger should we catch and handle this or let it bubble? We could also address in another PR

I think it's not an issue, since it would never match the Regex unless its a numeric value. Maybe another test for this would be in order though :)

Copy link
Contributor

@wolf4ood wolf4ood left a comment

Choose a reason for hiding this comment

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

LGTM 🪓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core feature enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: implement policies for contract start/end date
5 participants