Search in sources :

Example 61 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class IntegrationTestObjectMother method createClient.

public static void createClient(ClientBO client, MeetingBO meeting, AmountFeeBO fee) throws CustomerException {
    UserContext userContext = TestUtils.makeUser();
    client.setUserContext(userContext);
    AccountFeesEntity accountFee = new AccountFeesEntity(null, fee, fee.getFeeAmount().getAmountDoubleValue());
    List<AccountFeesEntity> accountFees = new ArrayList<AccountFeesEntity>();
    accountFees.add(accountFee);
    List<SavingsOfferingBO> selectedOfferings = new ArrayList<SavingsOfferingBO>();
    customerService.createClient(client, meeting, accountFees, selectedOfferings);
}
Also used : UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity)

Example 62 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class SavingsAccountRESTController method createSavingsAccount.

@RequestMapping(value = "/account/savings/create", method = RequestMethod.POST)
@ResponseBody
public Map<String, String> createSavingsAccount(@RequestParam String globalCustomerNum, @RequestParam(required = false) String amount, @RequestParam Integer productId) throws Throwable {
    CustomerBO customer = validateGlobalCustNum(globalCustomerNum);
    SavingsOfferingBO product = validateProductId(productId);
    String recommendedAmount = null != amount ? amount : product.getRecommendedAmount().toString();
    Integer customerId = customer.getCustomerId();
    AccountState accountState = AccountState.SAVINGS_PENDING_APPROVAL;
    SavingsAccountCreationDto savingsAccountCreation = new SavingsAccountCreationDto(productId, customerId, accountState.getValue(), recommendedAmount);
    Long savings = savingsServiceFacade.createSavingsAccount(savingsAccountCreation);
    SavingsAccountDetailDto details = savingsServiceFacade.retrieveSavingsAccountDetails(savings);
    Map<String, String> map = new HashMap<String, String>();
    map.put("customerName", customer.getDisplayName());
    map.put("productName", product.getPrdOfferingName());
    map.put("interesRate", details.getProductDetails().getInterestRate().toString());
    map.put("interestRatePeriod", details.getProductDetails().getInterestCalculationFrequency().toString());
    map.put("recommendedAmount", recommendedAmount);
    return map;
}
Also used : HashMap(java.util.HashMap) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) CustomerBO(org.mifos.customers.business.CustomerBO) SavingsAccountCreationDto(org.mifos.dto.domain.SavingsAccountCreationDto) AccountState(org.mifos.accounts.util.helpers.AccountState) SavingsAccountDetailDto(org.mifos.dto.domain.SavingsAccountDetailDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 63 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class SavingsPrdBusinessServiceIntegrationTest method testGetAllSavingsProducts.

@Test
public void testGetAllSavingsProducts() throws Exception {
    SavingsOfferingBO savingsOffering = createSavingsOfferingBO();
    Assert.assertEquals(1, savingsProductDao.findAllSavingsProducts().size());
    savingsOffering = null;
}
Also used : SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) Test(org.junit.Test)

Aggregations

SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)63 Test (org.junit.Test)33 ArrayList (java.util.ArrayList)20 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)17 SavingsProductBuilder (org.mifos.domain.builders.SavingsProductBuilder)14 MeetingBO (org.mifos.application.meeting.business.MeetingBO)11 LocalDate (org.joda.time.LocalDate)10 SavingsAccountBuilder (org.mifos.domain.builders.SavingsAccountBuilder)10 Date (java.util.Date)9 UserContext (org.mifos.security.util.UserContext)9 Date (java.sql.Date)8 DateTime (org.joda.time.DateTime)8 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)8 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)8 SavingsTestHelper (org.mifos.accounts.savings.util.helpers.SavingsTestHelper)8 MifosRuntimeException (org.mifos.core.MifosRuntimeException)8 CustomerException (org.mifos.customers.exceptions.CustomerException)7 Money (org.mifos.framework.util.helpers.Money)7 AccountException (org.mifos.accounts.exceptions.AccountException)6 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)5