FINERACT-2620: Add type-safe Feign-based helpers and integration tests for the Savings domain#5907
Conversation
9c695a2 to
87078ea
Compare
|
|
||
| public static final String DATETIME_PATTERN = "dd MMMM yyyy"; | ||
| public static final String LOCALE = "en"; | ||
| public static final String DATE_FORMAT = DATETIME_PATTERN; |
There was a problem hiding this comment.
do we use this anywhere? What's the role of this field?
There was a problem hiding this comment.
removed it. each domain's request builders already use DATETIME_PATTERN via their own *TestData class, so the alias was unnecessary. thank you!
|
|
||
| public static PostSavingsAccountsAccountIdRequest rejectSavings(String rejectedOnDate) { | ||
| return new PostSavingsAccountsAccountIdRequest()// | ||
| .closedOnDate(rejectedOnDate)// |
There was a problem hiding this comment.
Strange that we use closedOnDate here, but as I checked it is probably a swagger model problem. Anyway, I don't think it's the right way to send rejectedOnDate on other parameter
There was a problem hiding this comment.
this is a limitation of the generated Swagger model. PostSavingsAccountsAccountIdRequest doesn't expose a rejectedOnDate field (only activatedOnDate, approvedOnDate, closedOnDate). the legacy helper works around this by constructing raw JSON with map.put("rejectedOnDate", ...), but that defeats the purpose of type-safe migration. the server accepts closedOnDate for the reject command, and our tests pass. this is a Swagger spec gap worth filing separately so we can improve our tests .thoughts?
There was a problem hiding this comment.
final JsonElement element = this.fromApiJsonHelper.parse(json);
final LocalDate rejectedOnDate = this.fromApiJsonHelper.extractLocalDateNamed("rejectedOnDate", element);
baseDataValidator.reset().parameter("rejectedOnDate").value(rejectedOnDate).notNull();
Are you sure server accepts it?
There was a problem hiding this comment.
No, you were right it doesn't. I traced through SavingsAccountApplicationTransitionApiJsonValidator.validateRejection() and confirmed it rejects closedOnDate as unsupported. My tests only passed because rejectSavings is called in cleanup code wrapped in a try/catch that silently logs the failure. I've filed #5934 to fix the Swagger spec and updated this branch to use .rejectedOnDate() directly. that will be the proper fix!
87078ea to
50887b7
Compare
| this.fineractClient = fineractClient; | ||
| } | ||
|
|
||
| public Long submitApplication(PostSavingsAccountsRequest request) { |
There was a problem hiding this comment.
Lets return the response directly, not just the savingsId.
That would improve the reusability and the data is anyway fetched and returned, we can use it ;)
| this.fineractClient = fineractClient; | ||
| } | ||
|
|
||
| public Long createSavingsProduct(PostSavingsProductsRequest request) { |
There was a problem hiding this comment.
Lets return the response object, not just the resourceId.
That would help reusability and the data is fetched anyway.
adamsaghy
left a comment
There was a problem hiding this comment.
Please review my concerns.
50887b7 to
11b4015
Compare
…s for the Savings domain Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
11b4015 to
d2b2de4
Compare
Description
Adds Feign-based helpers and integration tests for the Savings domain — mirrors the existing Loan test infrastructure.
New files
FeignTestConstantsFeignSavingsProductHelperFeignSavingsHelperFeignSavingsTransactionHelperSavingsTestDataSavingsRequestBuildersFeignSavingsTestBaseFeignSavingsLifecycleExtensionFeignSavingsLifecycleTestModified files
LoanTestDataDATETIME_PATTERNandLOCALEtoFeignTestConstants(source-compatible)Notes
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.