From 308ede861cf8c72344fe431c79949d74e1c1135e Mon Sep 17 00:00:00 2001 From: rrpawar96 Date: Mon, 11 Jul 2022 15:55:58 +0530 Subject: [PATCH] FINERACT-1402:PaymentTypeMandatory --- .../savings/data/SavingsAccountTransactionDataValidator.java | 3 +++ .../integrationtests/common/savings/SavingsAccountHelper.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java index c625404c3..2a0047ef3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java @@ -124,6 +124,9 @@ public class SavingsAccountTransactionDataValidator { final BigDecimal transactionAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(transactionAmountParamName, element); baseDataValidator.reset().parameter(transactionAmountParamName).value(transactionAmount).notNull().positiveAmount(); + final Integer paymentType = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(paymentTypeIdParamName, element); + baseDataValidator.reset().parameter(paymentTypeIdParamName).value(paymentType).notNull(); + validatePaymentTypeDetails(baseDataValidator, element); throwExceptionIfValidationWarningsExist(dataValidationErrors); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/savings/SavingsAccountHelper.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/savings/SavingsAccountHelper.java index 5f3016e2b..e76abd6f6 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/savings/SavingsAccountHelper.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/savings/SavingsAccountHelper.java @@ -88,6 +88,7 @@ public class SavingsAccountHelper { public static final String TRANSACTION_DATE_PLUS_ONE = "02 March 2013"; public static final String LAST_TRANSACTION_DATE = "01 March 2013"; public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL"; + public static final Integer PAYMENT_TYPE_ID = 1; public static final String DATE_TIME_FORMAT = "dd MMMM yyyy HH:mm"; private static final Boolean IS_BLOCK = false; @@ -456,11 +457,12 @@ public class SavingsAccountHelper { } private String getSavingsTransactionJSON(final String amount, final String transactionDate) { - final HashMap map = new HashMap<>(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.LOCALE); map.put("dateFormat", CommonConstants.DATE_FORMAT); map.put("transactionDate", transactionDate); map.put("transactionAmount", amount); + map.put("paymentTypeId", PAYMENT_TYPE_ID); String savingsAccountWithdrawalJson = new Gson().toJson(map); LOG.info(savingsAccountWithdrawalJson); return savingsAccountWithdrawalJson;