fix for saving payment details in collection sheet

This commit is contained in:
sachinkulkarni12
2015-04-13 18:38:49 +05:30
parent f4ed5f80dd
commit 19e568e8f9
3 changed files with 16 additions and 8 deletions
@@ -12,6 +12,7 @@ import org.joda.time.LocalDate;
import org.mifosplatform.infrastructure.codes.data.CodeValueData;
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
import org.mifosplatform.portfolio.loanproduct.data.LoanProductData;
import org.mifosplatform.portfolio.paymenttype.data.PaymentTypeData;
import org.mifosplatform.portfolio.savings.data.SavingsProductData;
/**
@@ -25,11 +26,11 @@ public class JLGCollectionSheetData {
private final Collection<SavingsProductData> savingsProducts;
private final Collection<JLGGroupData> groups;
private final List<EnumOptionData> attendanceTypeOptions;
private final Collection<CodeValueData> paymentTypeOptions;
private final Collection<PaymentTypeData> paymentTypeOptions;
public static JLGCollectionSheetData instance(final LocalDate date, final Collection<LoanProductData> loanProducts,
final Collection<JLGGroupData> groups, final List<EnumOptionData> attendanceTypeOptions,
final Collection<CodeValueData> paymentTypeOptions) {
final Collection<PaymentTypeData> paymentTypeOptions) {
return new JLGCollectionSheetData(date, loanProducts, null, groups, attendanceTypeOptions, paymentTypeOptions);
}
@@ -42,7 +43,7 @@ public class JLGCollectionSheetData {
private JLGCollectionSheetData(LocalDate dueDate, Collection<LoanProductData> loanProducts,
Collection<SavingsProductData> savingsProducts, Collection<JLGGroupData> groups, List<EnumOptionData> attendanceTypeOptions,
final Collection<CodeValueData> paymentTypeOptions) {
final Collection<PaymentTypeData> paymentTypeOptions) {
this.dueDate = dueDate;
this.loanProducts = loanProducts;
this.savingsProducts = savingsProducts;
@@ -52,6 +52,8 @@ import org.mifosplatform.portfolio.loanproduct.data.LoanProductData;
import org.mifosplatform.portfolio.meeting.attendance.service.AttendanceDropdownReadPlatformService;
import org.mifosplatform.portfolio.meeting.attendance.service.AttendanceEnumerations;
import org.mifosplatform.portfolio.paymentdetail.PaymentDetailConstants;
import org.mifosplatform.portfolio.paymenttype.data.PaymentTypeData;
import org.mifosplatform.portfolio.paymenttype.service.PaymentTypeReadPlatformService;
import org.mifosplatform.portfolio.savings.data.SavingsProductData;
import org.mifosplatform.useradministration.domain.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
@@ -75,6 +77,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
private final AttendanceDropdownReadPlatformService attendanceDropdownReadPlatformService;
private final MandatorySavingsCollectionsheetExtractor mandatorySavingsExtractor = new MandatorySavingsCollectionsheetExtractor();
private final CodeValueReadPlatformService codeValueReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService;
@Autowired
public CollectionSheetReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource,
@@ -82,7 +85,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
final CollectionSheetGenerateCommandFromApiJsonDeserializer collectionSheetGenerateCommandFromApiJsonDeserializer,
final CalendarRepositoryWrapper calendarRepositoryWrapper,
final AttendanceDropdownReadPlatformService attendanceDropdownReadPlatformService,
final CodeValueReadPlatformService codeValueReadPlatformService) {
final CodeValueReadPlatformService codeValueReadPlatformService, final PaymentTypeReadPlatformService paymentTypeReadPlatformService) {
this.context = context;
this.centerReadPlatformService = centerReadPlatformService;
this.namedParameterjdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
@@ -91,6 +94,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
this.calendarRepositoryWrapper = calendarRepositoryWrapper;
this.attendanceDropdownReadPlatformService = attendanceDropdownReadPlatformService;
this.codeValueReadPlatformService = codeValueReadPlatformService;
this.paymentTypeReadPlatformService = paymentTypeReadPlatformService;
}
/*
@@ -105,8 +109,8 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
boolean firstTime = true;
Long prevGroupId = null;
Long prevClientId = null;
final Collection<CodeValueData> paymentOptions = this.codeValueReadPlatformService
.retrieveCodeValuesByCode(PaymentDetailConstants.paymentTypeCodeName);
final Collection<PaymentTypeData> paymentOptions = this.paymentTypeReadPlatformService.retrieveAllPaymentTypes();
final List<JLGGroupData> jlgGroupsData = new ArrayList<>();
List<JLGClientData> clientsData = new ArrayList<>();
@@ -24,6 +24,7 @@ import org.mifosplatform.portfolio.loanaccount.service.LoanWritePlatformService;
import org.mifosplatform.portfolio.meeting.service.MeetingWritePlatformService;
import org.mifosplatform.portfolio.paymentdetail.domain.PaymentDetail;
import org.mifosplatform.portfolio.paymentdetail.domain.PaymentDetailAssembler;
import org.mifosplatform.portfolio.paymentdetail.service.PaymentDetailWritePlatformService;
import org.mifosplatform.portfolio.savings.data.SavingsAccountTransactionDTO;
import org.mifosplatform.portfolio.savings.domain.DepositAccountAssembler;
import org.mifosplatform.portfolio.savings.domain.SavingsAccountTransaction;
@@ -42,6 +43,7 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col
private final DepositAccountAssembler accountAssembler;
private final DepositAccountWritePlatformService accountWritePlatformService;
private final PaymentDetailAssembler paymentDetailAssembler;
private final PaymentDetailWritePlatformService paymentDetailWritePlatformService;
@Autowired
public CollectionSheetWritePlatformServiceJpaRepositoryImpl(final LoanWritePlatformService loanWritePlatformService,
@@ -49,7 +51,7 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col
final CollectionSheetBulkDisbursalCommandFromApiJsonDeserializer bulkDisbursalCommandFromApiJsonDeserializer,
final CollectionSheetTransactionDataValidator transactionDataValidator,
final MeetingWritePlatformService meetingWritePlatformService, final DepositAccountAssembler accountAssembler,
final DepositAccountWritePlatformService accountWritePlatformService, final PaymentDetailAssembler paymentDetailAssembler) {
final DepositAccountWritePlatformService accountWritePlatformService, final PaymentDetailAssembler paymentDetailAssembler, final PaymentDetailWritePlatformService paymentDetailWritePlatformService) {
this.loanWritePlatformService = loanWritePlatformService;
this.bulkRepaymentCommandFromApiJsonDeserializer = bulkRepaymentCommandFromApiJsonDeserializer;
this.bulkDisbursalCommandFromApiJsonDeserializer = bulkDisbursalCommandFromApiJsonDeserializer;
@@ -58,6 +60,7 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col
this.accountAssembler = accountAssembler;
this.accountWritePlatformService = accountWritePlatformService;
this.paymentDetailAssembler = paymentDetailAssembler;
this.paymentDetailWritePlatformService = paymentDetailWritePlatformService;
}
@Override
@@ -74,7 +77,7 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col
changes.put("note", noteText);
}
final PaymentDetail paymentDetail = this.paymentDetailAssembler.fetchPaymentDetail(command.parsedJson().getAsJsonObject());
final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes);
changes.putAll(updateBulkReapayments(command, paymentDetail));
changes.putAll(updateBulkDisbursals(command));