@floristcloud/api-lib 1.2.183 → 1.2.184
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/commands/company/createCompany.command.js +4 -14
- package/build/commands/company-legal-profile/create.command.js +10 -0
- package/build/commands/company-legal-profile/delete.command.js +8 -0
- package/build/commands/company-legal-profile/get-list.query.js +8 -0
- package/build/commands/company-legal-profile/index.js +21 -0
- package/build/commands/company-legal-profile/save-integration-link.command.js +10 -0
- package/build/commands/company-legal-profile/update.command.js +10 -0
- package/build/commands/index.js +1 -0
- package/build/commands/integration/moysklad/get-seller-sync-status.query.js +10 -0
- package/build/commands/integration/moysklad/index.js +2 -0
- package/build/commands/integration/moysklad/retry-seller-sync.command.js +10 -0
- package/build/commands/order/create-order.command.js +4 -25
- package/build/commands/order/update-order.command.js +4 -29
- package/build/constant/error.js +22 -0
- package/build/enum/action-log-type.enum.js +1 -0
- package/build/enum/index.js +3 -0
- package/build/enum/order-seller-sync-status-list.js +14 -0
- package/build/enum/order-updated-field.enum.js +1 -0
- package/build/enum/seller-sync-item-status.enum.js +10 -0
- package/build/enum/seller-sync-status.enum.js +11 -0
- package/build/schemas/action-log/action-log-company-legal-profile.schema.js +10 -0
- package/build/schemas/action-log/action-log-payload.schema.js +2 -0
- package/build/schemas/action-log/action-log.schema.js +2 -0
- package/build/schemas/action-log/company-legal-profile-action-log.schema.js +9 -0
- package/build/schemas/action-log/index.js +2 -0
- package/build/schemas/company/create-company-request.schema.js +13 -0
- package/build/schemas/company/create-company-response.schema.js +6 -0
- package/build/schemas/company-legal-profile/company-legal-profile-integration-link.schema.js +5 -0
- package/build/schemas/company-legal-profile/company-legal-profile-integration-links-response.schema.js +6 -0
- package/build/schemas/company-legal-profile/company-legal-profile-list-response.schema.js +6 -0
- package/build/schemas/company-legal-profile/company-legal-profile-requisites.schema.js +28 -0
- package/build/schemas/company-legal-profile/company-legal-profile-response.schema.js +6 -0
- package/build/schemas/company-legal-profile/company-legal-profile.schema.js +14 -0
- package/build/schemas/company-legal-profile/create-company-legal-profile-request.schema.js +9 -0
- package/build/schemas/company-legal-profile/delete-company-legal-profile-response.schema.js +5 -0
- package/build/schemas/company-legal-profile/index.js +26 -0
- package/build/schemas/company-legal-profile/save-company-legal-profile-integration-link-request.schema.js +5 -0
- package/build/schemas/company-legal-profile/update-company-legal-profile-request.schema.js +8 -0
- package/build/schemas/index.js +7 -0
- package/build/schemas/integration/moysklad/index.js +4 -0
- package/build/schemas/integration/moysklad/seller-sync-failure.schema.js +5 -0
- package/build/schemas/integration/moysklad/seller-sync-request.schema.js +5 -0
- package/build/schemas/integration/moysklad/seller-sync-status-response.schema.js +6 -0
- package/build/schemas/integration/moysklad/seller-sync-status.schema.js +23 -0
- package/build/schemas/order/create-order-request.schema.js +25 -0
- package/build/schemas/order/create-order-response.schema.js +9 -0
- package/build/schemas/order/index.js +1 -0
- package/build/schemas/order/order-base.schema.js +1 -0
- package/build/schemas/order/order-vat-source-confirmation.schema.js +10 -0
- package/build/schemas/order/update-order-request.schema.js +30 -0
- package/build/schemas/order/update-order-response.schema.js +9 -0
- package/build/schemas/order-product/order-product-base.schema.js +1 -0
- package/build/schemas/order-service-line/order-service-line.schema.js +1 -0
- package/build/schemas/payment-invoice/create-payment-invoice-request.schema.js +1 -0
- package/build/schemas/payment-invoice/payment-invoice.schema.js +1 -0
- package/build/schemas/settings/settings.schema.js +14 -186
- package/build/schemas/transfer-document/transfer-document.schema.js +1 -0
- package/build/types/index.js +1 -0
- package/build/types/order-vat-source-confirmation.type.js +2 -0
- package/commands/company/createCompany.command.ts +3 -15
- package/commands/company-legal-profile/create.command.ts +9 -0
- package/commands/company-legal-profile/delete.command.ts +6 -0
- package/commands/company-legal-profile/get-list.query.ts +6 -0
- package/commands/company-legal-profile/index.ts +5 -0
- package/commands/company-legal-profile/save-integration-link.command.ts +9 -0
- package/commands/company-legal-profile/update.command.ts +9 -0
- package/commands/index.ts +2 -0
- package/commands/integration/moysklad/get-seller-sync-status.query.ts +10 -0
- package/commands/integration/moysklad/index.ts +4 -0
- package/commands/integration/moysklad/retry-seller-sync.command.ts +10 -0
- package/commands/order/create-order.command.ts +3 -26
- package/commands/order/update-order.command.ts +3 -30
- package/constant/error.ts +23 -0
- package/enum/action-log-type.enum.ts +1 -0
- package/enum/index.ts +6 -0
- package/enum/order-seller-sync-status-list.ts +12 -0
- package/enum/order-updated-field.enum.ts +1 -0
- package/enum/seller-sync-item-status.enum.ts +6 -0
- package/enum/seller-sync-status.enum.ts +7 -0
- package/package.json +1 -1
- package/schemas/action-log/action-log-company-legal-profile.schema.ts +7 -0
- package/schemas/action-log/action-log-payload.schema.ts +2 -0
- package/schemas/action-log/action-log.schema.ts +2 -0
- package/schemas/action-log/company-legal-profile-action-log.schema.ts +6 -0
- package/schemas/action-log/index.ts +3 -0
- package/schemas/company/create-company-request.schema.ts +10 -0
- package/schemas/company/create-company-response.schema.ts +3 -0
- package/schemas/company-legal-profile/company-legal-profile-integration-link.schema.ts +2 -0
- package/schemas/company-legal-profile/company-legal-profile-integration-links-response.schema.ts +3 -0
- package/schemas/company-legal-profile/company-legal-profile-list-response.schema.ts +3 -0
- package/schemas/company-legal-profile/company-legal-profile-requisites.schema.ts +25 -0
- package/schemas/company-legal-profile/company-legal-profile-response.schema.ts +3 -0
- package/schemas/company-legal-profile/company-legal-profile.schema.ts +11 -0
- package/schemas/company-legal-profile/create-company-legal-profile-request.schema.ts +6 -0
- package/schemas/company-legal-profile/delete-company-legal-profile-response.schema.ts +2 -0
- package/schemas/company-legal-profile/index.ts +10 -0
- package/schemas/company-legal-profile/save-company-legal-profile-integration-link-request.schema.ts +2 -0
- package/schemas/company-legal-profile/update-company-legal-profile-request.schema.ts +5 -0
- package/schemas/index.ts +9 -0
- package/schemas/integration/moysklad/index.ts +8 -0
- package/schemas/integration/moysklad/seller-sync-failure.schema.ts +3 -0
- package/schemas/integration/moysklad/seller-sync-request.schema.ts +3 -0
- package/schemas/integration/moysklad/seller-sync-status-response.schema.ts +4 -0
- package/schemas/integration/moysklad/seller-sync-status.schema.ts +21 -0
- package/schemas/order/create-order-request.schema.ts +24 -0
- package/schemas/order/create-order-response.schema.ts +8 -0
- package/schemas/order/index.ts +2 -0
- package/schemas/order/order-base.schema.ts +1 -0
- package/schemas/order/order-vat-source-confirmation.schema.ts +8 -0
- package/schemas/order/update-order-request.schema.ts +29 -0
- package/schemas/order/update-order-response.schema.ts +8 -0
- package/schemas/order-product/order-product-base.schema.ts +1 -0
- package/schemas/order-service-line/order-service-line.schema.ts +1 -0
- package/schemas/payment-invoice/create-payment-invoice-request.schema.ts +1 -0
- package/schemas/payment-invoice/payment-invoice.schema.ts +1 -0
- package/schemas/settings/settings.schema.ts +12 -61
- package/schemas/transfer-document/transfer-document.schema.ts +1 -0
- package/types/index.ts +2 -0
- package/types/order-vat-source-confirmation.type.ts +4 -0
package/enum/index.ts
CHANGED
|
@@ -164,3 +164,9 @@ export * from './pre-order-fulfillment-status.enum';
|
|
|
164
164
|
export * from './delivery-pricing-rule-scope.enum';
|
|
165
165
|
export * from './delivery-pricing-in-transit-mode.enum';
|
|
166
166
|
export * from './measure-unit-match-source.enum';
|
|
167
|
+
|
|
168
|
+
export * from './order-seller-sync-status-list';
|
|
169
|
+
|
|
170
|
+
export * from './seller-sync-status.enum';
|
|
171
|
+
|
|
172
|
+
export * from './seller-sync-item-status.enum';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OrderStatusEnum } from './order-status.enum';
|
|
2
|
+
|
|
3
|
+
// Orders already shipped, completed, imported or used as templates must not be relinked in bulk.
|
|
4
|
+
export const ORDER_SELLER_SYNC_STATUS_LIST = [
|
|
5
|
+
OrderStatusEnum.NEW,
|
|
6
|
+
OrderStatusEnum.WEBSHOP_NEW,
|
|
7
|
+
OrderStatusEnum.PREPAYMENT,
|
|
8
|
+
OrderStatusEnum.UNDER_REVIEW,
|
|
9
|
+
OrderStatusEnum.ACCEPTED,
|
|
10
|
+
OrderStatusEnum.ASSEMBLED,
|
|
11
|
+
OrderStatusEnum.VERIFIED,
|
|
12
|
+
];
|
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ActionLogTypeEnum } from '../../enum/action-log-type.enum';
|
|
3
|
+
import { BaseActionFields } from './base-action-fields.schema';
|
|
4
|
+
import { CompanyLegalProfileActionLogSchema } from './company-legal-profile-action-log.schema';
|
|
5
|
+
export const ActionLogCompanyLegalProfileSchema = z
|
|
6
|
+
.object({ actionType: z.literal(ActionLogTypeEnum.UPDATE_COMPANY_LEGAL_PROFILE), payload: CompanyLegalProfileActionLogSchema })
|
|
7
|
+
.merge(BaseActionFields);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CompanyLegalProfileActionLogSchema } from './company-legal-profile-action-log.schema';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { ClientCreateActionLogSchema } from './client-create-action-log.schema';
|
|
3
4
|
import { ClientDeleteActionLogSchema } from './client-delete-action-log.schema';
|
|
@@ -81,6 +82,7 @@ import { WriteOffStatusUpdateActionLogSchema } from './write-off-status-update-a
|
|
|
81
82
|
// ActionLogSchema, здесь только формы: вариант, забытый тут, не ломает чтение журнала, но
|
|
82
83
|
// оставляет потребителя контракта с типом, в котором не хватает полей.
|
|
83
84
|
export const ActionLogPayloadSchema = z.union([
|
|
85
|
+
CompanyLegalProfileActionLogSchema,
|
|
84
86
|
OrderDeleteActionLogPayloadSchema,
|
|
85
87
|
OrderMergeActionLogSchema,
|
|
86
88
|
OrderProductCreateActionLogSchema,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ActionLogCompanyLegalProfileSchema } from './action-log-company-legal-profile.schema';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { ActionLogTypeEnum } from '../../enum/action-log-type.enum';
|
|
3
4
|
import { ActionLogAddPaymentSchema } from './action-log-add-payment.schema';
|
|
@@ -81,6 +82,7 @@ import { ActionLogUpdateWriteOffStatusSchema } from './action-log-update-write-o
|
|
|
81
82
|
import { ActionLogVerifyOrderItemSchema } from './action-log-verify-order-item.schema';
|
|
82
83
|
|
|
83
84
|
export const ActionLogSchema = z.discriminatedUnion('actionType', [
|
|
85
|
+
ActionLogCompanyLegalProfileSchema,
|
|
84
86
|
ActionLogDeleteOrderSchema,
|
|
85
87
|
ActionLogDeleteOrderItemSchema,
|
|
86
88
|
ActionLogCreateOrderItemSchema,
|
|
@@ -179,3 +179,6 @@ export * from './write-off-delete-action-log.schema';
|
|
|
179
179
|
export * from './write-off-info.schema';
|
|
180
180
|
export * from './write-off-price-update-action-log.schema';
|
|
181
181
|
export * from './write-off-status-update-action-log.schema';
|
|
182
|
+
|
|
183
|
+
export * from './company-legal-profile-action-log.schema';
|
|
184
|
+
export * from './action-log-company-legal-profile.schema';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CreateSettingsSchema } from '../settings/settings.schema';
|
|
3
|
+
import { CreateCompanyLegalProfileRequestSchema } from '../company-legal-profile/create-company-legal-profile-request.schema';
|
|
4
|
+
export const CreateCompanyRequestSchema = z.object({
|
|
5
|
+
name: z.string(),
|
|
6
|
+
alias: z.string().optional(),
|
|
7
|
+
settings: CreateSettingsSchema,
|
|
8
|
+
legalProfile: CreateCompanyLegalProfileRequestSchema.optional(),
|
|
9
|
+
domain: z.string(),
|
|
10
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const CompanyLegalProfileRequisitesSchema = z.object({
|
|
3
|
+
invoiceNumberPrefix: z.string().trim().max(100).optional(),
|
|
4
|
+
transferDocumentStatus: z
|
|
5
|
+
.union([z.literal(1), z.literal(2)])
|
|
6
|
+
.nullable()
|
|
7
|
+
.optional(),
|
|
8
|
+
legalName: z.string().trim().max(1000).nullable().optional(),
|
|
9
|
+
taxId: z.string().trim().max(1000).nullable().optional(),
|
|
10
|
+
kpp: z.string().trim().max(1000).nullable().optional(),
|
|
11
|
+
ogrn: z.string().trim().max(1000).nullable().optional(),
|
|
12
|
+
legalAddress: z.string().trim().max(1000).nullable().optional(),
|
|
13
|
+
bankName: z.string().trim().max(1000).nullable().optional(),
|
|
14
|
+
bankAccountNumber: z.string().trim().max(1000).nullable().optional(),
|
|
15
|
+
bankBic: z.string().trim().max(1000).nullable().optional(),
|
|
16
|
+
correspondentAccount: z.string().trim().max(1000).nullable().optional(),
|
|
17
|
+
signatoryName: z.string().trim().max(1000).nullable().optional(),
|
|
18
|
+
signatoryPosition: z.string().trim().max(1000).nullable().optional(),
|
|
19
|
+
accountantName: z.string().trim().max(1000).nullable().optional(),
|
|
20
|
+
responsibleName: z.string().trim().max(1000).nullable().optional(),
|
|
21
|
+
responsiblePosition: z.string().trim().max(1000).nullable().optional(),
|
|
22
|
+
shipperName: z.string().trim().max(1000).nullable().optional(),
|
|
23
|
+
shipperAddress: z.string().trim().max(1000).nullable().optional(),
|
|
24
|
+
vat: z.number().int().min(0).max(100).nullable().optional(),
|
|
25
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CompanyLegalProfileRequisitesSchema } from './company-legal-profile-requisites.schema';
|
|
3
|
+
export const CompanyLegalProfileSchema = CompanyLegalProfileRequisitesSchema.required().extend({
|
|
4
|
+
uuid: z.uuid(),
|
|
5
|
+
companyUUID: z.uuid(),
|
|
6
|
+
label: z.string(),
|
|
7
|
+
isDefault: z.boolean(),
|
|
8
|
+
isArchived: z.boolean(),
|
|
9
|
+
createdAt: z.coerce.date(),
|
|
10
|
+
updatedAt: z.coerce.date(),
|
|
11
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CompanyLegalProfileRequisitesSchema } from './company-legal-profile-requisites.schema';
|
|
3
|
+
export const CreateCompanyLegalProfileRequestSchema = CompanyLegalProfileRequisitesSchema.extend({
|
|
4
|
+
label: z.string().trim().min(1).max(255),
|
|
5
|
+
isDefault: z.boolean().optional(),
|
|
6
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './company-legal-profile-list-response.schema';
|
|
2
|
+
export * from './company-legal-profile-requisites.schema';
|
|
3
|
+
export * from './company-legal-profile-response.schema';
|
|
4
|
+
export * from './company-legal-profile.schema';
|
|
5
|
+
export * from './create-company-legal-profile-request.schema';
|
|
6
|
+
export * from './delete-company-legal-profile-response.schema';
|
|
7
|
+
export * from './update-company-legal-profile-request.schema';
|
|
8
|
+
export * from './company-legal-profile-integration-link.schema';
|
|
9
|
+
export * from './save-company-legal-profile-integration-link-request.schema';
|
|
10
|
+
export * from './company-legal-profile-integration-links-response.schema';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CreateCompanyLegalProfileRequestSchema } from './create-company-legal-profile-request.schema';
|
|
3
|
+
export const UpdateCompanyLegalProfileRequestSchema = CreateCompanyLegalProfileRequestSchema.partial().extend({
|
|
4
|
+
isArchived: z.boolean().optional(),
|
|
5
|
+
});
|
package/schemas/index.ts
CHANGED
|
@@ -143,3 +143,12 @@ export * from './product/group';
|
|
|
143
143
|
export * from './report';
|
|
144
144
|
|
|
145
145
|
export * from './integration/moysklad';
|
|
146
|
+
|
|
147
|
+
export * from './company-legal-profile';
|
|
148
|
+
|
|
149
|
+
export * from './order/create-order-request.schema';
|
|
150
|
+
export * from './order/create-order-response.schema';
|
|
151
|
+
export * from './order/update-order-request.schema';
|
|
152
|
+
export * from './order/update-order-response.schema';
|
|
153
|
+
export * from './company/create-company-request.schema';
|
|
154
|
+
export * from './company/create-company-response.schema';
|
|
@@ -24,3 +24,11 @@ export * from './moysklad-scanned-measure-unit.schema';
|
|
|
24
24
|
|
|
25
25
|
export * from './moysklad-measure-unit-alias-added.schema';
|
|
26
26
|
export * from './moysklad-measure-unit-dictionary-item.schema';
|
|
27
|
+
|
|
28
|
+
export * from './seller-sync-failure.schema';
|
|
29
|
+
|
|
30
|
+
export * from './seller-sync-status.schema';
|
|
31
|
+
|
|
32
|
+
export * from './seller-sync-status-response.schema';
|
|
33
|
+
|
|
34
|
+
export * from './seller-sync-request.schema';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SellerSyncStatusEnum } from '../../../enum/seller-sync-status.enum';
|
|
3
|
+
import { SellerSyncFailureSchema } from './seller-sync-failure.schema';
|
|
4
|
+
|
|
5
|
+
export const SellerSyncStatusSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
profileUUID: z.string().uuid(),
|
|
8
|
+
status: z.nativeEnum(SellerSyncStatusEnum),
|
|
9
|
+
total: z.number().int().nonnegative(),
|
|
10
|
+
processed: z.number().int().nonnegative(),
|
|
11
|
+
succeeded: z.number().int().nonnegative(),
|
|
12
|
+
skipped: z.number().int().nonnegative(),
|
|
13
|
+
failed: z.number().int().nonnegative(),
|
|
14
|
+
pending: z.number().int().nonnegative(),
|
|
15
|
+
// Null until discovery finishes. Counts are actual HTTP outcomes, not enqueue acknowledgements.
|
|
16
|
+
progressPercent: z.number().min(0).max(100).nullable(),
|
|
17
|
+
failures: z.array(SellerSyncFailureSchema),
|
|
18
|
+
hasMoreFailures: z.boolean(),
|
|
19
|
+
createdAt: z.string().datetime(),
|
|
20
|
+
updatedAt: z.string().datetime(),
|
|
21
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OrderTypeEnum } from '../../enum';
|
|
3
|
+
import { CalendarDaySchema } from '../calendar-day.schema';
|
|
4
|
+
import { OrderDeliverySchema } from '../order-delivery/order-delivery.schema';
|
|
5
|
+
import { OrderExternalNumberRequestSchema } from './order-external-number.schema';
|
|
6
|
+
|
|
7
|
+
import { MoneySchema } from '../money.schema';
|
|
8
|
+
|
|
9
|
+
export const CreateOrderRequestSchema = z.object({
|
|
10
|
+
companyLegalProfileUUID: z.uuid().optional(),
|
|
11
|
+
clientUUID: z.uuid(),
|
|
12
|
+
branchUUID: z.uuid().nullable(),
|
|
13
|
+
deliveryCost: MoneySchema,
|
|
14
|
+
deliveryVat: z.number().nullable(),
|
|
15
|
+
type: z.nativeEnum(OrderTypeEnum),
|
|
16
|
+
comment: z.string().nullable(),
|
|
17
|
+
clientComment: z.string().nullable(),
|
|
18
|
+
tag: z.string().nullable(),
|
|
19
|
+
externalNumber: OrderExternalNumberRequestSchema,
|
|
20
|
+
// Дата отгрузки/выдачи — одна для самовывоза и доставки. Приоритет над устаревшим
|
|
21
|
+
// `delivery.deliveryDate`.
|
|
22
|
+
plannedShipmentDate: CalendarDaySchema.nullable().optional(),
|
|
23
|
+
delivery: OrderDeliverySchema.omit({ uuid: true }).nullable(),
|
|
24
|
+
});
|
package/schemas/order/index.ts
CHANGED
|
@@ -26,3 +26,5 @@ export * from './order-vat-transition-analyze-response.schema';
|
|
|
26
26
|
export * from './order-vat-transition-execute-failure.schema';
|
|
27
27
|
export * from './order-vat-transition-execute-result.schema';
|
|
28
28
|
export * from './order-vat-transition-execute-response.schema';
|
|
29
|
+
|
|
30
|
+
export * from './order-vat-source-confirmation.schema';
|
|
@@ -4,6 +4,7 @@ import { MoneySchema } from '../money.schema';
|
|
|
4
4
|
import { CalendarDaySchema } from '../calendar-day.schema';
|
|
5
5
|
|
|
6
6
|
export const OrderSchema = z.object({
|
|
7
|
+
companyLegalProfileUUID: z.uuid().nullable().optional(),
|
|
7
8
|
uuid: z.uuid(),
|
|
8
9
|
orderNumber: z.number(),
|
|
9
10
|
clientUUID: z.uuid(),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// Confirm the displayed historical rate before classifying its source.
|
|
4
|
+
export const OrderVatSourceConfirmationSchema = z.object({
|
|
5
|
+
uuid: z.uuid(),
|
|
6
|
+
vat: z.number().int().min(0).max(100).nullable(),
|
|
7
|
+
isVatInherited: z.boolean(),
|
|
8
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OrderVatSourceConfirmationSchema } from './order-vat-source-confirmation.schema';
|
|
3
|
+
import { OrderStatusEnum, OrderTypeEnum } from '../../enum';
|
|
4
|
+
import { CalendarDaySchema } from '../calendar-day.schema';
|
|
5
|
+
import { OrderExternalNumberRequestSchema } from './order-external-number.schema';
|
|
6
|
+
|
|
7
|
+
import { MoneySchema } from '../money.schema';
|
|
8
|
+
|
|
9
|
+
export const UpdateOrderRequestSchema = z.object({
|
|
10
|
+
vatSourceConfirmations: z.array(OrderVatSourceConfirmationSchema).min(1).max(1000).optional(),
|
|
11
|
+
companyLegalProfileUUID: z.uuid().optional(),
|
|
12
|
+
clientUUID: z.uuid(),
|
|
13
|
+
branchUUID: z.uuid().nullable(),
|
|
14
|
+
deliveryCost: MoneySchema,
|
|
15
|
+
type: z.nativeEnum(OrderTypeEnum),
|
|
16
|
+
comment: z.string().nullable(),
|
|
17
|
+
clientComment: z.string().nullable(),
|
|
18
|
+
tag: z.string().nullable(),
|
|
19
|
+
externalNumber: OrderExternalNumberRequestSchema,
|
|
20
|
+
status: z.nativeEnum(OrderStatusEnum),
|
|
21
|
+
isPaid: z.coerce.boolean(),
|
|
22
|
+
deliveryVat: z.coerce.number().nullable(),
|
|
23
|
+
deliveryVatAmount: MoneySchema,
|
|
24
|
+
completedAt: z.coerce.date().nullable().optional(),
|
|
25
|
+
paymentDueAt: z.coerce.date().nullable().optional(),
|
|
26
|
+
// Дата отгрузки/выдачи — одна для самовывоза и доставки. Не раньше прихода товара в пути
|
|
27
|
+
// (O061, в errorData — самый ранний день). Не передано — не меняется, null — снять.
|
|
28
|
+
plannedShipmentDate: CalendarDaySchema.nullable().optional(),
|
|
29
|
+
});
|
|
@@ -18,6 +18,7 @@ export const OrderServiceLineSchema = z.object({
|
|
|
18
18
|
quantity: z.number(),
|
|
19
19
|
amount: MoneySchema,
|
|
20
20
|
vat: z.number().nullable(),
|
|
21
|
+
isVatInherited: z.boolean().nullable(),
|
|
21
22
|
vatAmount: MoneySchema,
|
|
22
23
|
unit: z.nativeEnum(ServicePricingUnitEnum),
|
|
23
24
|
comment: z.string().nullable(),
|
|
@@ -13,6 +13,7 @@ const MAX_INVOICE_ORDER_COUNT = 100;
|
|
|
13
13
|
export const CreatePaymentInvoiceRequestSchema = z
|
|
14
14
|
.object({
|
|
15
15
|
clientUUID: z.uuid(),
|
|
16
|
+
companyLegalProfileUUID: z.uuid().optional(),
|
|
16
17
|
// Карточка реквизитов покупателя. Не передана — счёт выписывается на основную карточку клиента.
|
|
17
18
|
clientLegalProfileUUID: z.uuid().optional(),
|
|
18
19
|
invoiceDate: z.coerce.date(),
|
|
@@ -96,7 +96,7 @@ export const SettingsSchema = z.object({
|
|
|
96
96
|
currency: z.string().nullable(),
|
|
97
97
|
timeZone: z.string().nullable(),
|
|
98
98
|
phoneFormat: z.string().nullable(),
|
|
99
|
-
|
|
99
|
+
webShopLegalName: z.string().nullable().optional(),
|
|
100
100
|
webShopName: z.string().nullable(),
|
|
101
101
|
address: z.string().nullable(),
|
|
102
102
|
phone: z.string().nullable(),
|
|
@@ -109,25 +109,6 @@ export const SettingsSchema = z.object({
|
|
|
109
109
|
workingHours: z.array(SettingsWorkingHoursSchema),
|
|
110
110
|
isImageTemplateSync: z.boolean(),
|
|
111
111
|
imageTemplateLastSyncUUID: z.string().nullable(),
|
|
112
|
-
vat: z.number().nullable(),
|
|
113
|
-
taxId: z.string().nullable(),
|
|
114
|
-
legalAddress: z.string().nullable(),
|
|
115
|
-
bankName: z.string().nullable(),
|
|
116
|
-
bankAccountNumber: z.string().nullable(),
|
|
117
|
-
bankBic: z.string().nullable(),
|
|
118
|
-
correspondentAccount: z.string().nullable(),
|
|
119
|
-
invoiceNumberPrefix: z.string(),
|
|
120
|
-
kpp: z.string().nullable(),
|
|
121
|
-
ogrn: z.string().nullable(),
|
|
122
|
-
signatoryName: z.string().nullable(),
|
|
123
|
-
signatoryPosition: z.string().nullable(),
|
|
124
|
-
accountantName: z.string().nullable(),
|
|
125
|
-
responsibleName: z.string().nullable(),
|
|
126
|
-
responsiblePosition: z.string().nullable(),
|
|
127
|
-
shipperName: z.string().nullable(),
|
|
128
|
-
shipperAddress: z.string().nullable(),
|
|
129
|
-
transferDocumentStatus: z.number().int().nullable(),
|
|
130
|
-
transferDocumentNumberStart: z.number().int().positive().nullable(),
|
|
131
112
|
invoiceProductFields: z.array(z.nativeEnum(InvoiceProductFieldEnum)).nullable(),
|
|
132
113
|
isShowPriceAnonymous: z.boolean(),
|
|
133
114
|
orderExpirationWarningMin: z.number().nullable(),
|
|
@@ -192,13 +173,21 @@ export const SettingsForAdminSchema = SettingsSchema.extend({
|
|
|
192
173
|
maxApiTokenInstance: z.string().nullable(),
|
|
193
174
|
});
|
|
194
175
|
|
|
176
|
+
// Reject obsolete document settings instead of silently accepting an ineffective update.
|
|
177
|
+
const RemovedSellerDocumentSettings = {
|
|
178
|
+
invoiceNumberPrefix: z.never().optional(),
|
|
179
|
+
transferDocumentStatus: z.never().optional(),
|
|
180
|
+
transferDocumentNumberStart: z.never().optional(),
|
|
181
|
+
};
|
|
182
|
+
|
|
195
183
|
export const CreateSettingsSchema = z.object({
|
|
184
|
+
...RemovedSellerDocumentSettings,
|
|
196
185
|
language: z.nativeEnum(LanguageEnum),
|
|
197
186
|
additionalLanguage: z.nativeEnum(LanguageEnum).nullable().optional(),
|
|
198
187
|
currency: z.string().optional(),
|
|
199
188
|
timeZone: z.string().optional(),
|
|
200
189
|
phoneFormat: z.string().optional(),
|
|
201
|
-
|
|
190
|
+
webShopLegalName: z.string().nullable().optional(),
|
|
202
191
|
webShopName: z.string().optional(),
|
|
203
192
|
address: z.string().optional(),
|
|
204
193
|
phone: z.string().optional(),
|
|
@@ -207,25 +196,6 @@ export const CreateSettingsSchema = z.object({
|
|
|
207
196
|
logoKey: z.string().optional().nullable(),
|
|
208
197
|
iconKey: z.string().optional().nullable(),
|
|
209
198
|
isImageTemplateSync: z.coerce.boolean(),
|
|
210
|
-
vat: z.coerce.number().optional(),
|
|
211
|
-
taxId: z.string().optional(),
|
|
212
|
-
legalAddress: z.string().optional(),
|
|
213
|
-
bankName: z.string().optional(),
|
|
214
|
-
bankAccountNumber: z.string().optional(),
|
|
215
|
-
bankBic: z.string().nullable().optional(),
|
|
216
|
-
correspondentAccount: z.string().nullable().optional(),
|
|
217
|
-
invoiceNumberPrefix: z.string().optional(),
|
|
218
|
-
kpp: z.string().nullable().optional(),
|
|
219
|
-
ogrn: z.string().nullable().optional(),
|
|
220
|
-
signatoryName: z.string().nullable().optional(),
|
|
221
|
-
signatoryPosition: z.string().nullable().optional(),
|
|
222
|
-
accountantName: z.string().nullable().optional(),
|
|
223
|
-
responsibleName: z.string().nullable().optional(),
|
|
224
|
-
responsiblePosition: z.string().nullable().optional(),
|
|
225
|
-
shipperName: z.string().nullable().optional(),
|
|
226
|
-
shipperAddress: z.string().nullable().optional(),
|
|
227
|
-
transferDocumentStatus: z.number().int().nullable().optional(),
|
|
228
|
-
transferDocumentNumberStart: z.number().int().positive().nullable().optional(),
|
|
229
199
|
invoiceProductFields: z.array(z.nativeEnum(InvoiceProductFieldEnum)).nullable().optional(),
|
|
230
200
|
orderExpirationWarningMin: z.coerce.number().nullable().optional(),
|
|
231
201
|
orderExpirationMin: z.coerce.number().nullable().optional(),
|
|
@@ -279,13 +249,14 @@ export const CreateSettingsSchema = z.object({
|
|
|
279
249
|
});
|
|
280
250
|
|
|
281
251
|
export const UpdateSettingsRequestSchema = z.object({
|
|
252
|
+
...RemovedSellerDocumentSettings,
|
|
282
253
|
language: z.nativeEnum(LanguageEnum),
|
|
283
254
|
additionalLanguage: z.nativeEnum(LanguageEnum).nullable().optional(),
|
|
284
255
|
currency: z.string().optional(),
|
|
285
256
|
timeZone: z.string().optional(),
|
|
286
257
|
isImageTemplateSync: z.coerce.boolean().optional(),
|
|
287
258
|
phoneFormat: z.string().optional(),
|
|
288
|
-
|
|
259
|
+
webShopLegalName: z.string().nullable().optional(),
|
|
289
260
|
webShopName: z.string().optional(),
|
|
290
261
|
address: z.string().optional(),
|
|
291
262
|
phone: z.string().optional(),
|
|
@@ -293,26 +264,6 @@ export const UpdateSettingsRequestSchema = z.object({
|
|
|
293
264
|
mapUrl: z.string().optional().nullable(),
|
|
294
265
|
logoKey: z.string().optional().nullable(),
|
|
295
266
|
iconKey: z.string().optional().nullable(),
|
|
296
|
-
vat: z.coerce.number().optional().nullable(),
|
|
297
|
-
taxId: z.string().optional().nullable(),
|
|
298
|
-
legalAddress: z.string().optional().nullable(),
|
|
299
|
-
bankName: z.string().optional().nullable(),
|
|
300
|
-
bankAccountNumber: z.string().optional().nullable(),
|
|
301
|
-
bankBic: z.string().optional().nullable(),
|
|
302
|
-
correspondentAccount: z.string().optional().nullable(),
|
|
303
|
-
invoiceNumberPrefix: z.string().optional(),
|
|
304
|
-
kpp: z.string().optional().nullable(),
|
|
305
|
-
ogrn: z.string().optional().nullable(),
|
|
306
|
-
signatoryName: z.string().optional().nullable(),
|
|
307
|
-
signatoryPosition: z.string().optional().nullable(),
|
|
308
|
-
accountantName: z.string().optional().nullable(),
|
|
309
|
-
responsibleName: z.string().optional().nullable(),
|
|
310
|
-
responsiblePosition: z.string().optional().nullable(),
|
|
311
|
-
shipperName: z.string().optional().nullable(),
|
|
312
|
-
shipperAddress: z.string().optional().nullable(),
|
|
313
|
-
transferDocumentStatus: z.number().int().optional().nullable(),
|
|
314
|
-
// Понижать нельзя — это дало бы дубли к уже выданным документам; проверка в обработчике.
|
|
315
|
-
transferDocumentNumberStart: z.number().int().positive().optional().nullable(),
|
|
316
267
|
invoiceProductFields: z.array(z.nativeEnum(InvoiceProductFieldEnum)).optional().nullable(),
|
|
317
268
|
isShowPriceAnonymous: z.coerce.boolean().optional(),
|
|
318
269
|
orderExpirationWarningMin: z.coerce.number().nullable().optional(),
|
|
@@ -18,6 +18,7 @@ const TransferDocumentOrderSchema = z.object({
|
|
|
18
18
|
* `TransferDocumentDetailedSchema` на карточке.
|
|
19
19
|
*/
|
|
20
20
|
export const TransferDocumentSchema = z.object({
|
|
21
|
+
companyLegalProfileUUID: z.uuid().nullable().optional(),
|
|
21
22
|
uuid: z.string(),
|
|
22
23
|
// Номер с ведущими нулями — `01887`, ровно как он напечатан в документе.
|
|
23
24
|
number: z.string(),
|
package/types/index.ts
CHANGED