Skip to content

Conversation

dylantangredi-jakala
Copy link
Collaborator

@dylantangredi-jakala dylantangredi-jakala commented Mar 7, 2025

List of Changes

  • added switchToExpired and Debtor fields to getPositionByIUPD API

Motivation and Context

This change was requested to allow coherence checks on payment positions when comparing MYPAY with GPD

How Has This Been Tested?

  • Tested locally and in dev environment with Postman API call to /organizations/{organizationfiscalcode}/debtpositions/{iupd}

Screenshots (if appropriate):

Response:

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

add class to host the new fields extending the base response;
change interface return type to new response;
add new fields mapping to controller method;
add new response to openapi (excluding v3);
change API response schema on openapi specs (excluding v3);
Copy link
Contributor

github-actions bot commented Mar 7, 2025

This pull request does not contain a valid label. Please add one of the following labels: [major, minor, patch, patch, skip]

@dylantangredi-jakala dylantangredi-jakala marked this pull request as ready for review March 25, 2025 08:24
@dylantangredi-jakala dylantangredi-jakala requested a review from a team as a code owner March 25, 2025 08:24
Dylan Tangredi and others added 6 commits March 25, 2025 10:04
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link

Copy link
Contributor

This PR exceeds the recommended size of 400 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

Copy link
Collaborator

@gioelemella gioelemella Mar 26, 2025

Choose a reason for hiding this comment

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

Why a new model? Can we add the fields in the PaymentPositionModelBaseResponse?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought about at first but then I noticed that that the PaymentPositionModelBaseResponse is being used as a response model for other APIs. The task was to change one response to one specific API, so if I added the new field to the base model instead of extending it I would have added the new fields to API responses that were not asked.

Copy link
Contributor

Choose a reason for hiding this comment

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

The other API is getDebtPositionByIUV, it can be changed but the DWISP GPD client must be updated.

Comment on lines +190 to +191
PaymentPositionModelBaseResponse basePaymentPositionResponse =
ObjectMapperUtils.map(paymentPosition, PaymentPositionModelBaseResponse.class);

Choose a reason for hiding this comment

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

Since PaymentPositionModelEnhancedResponse extends PaymentPositionModelBaseResponse you could use directly the enhanced version here avoiding using reflection below (the copyProperties) to clone objects and then leave the set additional fields part.
What do you think?

Copy link
Contributor

@cap-ang cap-ang left a comment

Choose a reason for hiding this comment

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

LGTM, the idea of a model enhanced is reasonable. I suggest evaluating @pietro-tota's advice on the use of copyProperties and consider updating the API on pagopa-infra.

Copy link
Contributor

Choose a reason for hiding this comment

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

The other API is getDebtPositionByIUV, it can be changed but the DWISP GPD client must be updated.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants