use of org.mifos.accounts.util.helpers.PaymentData in project head by mifos.
the class SavingsBOIntegrationTest method testSuccessfulApplyPaymentWhenNoDepositDue.
@Test
public void testSuccessfulApplyPaymentWhenNoDepositDue() throws Exception {
createInitialObjects();
savingsOffering = helper.createSavingsOffering("dfasdasd1", "sad1");
savings = helper.createSavingsAccount("000X00000000013", savingsOffering, group, AccountStates.SAVINGS_ACC_APPROVED, userContext);
savings.setUserContext(TestObjectFactory.getContext());
PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
savings.changeStatus(AccountState.SAVINGS_CANCELLED, null, "", loggedInUser);
StaticHibernateUtil.getSessionTL().clear();
savings = savingsDao.findById(savings.getAccountId());
Money enteredAmount = new Money(currency, "100.0");
PaymentData paymentData = PaymentData.createPaymentData(enteredAmount, savings.getPersonnel(), Short.valueOf("1"), new Date(System.currentTimeMillis()));
paymentData.setCustomer(group);
paymentData.setReceiptDate(new Date(System.currentTimeMillis()));
paymentData.setReceiptNum("34244");
paymentData.addAccountPaymentData(getSavingsPaymentdata(null));
IntegrationTestObjectMother.applyAccountPayment(savings, paymentData);
savings = savingsDao.findById(savings.getAccountId());
Assert.assertEquals(AccountStates.SAVINGS_ACC_APPROVED, savings.getAccountState().getId().shortValue());
Assert.assertEquals(TestUtils.createMoney(100.0), savings.getSavingsBalance());
Assert.assertEquals(1, savings.getSavingsActivityDetails().size());
}
use of org.mifos.accounts.util.helpers.PaymentData in project head by mifos.
the class SavingsBOIntegrationTest method testSuccessfulWithdraw.
@Test
public void testSuccessfulWithdraw() throws AccountException, Exception {
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
client1 = TestObjectFactory.createClient("Client", CustomerStatus.CLIENT_ACTIVE, group);
savingsOffering = helper.createSavingsOffering("dfasdasd1", "sad1");
savings = TestObjectFactory.createSavingsAccount("43245434", client1, Short.valueOf("16"), new Date(System.currentTimeMillis()), savingsOffering);
savings = (SavingsBO) legacyAccountDao.getAccount(savings.getAccountId());
savings.setSavingsBalance(TestUtils.createMoney("100.0"));
Money enteredAmount = new Money(currency, "100.0");
PaymentData paymentData = PaymentData.createPaymentData(enteredAmount, savings.getPersonnel(), Short.valueOf("1"), new Date(System.currentTimeMillis()));
paymentData.setCustomer(client1);
paymentData.setReceiptDate(new Date(System.currentTimeMillis()));
paymentData.setReceiptNum("34244");
boolean persist = true;
savings.withdraw(paymentData, persist);
Assert.assertEquals(TestUtils.createMoney(), savings.getSavingsBalance());
Assert.assertEquals(1, savings.getSavingsActivityDetails().size());
savings.getAccountPayments().clear();
}
use of org.mifos.accounts.util.helpers.PaymentData in project head by mifos.
the class TestObjectFactory method getLoanAccountPaymentData.
public static PaymentData getLoanAccountPaymentData(final List<AccountActionDateEntity> accountActions, final Money totalAmount, final CustomerBO customer, final PersonnelBO personnel, final String receiptNum, final Short paymentId, final Date receiptDate, final Date transactionDate) {
PaymentData paymentData = PaymentData.createPaymentData(totalAmount, personnel, paymentId, transactionDate);
paymentData.setCustomer(customer);
paymentData.setReceiptDate(receiptDate);
paymentData.setReceiptNum(receiptNum);
return paymentData;
}
use of org.mifos.accounts.util.helpers.PaymentData in project head by mifos.
the class TestObjectFactory method getCustomerAccountPaymentDataView.
public static PaymentData getCustomerAccountPaymentDataView(final List<AccountActionDateEntity> accountActions, final Money totalAmount, final CustomerBO customer, final PersonnelBO personnel, final String receiptNum, final Short paymentId, final Date receiptDate, final Date transactionDate) {
PaymentData paymentData = PaymentData.createPaymentData(totalAmount, personnel, paymentId, transactionDate);
paymentData.setCustomer(customer);
paymentData.setReceiptDate(receiptDate);
paymentData.setReceiptNum(receiptNum);
for (AccountActionDateEntity actionDate : accountActions) {
CustomerAccountPaymentData customerAccountPaymentData = new CustomerAccountPaymentData(actionDate);
paymentData.addAccountPaymentData(customerAccountPaymentData);
}
return paymentData;
}
Aggregations