update switch providers and nama provider. fix original send
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
import { CustomerType, PaymentMethodType } from '@/generated/prisma/enums'
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import { Type } from 'class-transformer'
|
||||
import {
|
||||
IsDateString,
|
||||
IsEnum,
|
||||
IsNumber,
|
||||
IsObject,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Min,
|
||||
ValidateNested,
|
||||
} from 'class-validator'
|
||||
|
||||
export class CustomerUnknownInfoDto {
|
||||
@ApiProperty({})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
name: string
|
||||
|
||||
@ApiProperty({})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
economic_code: string
|
||||
}
|
||||
|
||||
export class CustomerLegalInfoDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
economic_code: string
|
||||
}
|
||||
|
||||
export class CustomerIndividualInfoDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
first_name: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
last_name: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
national_id: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
mobile_number: string
|
||||
}
|
||||
|
||||
export class CustomerInfoDto {
|
||||
@ApiProperty({ required: true, enum: CustomerType })
|
||||
@IsEnum(CustomerType)
|
||||
type: CustomerType
|
||||
|
||||
@ApiProperty({})
|
||||
@Type(() => CustomerLegalInfoDto)
|
||||
@ValidateNested({ each: true })
|
||||
legal_info?: CustomerLegalInfoDto
|
||||
|
||||
@ApiProperty({})
|
||||
@Type(() => CustomerIndividualInfoDto)
|
||||
@ValidateNested({ each: true })
|
||||
individual_info?: CustomerIndividualInfoDto
|
||||
|
||||
@ApiProperty({})
|
||||
@Type(() => CustomerUnknownInfoDto)
|
||||
@ValidateNested({ each: true })
|
||||
unknown_info?: CustomerUnknownInfoDto
|
||||
}
|
||||
|
||||
export class TerminalInfoDto {
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
tracking_code?: string
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
card_number?: string
|
||||
}
|
||||
|
||||
export class PaymentInfoDto {
|
||||
@ApiProperty({ required: true, enum: PaymentMethodType })
|
||||
@IsEnum(PaymentMethodType)
|
||||
payment_method: PaymentMethodType
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber({ allowInfinity: false, allowNaN: false })
|
||||
@Min(0)
|
||||
amount: number
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
paid_at?: Date
|
||||
|
||||
@ApiProperty({ type: TerminalInfoDto })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
terminal_info: TerminalInfoDto
|
||||
}
|
||||
|
||||
export class goldTypePayload {
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
karat: string
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
profit: string
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
wages: string
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
commission: string
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import {
|
||||
SharedCreateSalesInvoiceItemDto,
|
||||
SharedCreateSalesInvoicePaymentsDto,
|
||||
} from '@/common/services/saleInvoices/sale-invoice-create.dto'
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import { Type } from 'class-transformer'
|
||||
import {
|
||||
ArrayMinSize,
|
||||
IsArray,
|
||||
IsNumber,
|
||||
IsObject,
|
||||
IsString,
|
||||
ValidateNested,
|
||||
} from 'class-validator'
|
||||
import { TspProviderOriginalSendPayloadDto } from './original.dto'
|
||||
|
||||
export class TspProviderCorrectionInvoicePayloadDto {
|
||||
@ApiProperty({ type: [SharedCreateSalesInvoiceItemDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => SharedCreateSalesInvoiceItemDto)
|
||||
@ArrayMinSize(1)
|
||||
items: SharedCreateSalesInvoiceItemDto[]
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
total_amount: number
|
||||
|
||||
@ApiProperty({ required: true, type: SharedCreateSalesInvoicePaymentsDto })
|
||||
@IsObject()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => SharedCreateSalesInvoicePaymentsDto)
|
||||
payments: SharedCreateSalesInvoicePaymentsDto
|
||||
}
|
||||
export class TspProviderCorrectionSendPayloadDto extends TspProviderOriginalSendPayloadDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
last_tax_id: string
|
||||
}
|
||||
|
||||
export class TspProviderCorrectionSendResponseDto {}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { TspProviderResponseStatus } from '@/generated/prisma/enums'
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import {
|
||||
IsBoolean,
|
||||
IsDateString,
|
||||
IsEnum,
|
||||
IsObject,
|
||||
IsOptional,
|
||||
IsString,
|
||||
} from 'class-validator'
|
||||
|
||||
export class TspProviderGetResultDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
tax_id: string
|
||||
|
||||
@ApiProperty({ enum: TspProviderResponseStatus })
|
||||
@IsEnum(TspProviderResponseStatus)
|
||||
status: TspProviderResponseStatus
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsBoolean()
|
||||
hasError: boolean
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
message?: string | null
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
provider_response_payload?: Object
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsDateString()
|
||||
sent_at: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsDateString()
|
||||
received_at: string
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export * from './common.dto'
|
||||
export * from './correction.dto'
|
||||
export * from './get.dto'
|
||||
export * from './original.dto'
|
||||
export * from './provider-switch.dto'
|
||||
export * from './revoke.dto'
|
||||
@@ -0,0 +1,193 @@
|
||||
import {
|
||||
InvoiceSettlementType,
|
||||
InvoiceTemplateType,
|
||||
TspProviderResponseStatus,
|
||||
TspProviderType,
|
||||
} from '@/generated/prisma/enums'
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import { Type } from 'class-transformer'
|
||||
import {
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
IsDateString,
|
||||
IsEnum,
|
||||
IsNumber,
|
||||
IsObject,
|
||||
IsOptional,
|
||||
IsString,
|
||||
ValidateNested,
|
||||
} from 'class-validator'
|
||||
import { CustomerInfoDto, goldTypePayload, PaymentInfoDto } from './common.dto'
|
||||
|
||||
export class TspProviderOriginalItemPayloadDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
sku: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
sku_vat: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber()
|
||||
unit_price: number
|
||||
|
||||
// @ApiProperty()
|
||||
// @IsString()
|
||||
// invoice_item_id: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
quantity: number
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
total_amount: number
|
||||
|
||||
@ApiProperty()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
discount: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
measure_unit: string
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
good_id?: string | null
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
service_id?: string | null
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: goldTypePayload })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
gold_type_payload?: goldTypePayload
|
||||
|
||||
// @ApiProperty({ required: false, nullable: true, type: Object })
|
||||
// @IsOptional()
|
||||
// @IsObject()
|
||||
// payload?: unknown
|
||||
}
|
||||
|
||||
export class TspProviderOriginalSendPayloadDto {
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
id: string
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsNumber()
|
||||
invoice_number: number
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsDateString()
|
||||
invoice_date: Date
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
economic_code: string
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
fiscal_id: string
|
||||
|
||||
@ApiProperty({ required: true, enum: TspProviderType })
|
||||
@IsEnum(TspProviderType)
|
||||
tsp_provider: TspProviderType
|
||||
|
||||
@ApiProperty({ required: true, enum: InvoiceTemplateType })
|
||||
@IsEnum(InvoiceTemplateType)
|
||||
template: InvoiceTemplateType
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
token: string
|
||||
|
||||
@ApiProperty({ required: true, enum: InvoiceSettlementType })
|
||||
@IsEnum(InvoiceSettlementType)
|
||||
settlement_type: InvoiceSettlementType
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
total_amount: number
|
||||
|
||||
@ApiProperty({ type: [TspProviderOriginalItemPayloadDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => TspProviderOriginalItemPayloadDto)
|
||||
items: TspProviderOriginalItemPayloadDto[]
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Type(() => CustomerInfoDto)
|
||||
@ValidateNested({ each: true })
|
||||
customer?: CustomerInfoDto
|
||||
|
||||
@ApiProperty({ required: true, type: [PaymentInfoDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => PaymentInfoDto)
|
||||
payments: PaymentInfoDto[]
|
||||
}
|
||||
|
||||
export class TspProviderOriginalSendItemResultDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
invoice_id: string
|
||||
|
||||
@ApiProperty({ enum: TspProviderResponseStatus })
|
||||
@IsEnum(TspProviderResponseStatus)
|
||||
status: TspProviderResponseStatus
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
tax_id?: string | null
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
nullable: true,
|
||||
type: TspProviderOriginalSendPayloadDto,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => TspProviderOriginalSendPayloadDto)
|
||||
provider_request_payload: TspProviderOriginalSendPayloadDto
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
provider_response?: Object
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsBoolean()
|
||||
hasError: boolean
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
message?: string | null
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
error_message?: string
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
fiscal_warnings?: Object
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
validation_errors?: Object
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsDateString()
|
||||
received_at: string
|
||||
}
|
||||
@@ -1,412 +1,30 @@
|
||||
import { TspProviderCustomerType } from '@/common/enums/enums'
|
||||
import {
|
||||
SharedCreateSalesInvoiceItemDto,
|
||||
SharedCreateSalesInvoicePaymentsDto,
|
||||
} from '@/common/services/saleInvoices/sale-invoice-create.dto'
|
||||
import {
|
||||
CustomerType,
|
||||
InvoiceSettlementType,
|
||||
InvoiceTemplateType,
|
||||
PaymentMethodType,
|
||||
TspProviderRequestType,
|
||||
TspProviderResponseStatus,
|
||||
TspProviderType,
|
||||
} from '@/generated/prisma/enums'
|
||||
import { TspProviderResponseStatus } from '@/generated/prisma/enums'
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsArray, IsEnum, IsObject, IsString, ValidateNested } from 'class-validator'
|
||||
import {
|
||||
ArrayMinSize,
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
IsDateString,
|
||||
IsEnum,
|
||||
IsNumber,
|
||||
IsObject,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Min,
|
||||
ValidateNested,
|
||||
} from 'class-validator'
|
||||
|
||||
export class CustomerLegalInfoDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
economic_code: string
|
||||
}
|
||||
|
||||
export class CustomerIndividualInfoDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
first_name: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
last_name: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
national_id: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
mobile_number: string
|
||||
}
|
||||
|
||||
export class CustomerInfoDto {
|
||||
@ApiProperty({ required: true, enum: CustomerType })
|
||||
@IsEnum(CustomerType)
|
||||
type: CustomerType
|
||||
|
||||
@ApiProperty({})
|
||||
@Type(() => CustomerLegalInfoDto)
|
||||
@ValidateNested({ each: true })
|
||||
legal_info?: CustomerLegalInfoDto
|
||||
|
||||
@ApiProperty({})
|
||||
@Type(() => CustomerIndividualInfoDto)
|
||||
@ValidateNested({ each: true })
|
||||
individual_info?: CustomerIndividualInfoDto
|
||||
}
|
||||
|
||||
export class PaymentInfoDto {
|
||||
@ApiProperty({ required: true, enum: PaymentMethodType })
|
||||
@IsEnum(PaymentMethodType)
|
||||
payment_method: PaymentMethodType
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber({ allowInfinity: false, allowNaN: false })
|
||||
@Min(10_000)
|
||||
amount: number
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
tracking_code?: string
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
card_number?: string
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
paid_at?: Date
|
||||
}
|
||||
|
||||
export class TspProviderSendItemPayloadDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
sku: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
sku_vat: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
discount: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber()
|
||||
unit_price: number
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
invoice_item_id: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
quantity: number
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
total_amount: number
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
measure_unit: string
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
good_id?: string | null
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
service_id?: string | null
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
payload?: unknown
|
||||
}
|
||||
|
||||
export class TspProviderOriginalSendPayloadDto {
|
||||
@ApiProperty({ required: true, enum: TspProviderRequestType })
|
||||
@IsEnum(TspProviderRequestType)
|
||||
type: TspProviderRequestType
|
||||
|
||||
@ApiProperty({ required: true, enum: TspProviderCustomerType })
|
||||
@IsEnum(TspProviderCustomerType)
|
||||
customer_type: TspProviderCustomerType
|
||||
|
||||
@ApiProperty({ type: [TspProviderSendItemPayloadDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => TspProviderSendItemPayloadDto)
|
||||
items: TspProviderSendItemPayloadDto[]
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Type(() => CustomerInfoDto)
|
||||
@ValidateNested({ each: true })
|
||||
customer?: CustomerInfoDto
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsNumber()
|
||||
invoice_number: number
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsDateString()
|
||||
invoice_date: Date
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
invoice_id: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
total_amount: number
|
||||
|
||||
@ApiProperty({ required: true, enum: TspProviderType })
|
||||
@IsEnum(TspProviderType)
|
||||
tsp_provider: TspProviderType
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
economic_code: string
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
fiscal_id: string
|
||||
|
||||
@ApiProperty({ required: true, type: [PaymentInfoDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => PaymentInfoDto)
|
||||
payments: PaymentInfoDto[]
|
||||
|
||||
@ApiProperty({ required: true, enum: InvoiceTemplateType })
|
||||
@IsEnum(InvoiceTemplateType)
|
||||
invoice_template: InvoiceTemplateType
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
tsp_token: string
|
||||
|
||||
@ApiProperty({ required: true, enum: InvoiceSettlementType })
|
||||
@IsEnum(InvoiceSettlementType)
|
||||
settlement_type: InvoiceSettlementType
|
||||
}
|
||||
|
||||
export class TspProviderSendItemResultDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
invoice_id: string
|
||||
|
||||
@ApiProperty({ enum: TspProviderResponseStatus })
|
||||
@IsEnum(TspProviderResponseStatus)
|
||||
status: TspProviderResponseStatus
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
tax_id?: string | null
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
nullable: true,
|
||||
type: TspProviderOriginalSendPayloadDto,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
provider_request_payload: Object
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
provider_response_payload?: Object
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsBoolean()
|
||||
hasError: boolean
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
message?: string | null
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsDateString()
|
||||
sent_at: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsDateString()
|
||||
received_at: string
|
||||
}
|
||||
TspProviderCorrectionSendPayloadDto,
|
||||
TspProviderCorrectionSendResponseDto,
|
||||
} from './correction.dto'
|
||||
import { TspProviderGetResultDto } from './get.dto'
|
||||
import {
|
||||
TspProviderOriginalSendItemResultDto,
|
||||
TspProviderOriginalSendPayloadDto,
|
||||
} from './original.dto'
|
||||
import { TspProviderRevokePayloadDto, TspProviderRevokeResponseDto } from './revoke.dto'
|
||||
|
||||
export class TspProviderBulkSendResultDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
invoice_id: string
|
||||
|
||||
@ApiProperty({ type: [TspProviderSendItemResultDto] })
|
||||
@ApiProperty({ type: [TspProviderOriginalSendItemResultDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => TspProviderSendItemResultDto)
|
||||
items: TspProviderSendItemResultDto[]
|
||||
@Type(() => TspProviderOriginalSendItemResultDto)
|
||||
items: TspProviderOriginalSendItemResultDto[]
|
||||
}
|
||||
|
||||
///////////// GET RELATED DTOs /////////////
|
||||
|
||||
export class TspProviderGetResultDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
tax_id: string
|
||||
|
||||
@ApiProperty({ enum: TspProviderResponseStatus })
|
||||
@IsEnum(TspProviderResponseStatus)
|
||||
status: TspProviderResponseStatus
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsBoolean()
|
||||
hasError: boolean
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
message?: string | null
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
provider_response_payload?: Object
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsDateString()
|
||||
sent_at: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsDateString()
|
||||
received_at: string
|
||||
}
|
||||
|
||||
///////////// REVOKE RELATED DTOs /////////////
|
||||
|
||||
export class TspProviderRevokePayloadDto {
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsNumber()
|
||||
invoice_number: number
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
invoice_id: string
|
||||
|
||||
@ApiProperty({ required: true, enum: TspProviderType })
|
||||
@IsEnum(TspProviderType)
|
||||
tsp_provider: TspProviderType
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
economic_code: string
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
fiscal_id: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
tsp_token: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
last_tax_id: string
|
||||
}
|
||||
|
||||
export class TspProviderRevokeResponseDto {
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
invoice_id: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
tax_id: string
|
||||
|
||||
@ApiProperty({ enum: TspProviderResponseStatus })
|
||||
@IsEnum(TspProviderResponseStatus)
|
||||
status: TspProviderResponseStatus
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsBoolean()
|
||||
hasError: boolean
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
message?: string | null
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
provider_request_payload?: unknown
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
provider_response_payload?: unknown
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsDateString()
|
||||
sent_at: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsDateString()
|
||||
received_at: string
|
||||
}
|
||||
|
||||
///////////// CORRECTION RELATED DTOs /////////////
|
||||
export class TspProviderCorrectionInvoicePayloadDto {
|
||||
@ApiProperty({ type: [SharedCreateSalesInvoiceItemDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => SharedCreateSalesInvoiceItemDto)
|
||||
@ArrayMinSize(1)
|
||||
items: SharedCreateSalesInvoiceItemDto[]
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
total_amount: number
|
||||
|
||||
@ApiProperty({ required: true, type: SharedCreateSalesInvoicePaymentsDto })
|
||||
@IsObject()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => SharedCreateSalesInvoicePaymentsDto)
|
||||
payments: SharedCreateSalesInvoicePaymentsDto
|
||||
}
|
||||
export class TspProviderCorrectionSendPayloadDto extends TspProviderOriginalSendPayloadDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
last_tax_id: string
|
||||
}
|
||||
|
||||
export class TspProviderCorrectionSendResponseDto {}
|
||||
|
||||
export class TspProviderActionResponseDto {
|
||||
@IsObject()
|
||||
invoice: object
|
||||
@@ -422,7 +40,7 @@ export interface IProviderSwitchAdapter {
|
||||
readonly code: string
|
||||
originalSend(
|
||||
payload: TspProviderOriginalSendPayloadDto,
|
||||
): Promise<TspProviderSendItemResultDto>
|
||||
): Promise<TspProviderOriginalSendItemResultDto>
|
||||
sendBulk(
|
||||
payloads: TspProviderOriginalSendPayloadDto[],
|
||||
): Promise<TspProviderBulkSendResultDto[]>
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
import { TspProviderResponseStatus, TspProviderType } from '@/generated/prisma/enums'
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import {
|
||||
IsBoolean,
|
||||
IsDateString,
|
||||
IsEnum,
|
||||
IsNumber,
|
||||
IsObject,
|
||||
IsOptional,
|
||||
IsString,
|
||||
} from 'class-validator'
|
||||
|
||||
export class TspProviderRevokePayloadDto {
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsNumber()
|
||||
invoice_number: number
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
invoice_id: string
|
||||
|
||||
@ApiProperty({ required: true, enum: TspProviderType })
|
||||
@IsEnum(TspProviderType)
|
||||
tsp_provider: TspProviderType
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
economic_code: string
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
fiscal_id: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
tsp_token: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
last_tax_id: string
|
||||
}
|
||||
|
||||
export class TspProviderRevokeResponseDto {
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
invoice_id: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
tax_id: string
|
||||
|
||||
@ApiProperty({ enum: TspProviderResponseStatus })
|
||||
@IsEnum(TspProviderResponseStatus)
|
||||
status: TspProviderResponseStatus
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsBoolean()
|
||||
hasError: boolean
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
message?: string | null
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
provider_request_payload?: unknown
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
provider_response_payload?: unknown
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsDateString()
|
||||
sent_at: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsDateString()
|
||||
received_at: string
|
||||
}
|
||||
Reference in New Issue
Block a user