feat: implement tax switch functionality with Nama adapter

- Add DTOs for tax switch operations including payloads and results.
- Create SalesInvoiceFiscalSwitchService to handle sending and retrieving tax data.
- Implement SalesInvoiceFiscalService for managing invoice tax submissions and results persistence.
- Develop NamaTaxSwitchAdapter for interfacing with the external tax service.
- Introduce NamaTaxRequestDto and related classes for structured tax requests.
This commit is contained in:
2026-04-30 16:27:46 +03:30
parent 58a7c359d8
commit a68a7f594d
38 changed files with 2678 additions and 287 deletions
+29
View File
@@ -0,0 +1,29 @@
import translates from '@/common/constants/translates/translates'
type EnumTranslateMap = Record<string, string>
type EnumsRegistry = Record<string, EnumTranslateMap>
export interface EnumTranslatedValue {
value: string | null | undefined
translate: string | null
}
export function translateEnumValue(
enumKey: keyof typeof translates.enums,
value: string | null | undefined,
): EnumTranslatedValue {
const enumsRegistry = translates.enums as EnumsRegistry
const enumMap = enumsRegistry[String(enumKey)]
if (!value) {
return {
value,
translate: null,
}
}
return {
value,
translate: enumMap?.[value] ?? null,
}
}
+1
View File
@@ -1,4 +1,5 @@
export * from './jwt-user.util'
export * from './enum-translator.util'
export * from './mappers/consumer_mappers.util'
export * from './password.util'
export * from './tracking-code-generator.util'
@@ -1,5 +1,7 @@
import { translateEnumValue } from '../enum-translator.util'
export default (consumer: any) => {
const { legal, individual, activation, _count, ...rest } = consumer
const { legal, individual, activation, type, status, _count, ...rest } = consumer
const { business_activities: business_counts } = _count || { business_activities: 0 }
const partner = legal?.partner || individual?.partner
@@ -9,6 +11,8 @@ export default (consumer: any) => {
return {
...rest,
partner,
type: translateEnumValue('ConsumerType', consumer.type),
status: translateEnumValue('ConsumerStatus', consumer.status),
legal: legal ? { ...legal } : null,
individual: individual
? { ...individual, fullname: `${rest?.first_name} ${rest?.last_name}` }