add server to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 11:57:50 +02:00
parent 28e309981b
commit 80b97b5fdc
1303 changed files with 137049 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
import { IPaymentReceive, IPaymentReceiveEntry } from '@/interfaces';
import { Transformer } from '@/lib/Transformer/Transformer';
import { formatNumber } from 'utils';
import { SaleInvoiceTransformer } from '../SaleInvoiceTransformer';
export class PaymentReceiveTransfromer extends Transformer {
/**
* Include these attributes to payment receive object.
* @returns {Array}
*/
public includeAttributes = (): string[] => {
return [
'formattedPaymentDate',
'formattedAmount',
'formattedExchangeRate',
'entries',
];
};
/**
* Retrieve formatted payment receive date.
* @param {ISaleInvoice} invoice
* @returns {String}
*/
protected formattedPaymentDate = (payment: IPaymentReceive): string => {
return this.formatDate(payment.paymentDate);
};
/**
* Retrieve formatted payment amount.
* @param {ISaleInvoice} invoice
* @returns {string}
*/
protected formattedAmount = (payment: IPaymentReceive): string => {
return formatNumber(payment.amount, { currencyCode: payment.currencyCode });
};
/**
* Retrieve the formatted exchange rate.
* @param {IPaymentReceive} payment
* @returns {string}
*/
protected formattedExchangeRate = (payment: IPaymentReceive): string => {
return formatNumber(payment.exchangeRate, { money: false });
};
/**
* Retrieves the
* @param {IPaymentReceive} payment
* @returns {IPaymentReceiveEntry[]}
*/
protected entries = (payment: IPaymentReceive): IPaymentReceiveEntry[] => {
return payment?.entries?.map((entry) => ({
...entry,
invoice: this.item(entry.invoice, new SaleInvoiceTransformer()),
}));
};
}