feat: add DTOs and services for tax switch integration

- Created SendBulkSaleInvoicesDto for handling bulk sale invoice requests.
- Implemented TaxSwitchSendPayloadDto and related DTOs for tax switch item payloads and results.
- Developed SalesInvoiceTaxSwitchService to manage tax switch operations, including sending and retrieving tax information.
- Added SalesInvoiceTaxService for handling sales invoice tax logic, including bulk sending and persistence of results.
- Introduced NamaTaxSwitchAdapter to interact with the tax switch service, simulating external API responses.
- Created SendBulkSalesInvoicesDto for POS module to handle bulk sales invoice requests.
This commit is contained in:
2026-04-27 22:11:05 +03:30
parent dee96b6e91
commit 58a7c359d8
68 changed files with 7896 additions and 3534 deletions
@@ -1,8 +1,12 @@
import { TokenAccount } from '@/common/decorators/tokenInfo.decorator'
import { Controller, Get, Param } from '@nestjs/common'
import { Body, Controller, Get, Param, Post } from '@nestjs/common'
import { ApiTags } from '@nestjs/swagger'
import type {
SaleInvoicesServiceFindAllResponseDto,
SaleInvoicesServiceFindOneResponseDto,
} from './dto/saleInvoices-response.dto'
import { SendBulkSaleInvoicesDto } from './dto/send-saleInvoices.dto'
import { SaleInvoicesService } from './saleInvoices.service'
import type { SaleInvoicesServiceFindAllResponseDto, SaleInvoicesServiceFindOneResponseDto } from './dto/saleInvoices-response.dto'
@ApiTags('ConsumerSaleInvoices')
@Controller('consumer/sale-invoices')
@@ -10,12 +14,30 @@ export class StatisticsController {
constructor(private readonly service: SaleInvoicesService) {}
@Get('')
async findAll(@TokenAccount('userId') consumerId: string): Promise<SaleInvoicesServiceFindAllResponseDto> {
async findAll(
@TokenAccount('userId') consumerId: string,
): Promise<SaleInvoicesServiceFindAllResponseDto> {
return this.service.findAll(consumerId)
}
@Get(':id')
async findOne(@TokenAccount('userId') consumerId: string, @Param('id') id: string): Promise<SaleInvoicesServiceFindOneResponseDto> {
async findOne(
@TokenAccount('userId') consumerId: string,
@Param('id') id: string,
): Promise<SaleInvoicesServiceFindOneResponseDto> {
return this.service.findOne(consumerId, id)
}
@Post(':id/send_tax')
async send(@TokenAccount('userId') consumerId: string, @Param('id') id: string) {
return this.service.send(consumerId, id)
}
@Post('send_tax_bulk')
async sendBulk(
@TokenAccount('userId') consumerId: string,
@Body() data: SendBulkSaleInvoicesDto,
) {
return this.service.sendBulk(consumerId, data.invoice_ids)
}
}