update switch providers and nama provider. fix original send
This commit is contained in:
@@ -0,0 +1,257 @@
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import { Type } from 'class-transformer'
|
||||
import {
|
||||
IsArray,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Min,
|
||||
ValidateNested,
|
||||
} from 'class-validator'
|
||||
|
||||
export enum NamaProviderResponseStatus {
|
||||
POSTED = 'POSTED',
|
||||
PENDING = 'PENDING',
|
||||
IN_PROGRESS = 'IN_PROGRESS',
|
||||
SUCCESS = 'SUCCESS',
|
||||
VALIDATION_ERROR = 'VALIDATION_ERROR',
|
||||
FAILED = 'FAILED',
|
||||
}
|
||||
|
||||
export class NamaProviderPaymentInfoDto {
|
||||
@ApiProperty({ required: true, description: 'روش پرداخت با توجه به PaymentMethodType' })
|
||||
@IsNumber()
|
||||
pmt: number
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
description: 'مبلغ پرداختی. در صورتی که روش تسویه نسیه باشد برابر با ۰ است',
|
||||
})
|
||||
@IsNumber({ allowInfinity: false, allowNaN: false })
|
||||
@Min(0)
|
||||
pv: number
|
||||
|
||||
@ApiProperty({ required: false, description: 'شمارهی پیگیری' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
trn?: string
|
||||
|
||||
@ApiProperty({ required: false, description: 'شمارهی کارت پرداخت کنندهی صورتحساب' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
pcn?: string
|
||||
|
||||
@ApiProperty({ required: false, description: 'تاریخ و زمان پرداخت صورتحساب unix' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
pdt?: string
|
||||
}
|
||||
|
||||
export class NamaProviderCommonHeaderDto {
|
||||
@ApiProperty({ required: true, description: 'الگوی صورتحساب' })
|
||||
@IsString()
|
||||
inp: string
|
||||
|
||||
@ApiProperty({ required: true, description: 'نوع صورتحساب' })
|
||||
@IsString()
|
||||
inty: string
|
||||
|
||||
@ApiProperty({ required: true, description: 'سریال صورتحساب داخلی حافظه مالیاتی' })
|
||||
@IsString()
|
||||
inno: string
|
||||
|
||||
// @ApiProperty({ required: true })
|
||||
// @IsString()
|
||||
// tins: string
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
description: 'تاریخ و زمان صدور صورتحساب به صورت timestamp',
|
||||
})
|
||||
@IsString()
|
||||
indatim: string
|
||||
|
||||
@ApiProperty({ required: true, description: 'نام مشتری' })
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@ApiProperty({
|
||||
required: false,
|
||||
description:
|
||||
'نوع شخصیت خریدار (در صورتیکه خریدار نوع ۲ باشه باید ۱ یا ۲ گذاشته بشه)',
|
||||
})
|
||||
@IsString()
|
||||
tob: string
|
||||
|
||||
@ApiProperty({ description: 'آدرس' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
address?: string
|
||||
|
||||
@ApiProperty({ description: 'شماره موبایل' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
mobile?: string
|
||||
|
||||
@ApiProperty({
|
||||
description: `شماره ملی / شناسه ملی / شناسه مشارکت مدنی / کد فراگیر خریدار`,
|
||||
})
|
||||
@IsString()
|
||||
bid: string
|
||||
|
||||
@ApiProperty({ required: true, description: 'روش تسویه (۱.نقدی، ۲.نسیه، ۳.نقدی-نسیه)' })
|
||||
@IsString()
|
||||
setm: '1' | '2' | '3'
|
||||
|
||||
@ApiProperty({ description: 'سهم پرداخت نقدی در صورتی که نقدی - نسیه باشد (۳)' })
|
||||
@IsString()
|
||||
cap: string
|
||||
|
||||
@ApiProperty({ description: 'سهم پرداخت نسیه در صورتی که نقدی - نسیه باشد (۳)' })
|
||||
@IsString()
|
||||
insp: string
|
||||
}
|
||||
|
||||
export class NamaProviderCommonBodyDto {
|
||||
@ApiProperty({ required: true, description: 'شناسه کالا / خدمت' })
|
||||
@IsString()
|
||||
sstid: string
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
description: `نرخ مالیات بر ارزش افزوده`,
|
||||
})
|
||||
@IsString()
|
||||
vra: string
|
||||
|
||||
// @ApiProperty()
|
||||
// @IsString()
|
||||
// sstt: string
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
description: 'مبلغ واحد',
|
||||
})
|
||||
@IsString()
|
||||
fee: string
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
description: 'مبلغ تخفیف',
|
||||
})
|
||||
@IsString()
|
||||
dis: string
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
description: 'واحد اندازه گیری',
|
||||
})
|
||||
@IsString()
|
||||
mu: string
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
description: 'تعداد / مقدار',
|
||||
})
|
||||
@IsString()
|
||||
am: string
|
||||
|
||||
@ApiProperty({
|
||||
description: ' اجرت ساخت (طلا)',
|
||||
})
|
||||
@IsString()
|
||||
consfee: string
|
||||
|
||||
@ApiProperty({
|
||||
description: 'حق العمل',
|
||||
})
|
||||
@IsString()
|
||||
bros: string
|
||||
|
||||
@ApiProperty({
|
||||
description: 'سود فروشنده',
|
||||
})
|
||||
@IsString()
|
||||
spro: string
|
||||
}
|
||||
|
||||
export class NamaProviderApiErrorItemDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
code: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
message: string
|
||||
}
|
||||
|
||||
export class NamaProviderTSPValidationErrorsDto {
|
||||
@ApiProperty({ type: [NamaProviderApiErrorItemDto], required: false })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => NamaProviderApiErrorItemDto)
|
||||
error?: NamaProviderApiErrorItemDto[]
|
||||
|
||||
@ApiProperty({ type: [NamaProviderApiErrorItemDto], required: false })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => NamaProviderApiErrorItemDto)
|
||||
warning?: NamaProviderApiErrorItemDto[]
|
||||
}
|
||||
|
||||
export class NamaProviderValidationErrorDto {
|
||||
@IsString()
|
||||
key: string
|
||||
|
||||
@IsString()
|
||||
errorKeyPosition: string
|
||||
|
||||
@IsString()
|
||||
message: string
|
||||
|
||||
@IsNumber()
|
||||
errorKeyIndex: number
|
||||
}
|
||||
|
||||
export class NamaProviderResponseDto {
|
||||
@ApiProperty({ description: 'شناسه پیگیری فاکتور' })
|
||||
@IsString()
|
||||
uuid: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
message: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
status: NamaProviderResponseStatus
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
inno: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
reference_number: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
tax_id?: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
error_message: string
|
||||
|
||||
@ApiProperty({ type: [NamaProviderValidationErrorDto] })
|
||||
@IsArray()
|
||||
@IsOptional()
|
||||
validation_error: NamaProviderValidationErrorDto[]
|
||||
|
||||
@ApiProperty({ type: [NamaProviderTSPValidationErrorsDto], required: false })
|
||||
@IsOptional()
|
||||
tax_api_response?: NamaProviderTSPValidationErrorsDto[]
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsArray, IsString, Length, ValidateNested } from 'class-validator'
|
||||
import {
|
||||
NamaProviderCommonBodyDto,
|
||||
NamaProviderCommonHeaderDto,
|
||||
NamaProviderPaymentInfoDto,
|
||||
NamaProviderResponseDto,
|
||||
} from './common.dto'
|
||||
|
||||
export class NamaProviderCorrectionHeaderDto extends NamaProviderCommonHeaderDto {
|
||||
@ApiProperty({ required: true, description: 'موضوع صورتحساب (2- اصلاحی)' })
|
||||
@IsString()
|
||||
ins: '2'
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
description: 'شناسه مالیاتی صورتحساب مرجع',
|
||||
minLength: 22,
|
||||
maxLength: 22,
|
||||
})
|
||||
@IsString()
|
||||
@Length(22, 22)
|
||||
irtaxid: string
|
||||
}
|
||||
|
||||
export class NamaProviderCorrectionBodyItemDto extends NamaProviderCommonBodyDto {}
|
||||
|
||||
export class NamaProviderCorrectionRequestDto {
|
||||
@ApiProperty({ type: [NamaProviderCorrectionBodyItemDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => NamaProviderCorrectionBodyItemDto)
|
||||
body: NamaProviderCorrectionBodyItemDto[]
|
||||
|
||||
@ApiProperty({ type: [NamaProviderPaymentInfoDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => NamaProviderPaymentInfoDto)
|
||||
payment: NamaProviderPaymentInfoDto[]
|
||||
|
||||
@ApiProperty({ type: NamaProviderCorrectionHeaderDto })
|
||||
@ValidateNested()
|
||||
@Type(() => NamaProviderCorrectionHeaderDto)
|
||||
header: NamaProviderCorrectionHeaderDto
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
uuid: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
economic_code: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
fiscal_id: string
|
||||
}
|
||||
|
||||
export class NamaProviderCorrectionResponseDto extends NamaProviderResponseDto {}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { ApiProperty, OmitType } from '@nestjs/swagger'
|
||||
import { IsString } from 'class-validator'
|
||||
import { NamaProviderResponseDto } from './common.dto'
|
||||
|
||||
export class NamaProviderGetResponseDto extends OmitType(NamaProviderResponseDto, [
|
||||
'tax_id',
|
||||
]) {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
tax_id: string
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export * from './common.dto'
|
||||
export * from './correction.dto'
|
||||
export * from './get.dto'
|
||||
export * from './original.dto'
|
||||
export * from './revoke.dto'
|
||||
@@ -0,0 +1,50 @@
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsArray, IsString, ValidateNested } from 'class-validator'
|
||||
import {
|
||||
NamaProviderCommonBodyDto,
|
||||
NamaProviderCommonHeaderDto,
|
||||
NamaProviderPaymentInfoDto,
|
||||
NamaProviderResponseDto,
|
||||
} from './common.dto'
|
||||
|
||||
export class NamaProviderOriginalHeaderDto extends NamaProviderCommonHeaderDto {
|
||||
@ApiProperty({ required: true, description: 'موضوع صورتحساب (1- اصلی)' })
|
||||
@IsString()
|
||||
ins: '1'
|
||||
}
|
||||
|
||||
export class NamaProviderOriginalBodyItemDto extends NamaProviderCommonBodyDto {}
|
||||
|
||||
export class NamaProviderOriginalRequestDto {
|
||||
@ApiProperty({ type: [NamaProviderOriginalBodyItemDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => NamaProviderOriginalBodyItemDto)
|
||||
body: NamaProviderOriginalBodyItemDto[]
|
||||
|
||||
@ApiProperty({ type: [NamaProviderPaymentInfoDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => NamaProviderPaymentInfoDto)
|
||||
payment: NamaProviderPaymentInfoDto[]
|
||||
|
||||
@ApiProperty({ type: NamaProviderOriginalHeaderDto })
|
||||
@ValidateNested()
|
||||
@Type(() => NamaProviderOriginalHeaderDto)
|
||||
header: NamaProviderOriginalHeaderDto
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
uuid: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
economic_code: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
fiscal_id: string
|
||||
}
|
||||
|
||||
export class NamaProviderOriginalResponseDto extends NamaProviderResponseDto {}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { ApiProperty, OmitType } from '@nestjs/swagger'
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsString, ValidateNested } from 'class-validator'
|
||||
import { NamaProviderResponseDto } from './common.dto'
|
||||
|
||||
export class NamaProviderRevokeHeaderDto {
|
||||
@ApiProperty({ required: true, description: 'موضوع صورتحساب (3- ابطالی)' })
|
||||
@IsString()
|
||||
ins: '3'
|
||||
|
||||
@ApiProperty({ required: true, description: 'سریال صورتحساب داخلی حافظه مالیاتی' })
|
||||
@IsString()
|
||||
inno: string
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
description: 'تاریخ و زمان صدور صورتحساب به صورت timestamp',
|
||||
})
|
||||
@IsString()
|
||||
indatim: string
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
description: 'آخرین شماره مالیاتی دریافت شده مربوط به فاکتور',
|
||||
})
|
||||
@IsString()
|
||||
irtaxid: string
|
||||
}
|
||||
export class NamaProviderRevokeRequestDto {
|
||||
@ApiProperty({ type: NamaProviderRevokeHeaderDto })
|
||||
@ValidateNested()
|
||||
@Type(() => NamaProviderRevokeHeaderDto)
|
||||
header: NamaProviderRevokeHeaderDto
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
uuid: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
economic_code: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
fiscal_id: string
|
||||
}
|
||||
|
||||
export class NamaProviderRevokeResponseDto extends OmitType(NamaProviderResponseDto, [
|
||||
'tax_id',
|
||||
]) {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
tax_id: string
|
||||
}
|
||||
Reference in New Issue
Block a user