@floristcloud/api-lib 1.2.221 → 1.2.223
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/integration/moysklad/get-moysklad-money-account-links.query.js +8 -0
- package/build/commands/integration/moysklad/get-moysklad-payment-sync-check.query.js +10 -0
- package/build/commands/integration/moysklad/index.js +4 -0
- package/build/commands/integration/moysklad/list-moysklad-money-targets.query.js +8 -0
- package/build/commands/integration/moysklad/save-moysklad-money-account-link.command.js +10 -0
- package/build/commands/order/get-order-list.query.js +4 -70
- package/build/constant/error.js +30 -0
- package/build/enum/external-entity-type.enum.js +1 -0
- package/build/enum/index.js +2 -0
- package/build/enum/money-account-integration-link-kind.enum.js +9 -0
- package/build/enum/order-source.enum.js +9 -0
- package/build/schemas/integration/moysklad/enable-moysklad-request.schema.js +2 -0
- package/build/schemas/integration/moysklad/index.js +9 -0
- package/build/schemas/integration/moysklad/moysklad-money-account-link.schema.js +11 -0
- package/build/schemas/integration/moysklad/moysklad-money-account-links-response.schema.js +6 -0
- package/build/schemas/integration/moysklad/moysklad-money-target-ref.schema.js +17 -0
- package/build/schemas/integration/moysklad/moysklad-money-target.schema.js +14 -0
- package/build/schemas/integration/moysklad/moysklad-money-targets-response.schema.js +6 -0
- package/build/schemas/integration/moysklad/moysklad-payment-sync-check-request.schema.js +8 -0
- package/build/schemas/integration/moysklad/moysklad-payment-sync-check-response.schema.js +6 -0
- package/build/schemas/integration/moysklad/moysklad-payment-sync-check.schema.js +10 -0
- package/build/schemas/integration/moysklad/moysklad-status.schema.js +1 -0
- package/build/schemas/integration/moysklad/save-moysklad-money-account-link-request.schema.js +10 -0
- package/build/schemas/order/get-order-list-request.schema.js +64 -0
- package/build/schemas/order/get-order-list-response-data.schema.js +6 -0
- package/build/schemas/order/get-order-list-response.schema.js +6 -0
- package/build/schemas/order/index.js +4 -0
- package/build/schemas/order/order-creator.schema.js +5 -0
- package/build/schemas/order/order-extended.schema.js +4 -0
- package/build/schemas/pre-order/get-pre-order-list-request.schema.js +2 -0
- package/build/schemas/pre-order/pre-order.schema.js +4 -0
- package/commands/integration/moysklad/get-moysklad-money-account-links.query.ts +7 -0
- package/commands/integration/moysklad/get-moysklad-payment-sync-check.query.ts +10 -0
- package/commands/integration/moysklad/index.ts +5 -0
- package/commands/integration/moysklad/list-moysklad-money-targets.query.ts +7 -0
- package/commands/integration/moysklad/save-moysklad-money-account-link.command.ts +10 -0
- package/commands/order/get-order-list.query.ts +3 -76
- package/constant/error.ts +30 -0
- package/enum/external-entity-type.enum.ts +1 -0
- package/enum/index.ts +3 -0
- package/enum/money-account-integration-link-kind.enum.ts +5 -0
- package/enum/order-source.enum.ts +8 -0
- package/package.json +1 -1
- package/schemas/integration/moysklad/enable-moysklad-request.schema.ts +2 -0
- package/schemas/integration/moysklad/index.ts +10 -0
- package/schemas/integration/moysklad/moysklad-money-account-link.schema.ts +9 -0
- package/schemas/integration/moysklad/moysklad-money-account-links-response.schema.ts +4 -0
- package/schemas/integration/moysklad/moysklad-money-target-ref.schema.ts +15 -0
- package/schemas/integration/moysklad/moysklad-money-target.schema.ts +12 -0
- package/schemas/integration/moysklad/moysklad-money-targets-response.schema.ts +4 -0
- package/schemas/integration/moysklad/moysklad-payment-sync-check-request.schema.ts +6 -0
- package/schemas/integration/moysklad/moysklad-payment-sync-check-response.schema.ts +4 -0
- package/schemas/integration/moysklad/moysklad-payment-sync-check.schema.ts +8 -0
- package/schemas/integration/moysklad/moysklad-status.schema.ts +1 -0
- package/schemas/integration/moysklad/save-moysklad-money-account-link-request.schema.ts +8 -0
- package/schemas/order/get-order-list-request.schema.ts +68 -0
- package/schemas/order/get-order-list-response-data.schema.ts +3 -0
- package/schemas/order/get-order-list-response.schema.ts +3 -0
- package/schemas/order/index.ts +8 -0
- package/schemas/order/order-creator.schema.ts +2 -0
- package/schemas/order/order-extended.schema.ts +4 -0
- package/schemas/pre-order/get-pre-order-list-request.schema.ts +2 -0
- package/schemas/pre-order/pre-order.schema.ts +4 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetMoyskladMoneyAccountLinksContractQuery = void 0;
|
|
4
|
+
const moysklad_money_account_links_response_schema_1 = require("../../../schemas/integration/moysklad/moysklad-money-account-links-response.schema");
|
|
5
|
+
var GetMoyskladMoneyAccountLinksContractQuery;
|
|
6
|
+
(function (GetMoyskladMoneyAccountLinksContractQuery) {
|
|
7
|
+
GetMoyskladMoneyAccountLinksContractQuery.ResponseSchema = moysklad_money_account_links_response_schema_1.MoyskladMoneyAccountLinksResponseSchema;
|
|
8
|
+
})(GetMoyskladMoneyAccountLinksContractQuery || (exports.GetMoyskladMoneyAccountLinksContractQuery = GetMoyskladMoneyAccountLinksContractQuery = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetMoyskladPaymentSyncCheckContractQuery = void 0;
|
|
4
|
+
const moysklad_payment_sync_check_request_schema_1 = require("../../../schemas/integration/moysklad/moysklad-payment-sync-check-request.schema");
|
|
5
|
+
const moysklad_payment_sync_check_response_schema_1 = require("../../../schemas/integration/moysklad/moysklad-payment-sync-check-response.schema");
|
|
6
|
+
var GetMoyskladPaymentSyncCheckContractQuery;
|
|
7
|
+
(function (GetMoyskladPaymentSyncCheckContractQuery) {
|
|
8
|
+
GetMoyskladPaymentSyncCheckContractQuery.RequestSchema = moysklad_payment_sync_check_request_schema_1.MoyskladPaymentSyncCheckRequestSchema;
|
|
9
|
+
GetMoyskladPaymentSyncCheckContractQuery.ResponseSchema = moysklad_payment_sync_check_response_schema_1.MoyskladPaymentSyncCheckResponseSchema;
|
|
10
|
+
})(GetMoyskladPaymentSyncCheckContractQuery || (exports.GetMoyskladPaymentSyncCheckContractQuery = GetMoyskladPaymentSyncCheckContractQuery = {}));
|
|
@@ -33,3 +33,7 @@ __exportStar(require("./get-moysklad-order-states.query"), exports);
|
|
|
33
33
|
__exportStar(require("./update-moysklad-order-state-mapping.command"), exports);
|
|
34
34
|
__exportStar(require("./get-seller-sync-status.query"), exports);
|
|
35
35
|
__exportStar(require("./retry-seller-sync.command"), exports);
|
|
36
|
+
__exportStar(require("./list-moysklad-money-targets.query"), exports);
|
|
37
|
+
__exportStar(require("./get-moysklad-money-account-links.query"), exports);
|
|
38
|
+
__exportStar(require("./save-moysklad-money-account-link.command"), exports);
|
|
39
|
+
__exportStar(require("./get-moysklad-payment-sync-check.query"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListMoyskladMoneyTargetsContractQuery = void 0;
|
|
4
|
+
const moysklad_money_targets_response_schema_1 = require("../../../schemas/integration/moysklad/moysklad-money-targets-response.schema");
|
|
5
|
+
var ListMoyskladMoneyTargetsContractQuery;
|
|
6
|
+
(function (ListMoyskladMoneyTargetsContractQuery) {
|
|
7
|
+
ListMoyskladMoneyTargetsContractQuery.ResponseSchema = moysklad_money_targets_response_schema_1.MoyskladMoneyTargetsResponseSchema;
|
|
8
|
+
})(ListMoyskladMoneyTargetsContractQuery || (exports.ListMoyskladMoneyTargetsContractQuery = ListMoyskladMoneyTargetsContractQuery = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SaveMoyskladMoneyAccountLinkContractCommand = void 0;
|
|
4
|
+
const moysklad_money_account_links_response_schema_1 = require("../../../schemas/integration/moysklad/moysklad-money-account-links-response.schema");
|
|
5
|
+
const save_moysklad_money_account_link_request_schema_1 = require("../../../schemas/integration/moysklad/save-moysklad-money-account-link-request.schema");
|
|
6
|
+
var SaveMoyskladMoneyAccountLinkContractCommand;
|
|
7
|
+
(function (SaveMoyskladMoneyAccountLinkContractCommand) {
|
|
8
|
+
SaveMoyskladMoneyAccountLinkContractCommand.RequestSchema = save_moysklad_money_account_link_request_schema_1.SaveMoyskladMoneyAccountLinkRequestSchema;
|
|
9
|
+
SaveMoyskladMoneyAccountLinkContractCommand.ResponseSchema = moysklad_money_account_links_response_schema_1.MoyskladMoneyAccountLinksResponseSchema;
|
|
10
|
+
})(SaveMoyskladMoneyAccountLinkContractCommand || (exports.SaveMoyskladMoneyAccountLinkContractCommand = SaveMoyskladMoneyAccountLinkContractCommand = {}));
|
|
@@ -1,76 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetOrderListContractQuery = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const date_helper_1 = require("../../helpers/date.helper");
|
|
7
|
-
const query_boolean_helper_1 = require("../../helpers/query-boolean.helper");
|
|
8
|
-
const enum_1 = require("../../enum");
|
|
9
|
-
const GetOrderListRequestSchema = zod_1.z
|
|
10
|
-
.object({
|
|
11
|
-
page: zod_1.z.string().transform(val => Number(val) || 1),
|
|
12
|
-
count: zod_1.z.string().transform(val => Number(val) || 10),
|
|
13
|
-
startDate: zod_1.z.coerce.date().optional(),
|
|
14
|
-
endDate: zod_1.z.coerce.date().optional(),
|
|
15
|
-
isDelivery: zod_1.z.coerce.boolean().optional(),
|
|
16
|
-
isPaid: zod_1.z.coerce.boolean().optional(),
|
|
17
|
-
consignmentUUID: zod_1.z.string().optional(),
|
|
18
|
-
tag: zod_1.z.string().optional(),
|
|
19
|
-
clientUUID: zod_1.z.string().optional(),
|
|
20
|
-
searchQuery: zod_1.z.string().optional(),
|
|
21
|
-
consignmentDeliveryDate: zod_1.z.coerce.date().optional(),
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated Используйте `deliveryDateFrom` / `deliveryDateTo`. Оставлен ради сохранённых
|
|
24
|
-
* ссылок и MCP-клиентов: трактуется как период из одного дня (from = to = deliveryDate).
|
|
25
|
-
*/
|
|
26
|
-
deliveryDate: zod_1.z.coerce.date().optional(),
|
|
27
|
-
// Период даты отгрузки/выдачи заказа (`plannedShipmentDate`) — и доставка, и самовывоз; имена
|
|
28
|
-
// остались от фильтра по дате доставки. Календарные дни `YYYY-MM-DD`, обе границы включительно.
|
|
29
|
-
deliveryDateFrom: zod_1.z.coerce.date().optional(),
|
|
30
|
-
deliveryDateTo: zod_1.z.coerce.date().optional(),
|
|
31
|
-
byProductSearchQuery: zod_1.z.string().optional(),
|
|
32
|
-
statuses: zod_1.z.nativeEnum(enum_1.OrderStatusEnum).array().optional(),
|
|
33
|
-
type: zod_1.z.nativeEnum(enum_1.OrderTypeEnum).optional(),
|
|
34
|
-
city: zod_1.z.string().optional(),
|
|
35
|
-
responsibleUserUUID: zod_1.z.string().optional(),
|
|
36
|
-
group: zod_1.z.string().optional(),
|
|
37
|
-
// Только заказы, ещё не включённые ни в один счёт на оплату — список для пикера при
|
|
38
|
-
// выставлении счёта. Комбинируется с остальными критериями обычным AND.
|
|
39
|
-
withoutPaymentInvoice: zod_1.z.coerce.boolean().optional(),
|
|
40
|
-
// То же для передаточного документа — пикер заказов при выпуске УПД. Здесь `queryBooleanSchema`,
|
|
41
|
-
// а не `z.coerce.boolean()`: в query всегда приходит текст, и `Boolean('false') === true`,
|
|
42
|
-
// то есть флаг соседа невозможно выключить явным значением, только опустив параметр.
|
|
43
|
-
withoutTransferDocument: query_boolean_helper_1.queryBooleanSchema,
|
|
44
|
-
})
|
|
45
|
-
.refine(value => {
|
|
46
|
-
const { startDate, endDate } = value;
|
|
47
|
-
if (startDate && endDate) {
|
|
48
|
-
return (0, date_helper_1.dateRangeCheck)(startDate, endDate);
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
51
|
-
}, {
|
|
52
|
-
message: 'validation.dateRange',
|
|
53
|
-
path: ['endDate', 'startDate'],
|
|
54
|
-
})
|
|
55
|
-
.refine(value => {
|
|
56
|
-
const { deliveryDateFrom, deliveryDateTo } = value;
|
|
57
|
-
if (deliveryDateFrom && deliveryDateTo) {
|
|
58
|
-
return (0, date_helper_1.dateRangeCheck)(deliveryDateFrom, deliveryDateTo);
|
|
59
|
-
}
|
|
60
|
-
return true;
|
|
61
|
-
}, {
|
|
62
|
-
message: 'validation.dateRange',
|
|
63
|
-
path: ['deliveryDateTo', 'deliveryDateFrom'],
|
|
64
|
-
});
|
|
65
|
-
const GetOrderListResponseSchema = zod_1.z.object({
|
|
66
|
-
message: zod_1.z.string().optional(),
|
|
67
|
-
data: zod_1.z.object({
|
|
68
|
-
orderList: schemas_1.OrderExtendedSchema.array(),
|
|
69
|
-
total: zod_1.z.number(),
|
|
70
|
-
}),
|
|
71
|
-
});
|
|
4
|
+
const get_order_list_request_schema_1 = require("../../schemas/order/get-order-list-request.schema");
|
|
5
|
+
const get_order_list_response_schema_1 = require("../../schemas/order/get-order-list-response.schema");
|
|
72
6
|
var GetOrderListContractQuery;
|
|
73
7
|
(function (GetOrderListContractQuery) {
|
|
74
|
-
GetOrderListContractQuery.RequestSchema = GetOrderListRequestSchema;
|
|
75
|
-
GetOrderListContractQuery.ResponseSchema = GetOrderListResponseSchema;
|
|
8
|
+
GetOrderListContractQuery.RequestSchema = get_order_list_request_schema_1.GetOrderListRequestSchema;
|
|
9
|
+
GetOrderListContractQuery.ResponseSchema = get_order_list_response_schema_1.GetOrderListResponseSchema;
|
|
76
10
|
})(GetOrderListContractQuery || (exports.GetOrderListContractQuery = GetOrderListContractQuery = {}));
|
package/build/constant/error.js
CHANGED
|
@@ -68,6 +68,11 @@ exports.ERRORS = {
|
|
|
68
68
|
MONEY_ACCOUNT_FETCH_FAILED: { code: 'M006', message: 'Error when retrieving a list of money accounts', httpCode: 500 },
|
|
69
69
|
MONEY_ACCOUNT_HAS_TRANSACTIONS: { code: 'M007', message: 'Money account has transactions', httpCode: 400 },
|
|
70
70
|
MONEY_ACCOUNT_ACCESS_DENIED: { code: 'M008', message: 'Money account access denied', httpCode: 500 },
|
|
71
|
+
MONEY_ACCOUNT_INTEGRATION_LINK_FAILED: {
|
|
72
|
+
code: 'M009',
|
|
73
|
+
message: 'Failed to read or save money account integration link',
|
|
74
|
+
httpCode: 500,
|
|
75
|
+
},
|
|
71
76
|
//NOTIFICATION
|
|
72
77
|
NOTIFICATION_NOT_CREATED: { code: 'N001', message: 'Failed to create Notification', httpCode: 500 },
|
|
73
78
|
NOTIFICATION_NOT_FOUND: { code: 'N002', message: 'Notification not found', httpCode: 400 },
|
|
@@ -1819,6 +1824,11 @@ exports.ERRORS = {
|
|
|
1819
1824
|
message: 'Latest sync job for this entity is not DEAD; cannot retry',
|
|
1820
1825
|
httpCode: 409,
|
|
1821
1826
|
},
|
|
1827
|
+
OUTBOUND_SYNC_ENTITY_LOCK_LOST: {
|
|
1828
|
+
code: 'OS006',
|
|
1829
|
+
message: 'Outbound sync job lost its entity lock before writing to the external system; will retry shortly',
|
|
1830
|
+
httpCode: 409,
|
|
1831
|
+
},
|
|
1822
1832
|
MOYSKLAD_STOCK_SYNC_CAP_EXCEEDED: {
|
|
1823
1833
|
code: 'MS015',
|
|
1824
1834
|
message: 'MoySklad stock-sync concurrency cap exceeded; will retry shortly',
|
|
@@ -1859,6 +1869,26 @@ exports.ERRORS = {
|
|
|
1859
1869
|
message: 'The demand is waiting for the order to be pushed to MoySklad; will retry shortly',
|
|
1860
1870
|
httpCode: 409,
|
|
1861
1871
|
},
|
|
1872
|
+
MOYSKLAD_PAYMENT_CLIENT_NOT_LINKED: {
|
|
1873
|
+
code: 'MS024',
|
|
1874
|
+
message: 'Payment client has no MoySklad link; import clients first',
|
|
1875
|
+
httpCode: 400,
|
|
1876
|
+
},
|
|
1877
|
+
MOYSKLAD_PAYMENT_WAITING_ORDER_PUSH: {
|
|
1878
|
+
code: 'MS025',
|
|
1879
|
+
message: 'The payment is waiting for its order to be created in MoySklad; will retry shortly',
|
|
1880
|
+
httpCode: 409,
|
|
1881
|
+
},
|
|
1882
|
+
MOYSKLAD_MONEY_TARGET_NOT_FOUND: {
|
|
1883
|
+
code: 'MS026',
|
|
1884
|
+
message: 'The MoySklad cash desk or bank account was not found in the connected account',
|
|
1885
|
+
httpCode: 400,
|
|
1886
|
+
},
|
|
1887
|
+
MOYSKLAD_PAYMENT_CREATE_LOCK_BUSY: {
|
|
1888
|
+
code: 'MS027',
|
|
1889
|
+
message: 'Another payment is being created in MoySklad for this account; will retry shortly',
|
|
1890
|
+
httpCode: 409,
|
|
1891
|
+
},
|
|
1862
1892
|
// 1C COMMERCEML INTEGRATION
|
|
1863
1893
|
ONE_C_NOT_CONNECTED: { code: 'OC001', message: '1C integration is not connected for this company', httpCode: 404 },
|
|
1864
1894
|
ONE_C_CONNECT_FAILED: { code: 'OC002', message: 'Failed to connect 1C integration', httpCode: 500 },
|
|
@@ -11,4 +11,5 @@ var ExternalEntityTypeEnum;
|
|
|
11
11
|
ExternalEntityTypeEnum["SUPPLIER_ORDER"] = "SUPPLIER_ORDER";
|
|
12
12
|
ExternalEntityTypeEnum["SUPPLIER_ORDER_POSITION"] = "SUPPLIER_ORDER_POSITION";
|
|
13
13
|
ExternalEntityTypeEnum["PAYMENT"] = "PAYMENT";
|
|
14
|
+
ExternalEntityTypeEnum["TRANSACTION"] = "TRANSACTION";
|
|
14
15
|
})(ExternalEntityTypeEnum || (exports.ExternalEntityTypeEnum = ExternalEntityTypeEnum = {}));
|
package/build/enum/index.js
CHANGED
|
@@ -73,6 +73,7 @@ __exportStar(require("./image-type.enum"), exports);
|
|
|
73
73
|
__exportStar(require("./import-error-code.enum"), exports);
|
|
74
74
|
__exportStar(require("./integration-check-status.enum"), exports);
|
|
75
75
|
__exportStar(require("./integration-provider.enum"), exports);
|
|
76
|
+
__exportStar(require("./money-account-integration-link-kind.enum"), exports);
|
|
76
77
|
__exportStar(require("./integration-status.enum"), exports);
|
|
77
78
|
__exportStar(require("./inventory-movement-type.enum"), exports);
|
|
78
79
|
__exportStar(require("./invoice-product-field.enum"), exports);
|
|
@@ -209,3 +210,4 @@ __exportStar(require("./product-resolution-image-reason.enum"), exports);
|
|
|
209
210
|
__exportStar(require("./product-resolution-matched-attribute.enum"), exports);
|
|
210
211
|
__exportStar(require("./product-resolution-decision-action.enum"), exports);
|
|
211
212
|
__exportStar(require("./product-resolution-write-mode.enum"), exports);
|
|
213
|
+
__exportStar(require("./order-source.enum"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MoneyAccountIntegrationLinkKindEnum = void 0;
|
|
4
|
+
// Куда во внешней системе ложатся деньги счёта FC. Для МойСклада: касса юрлица или его расчётный счёт.
|
|
5
|
+
var MoneyAccountIntegrationLinkKindEnum;
|
|
6
|
+
(function (MoneyAccountIntegrationLinkKindEnum) {
|
|
7
|
+
MoneyAccountIntegrationLinkKindEnum["CASH"] = "CASH";
|
|
8
|
+
MoneyAccountIntegrationLinkKindEnum["BANK"] = "BANK";
|
|
9
|
+
})(MoneyAccountIntegrationLinkKindEnum || (exports.MoneyAccountIntegrationLinkKindEnum = MoneyAccountIntegrationLinkKindEnum = {}));
|
|
@@ -21,4 +21,6 @@ exports.EnableMoyskladRequestSchema = zod_1.z.object({
|
|
|
21
21
|
// Posted demand (отгрузка) in MS. No default on purpose: a client that does not send them keeps the saved values.
|
|
22
22
|
isDemandEnabled: zod_1.z.boolean().optional(),
|
|
23
23
|
demandOrderStatus: zod_1.z.enum(moysklad_demand_order_status_list_1.MOYSKLAD_DEMAND_ORDER_STATUS_LIST).optional(),
|
|
24
|
+
// Выгрузка оплат клиентов в МС. Без default по той же причине, что у отгрузок.
|
|
25
|
+
isPaymentSyncEnabled: zod_1.z.boolean().optional(),
|
|
24
26
|
});
|
|
@@ -42,3 +42,12 @@ __exportStar(require("./seller-sync-failure.schema"), exports);
|
|
|
42
42
|
__exportStar(require("./seller-sync-status.schema"), exports);
|
|
43
43
|
__exportStar(require("./seller-sync-status-response.schema"), exports);
|
|
44
44
|
__exportStar(require("./seller-sync-request.schema"), exports);
|
|
45
|
+
__exportStar(require("./moysklad-money-target-ref.schema"), exports);
|
|
46
|
+
__exportStar(require("./moysklad-money-target.schema"), exports);
|
|
47
|
+
__exportStar(require("./moysklad-money-targets-response.schema"), exports);
|
|
48
|
+
__exportStar(require("./moysklad-money-account-link.schema"), exports);
|
|
49
|
+
__exportStar(require("./moysklad-money-account-links-response.schema"), exports);
|
|
50
|
+
__exportStar(require("./save-moysklad-money-account-link-request.schema"), exports);
|
|
51
|
+
__exportStar(require("./moysklad-payment-sync-check-request.schema"), exports);
|
|
52
|
+
__exportStar(require("./moysklad-payment-sync-check.schema"), exports);
|
|
53
|
+
__exportStar(require("./moysklad-payment-sync-check-response.schema"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MoyskladMoneyAccountLinkSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const money_account_integration_link_kind_enum_1 = require("../../../enum/money-account-integration-link-kind.enum");
|
|
6
|
+
exports.MoyskladMoneyAccountLinkSchema = zod_1.z.object({
|
|
7
|
+
moneyAccountUUID: zod_1.z.uuid(),
|
|
8
|
+
kind: zod_1.z.nativeEnum(money_account_integration_link_kind_enum_1.MoneyAccountIntegrationLinkKindEnum),
|
|
9
|
+
organizationId: zod_1.z.string(),
|
|
10
|
+
externalAccountId: zod_1.z.string().nullable(),
|
|
11
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MoyskladMoneyAccountLinksResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const moysklad_money_account_link_schema_1 = require("./moysklad-money-account-link.schema");
|
|
6
|
+
exports.MoyskladMoneyAccountLinksResponseSchema = zod_1.z.object({ data: zod_1.z.array(moysklad_money_account_link_schema_1.MoyskladMoneyAccountLinkSchema) });
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MoyskladMoneyTargetRefSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const money_account_integration_link_kind_enum_1 = require("../../../enum/money-account-integration-link-kind.enum");
|
|
6
|
+
// Место денег в МойСкладе: касса юрлица (CASH, своего id у неё нет) или его расчётный счёт (BANK, externalAccountId). Идентификаторы МойСклада —
|
|
7
|
+
// 8-4-4-4-12, но не RFC 9562, поэтому z.guid(), а не z.uuid().
|
|
8
|
+
exports.MoyskladMoneyTargetRefSchema = zod_1.z
|
|
9
|
+
.object({
|
|
10
|
+
kind: zod_1.z.nativeEnum(money_account_integration_link_kind_enum_1.MoneyAccountIntegrationLinkKindEnum),
|
|
11
|
+
organizationId: zod_1.z.guid(),
|
|
12
|
+
externalAccountId: zod_1.z.guid().nullable(),
|
|
13
|
+
})
|
|
14
|
+
.refine(target => (target.kind === money_account_integration_link_kind_enum_1.MoneyAccountIntegrationLinkKindEnum.BANK) === (target.externalAccountId !== null), {
|
|
15
|
+
message: 'externalAccountId is required for BANK and must be null for CASH',
|
|
16
|
+
path: ['externalAccountId'],
|
|
17
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MoyskladMoneyTargetSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const money_account_integration_link_kind_enum_1 = require("../../../enum/money-account-integration-link-kind.enum");
|
|
6
|
+
// Вариант для выпадающего списка: касса или расчётный счёт юрлица МойСклада с подписями.
|
|
7
|
+
exports.MoyskladMoneyTargetSchema = zod_1.z.object({
|
|
8
|
+
kind: zod_1.z.nativeEnum(money_account_integration_link_kind_enum_1.MoneyAccountIntegrationLinkKindEnum),
|
|
9
|
+
organizationId: zod_1.z.string(),
|
|
10
|
+
organizationName: zod_1.z.string(),
|
|
11
|
+
externalAccountId: zod_1.z.string().nullable(),
|
|
12
|
+
accountNumber: zod_1.z.string().nullable(),
|
|
13
|
+
bankName: zod_1.z.string().nullable(),
|
|
14
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MoyskladMoneyTargetsResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const moysklad_money_target_schema_1 = require("./moysklad-money-target.schema");
|
|
6
|
+
exports.MoyskladMoneyTargetsResponseSchema = zod_1.z.object({ data: zod_1.z.array(moysklad_money_target_schema_1.MoyskladMoneyTargetSchema) });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MoyskladPaymentSyncCheckRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.MoyskladPaymentSyncCheckRequestSchema = zod_1.z.object({
|
|
6
|
+
moneyAccountUUID: zod_1.z.uuid(),
|
|
7
|
+
orderUUID: zod_1.z.uuid().optional(),
|
|
8
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MoyskladPaymentSyncCheckResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const moysklad_payment_sync_check_schema_1 = require("./moysklad-payment-sync-check.schema");
|
|
6
|
+
exports.MoyskladPaymentSyncCheckResponseSchema = zod_1.z.object({ data: moysklad_payment_sync_check_schema_1.MoyskladPaymentSyncCheckSchema });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MoyskladPaymentSyncCheckSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// isSynced — оплата клиента на этот счёт уйдёт в МойСклад. isOrganizationMismatch — юрлицо счёта в МС не совпадает
|
|
6
|
+
// с юрлицом заказа: документ оплаты создастся на юрлицо счёта, но со ссылкой на заказ другого юрлица.
|
|
7
|
+
exports.MoyskladPaymentSyncCheckSchema = zod_1.z.object({
|
|
8
|
+
isSynced: zod_1.z.boolean(),
|
|
9
|
+
isOrganizationMismatch: zod_1.z.boolean(),
|
|
10
|
+
});
|
|
@@ -33,4 +33,5 @@ exports.MoyskladStatusSchema = zod_1.z.object({
|
|
|
33
33
|
orderStateMapping: moysklad_order_state_mapping_schema_1.MoyskladOrderStateMappingSchema,
|
|
34
34
|
isDemandEnabled: zod_1.z.boolean(),
|
|
35
35
|
demandOrderStatus: zod_1.z.nativeEnum(order_status_enum_1.OrderStatusEnum),
|
|
36
|
+
isPaymentSyncEnabled: zod_1.z.boolean(),
|
|
36
37
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SaveMoyskladMoneyAccountLinkRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const moysklad_money_target_ref_schema_1 = require("./moysklad-money-target-ref.schema");
|
|
6
|
+
// target = null снимает связь: оплаты со счёта перестают уходить в МойСклад.
|
|
7
|
+
exports.SaveMoyskladMoneyAccountLinkRequestSchema = zod_1.z.object({
|
|
8
|
+
moneyAccountUUID: zod_1.z.uuid(),
|
|
9
|
+
target: moysklad_money_target_ref_schema_1.MoyskladMoneyTargetRefSchema.nullable(),
|
|
10
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOrderListRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const date_helper_1 = require("../../helpers/date.helper");
|
|
6
|
+
const query_boolean_helper_1 = require("../../helpers/query-boolean.helper");
|
|
7
|
+
const enum_1 = require("../../enum");
|
|
8
|
+
exports.GetOrderListRequestSchema = zod_1.z
|
|
9
|
+
.object({
|
|
10
|
+
page: zod_1.z.string().transform(val => Number(val) || 1),
|
|
11
|
+
count: zod_1.z.string().transform(val => Number(val) || 10),
|
|
12
|
+
startDate: zod_1.z.coerce.date().optional(),
|
|
13
|
+
endDate: zod_1.z.coerce.date().optional(),
|
|
14
|
+
isDelivery: zod_1.z.coerce.boolean().optional(),
|
|
15
|
+
isPaid: zod_1.z.coerce.boolean().optional(),
|
|
16
|
+
consignmentUUID: zod_1.z.string().optional(),
|
|
17
|
+
tag: zod_1.z.string().optional(),
|
|
18
|
+
clientUUID: zod_1.z.string().optional(),
|
|
19
|
+
searchQuery: zod_1.z.string().optional(),
|
|
20
|
+
consignmentDeliveryDate: zod_1.z.coerce.date().optional(),
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Используйте `deliveryDateFrom` / `deliveryDateTo`. Оставлен ради сохранённых
|
|
23
|
+
* ссылок и MCP-клиентов: трактуется как период из одного дня (from = to = deliveryDate).
|
|
24
|
+
*/
|
|
25
|
+
deliveryDate: zod_1.z.coerce.date().optional(),
|
|
26
|
+
// Период даты отгрузки/выдачи заказа (`plannedShipmentDate`) — и доставка, и самовывоз; имена
|
|
27
|
+
// остались от фильтра по дате доставки. Календарные дни `YYYY-MM-DD`, обе границы включительно.
|
|
28
|
+
deliveryDateFrom: zod_1.z.coerce.date().optional(),
|
|
29
|
+
deliveryDateTo: zod_1.z.coerce.date().optional(),
|
|
30
|
+
byProductSearchQuery: zod_1.z.string().optional(),
|
|
31
|
+
statuses: zod_1.z.nativeEnum(enum_1.OrderStatusEnum).array().optional(),
|
|
32
|
+
source: zod_1.z.nativeEnum(enum_1.OrderSourceEnum).optional(),
|
|
33
|
+
type: zod_1.z.nativeEnum(enum_1.OrderTypeEnum).optional(),
|
|
34
|
+
city: zod_1.z.string().optional(),
|
|
35
|
+
responsibleUserUUID: zod_1.z.string().optional(),
|
|
36
|
+
group: zod_1.z.string().optional(),
|
|
37
|
+
// Только заказы, ещё не включённые ни в один счёт на оплату — список для пикера при
|
|
38
|
+
// выставлении счёта. Комбинируется с остальными критериями обычным AND.
|
|
39
|
+
withoutPaymentInvoice: zod_1.z.coerce.boolean().optional(),
|
|
40
|
+
// То же для передаточного документа — пикер заказов при выпуске УПД. Здесь `queryBooleanSchema`,
|
|
41
|
+
// а не `z.coerce.boolean()`: в query всегда приходит текст, и `Boolean('false') === true`,
|
|
42
|
+
// то есть флаг соседа невозможно выключить явным значением, только опустив параметр.
|
|
43
|
+
withoutTransferDocument: query_boolean_helper_1.queryBooleanSchema,
|
|
44
|
+
})
|
|
45
|
+
.refine(value => {
|
|
46
|
+
const { startDate, endDate } = value;
|
|
47
|
+
if (startDate && endDate) {
|
|
48
|
+
return (0, date_helper_1.dateRangeCheck)(startDate, endDate);
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}, {
|
|
52
|
+
message: 'validation.dateRange',
|
|
53
|
+
path: ['endDate', 'startDate'],
|
|
54
|
+
})
|
|
55
|
+
.refine(value => {
|
|
56
|
+
const { deliveryDateFrom, deliveryDateTo } = value;
|
|
57
|
+
if (deliveryDateFrom && deliveryDateTo) {
|
|
58
|
+
return (0, date_helper_1.dateRangeCheck)(deliveryDateFrom, deliveryDateTo);
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}, {
|
|
62
|
+
message: 'validation.dateRange',
|
|
63
|
+
path: ['deliveryDateTo', 'deliveryDateFrom'],
|
|
64
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOrderListResponseDataSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const order_extended_schema_1 = require("./order-extended.schema");
|
|
6
|
+
exports.GetOrderListResponseDataSchema = zod_1.z.object({ orderList: order_extended_schema_1.OrderExtendedSchema.array(), total: zod_1.z.number() });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOrderListResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const get_order_list_response_data_schema_1 = require("./get-order-list-response-data.schema");
|
|
6
|
+
exports.GetOrderListResponseSchema = zod_1.z.object({ message: zod_1.z.string().optional(), data: get_order_list_response_data_schema_1.GetOrderListResponseDataSchema });
|
|
@@ -42,3 +42,7 @@ __exportStar(require("./order-vat-transition-execute-failure.schema"), exports);
|
|
|
42
42
|
__exportStar(require("./order-vat-transition-execute-result.schema"), exports);
|
|
43
43
|
__exportStar(require("./order-vat-transition-execute-response.schema"), exports);
|
|
44
44
|
__exportStar(require("./order-vat-source-confirmation.schema"), exports);
|
|
45
|
+
__exportStar(require("./get-order-list-request.schema"), exports);
|
|
46
|
+
__exportStar(require("./get-order-list-response.schema"), exports);
|
|
47
|
+
__exportStar(require("./get-order-list-response-data.schema"), exports);
|
|
48
|
+
__exportStar(require("./order-creator.schema"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrderCreatorSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.OrderCreatorSchema = zod_1.z.object({ uuid: zod_1.z.string().uuid(), name: zod_1.z.string(), isClient: zod_1.z.boolean() });
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrderExtendedSchema = void 0;
|
|
4
|
+
const order_creator_schema_1 = require("./order-creator.schema");
|
|
5
|
+
const order_source_enum_1 = require("../../enum/order-source.enum");
|
|
4
6
|
const zod_1 = require("zod");
|
|
5
7
|
const client_base_schema_1 = require("../client/client-base.schema");
|
|
6
8
|
const branch_schema_1 = require("../branch/branch.schema");
|
|
@@ -8,6 +10,8 @@ const order_delivery_schema_1 = require("../order-delivery/order-delivery.schema
|
|
|
8
10
|
const delivery_route_schema_1 = require("../delivery-route/delivery-route.schema");
|
|
9
11
|
const order_base_schema_1 = require("./order-base.schema");
|
|
10
12
|
exports.OrderExtendedSchema = order_base_schema_1.OrderSchema.extend({
|
|
13
|
+
source: zod_1.z.nativeEnum(order_source_enum_1.OrderSourceEnum).nullable(),
|
|
14
|
+
creator: order_creator_schema_1.OrderCreatorSchema.nullable(),
|
|
11
15
|
client: client_base_schema_1.ClientSchema,
|
|
12
16
|
branch: branch_schema_1.BranchSchema.nullable(),
|
|
13
17
|
delivery: order_delivery_schema_1.OrderDeliverySchema.nullable(),
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetPreOrderListRequestSchema = void 0;
|
|
4
|
+
const order_source_enum_1 = require("../../enum/order-source.enum");
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
const optional_query_boolean_helper_1 = require("../../helpers/optional-query-boolean.helper");
|
|
6
7
|
const enum_1 = require("../../enum");
|
|
7
8
|
exports.GetPreOrderListRequestSchema = zod_1.z.object({
|
|
9
|
+
source: zod_1.z.nativeEnum(order_source_enum_1.OrderSourceEnum).optional(),
|
|
8
10
|
page: zod_1.z.string().transform(val => Number(val) || 1),
|
|
9
11
|
excludeClosed: optional_query_boolean_helper_1.optionalQueryBooleanSchema,
|
|
10
12
|
count: zod_1.z.coerce.number().optional().default(10),
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpdatePreOrderWebshopSchema = exports.CreatePreOrderWebshopSchema = exports.UpdatePreOrderSchema = exports.UpdatablePreOrderStatusSchema = exports.CreatePreOrderSchema = exports.PreOrderListSchema = exports.PreOrderWithClientSchema = exports.PreOrderExtendedSchema = exports.PreOrderSchema = void 0;
|
|
4
|
+
const order_creator_schema_1 = require("../order/order-creator.schema");
|
|
5
|
+
const order_source_enum_1 = require("../../enum/order-source.enum");
|
|
4
6
|
const pre_order_conversion_current_order_schema_1 = require("./pre-order-conversion-current-order.schema");
|
|
5
7
|
const pre_order_conversion_change_schema_1 = require("./pre-order-conversion-change.schema");
|
|
6
8
|
const pre_order_conversion_summary_schema_1 = require("./pre-order-conversion-summary.schema");
|
|
@@ -24,6 +26,8 @@ exports.PreOrderSchema = zod_1.z.object({
|
|
|
24
26
|
createdAt: zod_1.z.coerce.date(),
|
|
25
27
|
});
|
|
26
28
|
exports.PreOrderExtendedSchema = exports.PreOrderSchema.extend({
|
|
29
|
+
source: zod_1.z.nativeEnum(order_source_enum_1.OrderSourceEnum).nullable(),
|
|
30
|
+
creator: order_creator_schema_1.OrderCreatorSchema.nullable(),
|
|
27
31
|
client: client_base_schema_1.ClientSchema,
|
|
28
32
|
branch: branch_schema_1.BranchSchema.nullable(),
|
|
29
33
|
preOrderCollection: pre_order_collection_schema_1.PreOrderCollectionSchema.nullable(),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { MoyskladMoneyAccountLinksResponseSchema } from '../../../schemas/integration/moysklad/moysklad-money-account-links-response.schema';
|
|
3
|
+
|
|
4
|
+
export namespace GetMoyskladMoneyAccountLinksContractQuery {
|
|
5
|
+
export const ResponseSchema = MoyskladMoneyAccountLinksResponseSchema;
|
|
6
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { MoyskladPaymentSyncCheckRequestSchema } from '../../../schemas/integration/moysklad/moysklad-payment-sync-check-request.schema';
|
|
3
|
+
import { MoyskladPaymentSyncCheckResponseSchema } from '../../../schemas/integration/moysklad/moysklad-payment-sync-check-response.schema';
|
|
4
|
+
|
|
5
|
+
export namespace GetMoyskladPaymentSyncCheckContractQuery {
|
|
6
|
+
export const RequestSchema = MoyskladPaymentSyncCheckRequestSchema;
|
|
7
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
+
export const ResponseSchema = MoyskladPaymentSyncCheckResponseSchema;
|
|
9
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
10
|
+
}
|
|
@@ -19,3 +19,8 @@ export * from './update-moysklad-order-state-mapping.command';
|
|
|
19
19
|
export * from './get-seller-sync-status.query';
|
|
20
20
|
|
|
21
21
|
export * from './retry-seller-sync.command';
|
|
22
|
+
|
|
23
|
+
export * from './list-moysklad-money-targets.query';
|
|
24
|
+
export * from './get-moysklad-money-account-links.query';
|
|
25
|
+
export * from './save-moysklad-money-account-link.command';
|
|
26
|
+
export * from './get-moysklad-payment-sync-check.query';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { MoyskladMoneyTargetsResponseSchema } from '../../../schemas/integration/moysklad/moysklad-money-targets-response.schema';
|
|
3
|
+
|
|
4
|
+
export namespace ListMoyskladMoneyTargetsContractQuery {
|
|
5
|
+
export const ResponseSchema = MoyskladMoneyTargetsResponseSchema;
|
|
6
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { MoyskladMoneyAccountLinksResponseSchema } from '../../../schemas/integration/moysklad/moysklad-money-account-links-response.schema';
|
|
3
|
+
import { SaveMoyskladMoneyAccountLinkRequestSchema } from '../../../schemas/integration/moysklad/save-moysklad-money-account-link-request.schema';
|
|
4
|
+
|
|
5
|
+
export namespace SaveMoyskladMoneyAccountLinkContractCommand {
|
|
6
|
+
export const RequestSchema = SaveMoyskladMoneyAccountLinkRequestSchema;
|
|
7
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
+
export const ResponseSchema = MoyskladMoneyAccountLinksResponseSchema;
|
|
9
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
10
|
+
}
|
|
@@ -1,79 +1,6 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { queryBooleanSchema } from '../../helpers/query-boolean.helper';
|
|
5
|
-
import { OrderStatusEnum, OrderTypeEnum } from '../../enum';
|
|
6
|
-
|
|
7
|
-
const GetOrderListRequestSchema = z
|
|
8
|
-
.object({
|
|
9
|
-
page: z.string().transform(val => Number(val) || 1),
|
|
10
|
-
count: z.string().transform(val => Number(val) || 10),
|
|
11
|
-
startDate: z.coerce.date().optional(),
|
|
12
|
-
endDate: z.coerce.date().optional(),
|
|
13
|
-
isDelivery: z.coerce.boolean().optional(),
|
|
14
|
-
isPaid: z.coerce.boolean().optional(),
|
|
15
|
-
consignmentUUID: z.string().optional(),
|
|
16
|
-
tag: z.string().optional(),
|
|
17
|
-
clientUUID: z.string().optional(),
|
|
18
|
-
searchQuery: z.string().optional(),
|
|
19
|
-
consignmentDeliveryDate: z.coerce.date().optional(),
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Используйте `deliveryDateFrom` / `deliveryDateTo`. Оставлен ради сохранённых
|
|
22
|
-
* ссылок и MCP-клиентов: трактуется как период из одного дня (from = to = deliveryDate).
|
|
23
|
-
*/
|
|
24
|
-
deliveryDate: z.coerce.date().optional(),
|
|
25
|
-
// Период даты отгрузки/выдачи заказа (`plannedShipmentDate`) — и доставка, и самовывоз; имена
|
|
26
|
-
// остались от фильтра по дате доставки. Календарные дни `YYYY-MM-DD`, обе границы включительно.
|
|
27
|
-
deliveryDateFrom: z.coerce.date().optional(),
|
|
28
|
-
deliveryDateTo: z.coerce.date().optional(),
|
|
29
|
-
byProductSearchQuery: z.string().optional(),
|
|
30
|
-
statuses: z.nativeEnum(OrderStatusEnum).array().optional(),
|
|
31
|
-
type: z.nativeEnum(OrderTypeEnum).optional(),
|
|
32
|
-
city: z.string().optional(),
|
|
33
|
-
responsibleUserUUID: z.string().optional(),
|
|
34
|
-
group: z.string().optional(),
|
|
35
|
-
// Только заказы, ещё не включённые ни в один счёт на оплату — список для пикера при
|
|
36
|
-
// выставлении счёта. Комбинируется с остальными критериями обычным AND.
|
|
37
|
-
withoutPaymentInvoice: z.coerce.boolean().optional(),
|
|
38
|
-
// То же для передаточного документа — пикер заказов при выпуске УПД. Здесь `queryBooleanSchema`,
|
|
39
|
-
// а не `z.coerce.boolean()`: в query всегда приходит текст, и `Boolean('false') === true`,
|
|
40
|
-
// то есть флаг соседа невозможно выключить явным значением, только опустив параметр.
|
|
41
|
-
withoutTransferDocument: queryBooleanSchema,
|
|
42
|
-
})
|
|
43
|
-
.refine(
|
|
44
|
-
value => {
|
|
45
|
-
const { startDate, endDate } = value;
|
|
46
|
-
if (startDate && endDate) {
|
|
47
|
-
return dateRangeCheck(startDate, endDate);
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
message: 'validation.dateRange',
|
|
53
|
-
path: ['endDate', 'startDate'],
|
|
54
|
-
},
|
|
55
|
-
)
|
|
56
|
-
.refine(
|
|
57
|
-
value => {
|
|
58
|
-
const { deliveryDateFrom, deliveryDateTo } = value;
|
|
59
|
-
if (deliveryDateFrom && deliveryDateTo) {
|
|
60
|
-
return dateRangeCheck(deliveryDateFrom, deliveryDateTo);
|
|
61
|
-
}
|
|
62
|
-
return true;
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
message: 'validation.dateRange',
|
|
66
|
-
path: ['deliveryDateTo', 'deliveryDateFrom'],
|
|
67
|
-
},
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
const GetOrderListResponseSchema = z.object({
|
|
71
|
-
message: z.string().optional(),
|
|
72
|
-
data: z.object({
|
|
73
|
-
orderList: OrderExtendedSchema.array(),
|
|
74
|
-
total: z.number(),
|
|
75
|
-
}),
|
|
76
|
-
});
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { GetOrderListRequestSchema } from '../../schemas/order/get-order-list-request.schema';
|
|
3
|
+
import { GetOrderListResponseSchema } from '../../schemas/order/get-order-list-response.schema';
|
|
77
4
|
|
|
78
5
|
export namespace GetOrderListContractQuery {
|
|
79
6
|
export const RequestSchema = GetOrderListRequestSchema;
|
package/constant/error.ts
CHANGED
|
@@ -68,6 +68,11 @@ export const ERRORS = {
|
|
|
68
68
|
MONEY_ACCOUNT_FETCH_FAILED: { code: 'M006', message: 'Error when retrieving a list of money accounts', httpCode: 500 },
|
|
69
69
|
MONEY_ACCOUNT_HAS_TRANSACTIONS: { code: 'M007', message: 'Money account has transactions', httpCode: 400 },
|
|
70
70
|
MONEY_ACCOUNT_ACCESS_DENIED: { code: 'M008', message: 'Money account access denied', httpCode: 500 },
|
|
71
|
+
MONEY_ACCOUNT_INTEGRATION_LINK_FAILED: {
|
|
72
|
+
code: 'M009',
|
|
73
|
+
message: 'Failed to read or save money account integration link',
|
|
74
|
+
httpCode: 500,
|
|
75
|
+
},
|
|
71
76
|
|
|
72
77
|
//NOTIFICATION
|
|
73
78
|
NOTIFICATION_NOT_CREATED: { code: 'N001', message: 'Failed to create Notification', httpCode: 500 },
|
|
@@ -1891,6 +1896,11 @@ export const ERRORS = {
|
|
|
1891
1896
|
message: 'Latest sync job for this entity is not DEAD; cannot retry',
|
|
1892
1897
|
httpCode: 409,
|
|
1893
1898
|
},
|
|
1899
|
+
OUTBOUND_SYNC_ENTITY_LOCK_LOST: {
|
|
1900
|
+
code: 'OS006',
|
|
1901
|
+
message: 'Outbound sync job lost its entity lock before writing to the external system; will retry shortly',
|
|
1902
|
+
httpCode: 409,
|
|
1903
|
+
},
|
|
1894
1904
|
MOYSKLAD_STOCK_SYNC_CAP_EXCEEDED: {
|
|
1895
1905
|
code: 'MS015',
|
|
1896
1906
|
message: 'MoySklad stock-sync concurrency cap exceeded; will retry shortly',
|
|
@@ -1931,6 +1941,26 @@ export const ERRORS = {
|
|
|
1931
1941
|
message: 'The demand is waiting for the order to be pushed to MoySklad; will retry shortly',
|
|
1932
1942
|
httpCode: 409,
|
|
1933
1943
|
},
|
|
1944
|
+
MOYSKLAD_PAYMENT_CLIENT_NOT_LINKED: {
|
|
1945
|
+
code: 'MS024',
|
|
1946
|
+
message: 'Payment client has no MoySklad link; import clients first',
|
|
1947
|
+
httpCode: 400,
|
|
1948
|
+
},
|
|
1949
|
+
MOYSKLAD_PAYMENT_WAITING_ORDER_PUSH: {
|
|
1950
|
+
code: 'MS025',
|
|
1951
|
+
message: 'The payment is waiting for its order to be created in MoySklad; will retry shortly',
|
|
1952
|
+
httpCode: 409,
|
|
1953
|
+
},
|
|
1954
|
+
MOYSKLAD_MONEY_TARGET_NOT_FOUND: {
|
|
1955
|
+
code: 'MS026',
|
|
1956
|
+
message: 'The MoySklad cash desk or bank account was not found in the connected account',
|
|
1957
|
+
httpCode: 400,
|
|
1958
|
+
},
|
|
1959
|
+
MOYSKLAD_PAYMENT_CREATE_LOCK_BUSY: {
|
|
1960
|
+
code: 'MS027',
|
|
1961
|
+
message: 'Another payment is being created in MoySklad for this account; will retry shortly',
|
|
1962
|
+
httpCode: 409,
|
|
1963
|
+
},
|
|
1934
1964
|
|
|
1935
1965
|
// 1C COMMERCEML INTEGRATION
|
|
1936
1966
|
ONE_C_NOT_CONNECTED: { code: 'OC001', message: '1C integration is not connected for this company', httpCode: 404 },
|
package/enum/index.ts
CHANGED
|
@@ -57,6 +57,7 @@ export * from './image-type.enum';
|
|
|
57
57
|
export * from './import-error-code.enum';
|
|
58
58
|
export * from './integration-check-status.enum';
|
|
59
59
|
export * from './integration-provider.enum';
|
|
60
|
+
export * from './money-account-integration-link-kind.enum';
|
|
60
61
|
export * from './integration-status.enum';
|
|
61
62
|
export * from './inventory-movement-type.enum';
|
|
62
63
|
export * from './invoice-product-field.enum';
|
|
@@ -202,3 +203,5 @@ export * from './product-resolution-image-reason.enum';
|
|
|
202
203
|
export * from './product-resolution-matched-attribute.enum';
|
|
203
204
|
export * from './product-resolution-decision-action.enum';
|
|
204
205
|
export * from './product-resolution-write-mode.enum';
|
|
206
|
+
|
|
207
|
+
export * from './order-source.enum';
|
package/package.json
CHANGED
|
@@ -19,4 +19,6 @@ export const EnableMoyskladRequestSchema = z.object({
|
|
|
19
19
|
// Posted demand (отгрузка) in MS. No default on purpose: a client that does not send them keeps the saved values.
|
|
20
20
|
isDemandEnabled: z.boolean().optional(),
|
|
21
21
|
demandOrderStatus: z.enum(MOYSKLAD_DEMAND_ORDER_STATUS_LIST).optional(),
|
|
22
|
+
// Выгрузка оплат клиентов в МС. Без default по той же причине, что у отгрузок.
|
|
23
|
+
isPaymentSyncEnabled: z.boolean().optional(),
|
|
22
24
|
});
|
|
@@ -32,3 +32,13 @@ export * from './seller-sync-status.schema';
|
|
|
32
32
|
export * from './seller-sync-status-response.schema';
|
|
33
33
|
|
|
34
34
|
export * from './seller-sync-request.schema';
|
|
35
|
+
|
|
36
|
+
export * from './moysklad-money-target-ref.schema';
|
|
37
|
+
export * from './moysklad-money-target.schema';
|
|
38
|
+
export * from './moysklad-money-targets-response.schema';
|
|
39
|
+
export * from './moysklad-money-account-link.schema';
|
|
40
|
+
export * from './moysklad-money-account-links-response.schema';
|
|
41
|
+
export * from './save-moysklad-money-account-link-request.schema';
|
|
42
|
+
export * from './moysklad-payment-sync-check-request.schema';
|
|
43
|
+
export * from './moysklad-payment-sync-check.schema';
|
|
44
|
+
export * from './moysklad-payment-sync-check-response.schema';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MoneyAccountIntegrationLinkKindEnum } from '../../../enum/money-account-integration-link-kind.enum';
|
|
3
|
+
|
|
4
|
+
export const MoyskladMoneyAccountLinkSchema = z.object({
|
|
5
|
+
moneyAccountUUID: z.uuid(),
|
|
6
|
+
kind: z.nativeEnum(MoneyAccountIntegrationLinkKindEnum),
|
|
7
|
+
organizationId: z.string(),
|
|
8
|
+
externalAccountId: z.string().nullable(),
|
|
9
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MoneyAccountIntegrationLinkKindEnum } from '../../../enum/money-account-integration-link-kind.enum';
|
|
3
|
+
|
|
4
|
+
// Место денег в МойСкладе: касса юрлица (CASH, своего id у неё нет) или его расчётный счёт (BANK, externalAccountId). Идентификаторы МойСклада —
|
|
5
|
+
// 8-4-4-4-12, но не RFC 9562, поэтому z.guid(), а не z.uuid().
|
|
6
|
+
export const MoyskladMoneyTargetRefSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
kind: z.nativeEnum(MoneyAccountIntegrationLinkKindEnum),
|
|
9
|
+
organizationId: z.guid(),
|
|
10
|
+
externalAccountId: z.guid().nullable(),
|
|
11
|
+
})
|
|
12
|
+
.refine(target => (target.kind === MoneyAccountIntegrationLinkKindEnum.BANK) === (target.externalAccountId !== null), {
|
|
13
|
+
message: 'externalAccountId is required for BANK and must be null for CASH',
|
|
14
|
+
path: ['externalAccountId'],
|
|
15
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MoneyAccountIntegrationLinkKindEnum } from '../../../enum/money-account-integration-link-kind.enum';
|
|
3
|
+
|
|
4
|
+
// Вариант для выпадающего списка: касса или расчётный счёт юрлица МойСклада с подписями.
|
|
5
|
+
export const MoyskladMoneyTargetSchema = z.object({
|
|
6
|
+
kind: z.nativeEnum(MoneyAccountIntegrationLinkKindEnum),
|
|
7
|
+
organizationId: z.string(),
|
|
8
|
+
organizationName: z.string(),
|
|
9
|
+
externalAccountId: z.string().nullable(),
|
|
10
|
+
accountNumber: z.string().nullable(),
|
|
11
|
+
bankName: z.string().nullable(),
|
|
12
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// isSynced — оплата клиента на этот счёт уйдёт в МойСклад. isOrganizationMismatch — юрлицо счёта в МС не совпадает
|
|
4
|
+
// с юрлицом заказа: документ оплаты создастся на юрлицо счёта, но со ссылкой на заказ другого юрлица.
|
|
5
|
+
export const MoyskladPaymentSyncCheckSchema = z.object({
|
|
6
|
+
isSynced: z.boolean(),
|
|
7
|
+
isOrganizationMismatch: z.boolean(),
|
|
8
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MoyskladMoneyTargetRefSchema } from './moysklad-money-target-ref.schema';
|
|
3
|
+
|
|
4
|
+
// target = null снимает связь: оплаты со счёта перестают уходить в МойСклад.
|
|
5
|
+
export const SaveMoyskladMoneyAccountLinkRequestSchema = z.object({
|
|
6
|
+
moneyAccountUUID: z.uuid(),
|
|
7
|
+
target: MoyskladMoneyTargetRefSchema.nullable(),
|
|
8
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { dateRangeCheck } from '../../helpers/date.helper';
|
|
3
|
+
import { queryBooleanSchema } from '../../helpers/query-boolean.helper';
|
|
4
|
+
import { OrderStatusEnum, OrderTypeEnum, OrderSourceEnum } from '../../enum';
|
|
5
|
+
|
|
6
|
+
export const GetOrderListRequestSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
page: z.string().transform(val => Number(val) || 1),
|
|
9
|
+
count: z.string().transform(val => Number(val) || 10),
|
|
10
|
+
startDate: z.coerce.date().optional(),
|
|
11
|
+
endDate: z.coerce.date().optional(),
|
|
12
|
+
isDelivery: z.coerce.boolean().optional(),
|
|
13
|
+
isPaid: z.coerce.boolean().optional(),
|
|
14
|
+
consignmentUUID: z.string().optional(),
|
|
15
|
+
tag: z.string().optional(),
|
|
16
|
+
clientUUID: z.string().optional(),
|
|
17
|
+
searchQuery: z.string().optional(),
|
|
18
|
+
consignmentDeliveryDate: z.coerce.date().optional(),
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Используйте `deliveryDateFrom` / `deliveryDateTo`. Оставлен ради сохранённых
|
|
21
|
+
* ссылок и MCP-клиентов: трактуется как период из одного дня (from = to = deliveryDate).
|
|
22
|
+
*/
|
|
23
|
+
deliveryDate: z.coerce.date().optional(),
|
|
24
|
+
// Период даты отгрузки/выдачи заказа (`plannedShipmentDate`) — и доставка, и самовывоз; имена
|
|
25
|
+
// остались от фильтра по дате доставки. Календарные дни `YYYY-MM-DD`, обе границы включительно.
|
|
26
|
+
deliveryDateFrom: z.coerce.date().optional(),
|
|
27
|
+
deliveryDateTo: z.coerce.date().optional(),
|
|
28
|
+
byProductSearchQuery: z.string().optional(),
|
|
29
|
+
statuses: z.nativeEnum(OrderStatusEnum).array().optional(),
|
|
30
|
+
source: z.nativeEnum(OrderSourceEnum).optional(),
|
|
31
|
+
type: z.nativeEnum(OrderTypeEnum).optional(),
|
|
32
|
+
city: z.string().optional(),
|
|
33
|
+
responsibleUserUUID: z.string().optional(),
|
|
34
|
+
group: z.string().optional(),
|
|
35
|
+
// Только заказы, ещё не включённые ни в один счёт на оплату — список для пикера при
|
|
36
|
+
// выставлении счёта. Комбинируется с остальными критериями обычным AND.
|
|
37
|
+
withoutPaymentInvoice: z.coerce.boolean().optional(),
|
|
38
|
+
// То же для передаточного документа — пикер заказов при выпуске УПД. Здесь `queryBooleanSchema`,
|
|
39
|
+
// а не `z.coerce.boolean()`: в query всегда приходит текст, и `Boolean('false') === true`,
|
|
40
|
+
// то есть флаг соседа невозможно выключить явным значением, только опустив параметр.
|
|
41
|
+
withoutTransferDocument: queryBooleanSchema,
|
|
42
|
+
})
|
|
43
|
+
.refine(
|
|
44
|
+
value => {
|
|
45
|
+
const { startDate, endDate } = value;
|
|
46
|
+
if (startDate && endDate) {
|
|
47
|
+
return dateRangeCheck(startDate, endDate);
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
message: 'validation.dateRange',
|
|
53
|
+
path: ['endDate', 'startDate'],
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
.refine(
|
|
57
|
+
value => {
|
|
58
|
+
const { deliveryDateFrom, deliveryDateTo } = value;
|
|
59
|
+
if (deliveryDateFrom && deliveryDateTo) {
|
|
60
|
+
return dateRangeCheck(deliveryDateFrom, deliveryDateTo);
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
message: 'validation.dateRange',
|
|
66
|
+
path: ['deliveryDateTo', 'deliveryDateFrom'],
|
|
67
|
+
},
|
|
68
|
+
);
|
package/schemas/order/index.ts
CHANGED
|
@@ -29,3 +29,11 @@ export * from './order-vat-transition-execute-result.schema';
|
|
|
29
29
|
export * from './order-vat-transition-execute-response.schema';
|
|
30
30
|
|
|
31
31
|
export * from './order-vat-source-confirmation.schema';
|
|
32
|
+
|
|
33
|
+
export * from './get-order-list-request.schema';
|
|
34
|
+
|
|
35
|
+
export * from './get-order-list-response.schema';
|
|
36
|
+
|
|
37
|
+
export * from './get-order-list-response-data.schema';
|
|
38
|
+
|
|
39
|
+
export * from './order-creator.schema';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { OrderCreatorSchema } from './order-creator.schema';
|
|
2
|
+
import { OrderSourceEnum } from '../../enum/order-source.enum';
|
|
1
3
|
import { z } from 'zod';
|
|
2
4
|
import { ClientSchema } from '../client/client-base.schema';
|
|
3
5
|
import { BranchSchema } from '../branch/branch.schema';
|
|
@@ -6,6 +8,8 @@ import { DeliveryRouteSchema } from '../delivery-route/delivery-route.schema';
|
|
|
6
8
|
import { OrderSchema } from './order-base.schema';
|
|
7
9
|
|
|
8
10
|
export const OrderExtendedSchema = OrderSchema.extend({
|
|
11
|
+
source: z.nativeEnum(OrderSourceEnum).nullable(),
|
|
12
|
+
creator: OrderCreatorSchema.nullable(),
|
|
9
13
|
client: ClientSchema,
|
|
10
14
|
branch: BranchSchema.nullable(),
|
|
11
15
|
delivery: OrderDeliverySchema.nullable(),
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { OrderSourceEnum } from '../../enum/order-source.enum';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { optionalQueryBooleanSchema } from '../../helpers/optional-query-boolean.helper';
|
|
3
4
|
import { PreOrderStatusEnum } from '../../enum';
|
|
4
5
|
|
|
5
6
|
export const GetPreOrderListRequestSchema = z.object({
|
|
7
|
+
source: z.nativeEnum(OrderSourceEnum).optional(),
|
|
6
8
|
page: z.string().transform(val => Number(val) || 1),
|
|
7
9
|
excludeClosed: optionalQueryBooleanSchema,
|
|
8
10
|
count: z.coerce.number().optional().default(10),
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { OrderCreatorSchema } from '../order/order-creator.schema';
|
|
2
|
+
import { OrderSourceEnum } from '../../enum/order-source.enum';
|
|
1
3
|
import { PreOrderConversionCurrentOrderSchema } from './pre-order-conversion-current-order.schema';
|
|
2
4
|
import { PreOrderConversionChangeSchema } from './pre-order-conversion-change.schema';
|
|
3
5
|
import { PreOrderConversionSummarySchema } from './pre-order-conversion-summary.schema';
|
|
@@ -23,6 +25,8 @@ export const PreOrderSchema = z.object({
|
|
|
23
25
|
});
|
|
24
26
|
|
|
25
27
|
export const PreOrderExtendedSchema = PreOrderSchema.extend({
|
|
28
|
+
source: z.nativeEnum(OrderSourceEnum).nullable(),
|
|
29
|
+
creator: OrderCreatorSchema.nullable(),
|
|
26
30
|
client: ClientSchema,
|
|
27
31
|
branch: BranchSchema.nullable(),
|
|
28
32
|
preOrderCollection: PreOrderCollectionSchema.nullable(),
|