@floristcloud/api-lib 1.2.221 → 1.2.222
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/constant/error.js +30 -0
- package/build/enum/external-entity-type.enum.js +1 -0
- package/build/enum/index.js +1 -0
- package/build/enum/money-account-integration-link-kind.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/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/constant/error.ts +30 -0
- package/enum/external-entity-type.enum.ts +1 -0
- package/enum/index.ts +1 -0
- package/enum/money-account-integration-link-kind.enum.ts +5 -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
|
@@ -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 = {}));
|
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);
|
|
@@ -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,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
|
+
}
|
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';
|
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
|
+
});
|