Skip to content

Commit

Permalink
FINERACT-2103: refactor the boilerplate code for ChargeData class a…
Browse files Browse the repository at this point in the history
…nd its affiliate code
  • Loading branch information
Zeyad2003 authored and adamsaghy committed Jul 4, 2024
1 parent cfdfa6c commit 0358921
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 254 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ private List<ChargeToGLAccountMapper> fetchChargeToIncomeAccountMappings(final P
final Long chargeId = (Long) chargeToIncomeAccountMap.get("chargeId");
final String chargeName = (String) chargeToIncomeAccountMap.get("chargeName");
final Boolean penalty1 = (Boolean) chargeToIncomeAccountMap.get("penalty");
final ChargeData chargeData = ChargeData.lookup(chargeId, chargeName, penalty1);
final ChargeData chargeData = ChargeData.builder().id(chargeId).name(chargeName).penalty(penalty1).build();
final ChargeToGLAccountMapper chargeToGLAccountMapper = new ChargeToGLAccountMapper().setCharge(chargeData)
.setIncomeAccount(gLAccountData);
chargeToGLAccountMappers.add(chargeToGLAccountMapper);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,10 +677,14 @@ public ChargeData toData() {
}

final CurrencyData currency = new CurrencyData(this.currencyCode, null, 0, 0, null, null);
return ChargeData.instance(getId(), this.name, this.amount, currency, chargeTimeType, chargeAppliesTo, chargeCalculationType,
chargePaymentMode, getFeeOnMonthDay(), this.feeInterval, this.penalty, this.active, this.enableFreeWithdrawal,
this.freeWithdrawalFrequency, this.restartFrequency, this.restartFrequencyEnum, this.enablePaymentType, paymentTypeData,
this.minCap, this.maxCap, feeFrequencyType, accountData, taxGroupData);
return ChargeData.builder().id(getId()).name(this.name).amount(this.amount).currency(currency).chargeTimeType(chargeTimeType)
.chargeAppliesTo(chargeAppliesTo).chargeCalculationType(chargeCalculationType).chargePaymentMode(chargePaymentMode)
.feeOnMonthDay(getFeeOnMonthDay()).feeInterval(this.feeInterval).penalty(this.penalty).active(this.active)
.freeWithdrawal(this.enableFreeWithdrawal).freeWithdrawalChargeFrequency(this.freeWithdrawalFrequency)
.restartFrequency(this.restartFrequency).restartFrequencyEnum(this.restartFrequencyEnum)
.isPaymentType(this.enablePaymentType).paymentTypeOptions(paymentTypeData).minCap(this.minCap).maxCap(this.maxCap)
.feeFrequency(feeFrequencyType).incomeOrLiabilityAccount(accountData).taxGroup(taxGroupData).build();

}

public Integer getChargePaymentMode() {
Expand Down
Loading

0 comments on commit 0358921

Please sign in to comment.