3333import java .util .Locale ;
3434import java .util .Map ;
3535import java .util .Objects ;
36+ import lombok .Getter ;
37+ import lombok .Setter ;
3638import org .apache .fineract .accounting .glaccount .data .GLAccountData ;
3739import org .apache .fineract .accounting .glaccount .domain .GLAccount ;
3840import org .apache .fineract .infrastructure .core .api .JsonCommand ;
@@ -66,34 +68,41 @@ public class Charge extends AbstractPersistableCustom<Long> {
6668 public static final String LOCALE_PARAM_NAME = "locale" ;
6769 public static final String FEE_FREQUENCY_PARAM_NAME = "feeFrequency" ;
6870
71+ @ Getter
6972 @ Column (name = "name" , length = 100 )
7073 private String name ;
7174
75+ @ Getter
7276 @ Column (name = "amount" , scale = 6 , precision = 19 , nullable = false )
7377 private BigDecimal amount ;
7478
79+ @ Getter
7580 @ Column (name = "currency_code" , length = 3 )
7681 private String currencyCode ;
7782
7883 @ Column (name = "charge_applies_to_enum" , nullable = false )
7984 private Integer chargeAppliesTo ;
8085
86+ @ Getter
8187 @ Column (name = "charge_time_enum" , nullable = false )
8288 private Integer chargeTimeType ;
8389
90+ @ Getter
8491 @ Column (name = "charge_calculation_enum" )
8592 private Integer chargeCalculation ;
8693
87- @ Column (name = "charge_payment_mode_enum" , nullable = true )
94+ @ Getter
95+ @ Column (name = "charge_payment_mode_enum" )
8896 private Integer chargePaymentMode ;
8997
90- @ Column (name = "fee_on_day" , nullable = true )
98+ @ Column (name = "fee_on_day" )
9199 private Integer feeOnDay ;
92100
93- @ Column (name = "fee_interval" , nullable = true )
101+ @ Getter
102+ @ Column (name = "fee_interval" )
94103 private Integer feeInterval ;
95104
96- @ Column (name = "fee_on_month" , nullable = true )
105+ @ Column (name = "fee_on_month" )
97106 private Integer feeOnMonth ;
98107
99108 @ Column (name = "is_penalty" , nullable = false )
@@ -105,10 +114,12 @@ public class Charge extends AbstractPersistableCustom<Long> {
105114 @ Column (name = "is_deleted" , nullable = false )
106115 private boolean deleted = false ;
107116
108- @ Column (name = "min_cap" , scale = 6 , precision = 19 , nullable = true )
117+ @ Getter
118+ @ Column (name = "min_cap" , scale = 6 , precision = 19 )
109119 private BigDecimal minCap ;
110120
111- @ Column (name = "max_cap" , scale = 6 , precision = 19 , nullable = true )
121+ @ Getter
122+ @ Column (name = "max_cap" , scale = 6 , precision = 19 )
112123 private BigDecimal maxCap ;
113124
114125 @ Column (name = "fee_frequency" , nullable = true )
@@ -117,26 +128,35 @@ public class Charge extends AbstractPersistableCustom<Long> {
117128 @ Column (name = "is_free_withdrawal" , nullable = false )
118129 private boolean enableFreeWithdrawal ;
119130
120- @ Column (name = "free_withdrawal_charge_frequency" , nullable = true )
131+ @ Column (name = "free_withdrawal_charge_frequency" )
121132 private Integer freeWithdrawalFrequency ;
122133
123- @ Column (name = "restart_frequency" , nullable = true )
134+ @ Getter
135+ @ Column (name = "restart_frequency" )
124136 private Integer restartFrequency ;
125137
126- @ Column (name = "restart_frequency_enum" , nullable = true )
138+ @ Getter
139+ @ Column (name = "restart_frequency_enum" )
127140 private Integer restartFrequencyEnum ;
128141
142+ @ Getter
129143 @ Column (name = "is_payment_type" , nullable = false )
130144 private boolean enablePaymentType ;
131145
146+ @ Setter
147+ @ Getter
132148 @ ManyToOne
133149 @ JoinColumn (name = "payment_type_id" , nullable = false )
134150 private PaymentType paymentType ;
135151
152+ @ Getter
153+ @ Setter
136154 @ ManyToOne (fetch = FetchType .LAZY )
137155 @ JoinColumn (name = "income_or_liability_account_id" )
138156 private GLAccount account ;
139157
158+ @ Getter
159+ @ Setter
140160 @ ManyToOne
141161 @ JoinColumn (name = "tax_group_id" )
142162 private TaxGroup taxGroup ;
@@ -245,12 +265,9 @@ private Charge(final String name, final BigDecimal amount, final String currency
245265 this .restartFrequencyEnum = restartFrequencyEnum .getValue ();
246266 }
247267
248- if (enablePaymentType ) {
249- if (paymentType != null ) {
250-
251- this .enablePaymentType = true ;
252- this .paymentType = paymentType ;
253- }
268+ if (enablePaymentType && paymentType != null ) {
269+ this .enablePaymentType = true ;
270+ this .paymentType = paymentType ;
254271 }
255272
256273 } else if (isLoanCharge ()) {
@@ -279,26 +296,6 @@ private Charge(final String name, final BigDecimal amount, final String currency
279296 }
280297 }
281298
282- public String getName () {
283- return this .name ;
284- }
285-
286- public BigDecimal getAmount () {
287- return this .amount ;
288- }
289-
290- public String getCurrencyCode () {
291- return this .currencyCode ;
292- }
293-
294- public Integer getChargeTimeType () {
295- return this .chargeTimeType ;
296- }
297-
298- public Integer getChargeCalculation () {
299- return this .chargeCalculation ;
300- }
301-
302299 public boolean isActive () {
303300 return this .active ;
304301 }
@@ -351,14 +348,6 @@ public boolean isPercentageOfDisbursementAmount() {
351348 return ChargeCalculationType .fromInt (this .chargeCalculation ).isPercentageOfDisbursementAmount ();
352349 }
353350
354- public BigDecimal getMinCap () {
355- return this .minCap ;
356- }
357-
358- public BigDecimal getMaxCap () {
359- return this .maxCap ;
360- }
361-
362351 public boolean isEnableFreeWithdrawal () {
363352 return this .enableFreeWithdrawal ;
364353 }
@@ -371,22 +360,6 @@ public Integer getFrequencyFreeWithdrawalCharge() {
371360 return this .freeWithdrawalFrequency ;
372361 }
373362
374- public Integer getRestartFrequency () {
375- return this .restartFrequency ;
376- }
377-
378- public Integer getRestartFrequencyEnum () {
379- return this .restartFrequencyEnum ;
380- }
381-
382- public PaymentType getPaymentType () {
383- return this .paymentType ;
384- }
385-
386- public void setPaymentType (PaymentType paymentType ) {
387- this .paymentType = paymentType ;
388- }
389-
390363 private Long getPaymentTypeId () {
391364 Long paymentTypeId = null ;
392365 if (this .paymentType != null ) {
@@ -450,11 +423,9 @@ public Map<String, Object> update(final JsonCommand command) {
450423 baseDataValidator .reset ().parameter (CHARGE_TIME_PARAM_NAME ).value (this .chargeTimeType )
451424 .failWithCodeNoParameterAddedToErrorCode ("not.allowed.charge.time.for.loan" );
452425 }
453- } else if (isClientCharge ()) {
454- if (!isAllowedLoanChargeTime ()) {
455- baseDataValidator .reset ().parameter (CHARGE_TIME_PARAM_NAME ).value (this .chargeTimeType )
456- .failWithCodeNoParameterAddedToErrorCode ("not.allowed.charge.time.for.client" );
457- }
426+ } else if (isClientCharge () && !isAllowedLoanChargeTime ()) {
427+ baseDataValidator .reset ().parameter (CHARGE_TIME_PARAM_NAME ).value (this .chargeTimeType )
428+ .failWithCodeNoParameterAddedToErrorCode ("not.allowed.charge.time.for.client" );
458429 }
459430 }
460431
@@ -647,7 +618,7 @@ public Map<String, Object> update(final JsonCommand command) {
647618 }
648619
649620 /**
650- * Delete is a <i>soft delete</i>. Updates flag on charge so it wont appear in query/report results.
621+ * Delete is a <i>soft delete</i>. Updates flag on charge so it won't appear in query/report results.
651622 *
652623 * Any fields with unique constraints and prepended with id of record.
653624 */
@@ -690,14 +661,6 @@ public ChargeData toData() {
690661
691662 }
692663
693- public Integer getChargePaymentMode () {
694- return this .chargePaymentMode ;
695- }
696-
697- public Integer getFeeInterval () {
698- return this .feeInterval ;
699- }
700-
701664 public boolean isMonthlyFee () {
702665 return ChargeTimeType .fromInt (this .chargeTimeType ).isMonthlyFee ();
703666 }
@@ -726,14 +689,6 @@ public Integer feeFrequency() {
726689 return this .feeFrequency ;
727690 }
728691
729- public GLAccount getAccount () {
730- return this .account ;
731- }
732-
733- public void setAccount (GLAccount account ) {
734- this .account = account ;
735- }
736-
737692 public Long getIncomeAccountId () {
738693 Long incomeAccountId = null ;
739694 if (this .account != null ) {
@@ -755,14 +710,6 @@ public boolean isDisbursementCharge() {
755710 || ChargeTimeType .fromInt (this .chargeTimeType ).equals (ChargeTimeType .TRANCHE_DISBURSEMENT );
756711 }
757712
758- public TaxGroup getTaxGroup () {
759- return this .taxGroup ;
760- }
761-
762- public void setTaxGroup (TaxGroup taxGroup ) {
763- this .taxGroup = taxGroup ;
764- }
765-
766713 @ Override
767714 public boolean equals (Object o ) {
768715 if (this == o ) {
0 commit comments