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

FINERACT-1760: savings account externalId support #3411

Conversation

abraham-menyhart
Copy link
Contributor

Description

Describe the changes made and why they were made.

Ignore if these details are present on the associated Apache Fineract JIRA ticket.

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per https://github.com/apache/fineract/#pull-requests

  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.

  • Create/update unit or integration tests for verifying the changes made.

  • Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.

  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes

  • Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)

FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

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

Please kindly see my comments!

@abraham-menyhart abraham-menyhart force-pushed the FINERACT-1760-savings-account-external-id-support branch 4 times, most recently from 899e0a6 to a56658b Compare August 31, 2023 11:47
@abraham-menyhart
Copy link
Contributor Author

abraham-menyhart commented Aug 31, 2023

Thanks for your review @adamsaghy, I fixed the PR according to your comments. Can you please review it again?

SavingsAccount findByExternalId(String externalId);
SavingsAccount findByExternalId(ExternalId externalId);

@Query("SELECT sa.id FROM SavingsAccount sa WHERE sa.externalId = :externalId")
Copy link
Contributor

Choose a reason for hiding this comment

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

This method would work without the @Query annotation as well! ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, nice catch, thanks!

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

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

LGTM

@adamsaghy
Copy link
Contributor

@abraham-menyhart Run './gradlew :integration-tests:spotlessApply' to fix these violations.

@abraham-menyhart abraham-menyhart force-pushed the FINERACT-1760-savings-account-external-id-support branch 2 times, most recently from 0e8ab52 to 15fc04a Compare September 8, 2023 08:50
final String newValue = command.stringValueOfParameterNamed(SavingsApiConstants.externalIdParamName);
actualChanges.put(SavingsApiConstants.externalIdParamName, newValue);
this.externalId = StringUtils.defaultIfEmpty(newValue, null);
this.externalId = ExternalIdFactory.produce(newValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we should generate one if nothing was provided: ExternalIdFactory.create(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since it is an Entity class, and the create method is not static, I should pass the ExternalIdFactory dependency as a method parameter, etc. So it won't be very pretty I think. Is it a business requirement? In the other cases, I'll implement your change request, only this case I'm a bit hesitant.

Copy link
Contributor

Choose a reason for hiding this comment

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

Till this logic is not extracted out from the entity you might wanna use this:

            ExternalId externalId = ExternalIdFactory.produce(newValue);
            if (externalId.isEmpty() && TemporaryConfigurationServiceContainer.isExternalIdAutoGenerationEnabled()) {
                externalId = ExternalId.generate();
            }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Updated the PR according to this.

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

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

Please see my comments!

@abraham-menyhart abraham-menyhart force-pushed the FINERACT-1760-savings-account-external-id-support branch from 15fc04a to 1600795 Compare September 11, 2023 13:56
@abraham-menyhart abraham-menyhart force-pushed the FINERACT-1760-savings-account-external-id-support branch from 1600795 to 73c62a7 Compare September 11, 2023 15:11
@adamsaghy adamsaghy merged commit 781f3ae into apache:develop Sep 13, 2023
8 checks passed
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