Skip to content
Merged
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 @@ -31,6 +31,7 @@ public enum AssetExternalizationErrorMessage {
LOAN_CLOSED_OBLIGATIONS_MET_INVALID("Loan status CLOSED_OBLIGATIONS_MET is not valid for transfer."), //
LOAN_SUBMITTED_AND_PENDING_APPROVAL_INVALID("Loan status SUBMITTED_AND_PENDING_APPROVAL is not valid for transfer."), //
LOAN_APPROVED_INVALID("Loan status APPROVED is not valid for transfer."), //
ALREADY_IN_PROGRESS("This loan cannot be sold, there is already an in progress transfer"), //
INVALID_REQUEST("The request was invalid. This typically will happen due to validation errors which are provided."); //

public final String value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ private void createAssetExternalizationRequestByLoanId(DataTable table, String t
} else if ((transferData.get(0).equals(TRANSACTION_TYPE_SALE) || transferData.get(0).equals(TRANSACTION_TYPE_INTERMEDIARY_SALE))) {
String ownerExternalId;
if (regenerateOwner) {
// For owner-to-owner transfers: preserve the current owner as previous owner
String currentOwner = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID);
if (currentOwner != null && !transferData.get(0).equals(TRANSACTION_TYPE_INTERMEDIARY_SALE)) {
testContext().set(TestContextKey.ASSET_EXTERNALIZATION_PREVIOUS_OWNER_EXTERNAL_ID, currentOwner);
}
ownerExternalId = Utils.randomStringGenerator(OWNER_EXTERNAL_ID_PREFIX, 10);
} else {
ownerExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID);
Expand Down Expand Up @@ -369,13 +374,20 @@ private void checkExternalAssetDetails(Long loanId, String loanExternalId, PageE
previousAssetOwner = null;
transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_SALES_TRANSFER_EXTERNAL_ID_FROM_RESPONSE);
}
} else { // in case transfer has previous intermediarySale transfer
} else { // in case transfer has previous intermediarySale or owner-to-owner transfer
if (transactionType.equalsIgnoreCase(TRANSACTION_TYPE_SALE)
&& (status.equals(ExternalTransferData.StatusEnum.ACTIVE.getValue())
|| status.equals(ExternalTransferData.StatusEnum.PENDING.getValue()))) {
ownerExternalId = ownerExternalIdStored;
previousAssetOwner = intermediarySaleAssetOwner;
transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_SALES_TRANSFER_EXTERNAL_ID_FROM_RESPONSE);
} else if (transactionType.equalsIgnoreCase(TRANSACTION_TYPE_SALE)
&& (status.equals(ExternalTransferData.StatusEnum.DECLINED.getValue())
|| status.equals(ExternalTransferData.StatusEnum.CANCELLED.getValue()))) {
// DECLINED and CANCELLED records have previousOwner = null in the API response
ownerExternalId = ownerExternalIdStored;
previousAssetOwner = null;
transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_SALES_TRANSFER_EXTERNAL_ID_FROM_RESPONSE);
} else if (transactionType.equalsIgnoreCase(TRANSACTION_TYPE_BUYBACK)
&& (status.equals(ExternalTransferData.StatusEnum.BUYBACK.getValue())
|| status.equals(ExternalTransferData.StatusEnum.BUYBACK_INTERMEDIATE.getValue()))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ public void makeLoanRepaymentAndCheckOwner(String repaymentType, String transact
makeRepayment(repaymentType, transactionDate, transactionAmount, transferExternalOwnerId);
}

@And("Customer makes {string} repayment on {string} with {double} EUR transaction amount and check previous external owner")
public void makeLoanRepaymentAndCheckPreviousOwner(String repaymentType, String transactionDate, double transactionAmount)
throws IOException {
String previousOwnerId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_PREVIOUS_OWNER_EXTERNAL_ID);
makeRepayment(repaymentType, transactionDate, transactionAmount, previousOwnerId);
}

private void makeRepayment(String repaymentType, String transactionDate, double transactionAmount, String transferExternalOwnerId)
throws IOException {
eventStore.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,14 @@ public void createTransactionWithAutoIdempotencyKeyWithExternalOwner(String tran
transactionAmount, transferExternalOwnerId);
}

@When("Customer makes {string} transaction with {string} payment type on {string} with {double} EUR transaction amount and system-generated Idempotency key and check previous external owner")
public void createTransactionWithAutoIdempotencyKeyWithPreviousExternalOwner(String transactionTypeInput, String transactionPaymentType,
String transactionDate, double transactionAmount) throws IOException {
String previousOwnerId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_PREVIOUS_OWNER_EXTERNAL_ID);
createTransactionWithAutoIdempotencyKeyAndWithExternalOwner(transactionTypeInput, transactionPaymentType, transactionDate,
transactionAmount, previousOwnerId);
}

@When("Customer makes {string} transaction with {string} payment type on {string} with {double} EUR transaction amount and system-generated Idempotency key and interestRefundCalculation {booleanValue}")
public void createTransactionWithAutoIdempotencyKeyAndWithInterestRefundCalculationFlagProvided(final String transactionTypeInput,
final String transactionPaymentType, final String transactionDate, final double transactionAmount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Feature: Asset Externalization - Part1
| sale | 2023-05-21 | 1 |

@TestRailId:C2735
Scenario: Verify that SALES request on a loan with ACTIVE ownership results an error
Scenario: Verify that SALES request on a loan with ACTIVE ownership succeeds (owner-to-owner transfer)
When Admin sets the business date to "1 May 2023"
When Admin creates a client with random data
When Admin creates a new default Loan with date: "1 May 2023"
Expand All @@ -304,9 +304,10 @@ Feature: Asset Externalization - Part1
| 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE |
| 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE |
When Admin sets the business date to "25 May 2023"
Then Asset externalization transaction with the following data results a 403 error and "ASSET_OWNED_CANNOT_BE_SOLD" error message
When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data:
| Transaction type | settlementDate | purchasePriceRatio |
| sale | 2023-05-30 | 1 |
Then Asset externalization response has the correct Loan ID, transferExternalId

@TestRailId:C2736
Scenario: Verify that BUYBACK request on a fully paid loan can be done successfully
Expand Down Expand Up @@ -1810,4 +1811,3 @@ Feature: Asset Externalization - Part1

When Loan Pay-off is made on "26 June 2025"
Then Loan's all installments have obligations met

Loading
Loading