Merge pull request #553 from vishwasbabu/mifosx-436
updating loan transacation api to retreive office data
This commit is contained in:
+19
-13
@@ -19,6 +19,8 @@ import org.mifosplatform.portfolio.paymentdetail.data.PaymentDetailData;
|
|||||||
public class LoanTransactionData {
|
public class LoanTransactionData {
|
||||||
|
|
||||||
private final Long id;
|
private final Long id;
|
||||||
|
private final Long officeId;
|
||||||
|
private final String officeName;
|
||||||
|
|
||||||
private final LoanTransactionEnumData type;
|
private final LoanTransactionEnumData type;
|
||||||
|
|
||||||
@@ -38,24 +40,28 @@ public class LoanTransactionData {
|
|||||||
final Collection<CodeValueData> paymentTypeOptions;
|
final Collection<CodeValueData> paymentTypeOptions;
|
||||||
|
|
||||||
public static LoanTransactionData templateOnTop(LoanTransactionData loanTransactionData, Collection<CodeValueData> paymentTypeOptions) {
|
public static LoanTransactionData templateOnTop(LoanTransactionData loanTransactionData, Collection<CodeValueData> paymentTypeOptions) {
|
||||||
return new LoanTransactionData(loanTransactionData.id, loanTransactionData.type, loanTransactionData.paymentDetailData,
|
return new LoanTransactionData(loanTransactionData.id, loanTransactionData.officeId, loanTransactionData.officeName,
|
||||||
loanTransactionData.currency, loanTransactionData.date, loanTransactionData.amount, loanTransactionData.principalPortion,
|
loanTransactionData.type, loanTransactionData.paymentDetailData, loanTransactionData.currency, loanTransactionData.date,
|
||||||
loanTransactionData.interestPortion, loanTransactionData.feeChargesPortion, loanTransactionData.penaltyChargesPortion,
|
loanTransactionData.amount, loanTransactionData.principalPortion, loanTransactionData.interestPortion,
|
||||||
paymentTypeOptions, loanTransactionData.externalId);
|
loanTransactionData.feeChargesPortion, loanTransactionData.penaltyChargesPortion, paymentTypeOptions,
|
||||||
|
loanTransactionData.externalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoanTransactionData(final Long id, final LoanTransactionEnumData transactionType, final PaymentDetailData paymentDetailData,
|
public LoanTransactionData(final Long id, final Long officeId, final String officeName, final LoanTransactionEnumData transactionType,
|
||||||
final CurrencyData currency, final LocalDate date, final BigDecimal amount, final BigDecimal principalPortion,
|
final PaymentDetailData paymentDetailData, final CurrencyData currency, final LocalDate date, final BigDecimal amount,
|
||||||
final BigDecimal interestPortion, final BigDecimal feeChargesPortion, final BigDecimal penaltyChargesPortion, final String externalId) {
|
final BigDecimal principalPortion, final BigDecimal interestPortion, final BigDecimal feeChargesPortion,
|
||||||
this(id, transactionType, paymentDetailData, currency, date, amount, principalPortion, interestPortion, feeChargesPortion,
|
final BigDecimal penaltyChargesPortion, final String externalId) {
|
||||||
penaltyChargesPortion, null, externalId);
|
this(id, officeId, officeName, transactionType, paymentDetailData, currency, date, amount, principalPortion, interestPortion,
|
||||||
|
feeChargesPortion, penaltyChargesPortion, null, externalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoanTransactionData(final Long id, final LoanTransactionEnumData transactionType, final PaymentDetailData paymentDetailData,
|
public LoanTransactionData(final Long id, final Long officeId, final String officeName, final LoanTransactionEnumData transactionType,
|
||||||
final CurrencyData currency, final LocalDate date, final BigDecimal amount, final BigDecimal principalPortion,
|
final PaymentDetailData paymentDetailData, final CurrencyData currency, final LocalDate date, final BigDecimal amount,
|
||||||
final BigDecimal interestPortion, final BigDecimal feeChargesPortion, final BigDecimal penaltyChargesPortion,
|
final BigDecimal principalPortion, final BigDecimal interestPortion, final BigDecimal feeChargesPortion,
|
||||||
final Collection<CodeValueData> paymentTypeOptions, final String externalId) {
|
final BigDecimal penaltyChargesPortion, final Collection<CodeValueData> paymentTypeOptions, final String externalId) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
this.officeId = officeId;
|
||||||
|
this.officeName = officeName;
|
||||||
this.type = transactionType;
|
this.type = transactionType;
|
||||||
this.paymentDetailData = paymentDetailData;
|
this.paymentDetailData = paymentDetailData;
|
||||||
this.currency = currency;
|
this.currency = currency;
|
||||||
|
|||||||
+4
-3
@@ -394,8 +394,9 @@ public final class LoanTransaction extends AbstractPersistable<Long> {
|
|||||||
if (this.paymentDetail != null) {
|
if (this.paymentDetail != null) {
|
||||||
paymentDetailData = paymentDetail.toData();
|
paymentDetailData = paymentDetail.toData();
|
||||||
}
|
}
|
||||||
return new LoanTransactionData(this.getId(), transactionType, paymentDetailData, currencyData, getTransactionDate(), this.amount,
|
return new LoanTransactionData(this.getId(), this.office.getId(), this.office.getName(), transactionType, paymentDetailData,
|
||||||
this.principalPortion, this.interestPortion, this.feeChargesPortion, this.penaltyChargesPortion, this.externalId);
|
currencyData, getTransactionDate(), this.amount, this.principalPortion, this.interestPortion, this.feeChargesPortion,
|
||||||
|
this.penaltyChargesPortion, this.externalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> toMapData(final CurrencyData currencyData) {
|
public Map<String, Object> toMapData(final CurrencyData currencyData) {
|
||||||
@@ -452,7 +453,7 @@ public final class LoanTransaction extends AbstractPersistable<Long> {
|
|||||||
return externalId;
|
return externalId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRefund(){
|
public boolean isRefund() {
|
||||||
return LoanTransactionType.REFUND.equals(getTypeOf()) && isNotReversed();
|
return LoanTransactionType.REFUND.equals(getTypeOf()) && isNotReversed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-13
@@ -288,7 +288,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
final Collection<CalendarData> calendarsData = null;
|
final Collection<CalendarData> calendarsData = null;
|
||||||
final CalendarData collectionMeetingCalendar = null;
|
final CalendarData collectionMeetingCalendar = null;
|
||||||
final Collection<GroupRoleData> groupRoles = null;
|
final Collection<GroupRoleData> groupRoles = null;
|
||||||
groupAccount = GroupGeneralData.withAssocations(groupAccount, membersOfGroup, groupRoles, calendarsData, collectionMeetingCalendar);
|
groupAccount = GroupGeneralData.withAssocations(groupAccount, membersOfGroup, groupRoles, calendarsData,
|
||||||
|
collectionMeetingCalendar);
|
||||||
}
|
}
|
||||||
|
|
||||||
final LocalDate expectedDisbursementDate = DateUtils.getLocalDateOfTenant();
|
final LocalDate expectedDisbursementDate = DateUtils.getLocalDateOfTenant();
|
||||||
@@ -323,7 +324,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.REPAYMENT);
|
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.REPAYMENT);
|
||||||
final Collection<CodeValueData> paymentOptions = codeValueReadPlatformService
|
final Collection<CodeValueData> paymentOptions = codeValueReadPlatformService
|
||||||
.retrieveCodeValuesByCode(PaymentDetailConstants.paymentTypeCodeName);
|
.retrieveCodeValuesByCode(PaymentDetailConstants.paymentTypeCodeName);
|
||||||
return new LoanTransactionData(null, transactionType, null, currencyData, earliestUnpaidInstallmentDate,
|
return new LoanTransactionData(null, null, null, transactionType, null, currencyData, earliestUnpaidInstallmentDate,
|
||||||
possibleNextRepaymentAmount.getAmount(), null, null, null, null, paymentOptions, null);
|
possibleNextRepaymentAmount.getAmount(), null, null, null, null, paymentOptions, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,8 +348,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.WAIVE_INTEREST);
|
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.WAIVE_INTEREST);
|
||||||
|
|
||||||
final BigDecimal amount = waiveOfInterest.getAmount(currency).getAmount();
|
final BigDecimal amount = waiveOfInterest.getAmount(currency).getAmount();
|
||||||
return new LoanTransactionData(null, transactionType, null, currencyData, waiveOfInterest.getTransactionDate(), amount, null, null,
|
return new LoanTransactionData(null, null, null, transactionType, null, currencyData, waiveOfInterest.getTransactionDate(), amount,
|
||||||
null, null, null);
|
null, null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -357,8 +358,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
context.authenticatedUser();
|
context.authenticatedUser();
|
||||||
|
|
||||||
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.WRITEOFF);
|
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.WRITEOFF);
|
||||||
return new LoanTransactionData(null, transactionType, null, null, DateUtils.getLocalDateOfTenant(), null, null, null, null, null,
|
return new LoanTransactionData(null, null, null, transactionType, null, null, DateUtils.getLocalDateOfTenant(), null, null, null,
|
||||||
null);
|
null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -368,8 +369,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.DISBURSEMENT);
|
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.DISBURSEMENT);
|
||||||
final Collection<CodeValueData> paymentOptions = codeValueReadPlatformService
|
final Collection<CodeValueData> paymentOptions = codeValueReadPlatformService
|
||||||
.retrieveCodeValuesByCode(PaymentDetailConstants.paymentTypeCodeName);
|
.retrieveCodeValuesByCode(PaymentDetailConstants.paymentTypeCodeName);
|
||||||
return new LoanTransactionData(null, transactionType, null, null, loan.getExpectedDisbursedOnLocalDate(), null, null, null, null,
|
return new LoanTransactionData(null, null, null, transactionType, null, null, loan.getExpectedDisbursedOnLocalDate(), null, null,
|
||||||
null, paymentOptions, null);
|
null, null, null, paymentOptions, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -856,11 +857,12 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
+ " pd.receipt_number as receiptNumber, pd.bank_number as bankNumber,pd.routing_code as routingCode, "
|
+ " pd.receipt_number as receiptNumber, pd.bank_number as bankNumber,pd.routing_code as routingCode, "
|
||||||
+ " l.currency_code as currencyCode, l.currency_digits as currencyDigits, l.currency_multiplesof as inMultiplesOf, rc.`name` as currencyName, "
|
+ " l.currency_code as currencyCode, l.currency_digits as currencyDigits, l.currency_multiplesof as inMultiplesOf, rc.`name` as currencyName, "
|
||||||
+ " rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode, "
|
+ " rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode, "
|
||||||
+ " cv.code_value as paymentTypeName, tr.external_id as externalId "
|
+ " cv.code_value as paymentTypeName, tr.external_id as externalId, tr.office_id as officeId, office.name as officeName "
|
||||||
+ " from m_loan l join m_loan_transaction tr on tr.loan_id = l.id"
|
+ " from m_loan l join m_loan_transaction tr on tr.loan_id = l.id"
|
||||||
+ " join m_currency rc on rc.`code` = l.currency_code "
|
+ " join m_currency rc on rc.`code` = l.currency_code "
|
||||||
+ " left JOIN m_payment_detail pd ON tr.payment_detail_id = pd.id"
|
+ " left JOIN m_payment_detail pd ON tr.payment_detail_id = pd.id"
|
||||||
+ " left join m_code_value cv on pd.payment_type_cv_id = cv.id";
|
+ " left join m_code_value cv on pd.payment_type_cv_id = cv.id"
|
||||||
|
+ " left join m_office office on office.id=tr.office_id";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -876,6 +878,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
currencyDisplaySymbol, currencyNameCode);
|
currencyDisplaySymbol, currencyNameCode);
|
||||||
|
|
||||||
final Long id = rs.getLong("id");
|
final Long id = rs.getLong("id");
|
||||||
|
final Long officeId = rs.getLong("officeId");
|
||||||
|
final String officeName = rs.getString("officeName");
|
||||||
final int transactionTypeInt = JdbcSupport.getInteger(rs, "transactionType");
|
final int transactionTypeInt = JdbcSupport.getInteger(rs, "transactionType");
|
||||||
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(transactionTypeInt);
|
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(transactionTypeInt);
|
||||||
|
|
||||||
@@ -903,8 +907,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
final BigDecimal penaltyChargesPortion = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "penalties");
|
final BigDecimal penaltyChargesPortion = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "penalties");
|
||||||
final String externalId = rs.getString("externalId");
|
final String externalId = rs.getString("externalId");
|
||||||
|
|
||||||
return new LoanTransactionData(id, transactionType, paymentDetailData, currencyData, date, totalAmount, principalPortion,
|
return new LoanTransactionData(id, officeId, officeName, transactionType, paymentDetailData, currencyData, date, totalAmount,
|
||||||
interestPortion, feeChargesPortion, penaltyChargesPortion, externalId);
|
principalPortion, interestPortion, feeChargesPortion, penaltyChargesPortion, externalId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -969,7 +973,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
final Collection<CalendarData> calendarsData = null;
|
final Collection<CalendarData> calendarsData = null;
|
||||||
final CalendarData collectionMeetingCalendar = null;
|
final CalendarData collectionMeetingCalendar = null;
|
||||||
final Collection<GroupRoleData> groupRoles = null;
|
final Collection<GroupRoleData> groupRoles = null;
|
||||||
groupAccount = GroupGeneralData.withAssocations(groupAccount, membersOfGroup, groupRoles, calendarsData, collectionMeetingCalendar);
|
groupAccount = GroupGeneralData.withAssocations(groupAccount, membersOfGroup, groupRoles, calendarsData,
|
||||||
|
collectionMeetingCalendar);
|
||||||
}
|
}
|
||||||
|
|
||||||
return LoanAccountData.groupDefaults(groupAccount, expectedDisbursementDate);
|
return LoanAccountData.groupDefaults(groupAccount, expectedDisbursementDate);
|
||||||
|
|||||||
+1
-1
@@ -101,7 +101,7 @@ public final class TransfersDataValidator {
|
|||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(TransferApiConstants.newStaffIdParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(TransferApiConstants.newStaffIdParamName, element)) {
|
||||||
final Long newStaffId = this.fromApiJsonHelper.extractLongNamed(TransferApiConstants.newStaffIdParamName, element);
|
final Long newStaffId = this.fromApiJsonHelper.extractLongNamed(TransferApiConstants.newStaffIdParamName, element);
|
||||||
baseDataValidator.reset().parameter(TransferApiConstants.newStaffIdParamName).value(newStaffId).notNull()
|
baseDataValidator.reset().parameter(TransferApiConstants.newStaffIdParamName).value(newStaffId).ignoreIfNull()
|
||||||
.integerGreaterThanZero();
|
.integerGreaterThanZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user