Block undo Loan Interest Refund transaction

This commit is contained in:
Jose Alberto Hernandez
2024-11-18 11:35:41 -06:00
committed by Jose Alberto Hernandez
parent aa3e70e5c5
commit a736f4bf74
3 changed files with 17 additions and 38 deletions
@@ -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 });
}
}
@@ -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 {
@@ -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) {
@@ -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
*/
@@ -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 {
@@ -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;
}