Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public enum DefaultWorkingCapitalLoanProduct implements WorkingCapitalLoanProduc
WCLP_DUE_FEE_PENALTY_PRINCIPAL, //
WCLP_IN_ADVANCE_PENALTY_FEE_PRINCIPAL, //
WCLP_DUE_FEE_PRINCIPAL_PENALTY, //
WCLP_DUE_PRINCIPAL_FEE_PENALTY; //
WCLP_DUE_PRINCIPAL_FEE_PENALTY, //
WCLP_GOODWILL_CREDIT_ALLOCATION, //
WCLP_REPAYMENT_DIFF_DEFAULT; //

@Override
public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ public List<PostPaymentAllocation> invalidPaymentAllocationRulesForWorkingCapita
List.of(DUE_FEE, DUE_PRINCIPAL, "INTEREST", IN_ADVANCE_FEE, IN_ADVANCE_PRINCIPAL, IN_ADVANCE_PENALTY)));//
}

public List<PostPaymentAllocation> paymentAllocationRulesWithoutDefaultForWorkingCapitalLoanProductCreateRequest() {
return List.of(//
createPaymentAllocation(PostPaymentAllocation.TransactionTypeEnum.GOODWILL_CREDIT.getValue(), //
List.of(DUE_PRINCIPAL, DUE_FEE, DUE_PENALTY, IN_ADVANCE_PRINCIPAL, IN_ADVANCE_FEE, IN_ADVANCE_PENALTY)));//
}

public List<PostPaymentAllocation> invalidNumberOfPaymentAllocationRulesForWorkingCapitalLoanProductUpdateRequest() {
return List.of(//
createPaymentAllocation(PostPaymentAllocation.TransactionTypeEnum.DEFAULT.getValue(), //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,10 @@ public static String paymentAllocationRulesDuplicateFailure() {
return "The list of provided payment allocation rules must not contain any duplicates";
}

public static String paymentAllocationRulesWithoutDefaultFailure() {
return "At least one DEFAULT payment allocation must be provided";
}

public static String workingCapitalLoanProductIdentifiedDoesNotExistFailure(String identifierId) {
return String.format("Working Capital Loan Product with identifier %s does not exist", identifierId);
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ public abstract class TestContextKey {
public static final String DEFAULT_WORKING_CAPITAL_LOAN_PRODUCT_CREATE_RESPONSE_WCLP_IN_ADVANCE_PENALTY_FEE_PRINCIPAL = "workingCapitalLoanProductCreateResponseWCLPInAdvancePenaltyFeePrincipal";
public static final String DEFAULT_WORKING_CAPITAL_LOAN_PRODUCT_CREATE_RESPONSE_WCLP_DUE_FEE_PRINCIPAL_PENALTY = "workingCapitalLoanProductCreateResponseWCLPDueFeePrincipalPenalty";
public static final String DEFAULT_WORKING_CAPITAL_LOAN_PRODUCT_CREATE_RESPONSE_WCLP_DUE_PRINCIPAL_FEE_PENALTY = "workingCapitalLoanProductCreateResponseWCLPDuePrincipalFeePenalty";
public static final String DEFAULT_WORKING_CAPITAL_LOAN_PRODUCT_CREATE_RESPONSE_WCLP_GOODWILL_CREDIT_ALLOCATION = "workingCapitalLoanProductCreateResponseWCLPGoodwillCreditAllocation";
public static final String DEFAULT_WORKING_CAPITAL_LOAN_PRODUCT_CREATE_RESPONSE_WCLP_REPAYMENT_DIFF_DEFAULT = "workingCapitalLoanProductCreateResponseWCLPRepaymentDiffDefault";
public static final String WC_LOAN_IDS = "wcLoanIds";
public static final String DEFAULT_WORKING_CAPITAL_LOAN_PRODUCT_CREATE_REQUEST_FOR_UPDATE_WCLP = "workingCapitalLoanProductCreateRequestForUpdateWCLP";
public static final String DEFAULT_WORKING_CAPITAL_LOAN_PRODUCT_CREATE_RESPONSE_FOR_UPDATE_WCLP = "workingCapitalLoanProductCreateResponseForUpdateWCLP";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,48 @@ public void initialize() throws Exception {
List.of(DUE_PRINCIPAL, DUE_FEE, DUE_PENALTY, IN_ADVANCE_PRINCIPAL, IN_ADVANCE_FEE,
IN_ADVANCE_PENALTY))))
.overpaymentLiabilityAccountId(accountTypeResolver.resolve(DefaultAccountType.OTHER_CREDIT_LIABILITY))
.paymentChannelToFundSourceMappings(
List.of(new org.apache.fineract.client.models.WorkingCapitalLoanPaymentChannelToFundSourceMappings()
.paymentTypeId(paymentTypeResolver.resolve(DefaultPaymentType.MONEY_TRANSFER))
.fundSourceAccountId(accountTypeResolver.resolve(DefaultAccountType.FUND_RECEIVABLES)))))),
() -> TestContext.INSTANCE.set(
TestContextKey.DEFAULT_WORKING_CAPITAL_LOAN_PRODUCT_CREATE_RESPONSE_WCLP_GOODWILL_CREDIT_ALLOCATION,
createWorkingCapitalLoanProductIdempotent(workingCapitalRequestFactory
.defaultWorkingCapitalLoanProductRequestWithAccrualAccounting()
.name(DefaultWorkingCapitalLoanProduct.WCLP_GOODWILL_CREDIT_ALLOCATION.getName())
.allowAttributeOverrides(allowAttributeOverrides)
.overpaymentLiabilityAccountId(accountTypeResolver.resolve(DefaultAccountType.OTHER_CREDIT_LIABILITY))
.paymentAllocation(List.of(
createPaymentAllocation(PostPaymentAllocation.TransactionTypeEnum.DEFAULT.getValue(),
List.of(DUE_FEE, DUE_PENALTY, DUE_PRINCIPAL, IN_ADVANCE_FEE, IN_ADVANCE_PENALTY,
IN_ADVANCE_PRINCIPAL)),
createPaymentAllocation(PostPaymentAllocation.TransactionTypeEnum.REPAYMENT.getValue(),
List.of(DUE_FEE, DUE_PENALTY, DUE_PRINCIPAL, IN_ADVANCE_FEE, IN_ADVANCE_PENALTY,
IN_ADVANCE_PRINCIPAL)),
createPaymentAllocation(PostPaymentAllocation.TransactionTypeEnum.GOODWILL_CREDIT.getValue(),
List.of(DUE_PRINCIPAL, DUE_FEE, DUE_PENALTY, IN_ADVANCE_PRINCIPAL, IN_ADVANCE_FEE,
IN_ADVANCE_PENALTY))))
.paymentChannelToFundSourceMappings(
List.of(new org.apache.fineract.client.models.WorkingCapitalLoanPaymentChannelToFundSourceMappings()
.paymentTypeId(paymentTypeResolver.resolve(DefaultPaymentType.MONEY_TRANSFER))
.fundSourceAccountId(accountTypeResolver.resolve(DefaultAccountType.FUND_RECEIVABLES)))))),
() -> TestContext.INSTANCE.set(
TestContextKey.DEFAULT_WORKING_CAPITAL_LOAN_PRODUCT_CREATE_RESPONSE_WCLP_REPAYMENT_DIFF_DEFAULT,
createWorkingCapitalLoanProductIdempotent(workingCapitalRequestFactory
.defaultWorkingCapitalLoanProductRequestWithAccrualAccounting()
.name(DefaultWorkingCapitalLoanProduct.WCLP_REPAYMENT_DIFF_DEFAULT.getName())
.allowAttributeOverrides(allowAttributeOverrides)
.overpaymentLiabilityAccountId(accountTypeResolver.resolve(DefaultAccountType.OTHER_CREDIT_LIABILITY))
// DEFAULT differs from REPAYMENT on purpose and no GOODWILL_CREDIT rule is configured:
// goodwill credits must fall back to DEFAULT (principal-first), not to REPAYMENT
// (fee-first).
.paymentAllocation(List.of(
createPaymentAllocation(PostPaymentAllocation.TransactionTypeEnum.DEFAULT.getValue(),
List.of(DUE_PRINCIPAL, DUE_FEE, DUE_PENALTY, IN_ADVANCE_PRINCIPAL, IN_ADVANCE_FEE,
IN_ADVANCE_PENALTY)),
createPaymentAllocation(PostPaymentAllocation.TransactionTypeEnum.REPAYMENT.getValue(),
List.of(DUE_FEE, DUE_PENALTY, DUE_PRINCIPAL, IN_ADVANCE_FEE, IN_ADVANCE_PENALTY,
IN_ADVANCE_PRINCIPAL))))
.paymentChannelToFundSourceMappings(
List.of(new org.apache.fineract.client.models.WorkingCapitalLoanPaymentChannelToFundSourceMappings()
.paymentTypeId(paymentTypeResolver.resolve(DefaultPaymentType.MONEY_TRANSFER))
Expand Down
Loading
Loading