194 lines
4.3 KiB
TypeScript
194 lines
4.3 KiB
TypeScript
|
|
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
|
||
|
|
}
|