Files
bigcapital/packages/server/src/services/Purchases/BillPayments/BillPaymentEntryTransformer.ts
2024-06-12 19:43:42 +02:00

29 lines
766 B
TypeScript

import { Transformer } from '@/lib/Transformer/Transformer';
import { formatNumber } from '@/utils';
import { PurchaseInvoiceTransformer } from '../Bills/PurchaseInvoiceTransformer';
export class BillPaymentEntryTransformer extends Transformer {
/**
* Include these attributes to bill payment object.
* @returns {Array}
*/
public includeAttributes = (): string[] => {
return ['paymentAmountFormatted', 'bill'];
};
/**
* Retreives the
*/
protected bill = (entry) => {
return this.item(entry.bill, new PurchaseInvoiceTransformer());
};
/**
* Retreives the payment amount formatted.
* @returns {string}
*/
protected paymentAmountFormatted(entry) {
return formatNumber(entry.paymentAmount, { money: false });
}
}