DeathGun44 commented on code in PR #5907:
URL: https://github.com/apache/fineract/pull/5907#discussion_r3328254273


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/modules/SavingsRequestBuilders.java:
##########
@@ -0,0 +1,104 @@
+/**
+ * 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.modules;
+
+import java.math.BigDecimal;
+import org.apache.fineract.client.models.PostSavingsAccountTransactionsRequest;
+import org.apache.fineract.client.models.PostSavingsAccountsAccountIdRequest;
+import org.apache.fineract.client.models.PostSavingsAccountsRequest;
+import org.apache.fineract.client.models.PostSavingsProductsRequest;
+import org.apache.fineract.integrationtests.common.Utils;
+
+public final class SavingsRequestBuilders {
+
+    private SavingsRequestBuilders() {}
+
+    public static PostSavingsProductsRequest defaultSavingsProduct() {
+        return new PostSavingsProductsRequest()//
+                .name("Savings Product " + System.currentTimeMillis())//
+                .shortName(Utils.uniqueRandomStringGenerator("", 4))//
+                .description("Test savings product")//
+                .currencyCode("USD")//
+                .digitsAfterDecimal(4)//
+                .inMultiplesOf(0)//
+                .nominalAnnualInterestRate(10.0)//
+                
.interestCompoundingPeriodType(SavingsTestData.InterestCompoundingPeriodType.DAILY)//
+                
.interestPostingPeriodType(SavingsTestData.InterestPostingPeriodType.MONTHLY)//
+                
.interestCalculationType(SavingsTestData.InterestCalculationType.DAILY_BALANCE)//
+                
.interestCalculationDaysInYearType(SavingsTestData.InterestCalculationDaysInYearType.DAYS_365)//
+                .accountingRule(SavingsTestData.AccountingRule.NONE)//
+                .locale(SavingsTestData.LOCALE);
+    }
+
+    public static PostSavingsAccountsRequest submitSavingsApplication(Long 
clientId, Long productId, String submittedOnDate) {
+        return new PostSavingsAccountsRequest()//
+                .clientId(clientId)//
+                .productId(productId)//
+                .submittedOnDate(submittedOnDate)//
+                .dateFormat(SavingsTestData.DATETIME_PATTERN)//
+                .locale(SavingsTestData.LOCALE);
+    }
+
+    public static PostSavingsAccountsAccountIdRequest approveSavings(String 
approvedOnDate) {
+        return new PostSavingsAccountsAccountIdRequest()//
+                .approvedOnDate(approvedOnDate)//
+                .dateFormat(SavingsTestData.DATETIME_PATTERN)//
+                .locale(SavingsTestData.LOCALE);
+    }
+
+    public static PostSavingsAccountsAccountIdRequest activateSavings(String 
activatedOnDate) {
+        return new PostSavingsAccountsAccountIdRequest()//
+                .activatedOnDate(activatedOnDate)//
+                .dateFormat(SavingsTestData.DATETIME_PATTERN)//
+                .locale(SavingsTestData.LOCALE);
+    }
+
+    public static PostSavingsAccountsAccountIdRequest closeSavings(String 
closedOnDate, boolean withdrawBalance) {
+        return new PostSavingsAccountsAccountIdRequest()//
+                .closedOnDate(closedOnDate)//
+                .withdrawBalance(withdrawBalance)//
+                .dateFormat(SavingsTestData.DATETIME_PATTERN)//
+                .locale(SavingsTestData.LOCALE);
+    }
+
+    public static PostSavingsAccountsAccountIdRequest rejectSavings(String 
rejectedOnDate) {
+        return new PostSavingsAccountsAccountIdRequest()//
+                .closedOnDate(rejectedOnDate)//

Review 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?



-- 
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]

Reply via email to