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
+64 -23
View File
@@ -1,17 +1,29 @@
import translates from '@/common/constants/translates/translates'
import { translateEnumValue } from '@/common/utils/enum-translator.util'
import {
AccountRole,
AccountStatus,
ApplicationPlatform,
ApplicationPublisher,
ApplicationReleaseType,
BusinessRole,
ConsumerRole,
ConsumerStatus,
ConsumerType,
CustomerType,
FiscalResponseStatus,
GoodPricingModel,
LicenseStatus,
LicenseType,
PartnerFiscalSwitchType,
PartnerRole,
PartnerStatus,
PaymentMethodType,
POSRole,
POSStatus,
POSType,
ProviderRole,
ProviderStatus,
UnitType,
UserStatus,
UserType,
@@ -22,33 +34,62 @@ import { ResponseMapper } from 'common/response/response-mapper'
@Injectable()
export class EnumsService {
private prepareData(items: Record<string, string>) {
return Object.values(items).map(item => ({
name: translates.enums[item] || item,
value: item,
}))
private prepareData(
items: Record<string, string>,
enumName: keyof typeof translates.enums,
) {
return Object.values(items).map(item => {
const translated = translateEnumValue(enumName, item)
return {
name: translated.translate || item,
value: translated.value,
}
})
}
getAllEnums() {
return {
GoldKarat: this.prepareData(GoldKarat),
UserStatus: this.prepareData(UserStatus),
AccountRole: this.prepareData(AccountRole),
AccountStatus: this.prepareData(AccountStatus),
POSStatus: this.prepareData(POSStatus),
POSRole: this.prepareData(POSRole),
LicenseType: this.prepareData(LicenseType),
LicenseStatus: this.prepareData(LicenseStatus),
POSType: this.prepareData(POSType),
UserType: this.prepareData(UserType),
AccountType: this.prepareData(AccountType),
PartnerRole: this.prepareData(PartnerRole),
BusinessRole: this.prepareData(BusinessRole),
ProviderRole: this.prepareData(ProviderRole),
TokenType: this.prepareData(TokenType),
UnitType: this.prepareData(UnitType),
GoodPricingModel: this.prepareData(GoodPricingModel),
ConsumerRole: this.prepareData(ConsumerRole),
PaymentMethodType: this.prepareData(PaymentMethodType, 'PaymentMethodType'),
GoldKarat: this.prepareData(GoldKarat, 'GoldKarat'),
UserStatus: this.prepareData(UserStatus, 'UserStatus'),
AccountRole: this.prepareData(AccountRole, 'AccountRole'),
AccountStatus: this.prepareData(AccountStatus, 'AccountStatus'),
POSStatus: this.prepareData(POSStatus, 'POSStatus'),
POSRole: this.prepareData(POSRole, 'POSRole'),
LicenseType: this.prepareData(LicenseType, 'LicenseType'),
LicenseStatus: this.prepareData(LicenseStatus, 'LicenseStatus'),
POSType: this.prepareData(POSType, 'POSType'),
UserType: this.prepareData(UserType, 'UserType'),
AccountType: this.prepareData(AccountType, 'AccountType'),
PartnerRole: this.prepareData(PartnerRole, 'PartnerRole'),
BusinessRole: this.prepareData(BusinessRole, 'BusinessRole'),
ProviderRole: this.prepareData(ProviderRole, 'ProviderRole'),
ProviderStatus: this.prepareData(ProviderStatus, 'ProviderStatus'),
TokenType: this.prepareData(TokenType, 'TokenType'),
UnitType: this.prepareData(UnitType, 'UnitType'),
GoodPricingModel: this.prepareData(GoodPricingModel, 'GoodPricingModel'),
ConsumerRole: this.prepareData(ConsumerRole, 'ConsumerRole'),
ConsumerStatus: this.prepareData(ConsumerStatus, 'ConsumerStatus'),
ConsumerType: this.prepareData(ConsumerType, 'ConsumerType'),
PartnerStatus: this.prepareData(PartnerStatus, 'PartnerStatus'),
PartnerFiscalSwitchType: this.prepareData(
PartnerFiscalSwitchType,
'PartnerFiscalSwitchType',
),
ApplicationPlatform: this.prepareData(ApplicationPlatform, 'ApplicationPlatform'),
ApplicationReleaseType: this.prepareData(
ApplicationReleaseType,
'ApplicationReleaseType',
),
ApplicationPublisher: this.prepareData(
ApplicationPublisher,
'ApplicationPublisher',
),
CustomerType: this.prepareData(CustomerType, 'CustomerType'),
FiscalResponseStatus: this.prepareData(
FiscalResponseStatus,
'FiscalResponseStatus',
),
}
}