@floristcloud/api-lib 1.2.183 → 1.2.185
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/delivery-pricing-split-group.schema.js +12 -0
- package/build/schemas/order/delivery-pricing.schema.js +7 -2
- package/build/schemas/order/index.js +2 -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/delivery-pricing-split-group.schema.ts +10 -0
- package/schemas/order/delivery-pricing.schema.ts +9 -2
- package/schemas/order/index.ts +3 -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
|
@@ -1,33 +1,6 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { MoneySchema } from '../../schemas/money.schema';
|
|
5
|
-
|
|
6
|
-
const UpdateOrderRequestSchema = z.object({
|
|
7
|
-
clientUUID: z.uuid(),
|
|
8
|
-
branchUUID: z.uuid().nullable(),
|
|
9
|
-
deliveryCost: MoneySchema,
|
|
10
|
-
type: z.nativeEnum(OrderTypeEnum),
|
|
11
|
-
comment: z.string().nullable(),
|
|
12
|
-
clientComment: z.string().nullable(),
|
|
13
|
-
tag: z.string().nullable(),
|
|
14
|
-
externalNumber: OrderExternalNumberRequestSchema,
|
|
15
|
-
status: z.nativeEnum(OrderStatusEnum),
|
|
16
|
-
isPaid: z.coerce.boolean(),
|
|
17
|
-
deliveryVat: z.coerce.number().nullable(),
|
|
18
|
-
deliveryVatAmount: MoneySchema,
|
|
19
|
-
completedAt: z.coerce.date().nullable().optional(),
|
|
20
|
-
paymentDueAt: z.coerce.date().nullable().optional(),
|
|
21
|
-
// Дата отгрузки/выдачи — одна для самовывоза и доставки. Не раньше прихода товара в пути
|
|
22
|
-
// (O061, в errorData — самый ранний день). Не передано — не меняется, null — снять.
|
|
23
|
-
plannedShipmentDate: CalendarDaySchema.nullable().optional(),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const UpdateOrderResponseSchema = z.object({
|
|
27
|
-
message: z.string().optional(),
|
|
28
|
-
data: OrderSchema.nullable(),
|
|
29
|
-
});
|
|
30
|
-
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { UpdateOrderRequestSchema } from '../../schemas/order/update-order-request.schema';
|
|
3
|
+
import { UpdateOrderResponseSchema } from '../../schemas/order/update-order-response.schema';
|
|
31
4
|
export namespace UpdateOrderContractCommand {
|
|
32
5
|
export const RequestSchema = UpdateOrderRequestSchema;
|
|
33
6
|
export type Request = z.infer<typeof RequestSchema>;
|
package/constant/error.ts
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
export const ERRORS = {
|
|
2
|
+
COMPANY_LEGAL_PROFILE_HAS_ORDERS: {
|
|
3
|
+
code: 'CLP010',
|
|
4
|
+
message: 'Seller cannot be archived or deleted because it has orders, including deleted orders',
|
|
5
|
+
httpCode: 409,
|
|
6
|
+
},
|
|
7
|
+
ORDER_VAT_SOURCE_UNKNOWN: { code: 'CLP008', message: 'Confirm VAT sources of historical lines before changing seller', httpCode: 409 },
|
|
8
|
+
ORDER_VAT_SOURCE_CONFIRMATION_INVALID: {
|
|
9
|
+
code: 'CLP009',
|
|
10
|
+
message: 'VAT source confirmation is stale or invalid; refresh the order and confirm sources before changing seller',
|
|
11
|
+
httpCode: 409,
|
|
12
|
+
},
|
|
13
|
+
COMPANY_LEGAL_PROFILE_NOT_FOUND: { code: 'CLP001', message: 'Card was not found', httpCode: 404 },
|
|
14
|
+
COMPANY_LEGAL_PROFILE_ARCHIVED: { code: 'CLP002', message: 'Card is archived', httpCode: 409 },
|
|
15
|
+
COMPANY_LEGAL_PROFILE_DEFAULT_REQUIRED: { code: 'CLP003', message: 'At least one active seller card is required', httpCode: 409 },
|
|
16
|
+
COMPANY_LEGAL_PROFILE_FAILED: { code: 'CLP004', message: 'Failed to save seller card', httpCode: 500 },
|
|
17
|
+
COMPANY_LEGAL_PROFILE_MIXED: { code: 'CLP005', message: 'Orders must have the same seller', httpCode: 409 },
|
|
18
|
+
COMPANY_LEGAL_PROFILE_ORDER_LOCKED: {
|
|
19
|
+
code: 'CLP006',
|
|
20
|
+
message: 'Seller cannot be changed while the order belongs to a document',
|
|
21
|
+
httpCode: 409,
|
|
22
|
+
},
|
|
23
|
+
COMPANY_LEGAL_PROFILE_CHANGED: { code: 'CLP007', message: 'Seller changed during document creation; retry', httpCode: 409 },
|
|
24
|
+
|
|
2
25
|
// COMPANY
|
|
3
26
|
COMPANY_NOT_CREATED: { code: 'C001', message: 'Failed to create company', httpCode: 500 },
|
|
4
27
|
COMPANY_NOT_DELETED: { code: 'C002', message: 'Failed to delete company', httpCode: 500 },
|
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
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MoneySchema } from '../money.schema';
|
|
3
|
+
|
|
4
|
+
export const DeliveryPricingSplitGroupSchema = z.object({
|
|
5
|
+
deliveryDate: z.string().nullable().describe('ISO arrival date for transit; null for the stock order.'),
|
|
6
|
+
isInTransit: z.boolean(),
|
|
7
|
+
subtotal: MoneySchema,
|
|
8
|
+
thresholdSubtotal: MoneySchema.nullable(),
|
|
9
|
+
cost: MoneySchema,
|
|
10
|
+
});
|
|
@@ -2,11 +2,18 @@ import { z } from 'zod';
|
|
|
2
2
|
import { MoneySchema } from '../money.schema';
|
|
3
3
|
import { DeliveryPricingTierSchema } from '../settings/delivery-pricing-tier.schema';
|
|
4
4
|
import { DeliveryPricingInTransitModeEnum } from '../../enum/delivery-pricing-in-transit-mode.enum';
|
|
5
|
+
import { DeliveryPricingSplitGroupSchema } from './delivery-pricing-split-group.schema';
|
|
5
6
|
|
|
6
7
|
export const DeliveryPricingSchema = z.object({
|
|
7
|
-
cost: MoneySchema,
|
|
8
|
+
cost: MoneySchema.describe('Delivery cost; when splitGroups is present, the sum of future order delivery costs.'),
|
|
8
9
|
inStockSubtotal: MoneySchema,
|
|
9
|
-
thresholdSubtotal: MoneySchema.nullable()
|
|
10
|
+
thresholdSubtotal: MoneySchema.nullable().describe(
|
|
11
|
+
'Threshold basis for this order, or only the stock group in a split preview; null without stock in a split preview or without applicable tiers.',
|
|
12
|
+
),
|
|
13
|
+
splitGroups: z
|
|
14
|
+
.array(DeliveryPricingSplitGroupSchema)
|
|
15
|
+
.nullable()
|
|
16
|
+
.describe('Future orders for a SAME_RULES cart preview with multiple groups; null otherwise. All groups use the shared tiers.'),
|
|
10
17
|
isInTransit: z.boolean(),
|
|
11
18
|
tiers: z.array(DeliveryPricingTierSchema),
|
|
12
19
|
inTransitMode: z.nativeEnum(DeliveryPricingInTransitModeEnum),
|
package/schemas/order/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from './update-cart-request.schema';
|
|
|
14
14
|
export * from './update-cart-response.schema';
|
|
15
15
|
|
|
16
16
|
export * from './delivery-pricing.schema';
|
|
17
|
+
export * from './delivery-pricing-split-group.schema';
|
|
17
18
|
export * from './get-order-delivery-pricing-request.schema';
|
|
18
19
|
export * from './get-order-delivery-pricing-response.schema';
|
|
19
20
|
|
|
@@ -26,3 +27,5 @@ export * from './order-vat-transition-analyze-response.schema';
|
|
|
26
27
|
export * from './order-vat-transition-execute-failure.schema';
|
|
27
28
|
export * from './order-vat-transition-execute-result.schema';
|
|
28
29
|
export * from './order-vat-transition-execute-response.schema';
|
|
30
|
+
|
|
31
|
+
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(),
|