-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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-2173: Introduce new loan migration module api #4319
base: develop
Are you sure you want to change the base?
FINERACT-2173: Introduce new loan migration module api #4319
Conversation
d4265c5
to
7c81309
Compare
@@ -259,6 +259,8 @@ private NewCommandSourceHandler findCommandHandler(final CommandWrapper wrapper) | |||
} else { | |||
throw new UnsupportedCommandException(wrapper.commandName()); | |||
} | |||
} else if (wrapper.isLoanMigration()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need... you can just use the proper annotations and will be picked up dynamically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// implementation dependencies are directly used (compiled against) in src/main (and src/test) | ||
// | ||
implementation(project(path: ':fineract-core')) | ||
implementation(project(path: ':fineract-accounting')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need accounting and charge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@Schema(example = "MIGRATION_IN_PROGRESS", allowableValues = { "MIGRATION_IN_PROGRESS", "MIGRATION_SUCCESSFUL", "MIGRATION_FAILED" }) | ||
private String action; | ||
|
||
public String toJson() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this toJson
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use it in LoanMigrationApiResource
ex: new CommandWrapperBuilder().initiateLoanMigration(loanId).withJson(request.toJson()).build();
private String status; | ||
|
||
@Schema(example = "2024-01-01T12:00:00Z") | ||
private LocalDateTime migrationStartDateTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use OffsetDateTime please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also return dateformat to make easier to digest the consumer and locale...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
private Loan loan; | ||
|
||
@Column(name = "migration_start_datetime", nullable = false) | ||
private LocalDateTime migrationStartDateTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use OffsetDateTime please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
private LocalDateTime migrationEndDateTime; | ||
|
||
@Column(name = "status", nullable = false, length = 50) | ||
private String status; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be enum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
private CommandProcessingResult processMigrationCreation(Loan loan, String date, String dateFormat, String locale, String action) { | ||
LocalDateTime migrationDate = parseDate(date, dateFormat, locale); | ||
|
||
LoanMigration migration = LoanMigration.newInstance(loan, migrationDate, action); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add validations:
- We cannot mark completed or failed migration if it was never started for the loan: only loans where migration is IN PROGRESS can be marked as FAILED or COMPLETED
- We cannot mark loan as IN PROGRESS twice...
etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
LoanMigration migration = LoanMigration.newInstance(loan, migrationDate, action); | ||
loanMigrationRepository.save(migration); | ||
|
||
return new CommandProcessingResultBuilder().withEntityId(migration.getId()).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return the loan id as sub resource id please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
7c81309
to
8e97351
Compare
8e97351
to
7a3237c
Compare
Description
Introduce new loan migration module api
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.