feat: enhance CustomerIndividual and CustomerLegal models with new unique input types

feat: add cache invalidation method for POS middleware

feat: implement Redis caching in POS middleware for improved performance

feat: refactor sales invoice DTOs for POS to include correction functionality

feat: extend SalesInvoicesController to handle invoice corrections and returns

feat: update SalesInvoicesService to support invoice correction and return operations

feat: enhance TSP provider correction functionality with new DTOs and utility methods

fix: improve error handling and logging in Nama provider switch adapter

refactor: streamline invoice payload building in TSP provider utilities
This commit is contained in:
2026-06-06 19:53:00 +03:30
parent 25e589551b
commit f61100bf25
21 changed files with 302 additions and 113 deletions
@@ -1,6 +1,7 @@
import { SharedSaleInvoiceAccessService } from '@/common/services/saleInvoices/sale-invoice-access.service'
import { Injectable } from '@nestjs/common'
import { PosCorrectionSalesInvoiceDto } from '@/modules/pos/sales-invoices/dto/create-sales-invoice.dto'
import { SalesInvoiceTspService } from '@/modules/tspProviders/sales-invoice-tsp.service'
import { Injectable } from '@nestjs/common'
@Injectable()
export class SharedSaleInvoiceActionsService {
@@ -45,6 +46,28 @@ export class SharedSaleInvoiceActionsService {
)
}
async correction(
data: PosCorrectionSalesInvoiceDto,
consumerAccountId: string,
posId: string,
complexId: string,
businessId: string,
invoiceId: string,
) {
await this.saleInvoiceAccessService.getConsumerIdWithPosAccess(
consumerAccountId,
posId,
)
return this.salesInvoiceTspService.correctionSend(
consumerAccountId,
posId,
complexId,
businessId,
invoiceId,
data,
)
}
async inquiry(consumerAccountId: string, posId: string, invoiceId: string) {
const consumerId = await this.saleInvoiceAccessService.getConsumerIdWithPosAccess(
consumerAccountId,
@@ -1,5 +1,5 @@
import type { SaleInvoiceType } from '@/common/interfaces/sale-invoice-payload'
import { ApiProperty } from '@nestjs/swagger'
import { ApiProperty, OmitType } from '@nestjs/swagger'
import { Type } from 'class-transformer'
import {
ArrayMinSize,
@@ -206,8 +206,6 @@ export class SharedCreateSalesInvoiceDto {
@IsBoolean()
send_to_tsp?: boolean
@ApiProperty({ required: true, default: CustomerType.UNKNOWN })
@IsEnum(CustomerType)
customer_type: CustomerType
@@ -229,3 +227,8 @@ export class SharedCreateSalesInvoiceDto {
}
}
}
export class SharedCorrectionSalesInvoiceDto extends OmitType(
SharedCreateSalesInvoiceDto,
['customer', 'customer_id', 'send_to_tsp', 'customer_type', 'settlement_type'],
) {}