[ 
https://issues.apache.org/jira/browse/FINERACT-2779?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Krishna Mewara updated FINERACT-2779:
-------------------------------------
    Fix Version/s: 1.16.0

> Remove REST-assured and hand-built JSON from FeignLoanHelper
> ------------------------------------------------------------
>
>                 Key: FINERACT-2779
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2779
>             Project: Apache Fineract
>          Issue Type: Improvement
>          Components: Test
>    Affects Versions: 1.15.0
>            Reporter: Krishna Mewara
>            Assignee: Krishna Mewara
>            Priority: Trivial
>              Labels: feign-migration
>             Fix For: 1.16.0
>
>
> This refactor addresses issues in {{{}FeignLoanHelper{}}}, which previously 
> relied on REST-assured for some operations and hand-built JSON strings for 
> others. This defeated the purpose of the Feign migration, as JSON was parsed 
> straight back into a request model before being sent-costing unnecessary 
> round trips and losing compile-time safety.
> h3. Key Test Modifications
>  * *REST-assured completely removed:* The loan apply, approve, disburse, 
> disburse-to-savings, and reschedule paths no longer build their own request 
> specs or use hard-coded URLs. They now use the generated Feign client with 
> typed request models. There are zero REST-assured references left anywhere 
> under the Feign test folder.
>  * *JSON loan product paths removed:* Methods that relied on deserializing 
> JSON strings (e.g., {{{}createLoanProductFromJson{}}}, 
> {{{}getLoanProductError{}}}, and {{{}getLoanProductId{}}}) have been 
> eliminated.
>  * *Typed request builders introduced:* {{LoanProductTestBuilder}} now offers 
> {{{}buildRequest(){}}}, a typed counterpart to {{{}build(){}}}, allowing 
> callers to pass the request model directly. The legacy {{build()}} method 
> remains strictly for the older REST-assured-era tests.
>  * *Dead builder keys dropped:* Six keys emitted by the builder have been 
> removed because they have no corresponding field on 
> {{PostLoanProductsRequest}} ({{{}syncExpectedWithDisbursementDate{}}}, 
> {{{}mandatoryGuarantee{}}}, {{{}minimumGuaranteeFromGuarantor{}}}, 
> {{{}minimumGuaranteeFromOwnFunds{}}}, {{{}minimumGap{}}}, 
> {{{}maximumGap{}}}). The old JSON path dropped them as unknown properties 
> anyway, so leaving them unset sends the exact same body without requiring a 
> schema change.
> h3. Production Code & Swagger DTO Changes
> Because the typed client cannot send a field the spec does not declare, two 
> Swagger DTOs have been updated. Every field listed below is actively used by 
> a test in this change.
> *{{LoansApiResourceSwagger.PostLoansRequest}}* Gains the following fields:
>  * {{isFloatingInterestRate}}
>  * {{interestRateDifferential}}
>  * {{calendarId}}
>  * {{syncDisbursementWithMeeting}}
>  * {{interestChargedFromDate}}
>  * {{createStandingInstructionAtDisbursement}}
> *{{RescheduleLoansApiResourceSwagger}}*
>  * *Added field:* {{recalculateInterest}}
>  * *Data type corrections:* Corrected {{repaymentsStartingFromDate}} and 
> {{expectedDisbursementDate}} from {{LocalDate}} to {{{}String{}}}.
> {quote}*Note on backward compatibility:* The server reads both fields using 
> {{{}fromApiJsonHelper.extractLocalDateNamed{}}}, which parses using the 
> {{dateFormat}} sent in the request. {{LocalDate}} was previously incorrect, 
> as a generated client would serialize ISO into a body that declared "dd MMMM 
> yyyy". While the API backward-compatibility check will report a type change, 
> the wire format remains exactly the same; the spec is simply being corrected 
> to match what the server actually parses.
> {quote}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to