Skip to content

Commit 9fd62e9

Browse files
FINERACT-2455: added e2e test scenarios for Working Capital Delinquency Buckets
1 parent 083a9e5 commit 9fd62e9

10 files changed

Lines changed: 602 additions & 69 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.fineract.test.data.delinquency;
20+
21+
import lombok.Getter;
22+
23+
public enum DelinquencyBucketType {
24+
25+
REGULAR(1L, "bucketType.regular"), WORKING_CAPITAL(2L, "bucketType.workingCapital");
26+
27+
@Getter
28+
public final Long value;
29+
30+
@Getter
31+
public final String code;
32+
33+
DelinquencyBucketType(Long value, String code) {
34+
this.value = value;
35+
this.code = code;
36+
}
37+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.fineract.test.data.delinquency;
21+
22+
import lombok.Getter;
23+
24+
public enum DelinquencyFrequencyType {
25+
26+
DAYS(0, "delinquencyFrequencyType.days"), //
27+
WEEKS(1, "delinquencyFrequencyType.weeks"), //
28+
MONTHS(2, "delinquencyFrequencyType.months"), //
29+
YEARS(3, "delinquencyFrequencyType.years");
30+
31+
@Getter
32+
private final Integer value;
33+
@Getter
34+
private final String code;
35+
36+
DelinquencyFrequencyType(final Integer value, final String code) {
37+
this.value = value;
38+
this.code = code;
39+
}
40+
41+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.fineract.test.data.delinquency;
20+
21+
import lombok.Getter;
22+
23+
public enum DelinquencyMinimumPayment {
24+
25+
PERCENTAGE(1L, "delinquencyMinimumPayment.percentage"), FLAT(2L, "delinquencyMinimumPayment.flat");
26+
27+
@Getter
28+
private final Long value;
29+
@Getter
30+
private final String code;
31+
32+
DelinquencyMinimumPayment(Long value, String code) {
33+
this.value = value;
34+
this.code = code;
35+
}
36+
}

fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/WorkingCapitalRequestFactory.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,16 @@
3232
import java.util.ArrayList;
3333
import java.util.List;
3434
import lombok.RequiredArgsConstructor;
35+
import org.apache.fineract.client.models.DelinquencyBucketRequest;
36+
import org.apache.fineract.client.models.MinimumPaymentPeriodAndRule;
3537
import org.apache.fineract.client.models.PaymentAllocationOrder;
3638
import org.apache.fineract.client.models.PostAllowAttributeOverrides;
3739
import org.apache.fineract.client.models.PostPaymentAllocation;
3840
import org.apache.fineract.client.models.PostWorkingCapitalLoanProductsRequest;
3941
import org.apache.fineract.client.models.PutWorkingCapitalLoanProductsProductIdRequest;
42+
import org.apache.fineract.test.data.delinquency.DelinquencyBucketType;
43+
import org.apache.fineract.test.data.delinquency.DelinquencyFrequencyType;
44+
import org.apache.fineract.test.data.delinquency.DelinquencyMinimumPayment;
4045
import org.apache.fineract.test.helper.Utils;
4146
import org.springframework.stereotype.Component;
4247

@@ -156,4 +161,16 @@ public static PostPaymentAllocation createPaymentAllocation(String transactionTy
156161
return paymentAllocationData;
157162
}
158163

164+
public DelinquencyBucketRequest defaultWorkingCapitalDelinquencyBucketRequest() {
165+
return new DelinquencyBucketRequest() //
166+
.name("DB-WCL-" + Utils.randomStringGenerator(8)) //
167+
.bucketType(DelinquencyBucketType.WORKING_CAPITAL.getValue().toString())//
168+
.ranges(List.of(1L)) //
169+
.minimumPaymentPeriodAndRule(new MinimumPaymentPeriodAndRule() //
170+
.frequency(1L) //
171+
.minimumPaymentType(DelinquencyMinimumPayment.PERCENTAGE.getValue()) //
172+
.frequencyType(DelinquencyFrequencyType.WEEKS.getValue()) //
173+
.minimumPayment(BigDecimal.valueOf(1.23D)));
174+
}
175+
159176
}

fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,4 +1044,20 @@ public static String paymentAllocationRulesInvalidValueFailure() {
10441044
public static String workingCapitalLoanProductIdentifiedDoesNotExistFailure(String identifierId) {
10451045
return String.format("Working Capital Loan Product with identifier %s does not exist", identifierId);
10461046
}
1047+
1048+
public static String workingCapitalDelinquencyBucketCreateDuplicateNameFailure(Long identifierId) {
1049+
return String.format("Data integrity issue with resource: %d", identifierId);
1050+
}
1051+
1052+
public static String workingCapitalDelinquencyBucketUpdateDuplicateNameFailure(String nameValue) {
1053+
return String.format("Duplicate entry '%s' for key 'name'", nameValue);
1054+
}
1055+
1056+
public static String workingCapitalDelinquencyBucketNotFoundFailure(Long id) {
1057+
return String.format("Delinquency bucket with id `%d` is not found.", id);
1058+
}
1059+
1060+
public static String workingCapitalDelinquencyBucketDoesntExistFailure(Long id) {
1061+
return String.format("Delinquency bucket with id `%d` does not exist.", id);
1062+
}
10471063
}

0 commit comments

Comments
 (0)