feat: retrieve the matching transactions

This commit is contained in:
Ahmed Bouhuolia
2024-06-20 10:20:18 +02:00
parent d3230767dd
commit b6deb842ff
11 changed files with 507 additions and 149 deletions

View File

@@ -6,27 +6,108 @@ export class GetMatchedTransactionExpensesTransformer extends Transformer {
* @returns {Array}
*/
public includeAttributes = (): string[] => {
return ['referenceNo'];
return [
'referenceNo',
'amount',
'amountFormatted',
'transactionNo',
'date',
'dateFromatted',
'transactionId',
'transactionNo',
'transactionType',
'transsactionTypeFormatted',
];
};
/**
* Exclude all attributes.
* @returns {Array<string>}
*/
public excludeAttributes = (): string[] => {
return ['*'];
};
protected referenceNo(invoice) {
return invoice.referenceNo;
/**
* Retrieves the expense reference number.
* @param expense
* @returns {string}
*/
protected referenceNo(expense) {
return expense.referenceNo;
}
amount(invoice) {
return 1;
/**
* Retrieves the expense amount.
* @param expense
* @returns {number}
*/
protected amount(expense) {
return expense.totalAmount;
}
amountFormatted() {}
date() {}
dateFromatted() {}
transactionId(invoice) {
return invoice.id;
/**
* Formats the amount of the expense.
* @param expense
* @returns {string}
*/
protected amountFormatted(expense) {
return this.formatNumber(expense.totalAmount, {
currencyCode: expense.currencyCode,
});
}
/**
* Retrieves the date of the expense.
* @param expense
* @returns {Date}
*/
protected date(expense) {
return expense.paymentDate;
}
/**
* Formats the date of the expense.
* @param expense
* @returns {string}
*/
protected dateFromatted(expense) {
return this.formatDate(expense.paymentDate);
}
/**
* Retrieves the transaction ID of the expense.
* @param expense
* @returns {number}
*/
protected transactionId(expense) {
return expense.id;
}
/**
* Retrieves the expense transaction number.
* @param expense
* @returns {string}
*/
protected transactionNo(expense) {
return expense.expenseNo;
}
/**
* Retrieves the expense transaction type.
* @param expense
* @returns {String}
*/
protected transactionType() {
return 'Expense';
}
/**
* Retrieves the formatted transaction type of the expense.
* @param expense
* @returns {string}
*/
protected transsactionTypeFormatted() {
return 'Expense';
}
transactionNo() {}
transactionType() {}
transsactionTypeFormatted() {}
}