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:
@@ -1,3 +1,4 @@
|
||||
import { QUERY_CONSTANTS } from '@/common/queryConstants'
|
||||
import { ComplexSelect, ComplexWhereInput } from '@/generated/prisma/models'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { BadRequestException, Injectable } from '@nestjs/common'
|
||||
@@ -44,9 +45,24 @@ export class BusinessActivityComplexesService {
|
||||
async findAll(partner_id: string, consumer_id: string, business_activity_id: string) {
|
||||
const complexes = await this.prisma.complex.findMany({
|
||||
where: this.defaultWhere(partner_id, consumer_id, business_activity_id),
|
||||
select: this.defaultSelect,
|
||||
select: {
|
||||
...this.defaultSelect,
|
||||
_count: {
|
||||
select: {
|
||||
pos_list: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
return ResponseMapper.list(complexes)
|
||||
|
||||
const mappedComplexes = complexes.map(complex => {
|
||||
const { _count, ...rest } = complex
|
||||
return {
|
||||
...rest,
|
||||
pos_count: _count.pos_list,
|
||||
}
|
||||
})
|
||||
return ResponseMapper.list(mappedComplexes)
|
||||
}
|
||||
|
||||
async findOne(
|
||||
@@ -67,8 +83,6 @@ export class BusinessActivityComplexesService {
|
||||
|
||||
async create(partner_id: string, business_id: string, data: CreateComplexDto) {
|
||||
const complex = this.prisma.$transaction(async tx => {
|
||||
const now = new Date()
|
||||
|
||||
const relatedLicense = await tx.licenseAccountAllocation.findFirst({
|
||||
where: {
|
||||
license_activation: {
|
||||
@@ -80,22 +94,7 @@ export class BusinessActivityComplexesService {
|
||||
business_activity: {
|
||||
id: business_id,
|
||||
},
|
||||
OR: [
|
||||
{
|
||||
expires_at: {
|
||||
gte: now,
|
||||
},
|
||||
},
|
||||
{
|
||||
license_renews: {
|
||||
some: {
|
||||
expires_at: {
|
||||
gte: now,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
...QUERY_CONSTANTS.LICENSE_ACTIVATION.activeOnDate(),
|
||||
},
|
||||
account_id: null,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user