Merge branch 'develop' into big-105-convert-invoice-status-after-sending-mail-notification

This commit is contained in:
Ahmed Bouhuolia
2024-02-21 20:20:36 +02:00
committed by GitHub
368 changed files with 6512 additions and 2339 deletions

View File

@@ -61,7 +61,8 @@ export class EditPaymentReceive {
// Validate the payment receive existance.
const oldPaymentReceive = await PaymentReceive.query()
.withGraphFetched('entries')
.findById(paymentReceiveId);
.findById(paymentReceiveId)
.throwIfNotFound();
// Validates the payment existance.
this.validators.validatePaymentExistance(oldPaymentReceive);

View File

@@ -10,6 +10,7 @@ export class PaymentReceiveTransfromer extends Transformer {
*/
public includeAttributes = (): string[] => {
return [
'subtotalFormatted',
'formattedPaymentDate',
'formattedAmount',
'formattedExchangeRate',
@@ -26,6 +27,18 @@ export class PaymentReceiveTransfromer extends Transformer {
return this.formatDate(payment.paymentDate);
};
/**
* Retrieve the formatted payment subtotal.
* @param {IPaymentReceive} payment
* @returns {string}
*/
protected subtotalFormatted = (payment: IPaymentReceive): string => {
return formatNumber(payment.amount, {
currencyCode: payment.currencyCode,
money: false,
});
};
/**
* Retrieve formatted payment amount.
* @param {ISaleInvoice} invoice