Skip to content

Commit

Permalink
Block undo Loan Interest Refund transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Alberto Hernandez authored and alberto-art3ch committed Nov 18, 2024
1 parent aa3e70e commit a736f4b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ export class TransactionsTabComponent implements OnInit {
* DOWN_PAYMENT:28
* REAGE:29
* REAMORTIZE:30
* INTEREST REFUND:33
*/
showTransactions(transactionsData: LoanTransaction) {
if ([1, 2, 4, 9, 20, 21, 22, 23, 26, 28, 29, 30, 31].includes(transactionsData.type.id)) {
if ([1, 2, 4, 9, 20, 21, 22, 23, 26, 28, 29, 30, 31, 33].includes(transactionsData.type.id)) {
this.router.navigate([transactionsData.id], { relativeTo: this.route });
}
}
Expand All @@ -144,7 +145,9 @@ export class TransactionsTabComponent implements OnInit {
if (transaction.manuallyReversed) {
return false;
}
return !(transaction.type.disbursement || transaction.type.chargeoff || this.isReAgoeOrReAmortize(transaction.type) );
return !(transaction.type.disbursement || transaction.type.chargeoff || this.isReAgoeOrReAmortize(transaction.type)
|| transaction.type.interestRefund
);
}

loanTransactionColor(transaction: LoanTransaction): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class ViewTransactionComponent implements OnInit {
this.transactionData = data.loansAccountTransaction;
this.transactionType = this.transactionData.type;
this.allowEdition = !this.transactionData.manuallyReversed && !this.allowTransactionEdition(this.transactionData.type.id);
this.allowUndo = !this.transactionData.manuallyReversed;
this.allowUndo = this.allowUndoTransaction(this.transactionData.manuallyReversed, this.transactionType);
this.allowChargeback = this.allowChargebackTransaction(this.transactionType) && !this.transactionData.manuallyReversed;
let transactionsChargebackRelated = false;
if (this.transactionData.transactionRelations) {
Expand Down Expand Up @@ -128,6 +128,16 @@ export class ViewTransactionComponent implements OnInit {
|| transactionType.merchantIssuedRefund || transactionType.downPayment);
}

allowUndoTransaction(manuallyReversed: boolean, transactionType: LoanTransactionType): boolean {
if (manuallyReversed) {
return false;
}
if (transactionType.interestRefund) {
return false;
}
return true;
}

/**
* Undo the loans transaction
*/
Expand Down
36 changes: 1 addition & 35 deletions src/app/products/loan-products/models/loan-account.model.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LoanTransactionType } from 'app/loans/models/loan-transaction-type.model';
import { Currency } from 'app/shared/models/general.model';

export interface LoanTransaction {
Expand All @@ -24,38 +25,3 @@ export interface LoanTransaction {
numberOfRepayments: number;
transactionRelations: any[];
}


export interface LoanTransactionType {
id: number;
code: string;
value: string;
disbursement: boolean;
repaymentAtDisbursement: boolean;
repayment: boolean;
merchantIssuedRefund: boolean;
payoutRefund: boolean;
goodwillCredit: boolean;
interestPaymentWaiver: boolean;
chargeRefund: boolean;
contra: boolean;
waiveInterest: boolean;
waiveCharges: boolean;
accrual: boolean;
writeOff: boolean;
recoveryRepayment: boolean;
initiateTransfer: boolean;
approveTransfer: boolean;
withdrawTransfer: boolean;
rejectTransfer: boolean;
chargePayment: boolean;
refund: boolean;
refundForActiveLoans: boolean;
creditBalanceRefund: boolean;
chargeAdjustment: boolean;
chargeback: boolean;
chargeoff: boolean;
downPayment: boolean;
reAge: boolean;
reAmortize: boolean;
}

0 comments on commit a736f4b

Please sign in to comment.