Merge branch 'develop' into tax-compliance

This commit is contained in:
Ahmed Bouhuolia
2023-08-29 15:09:52 +02:00
238 changed files with 1917 additions and 1285 deletions

View File

@@ -44,7 +44,7 @@ export class DeleteSaleEstimate {
if (oldSaleEstimate.convertedToInvoiceId) {
throw new ServiceError(ERRORS.SALE_ESTIMATE_CONVERTED_TO_INVOICE);
}
// Deletes the estimate with associated transactions under UOW enivrement.
// Updates the estimate with associated transactions under UOW enivrement.
return this.uow.withTransaction(tenantId, async (trx: Knex.Transaction) => {
// Triggers `onSaleEstimatedDeleting` event.
await this.eventPublisher.emitAsync(events.saleEstimate.onDeleting, {

View File

@@ -63,14 +63,17 @@ export class DeliverSaleInvoice {
// Record the delivered at on the storage.
const saleInvoice = await SaleInvoice.query(trx)
.where({ id: saleInvoiceId })
.update({ deliveredAt: moment().toMySqlDateTime() });
.patchAndFetchById(saleInvoiceId, {
deliveredAt: moment().toMySqlDateTime(),
})
.withGraphFetched('entries');
// Triggers `onSaleInvoiceDelivered` event.
await this.eventPublisher.emitAsync(events.saleInvoice.onDelivered, {
tenantId,
saleInvoiceId,
saleInvoice,
trx,
} as ISaleInvoiceEventDeliveredPayload);
});
}

View File

@@ -12,7 +12,7 @@ export class GetInvoicePaymentsService {
private transformer: TransformerInjectable;
/**
* Retrieve the invoice assocaited payments transactions.
* Retrieve the invoice associated payments transactions.
* @param {number} tenantId - Tenant id.
* @param {number} invoiceId - Invoice id.
*/

View File

@@ -58,12 +58,12 @@ export class CloseSaleReceipt {
} as ISaleReceiptEventClosingPayload);
// Mark the sale receipt as closed on the storage.
const saleReceipt = await SaleReceipt.query(trx)
.findById(saleReceiptId)
.patch({
const saleReceipt = await SaleReceipt.query(trx).patchAndFetchById(
saleReceiptId,
{
closedAt: moment().toMySqlDateTime(),
});
}
);
// Triggers `onSaleReceiptClosed` event.
await this.eventPublisher.emitAsync(events.saleReceipt.onClosed, {
saleReceiptId,