DeathGun44 commented on code in PR #6158: URL: https://github.com/apache/fineract/pull/6158#discussion_r3774979657
########## integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/LoanChargeCommandsApi.java: ########## @@ -0,0 +1,115 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.integrationtests.client.feign.helpers; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.apache.fineract.client.models.PostLoansLoanIdChargesChargeIdResponse; +import org.apache.fineract.client.models.PostLoansLoanIdChargesResponse; + +/** + * Feign interface for the two loan-charge request shapes the generated client cannot express. Both bind to the + * generated response models, so the calls stay typed end to end; neither builds a JSON body by hand. + * + * <p> + * These are the only loan-charge calls that need it - everything else goes through the generated + * {@code fineractClient.loanCharges()} API. + */ +@Headers({ "Accept: application/json", "Content-Type: application/json" }) +public interface LoanChargeCommandsApi { + + /** + * Waives a loan charge in full, sending <em>no</em> request body. + * + * <p> + * The generated {@code executeLoanCharge} always serialises at least <code>{}</code>, which this endpoint answers + * with a 500. The pre-migration test sent an empty body here, so this reproduces it exactly. A request model cannot + * express "no body at all", which is why this needs its own declaration rather than a Swagger DTO change. + * + * <p> + * Waiving a single installment of an instalment fee <em>does</em> take a body and goes through the generated + * client's typed {@code waiveLoanCharge} instead. + */ + @RequestLine("POST /v1/loans/{loanId}/charges/{loanChargeId}?command=waive") Review Comment: You're right, this isn't needed. I tested against a live server - waiving a whole charge with a {} body returns 200 (flat fee, percentage fee, penalty). I'd noted a 500 earlier but can't reproduce it; the server never reads the body for a non-installment charge anyway. Removing it and using the generated client! Small note: passing null doesn't work - Feign throws Body parameter N was null before sending. An empty request object is how it sends {}. I'd like to keep the second method (German "50,05") - that field is a JSON number in the spec, and the test exists to check comma parsing. Let me know if you disagree? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
