feat: implement SalesInvoiceTspSwitchService and SalesInvoiceTspService for handling TSP provider interactions

- Add SalesInvoiceTspSwitchService to manage TSP provider selection and sending invoices.
- Introduce SalesInvoiceTspService for creating, sending, and retrieving sales invoices.
- Implement NamaProviderSwitchAdapter for communication with the NAMA TSP provider API.
- Define DTOs for request and response structures specific to the NAMA provider.
- Enhance error handling and logging for TSP provider interactions.
This commit is contained in:
2026-05-03 16:23:17 +03:30
parent ad470d2166
commit a486127ade
62 changed files with 4136 additions and 5015 deletions
@@ -92,8 +92,7 @@ export const ModelName = {
Guild: 'Guild',
SalesInvoice: 'SalesInvoice',
SalesInvoiceItem: 'SalesInvoiceItem',
SaleInvoiceFiscals: 'SaleInvoiceFiscals',
SaleInvoiceFiscalAttempts: 'SaleInvoiceFiscalAttempts',
SaleInvoiceTspAttempts: 'SaleInvoiceTspAttempts',
SalesInvoicePayment: 'SalesInvoicePayment',
SalesInvoicePaymentTerminalInfo: 'SalesInvoicePaymentTerminalInfo',
Service: 'Service',
@@ -287,7 +286,7 @@ export const PartnerScalarFieldEnum = {
name: 'name',
code: 'code',
status: 'status',
fiscal_switch_type: 'fiscal_switch_type',
tsp_provider: 'tsp_provider',
logo_url: 'logo_url',
created_at: 'created_at',
updated_at: 'updated_at'
@@ -452,6 +451,7 @@ export const BusinessActivityScalarFieldEnum = {
name: 'name',
fiscal_id: 'fiscal_id',
partner_token: 'partner_token',
invoice_number_sequence: 'invoice_number_sequence',
created_at: 'created_at',
updated_at: 'updated_at',
guild_id: 'guild_id',
@@ -607,6 +607,7 @@ export type CustomerLegalScalarFieldEnum = (typeof CustomerLegalScalarFieldEnum)
export const GuildScalarFieldEnum = {
id: 'id',
name: 'name',
invoice_template: 'invoice_template',
code: 'code',
created_at: 'created_at',
updated_at: 'updated_at'
@@ -655,19 +656,7 @@ export const SalesInvoiceItemScalarFieldEnum = {
export type SalesInvoiceItemScalarFieldEnum = (typeof SalesInvoiceItemScalarFieldEnum)[keyof typeof SalesInvoiceItemScalarFieldEnum]
export const SaleInvoiceFiscalsScalarFieldEnum = {
id: 'id',
retry_count: 'retry_count',
last_attempt_at: 'last_attempt_at',
created_at: 'created_at',
updated_at: 'updated_at',
invoice_id: 'invoice_id'
} as const
export type SaleInvoiceFiscalsScalarFieldEnum = (typeof SaleInvoiceFiscalsScalarFieldEnum)[keyof typeof SaleInvoiceFiscalsScalarFieldEnum]
export const SaleInvoiceFiscalAttemptsScalarFieldEnum = {
export const SaleInvoiceTspAttemptsScalarFieldEnum = {
id: 'id',
attempt_no: 'attempt_no',
status: 'status',
@@ -679,10 +668,10 @@ export const SaleInvoiceFiscalAttemptsScalarFieldEnum = {
sent_at: 'sent_at',
received_at: 'received_at',
created_at: 'created_at',
fiscal_id: 'fiscal_id'
invoice_id: 'invoice_id'
} as const
export type SaleInvoiceFiscalAttemptsScalarFieldEnum = (typeof SaleInvoiceFiscalAttemptsScalarFieldEnum)[keyof typeof SaleInvoiceFiscalAttemptsScalarFieldEnum]
export type SaleInvoiceTspAttemptsScalarFieldEnum = (typeof SaleInvoiceTspAttemptsScalarFieldEnum)[keyof typeof SaleInvoiceTspAttemptsScalarFieldEnum]
export const SalesInvoicePaymentScalarFieldEnum = {
@@ -762,6 +751,13 @@ export const NullableJsonNullValueInput = {
export type NullableJsonNullValueInput = (typeof NullableJsonNullValueInput)[keyof typeof NullableJsonNullValueInput]
export const JsonNullValueInput = {
JsonNull: JsonNull
} as const
export type JsonNullValueInput = (typeof JsonNullValueInput)[keyof typeof JsonNullValueInput]
export const AdminAccountOrderByRelevanceFieldEnum = {
id: 'id',
admin_id: 'admin_id',
@@ -1204,22 +1200,14 @@ export const SalesInvoiceItemOrderByRelevanceFieldEnum = {
export type SalesInvoiceItemOrderByRelevanceFieldEnum = (typeof SalesInvoiceItemOrderByRelevanceFieldEnum)[keyof typeof SalesInvoiceItemOrderByRelevanceFieldEnum]
export const SaleInvoiceFiscalsOrderByRelevanceFieldEnum = {
id: 'id',
invoice_id: 'invoice_id'
} as const
export type SaleInvoiceFiscalsOrderByRelevanceFieldEnum = (typeof SaleInvoiceFiscalsOrderByRelevanceFieldEnum)[keyof typeof SaleInvoiceFiscalsOrderByRelevanceFieldEnum]
export const SaleInvoiceFiscalAttemptsOrderByRelevanceFieldEnum = {
export const SaleInvoiceTspAttemptsOrderByRelevanceFieldEnum = {
id: 'id',
tax_id: 'tax_id',
error_message: 'error_message',
fiscal_id: 'fiscal_id'
invoice_id: 'invoice_id'
} as const
export type SaleInvoiceFiscalAttemptsOrderByRelevanceFieldEnum = (typeof SaleInvoiceFiscalAttemptsOrderByRelevanceFieldEnum)[keyof typeof SaleInvoiceFiscalAttemptsOrderByRelevanceFieldEnum]
export type SaleInvoiceTspAttemptsOrderByRelevanceFieldEnum = (typeof SaleInvoiceTspAttemptsOrderByRelevanceFieldEnum)[keyof typeof SaleInvoiceTspAttemptsOrderByRelevanceFieldEnum]
export const SalesInvoicePaymentOrderByRelevanceFieldEnum = {