Files
bigcapital/packages/server/src/services/Purchases/BillPayments/BillPaymentTransformer.ts
2023-02-03 11:57:50 +02:00

34 lines
914 B
TypeScript

import { IBillPayment } from '@/interfaces';
import { Transformer } from '@/lib/Transformer/Transformer';
import { formatNumber } from 'utils';
export class BillPaymentTransformer extends Transformer {
/**
* Include these attributes to sale invoice object.
* @returns {Array}
*/
public includeAttributes = (): string[] => {
return ['formattedPaymentDate', 'formattedAmount'];
};
/**
* Retrieve formatted invoice date.
* @param {IBill} invoice
* @returns {String}
*/
protected formattedPaymentDate = (billPayment: IBillPayment): string => {
return this.formatDate(billPayment.paymentDate);
};
/**
* Retrieve formatted bill amount.
* @param {IBill} invoice
* @returns {string}
*/
protected formattedAmount = (billPayment: IBillPayment): string => {
return formatNumber(billPayment.amount, {
currencyCode: billPayment.currencyCode,
});
};
}