use of org.mifos.dto.domain.CustomerDto in project head by mifos.
the class BulkEntryActionStrutsTest method createDefaultCollectionSheetDto.
private CollectionSheetEntryFormDto createDefaultCollectionSheetDto() {
List<OfficeDetailsDto> activeBranches = new ArrayList<OfficeDetailsDto>();
List<ListItem<Short>> paymentTypesDtoList = new ArrayList<ListItem<Short>>();
List<CustomerDto> customerList = new ArrayList<CustomerDto>();
List<PersonnelDto> loanOfficerList = new ArrayList<PersonnelDto>();
final Short reloadFormAutomatically = Constants.YES;
final Short backDatedTransactionAllowed = Constants.NO;
final Short centerHierarchyExists = Constants.YES;
final Date meetingDate = new Date();
return new CollectionSheetEntryFormDto(activeBranches, paymentTypesDtoList, loanOfficerList, customerList, reloadFormAutomatically, centerHierarchyExists, backDatedTransactionAllowed, meetingDate);
}
use of org.mifos.dto.domain.CustomerDto in project head by mifos.
the class BulkEntryActionStrutsTest method getCusomerView.
private CustomerDto getCusomerView(final CustomerBO customer) {
CustomerDto customerDto = new CustomerDto();
customerDto.setCustomerId(customer.getCustomerId());
customerDto.setCustomerLevelId(customer.getCustomerLevel().getId());
customerDto.setCustomerSearchId(customer.getSearchId());
customerDto.setDisplayName(customer.getDisplayName());
customerDto.setGlobalCustNum(customer.getGlobalCustNum());
customerDto.setOfficeId(customer.getOffice().getOfficeId());
if (null != customer.getParentCustomer()) {
customerDto.setParentCustomerId(customer.getParentCustomer().getCustomerId());
}
customerDto.setPersonnelId(customer.getPersonnel().getPersonnelId());
customerDto.setStatusId(customer.getCustomerStatus().getId());
return customerDto;
}
use of org.mifos.dto.domain.CustomerDto in project head by mifos.
the class BulkEntryActionStrutsTest method setMasterListInSession.
private void setMasterListInSession(final Integer customerId) throws PageExpiredException {
OfficeDetailsDto office = new OfficeDetailsDto(Short.valueOf("3"), "Branch", OfficeConstants.BRANCHOFFICE, Integer.valueOf("0"));
List<OfficeDetailsDto> branchOfficesList = new ArrayList<OfficeDetailsDto>();
branchOfficesList.add(office);
SessionUtils.setCollectionAttribute(OfficeConstants.OFFICESBRANCHOFFICESLIST, branchOfficesList, request);
PersonnelDto personnel = new PersonnelDto(Short.valueOf("3"), "John");
List<PersonnelDto> personnelList = new ArrayList<PersonnelDto>();
personnelList.add(personnel);
SessionUtils.setCollectionAttribute(CustomerConstants.LOAN_OFFICER_LIST, personnelList, request);
CustomerDto parentCustomer = new CustomerDto(customerId, "Center_Active", Short.valueOf(CustomerLevel.CENTER.getValue()), "1.1");
List<CustomerDto> customerList = new ArrayList<CustomerDto>();
customerList.add(parentCustomer);
SessionUtils.setCollectionAttribute(CollectionSheetEntryConstants.CUSTOMERSLIST, customerList, request);
}
use of org.mifos.dto.domain.CustomerDto in project head by mifos.
the class CustomerStatusUpdateTest method rollsbackTransactionClosesSessionAndThrowsRuntimeExceptionWhenExceptionOccurs.
@Test(expected = MifosRuntimeException.class)
public void rollsbackTransactionClosesSessionAndThrowsRuntimeExceptionWhenExceptionOccurs() throws Exception {
// setup
UserContext userContext = TestUtils.makeUser();
CustomerStatusUpdate customerStatusUpdate = new CustomerStatusUpdateBuilder().with(CustomerStatus.CENTER_INACTIVE).build();
CenterBO existingCenter = new CenterBuilder().withVersion(customerStatusUpdate.getVersionNum()).active().build();
CustomerDto customer1 = new CustomerDto();
List<CustomerDto> clientsThatAreNotCancelledOrClosed = new ArrayList<CustomerDto>();
clientsThatAreNotCancelledOrClosed.add(customer1);
// stubbing
when(customerDao.findCustomerById(customerStatusUpdate.getCustomerId())).thenReturn(existingCenter);
doThrow(new RuntimeException()).when(customerDao).save(existingCenter);
// exercise test
customerService.updateCustomerStatus(userContext, customerStatusUpdate);
// verification
verify(hibernateTransaction).rollbackTransaction();
verify(hibernateTransaction).closeSession();
}
use of org.mifos.dto.domain.CustomerDto in project head by mifos.
the class K2RESTController method processLoanPayment.
private Map<String, String> processLoanPayment(LoanBO loanBO, String k2TransactionId, String acNo, String mmSystemId, LocalDate transactionDate, BigDecimal amount, String currency) throws Exception {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserReferenceDto userDto = new UserReferenceDto((short) user.getUserId());
AccountReferenceDto accountReferenceDto = new AccountReferenceDto(loanBO.getAccountId());
PaymentTypeDto paymentTypeDto = null;
List<PaymentTypeDto> loanPaymentTypes = accountService.getLoanPaymentTypes();
for (PaymentTypeDto paymentTypeDtoIterator : loanPaymentTypes) {
if (paymentTypeDtoIterator.getName().equals(mmSystemId)) {
paymentTypeDto = paymentTypeDtoIterator;
break;
}
}
if (paymentTypeDto == null || !loanBO.getCurrency().getCurrencyCode().equals(currency)) {
return invalidPayment();
}
CustomerDto customerDto = loanBO.getCustomer().toCustomerDto();
LocalDate receiptLocalDate = transactionDate;
String receiptIdString = k2TransactionId;
AccountPaymentParametersDto payment = new AccountPaymentParametersDto(userDto, accountReferenceDto, amount, transactionDate, paymentTypeDto, acNo, receiptLocalDate, receiptIdString, customerDto);
accountService.makePayment(payment);
return accepted();
}
Aggregations