@purpleschool/gptbot 0.5.32 → 0.5.34
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/api/controllers/http/account-merge.ts +5 -0
- package/api/controllers/http/index.ts +1 -0
- package/build/api/controllers/http/account-merge.js +7 -0
- package/build/api/controllers/http/index.js +1 -0
- package/build/commands/account-merge/index.js +17 -0
- package/build/commands/account-merge/merge-account.command.js +16 -0
- package/build/commands/index.js +1 -0
- package/build/commands/payment/index.js +2 -1
- package/build/commands/payment/receipt.command.js +67 -0
- package/build/commands/user/get-me.command.js +1 -0
- package/build/constants/errors/errors.js +30 -0
- package/build/constants/roles/role.js +1 -0
- package/build/constants/user/enums/index.js +1 -0
- package/build/constants/user/enums/singup-method.enum.js +8 -0
- package/build/constants/user/enums/user-status.js +1 -0
- package/build/models/cloud-payments-receipt.schema.js +118 -0
- package/build/models/index.js +1 -0
- package/commands/account-merge/index.ts +1 -0
- package/commands/account-merge/merge-account.command.ts +18 -0
- package/commands/index.ts +1 -0
- package/commands/payment/index.ts +2 -1
- package/commands/payment/receipt.command.ts +68 -0
- package/commands/user/get-me.command.ts +2 -1
- package/constants/errors/errors.ts +32 -0
- package/constants/roles/role.ts +1 -0
- package/constants/user/enums/index.ts +1 -0
- package/constants/user/enums/singup-method.enum.ts +4 -0
- package/constants/user/enums/user-status.ts +1 -0
- package/models/cloud-payments-receipt.schema.ts +119 -0
- package/models/index.ts +1 -0
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./account-merge"), exports);
|
|
17
18
|
__exportStar(require("./ai-model"), exports);
|
|
18
19
|
__exportStar(require("./auth"), exports);
|
|
19
20
|
__exportStar(require("./blog"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./merge-account.command"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MergeAccountCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
var MergeAccountCommand;
|
|
6
|
+
(function (MergeAccountCommand) {
|
|
7
|
+
MergeAccountCommand.RequestSchema = zod_1.z.object({
|
|
8
|
+
email: zod_1.z.string().email(),
|
|
9
|
+
password: zod_1.z.string(),
|
|
10
|
+
});
|
|
11
|
+
MergeAccountCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
data: zod_1.z.object({
|
|
13
|
+
accessToken: zod_1.z.string(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
})(MergeAccountCommand || (exports.MergeAccountCommand = MergeAccountCommand = {}));
|
package/build/commands/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./account-merge"), exports);
|
|
17
18
|
__exportStar(require("./ai-model"), exports);
|
|
18
19
|
__exportStar(require("./auth"), exports);
|
|
19
20
|
__exportStar(require("./blog"), exports);
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./check.command"), exports);
|
|
17
18
|
__exportStar(require("./get-payment-history.command"), exports);
|
|
18
19
|
__exportStar(require("./pay.command"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
20
|
+
__exportStar(require("./receipt.command"), exports);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReceiptCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var ReceiptCommand;
|
|
7
|
+
(function (ReceiptCommand) {
|
|
8
|
+
ReceiptCommand.RequestSchema = zod_1.z
|
|
9
|
+
.object({
|
|
10
|
+
Id: zod_1.z.string(),
|
|
11
|
+
DocumentNumber: zod_1.z.string(),
|
|
12
|
+
SessionNumber: zod_1.z.string(),
|
|
13
|
+
Number: zod_1.z.string(),
|
|
14
|
+
FiscalSign: zod_1.z.string(),
|
|
15
|
+
DeviceNumber: zod_1.z.string(),
|
|
16
|
+
RegNumber: zod_1.z.string(),
|
|
17
|
+
FiscalNumber: zod_1.z.string(),
|
|
18
|
+
Inn: zod_1.z.string(),
|
|
19
|
+
Type: zod_1.z.string(),
|
|
20
|
+
Ofd: zod_1.z.string(),
|
|
21
|
+
Url: zod_1.z.string(),
|
|
22
|
+
QrCodeUrl: zod_1.z.string(),
|
|
23
|
+
TransactionId: zod_1.z.string(),
|
|
24
|
+
Amount: zod_1.z.string().transform((amount) => parseInt(amount, 10)),
|
|
25
|
+
DateTime: zod_1.z.string(),
|
|
26
|
+
InvoiceId: zod_1.z.string().optional(),
|
|
27
|
+
SubscriptionId: zod_1.z.string().optional(),
|
|
28
|
+
AccountId: zod_1.z.string(),
|
|
29
|
+
Receipt: zod_1.z
|
|
30
|
+
.string()
|
|
31
|
+
.transform((str, ctx) => {
|
|
32
|
+
try {
|
|
33
|
+
return JSON.parse(str);
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid JSON' });
|
|
37
|
+
return zod_1.z.NEVER;
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
.pipe(models_1.CloudPaymentsReceiptSchema),
|
|
41
|
+
})
|
|
42
|
+
.transform((data) => ({
|
|
43
|
+
id: data.Id,
|
|
44
|
+
docmentNumber: data.DocumentNumber,
|
|
45
|
+
sessionNumber: data.SessionNumber,
|
|
46
|
+
number: data.Number,
|
|
47
|
+
fiscalSign: data.FiscalSign,
|
|
48
|
+
deviceNumber: data.DeviceNumber,
|
|
49
|
+
regNumber: data.RegNumber,
|
|
50
|
+
fiscalNumber: data.FiscalNumber,
|
|
51
|
+
inn: data.Inn,
|
|
52
|
+
type: data.Type,
|
|
53
|
+
ofd: data.Ofd,
|
|
54
|
+
url: data.Url,
|
|
55
|
+
qrCodeUrl: data.QrCodeUrl,
|
|
56
|
+
transactionId: data.TransactionId,
|
|
57
|
+
amount: data.Amount,
|
|
58
|
+
dateTime: data.DateTime,
|
|
59
|
+
invoiceId: data.InvoiceId,
|
|
60
|
+
subscriptionId: data.SubscriptionId,
|
|
61
|
+
accountId: data.AccountId,
|
|
62
|
+
receipt: data.Receipt,
|
|
63
|
+
}));
|
|
64
|
+
ReceiptCommand.ResponseSchema = zod_1.z.object({
|
|
65
|
+
code: zod_1.z.number(),
|
|
66
|
+
});
|
|
67
|
+
})(ReceiptCommand || (exports.ReceiptCommand = ReceiptCommand = {}));
|
|
@@ -12,6 +12,7 @@ var GetMeCommand;
|
|
|
12
12
|
email: zod_1.z.string().email(),
|
|
13
13
|
status: zod_1.z.nativeEnum(constants_1.USER_STATUS),
|
|
14
14
|
role: zod_1.z.nativeEnum(constants_1.ROLE),
|
|
15
|
+
signupMethod: zod_1.z.nativeEnum(constants_1.SIGNUP_METHOD),
|
|
15
16
|
telegramId: zod_1.z.number().nullable(),
|
|
16
17
|
}),
|
|
17
18
|
});
|
|
@@ -810,4 +810,34 @@ exports.ERRORS = {
|
|
|
810
810
|
message: 'Пользователь не подписан на канал',
|
|
811
811
|
httpCode: 400,
|
|
812
812
|
},
|
|
813
|
+
ACCOUNT_MERGE_ERROR: {
|
|
814
|
+
code: 'A187',
|
|
815
|
+
message: 'Произошла ошибка при объединении учетных записей',
|
|
816
|
+
httpCode: 500,
|
|
817
|
+
},
|
|
818
|
+
ACCOUNT_MERGE_SOURCE_ACCOUNT_HAS_PURCHASES: {
|
|
819
|
+
code: 'A188',
|
|
820
|
+
message: 'Объединение невозможно: на исходной учетной записи есть покупки.',
|
|
821
|
+
httpCode: 400,
|
|
822
|
+
},
|
|
823
|
+
ACCOUNT_MERGE_SOURCE_ACCOUNT_INVALID_SIGNUP_METHOD: {
|
|
824
|
+
code: 'A189',
|
|
825
|
+
message: 'Объединение невозможно: исходная учетная запись не была зарегистрирована через Telegram.',
|
|
826
|
+
httpCode: 400,
|
|
827
|
+
},
|
|
828
|
+
ACCOUNT_MERGE_TARGET_ACCOUNT_INVALID_SIGNUP_METHOD: {
|
|
829
|
+
code: 'A190',
|
|
830
|
+
message: 'Объединение возможно только с учетной записью, зарегистрированной через веб-сайт',
|
|
831
|
+
httpCode: 400,
|
|
832
|
+
},
|
|
833
|
+
ACCOUNT_MERGE_TARGET_ACCOUNT_HAS_TELEGRAM_PROFILE_LINKED: {
|
|
834
|
+
code: 'A191',
|
|
835
|
+
message: 'Невозможно объединить учетные записи: к выбранной учетной записи уже привязан Telegram профиль',
|
|
836
|
+
httpCode: 400,
|
|
837
|
+
},
|
|
838
|
+
TELEGRAM_SEND_RECEIPT_ERROR: {
|
|
839
|
+
code: 'A192',
|
|
840
|
+
message: 'Произошла ошибка при отправке чека в Telegram',
|
|
841
|
+
httpCode: 500,
|
|
842
|
+
},
|
|
813
843
|
};
|
|
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./singup-method.enum"), exports);
|
|
17
18
|
__exportStar(require("./user-status"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SIGNUP_METHOD = void 0;
|
|
4
|
+
var SIGNUP_METHOD;
|
|
5
|
+
(function (SIGNUP_METHOD) {
|
|
6
|
+
SIGNUP_METHOD["WEBSITE"] = "website";
|
|
7
|
+
SIGNUP_METHOD["TELEGRAM"] = "telegram";
|
|
8
|
+
})(SIGNUP_METHOD || (exports.SIGNUP_METHOD = SIGNUP_METHOD = {}));
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudPaymentsReceiptSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ItemSchema = zod_1.z.object({
|
|
6
|
+
Label: zod_1.z.string(),
|
|
7
|
+
Price: zod_1.z.number(),
|
|
8
|
+
Quantity: zod_1.z.number(),
|
|
9
|
+
Amount: zod_1.z.number(),
|
|
10
|
+
Department: zod_1.z.nullable(zod_1.z.unknown()),
|
|
11
|
+
Vat: zod_1.z.number(),
|
|
12
|
+
EAN13: zod_1.z.nullable(zod_1.z.string()),
|
|
13
|
+
AgentSign: zod_1.z.nullable(zod_1.z.unknown()),
|
|
14
|
+
Method: zod_1.z.number(),
|
|
15
|
+
Object: zod_1.z.number(),
|
|
16
|
+
MeasurementUnit: zod_1.z.nullable(zod_1.z.string()),
|
|
17
|
+
UnitCode: zod_1.z.nullable(zod_1.z.string()),
|
|
18
|
+
Code: zod_1.z.nullable(zod_1.z.string()),
|
|
19
|
+
CalcVat: zod_1.z.number(),
|
|
20
|
+
VatDescription: zod_1.z.string(),
|
|
21
|
+
MethodName: zod_1.z.nullable(zod_1.z.string()),
|
|
22
|
+
ObjectName: zod_1.z.nullable(zod_1.z.string()),
|
|
23
|
+
AgentDescription: zod_1.z.string(),
|
|
24
|
+
AgentData: zod_1.z.nullable(zod_1.z.unknown()),
|
|
25
|
+
PurveyorData: zod_1.z.nullable(zod_1.z.unknown()),
|
|
26
|
+
Excise: zod_1.z.nullable(zod_1.z.unknown()),
|
|
27
|
+
CountryOriginCode: zod_1.z.nullable(zod_1.z.string()),
|
|
28
|
+
CustomsDeclarationNumber: zod_1.z.nullable(zod_1.z.string()),
|
|
29
|
+
ProductCodeData: zod_1.z.nullable(zod_1.z.unknown()),
|
|
30
|
+
AdditionalPositionInfo: zod_1.z.nullable(zod_1.z.string()),
|
|
31
|
+
SaleObjectData: zod_1.z.nullable(zod_1.z.unknown()),
|
|
32
|
+
PriceChangeDescription: zod_1.z.nullable(zod_1.z.string()),
|
|
33
|
+
IndustryRequisiteCollection: zod_1.z.array(zod_1.z.unknown()),
|
|
34
|
+
MarkPartQuantity: zod_1.z.nullable(zod_1.z.unknown()),
|
|
35
|
+
ExpectedMarkItemStatus: zod_1.z.nullable(zod_1.z.unknown()),
|
|
36
|
+
MarkCheckFlags: zod_1.z.nullable(zod_1.z.unknown()),
|
|
37
|
+
RawMarkCode: zod_1.z.nullable(zod_1.z.string()),
|
|
38
|
+
GroupSeparator: zod_1.z.nullable(zod_1.z.string()),
|
|
39
|
+
MarkResultSign: zod_1.z.nullable(zod_1.z.unknown()),
|
|
40
|
+
Spic: zod_1.z.nullable(zod_1.z.string()),
|
|
41
|
+
PackageCode: zod_1.z.nullable(zod_1.z.string()),
|
|
42
|
+
Barcode: zod_1.z.nullable(zod_1.z.string()),
|
|
43
|
+
Discount: zod_1.z.nullable(zod_1.z.number()),
|
|
44
|
+
OtherDiscount: zod_1.z.nullable(zod_1.z.number()),
|
|
45
|
+
MarkCodes: zod_1.z.array(zod_1.z.unknown()),
|
|
46
|
+
});
|
|
47
|
+
const AmountsSchema = zod_1.z.object({
|
|
48
|
+
Electronic: zod_1.z.number(),
|
|
49
|
+
Cash: zod_1.z.number(),
|
|
50
|
+
AdvancePayment: zod_1.z.number(),
|
|
51
|
+
Credit: zod_1.z.number(),
|
|
52
|
+
Provision: zod_1.z.number(),
|
|
53
|
+
});
|
|
54
|
+
const VatTotalSchema = zod_1.z.object({
|
|
55
|
+
Vat: zod_1.z.number(),
|
|
56
|
+
Label: zod_1.z.string(),
|
|
57
|
+
Amount: zod_1.z.number(),
|
|
58
|
+
});
|
|
59
|
+
exports.CloudPaymentsReceiptSchema = zod_1.z.object({
|
|
60
|
+
TinyUrl: zod_1.z.string(),
|
|
61
|
+
Email: zod_1.z.string().email(),
|
|
62
|
+
Phone: zod_1.z.nullable(zod_1.z.string()),
|
|
63
|
+
CalculationPlace: zod_1.z.string().url(),
|
|
64
|
+
SettlePlace: zod_1.z.string(),
|
|
65
|
+
Items: zod_1.z.array(ItemSchema),
|
|
66
|
+
TaxationSystem: zod_1.z.number(),
|
|
67
|
+
Amounts: AmountsSchema,
|
|
68
|
+
IsBso: zod_1.z.boolean(),
|
|
69
|
+
Currency: zod_1.z.number(),
|
|
70
|
+
CustomerInfo: zod_1.z.nullable(zod_1.z.unknown()),
|
|
71
|
+
CustomerInn: zod_1.z.nullable(zod_1.z.string()),
|
|
72
|
+
CustomerBirthday: zod_1.z.nullable(zod_1.z.string()),
|
|
73
|
+
CustomerStateCode: zod_1.z.nullable(zod_1.z.string()),
|
|
74
|
+
CustomerDocType: zod_1.z.nullable(zod_1.z.string()),
|
|
75
|
+
CustomerDoc: zod_1.z.nullable(zod_1.z.string()),
|
|
76
|
+
CustomerPlace: zod_1.z.nullable(zod_1.z.string()),
|
|
77
|
+
HasServices: zod_1.z.boolean(),
|
|
78
|
+
AgentSign: zod_1.z.nullable(zod_1.z.unknown()),
|
|
79
|
+
EncryptedData: zod_1.z.nullable(zod_1.z.unknown()),
|
|
80
|
+
Signature: zod_1.z.nullable(zod_1.z.string()),
|
|
81
|
+
HasAgentData: zod_1.z.boolean(),
|
|
82
|
+
CashierName: zod_1.z.nullable(zod_1.z.string()),
|
|
83
|
+
CashierInn: zod_1.z.nullable(zod_1.z.string()),
|
|
84
|
+
PurveyorData: zod_1.z.nullable(zod_1.z.unknown()),
|
|
85
|
+
AgentData: zod_1.z.nullable(zod_1.z.unknown()),
|
|
86
|
+
DocumentNumber: zod_1.z.string(),
|
|
87
|
+
SessionNumber: zod_1.z.string(),
|
|
88
|
+
SessionCheckNumber: zod_1.z.string(),
|
|
89
|
+
FiscalSign: zod_1.z.string(),
|
|
90
|
+
FiscalDate: zod_1.z.string().datetime(),
|
|
91
|
+
DeviceNumber: zod_1.z.string(),
|
|
92
|
+
RegNumber: zod_1.z.string(),
|
|
93
|
+
FiscalNumber: zod_1.z.string(),
|
|
94
|
+
Ofd: zod_1.z.number(),
|
|
95
|
+
Url: zod_1.z.string(),
|
|
96
|
+
TestMode: zod_1.z.boolean(),
|
|
97
|
+
ClientAdress: zod_1.z.string().email(),
|
|
98
|
+
FfdVersion: zod_1.z.number(),
|
|
99
|
+
KkmModelName: zod_1.z.string(),
|
|
100
|
+
IsSmsDisabled: zod_1.z.boolean(),
|
|
101
|
+
ReceiptQrCodeUrl: zod_1.z.string(),
|
|
102
|
+
ReceiptOfdUrl: zod_1.z.string(),
|
|
103
|
+
ReceiptLocalUrl: zod_1.z.string(),
|
|
104
|
+
OfdName: zod_1.z.string(),
|
|
105
|
+
OfdUrl: zod_1.z.string(),
|
|
106
|
+
OfdInn: zod_1.z.string(),
|
|
107
|
+
VatTotals: zod_1.z.array(VatTotalSchema),
|
|
108
|
+
TaxationSystemDescription: zod_1.z.string(),
|
|
109
|
+
AdditionalReceiptInfos: zod_1.z.array(zod_1.z.unknown()),
|
|
110
|
+
UserRequisiteData: zod_1.z.nullable(zod_1.z.unknown()),
|
|
111
|
+
AdditionalReceiptRequisite: zod_1.z.nullable(zod_1.z.unknown()),
|
|
112
|
+
IndustryRequisiteCollection: zod_1.z.array(zod_1.z.unknown()),
|
|
113
|
+
OperationReceiptRequisite: zod_1.z.nullable(zod_1.z.unknown()),
|
|
114
|
+
TinyUrlRefundTarget: zod_1.z.nullable(zod_1.z.string()),
|
|
115
|
+
Location: zod_1.z.nullable(zod_1.z.unknown()),
|
|
116
|
+
TaxiData: zod_1.z.nullable(zod_1.z.unknown()),
|
|
117
|
+
OtherContactData: zod_1.z.nullable(zod_1.z.unknown()),
|
|
118
|
+
});
|
package/build/models/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./ai-model-formatted.schema"), exports);
|
|
|
18
18
|
__exportStar(require("./ai-model.schema"), exports);
|
|
19
19
|
__exportStar(require("./category.schema"), exports);
|
|
20
20
|
__exportStar(require("./chat.schema"), exports);
|
|
21
|
+
__exportStar(require("./cloud-payments-receipt.schema"), exports);
|
|
21
22
|
__exportStar(require("./course-author.schema"), exports);
|
|
22
23
|
__exportStar(require("./course.schema"), exports);
|
|
23
24
|
__exportStar(require("./feedback.schema"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './merge-account.command';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace MergeAccountCommand {
|
|
4
|
+
export const RequestSchema = z.object({
|
|
5
|
+
email: z.string().email(),
|
|
6
|
+
password: z.string(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.object({
|
|
13
|
+
accessToken: z.string(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
package/commands/index.ts
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CloudPaymentsReceiptSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace ReceiptCommand {
|
|
5
|
+
export const RequestSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
Id: z.string(),
|
|
8
|
+
DocumentNumber: z.string(),
|
|
9
|
+
SessionNumber: z.string(),
|
|
10
|
+
Number: z.string(),
|
|
11
|
+
FiscalSign: z.string(),
|
|
12
|
+
DeviceNumber: z.string(),
|
|
13
|
+
RegNumber: z.string(),
|
|
14
|
+
FiscalNumber: z.string(),
|
|
15
|
+
Inn: z.string(),
|
|
16
|
+
Type: z.string(),
|
|
17
|
+
Ofd: z.string(),
|
|
18
|
+
Url: z.string(),
|
|
19
|
+
QrCodeUrl: z.string(),
|
|
20
|
+
TransactionId: z.string(),
|
|
21
|
+
Amount: z.string().transform((amount) => parseInt(amount, 10)),
|
|
22
|
+
DateTime: z.string(),
|
|
23
|
+
InvoiceId: z.string().optional(),
|
|
24
|
+
SubscriptionId: z.string().optional(),
|
|
25
|
+
AccountId: z.string(),
|
|
26
|
+
Receipt: z
|
|
27
|
+
.string()
|
|
28
|
+
.transform((str, ctx) => {
|
|
29
|
+
try {
|
|
30
|
+
return JSON.parse(str);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
ctx.addIssue({ code: 'custom', message: 'Invalid JSON' });
|
|
33
|
+
return z.NEVER;
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
.pipe(CloudPaymentsReceiptSchema),
|
|
37
|
+
})
|
|
38
|
+
.transform((data) => ({
|
|
39
|
+
id: data.Id,
|
|
40
|
+
docmentNumber: data.DocumentNumber,
|
|
41
|
+
sessionNumber: data.SessionNumber,
|
|
42
|
+
number: data.Number,
|
|
43
|
+
fiscalSign: data.FiscalSign,
|
|
44
|
+
deviceNumber: data.DeviceNumber,
|
|
45
|
+
regNumber: data.RegNumber,
|
|
46
|
+
fiscalNumber: data.FiscalNumber,
|
|
47
|
+
inn: data.Inn,
|
|
48
|
+
type: data.Type,
|
|
49
|
+
ofd: data.Ofd,
|
|
50
|
+
url: data.Url,
|
|
51
|
+
qrCodeUrl: data.QrCodeUrl,
|
|
52
|
+
transactionId: data.TransactionId,
|
|
53
|
+
amount: data.Amount,
|
|
54
|
+
dateTime: data.DateTime,
|
|
55
|
+
invoiceId: data.InvoiceId,
|
|
56
|
+
subscriptionId: data.SubscriptionId,
|
|
57
|
+
accountId: data.AccountId,
|
|
58
|
+
receipt: data.Receipt,
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
62
|
+
|
|
63
|
+
export const ResponseSchema = z.object({
|
|
64
|
+
code: z.number(),
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
68
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ROLE, USER_STATUS } from '../../constants';
|
|
1
|
+
import { ROLE, SIGNUP_METHOD, USER_STATUS } from '../../constants';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export namespace GetMeCommand {
|
|
@@ -12,6 +12,7 @@ export namespace GetMeCommand {
|
|
|
12
12
|
email: z.string().email(),
|
|
13
13
|
status: z.nativeEnum(USER_STATUS),
|
|
14
14
|
role: z.nativeEnum(ROLE),
|
|
15
|
+
signupMethod: z.nativeEnum(SIGNUP_METHOD),
|
|
15
16
|
telegramId: z.number().nullable(),
|
|
16
17
|
}),
|
|
17
18
|
});
|
|
@@ -810,4 +810,36 @@ export const ERRORS = {
|
|
|
810
810
|
message: 'Пользователь не подписан на канал',
|
|
811
811
|
httpCode: 400,
|
|
812
812
|
},
|
|
813
|
+
ACCOUNT_MERGE_ERROR: {
|
|
814
|
+
code: 'A187',
|
|
815
|
+
message: 'Произошла ошибка при объединении учетных записей',
|
|
816
|
+
httpCode: 500,
|
|
817
|
+
},
|
|
818
|
+
ACCOUNT_MERGE_SOURCE_ACCOUNT_HAS_PURCHASES: {
|
|
819
|
+
code: 'A188',
|
|
820
|
+
message: 'Объединение невозможно: на исходной учетной записи есть покупки.',
|
|
821
|
+
httpCode: 400,
|
|
822
|
+
},
|
|
823
|
+
ACCOUNT_MERGE_SOURCE_ACCOUNT_INVALID_SIGNUP_METHOD: {
|
|
824
|
+
code: 'A189',
|
|
825
|
+
message:
|
|
826
|
+
'Объединение невозможно: исходная учетная запись не была зарегистрирована через Telegram.',
|
|
827
|
+
httpCode: 400,
|
|
828
|
+
},
|
|
829
|
+
ACCOUNT_MERGE_TARGET_ACCOUNT_INVALID_SIGNUP_METHOD: {
|
|
830
|
+
code: 'A190',
|
|
831
|
+
message: 'Объединение возможно только с учетной записью, зарегистрированной через веб-сайт',
|
|
832
|
+
httpCode: 400,
|
|
833
|
+
},
|
|
834
|
+
ACCOUNT_MERGE_TARGET_ACCOUNT_HAS_TELEGRAM_PROFILE_LINKED: {
|
|
835
|
+
code: 'A191',
|
|
836
|
+
message:
|
|
837
|
+
'Невозможно объединить учетные записи: к выбранной учетной записи уже привязан Telegram профиль',
|
|
838
|
+
httpCode: 400,
|
|
839
|
+
},
|
|
840
|
+
TELEGRAM_SEND_RECEIPT_ERROR: {
|
|
841
|
+
code: 'A192',
|
|
842
|
+
message: 'Произошла ошибка при отправке чека в Telegram',
|
|
843
|
+
httpCode: 500,
|
|
844
|
+
},
|
|
813
845
|
};
|
package/constants/roles/role.ts
CHANGED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const ItemSchema = z.object({
|
|
4
|
+
Label: z.string(),
|
|
5
|
+
Price: z.number(),
|
|
6
|
+
Quantity: z.number(),
|
|
7
|
+
Amount: z.number(),
|
|
8
|
+
Department: z.nullable(z.unknown()),
|
|
9
|
+
Vat: z.number(),
|
|
10
|
+
EAN13: z.nullable(z.string()),
|
|
11
|
+
AgentSign: z.nullable(z.unknown()),
|
|
12
|
+
Method: z.number(),
|
|
13
|
+
Object: z.number(),
|
|
14
|
+
MeasurementUnit: z.nullable(z.string()),
|
|
15
|
+
UnitCode: z.nullable(z.string()),
|
|
16
|
+
Code: z.nullable(z.string()),
|
|
17
|
+
CalcVat: z.number(),
|
|
18
|
+
VatDescription: z.string(),
|
|
19
|
+
MethodName: z.nullable(z.string()),
|
|
20
|
+
ObjectName: z.nullable(z.string()),
|
|
21
|
+
AgentDescription: z.string(),
|
|
22
|
+
AgentData: z.nullable(z.unknown()),
|
|
23
|
+
PurveyorData: z.nullable(z.unknown()),
|
|
24
|
+
Excise: z.nullable(z.unknown()),
|
|
25
|
+
CountryOriginCode: z.nullable(z.string()),
|
|
26
|
+
CustomsDeclarationNumber: z.nullable(z.string()),
|
|
27
|
+
ProductCodeData: z.nullable(z.unknown()),
|
|
28
|
+
AdditionalPositionInfo: z.nullable(z.string()),
|
|
29
|
+
SaleObjectData: z.nullable(z.unknown()),
|
|
30
|
+
PriceChangeDescription: z.nullable(z.string()),
|
|
31
|
+
IndustryRequisiteCollection: z.array(z.unknown()),
|
|
32
|
+
MarkPartQuantity: z.nullable(z.unknown()),
|
|
33
|
+
ExpectedMarkItemStatus: z.nullable(z.unknown()),
|
|
34
|
+
MarkCheckFlags: z.nullable(z.unknown()),
|
|
35
|
+
RawMarkCode: z.nullable(z.string()),
|
|
36
|
+
GroupSeparator: z.nullable(z.string()),
|
|
37
|
+
MarkResultSign: z.nullable(z.unknown()),
|
|
38
|
+
Spic: z.nullable(z.string()),
|
|
39
|
+
PackageCode: z.nullable(z.string()),
|
|
40
|
+
Barcode: z.nullable(z.string()),
|
|
41
|
+
Discount: z.nullable(z.number()),
|
|
42
|
+
OtherDiscount: z.nullable(z.number()),
|
|
43
|
+
MarkCodes: z.array(z.unknown()),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const AmountsSchema = z.object({
|
|
47
|
+
Electronic: z.number(),
|
|
48
|
+
Cash: z.number(),
|
|
49
|
+
AdvancePayment: z.number(),
|
|
50
|
+
Credit: z.number(),
|
|
51
|
+
Provision: z.number(),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const VatTotalSchema = z.object({
|
|
55
|
+
Vat: z.number(),
|
|
56
|
+
Label: z.string(),
|
|
57
|
+
Amount: z.number(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const CloudPaymentsReceiptSchema = z.object({
|
|
61
|
+
TinyUrl: z.string(),
|
|
62
|
+
Email: z.string().email(),
|
|
63
|
+
Phone: z.nullable(z.string()),
|
|
64
|
+
CalculationPlace: z.string().url(),
|
|
65
|
+
SettlePlace: z.string(),
|
|
66
|
+
Items: z.array(ItemSchema),
|
|
67
|
+
TaxationSystem: z.number(),
|
|
68
|
+
Amounts: AmountsSchema,
|
|
69
|
+
IsBso: z.boolean(),
|
|
70
|
+
Currency: z.number(),
|
|
71
|
+
CustomerInfo: z.nullable(z.unknown()),
|
|
72
|
+
CustomerInn: z.nullable(z.string()),
|
|
73
|
+
CustomerBirthday: z.nullable(z.string()),
|
|
74
|
+
CustomerStateCode: z.nullable(z.string()),
|
|
75
|
+
CustomerDocType: z.nullable(z.string()),
|
|
76
|
+
CustomerDoc: z.nullable(z.string()),
|
|
77
|
+
CustomerPlace: z.nullable(z.string()),
|
|
78
|
+
HasServices: z.boolean(),
|
|
79
|
+
AgentSign: z.nullable(z.unknown()),
|
|
80
|
+
EncryptedData: z.nullable(z.unknown()),
|
|
81
|
+
Signature: z.nullable(z.string()),
|
|
82
|
+
HasAgentData: z.boolean(),
|
|
83
|
+
CashierName: z.nullable(z.string()),
|
|
84
|
+
CashierInn: z.nullable(z.string()),
|
|
85
|
+
PurveyorData: z.nullable(z.unknown()),
|
|
86
|
+
AgentData: z.nullable(z.unknown()),
|
|
87
|
+
DocumentNumber: z.string(),
|
|
88
|
+
SessionNumber: z.string(),
|
|
89
|
+
SessionCheckNumber: z.string(),
|
|
90
|
+
FiscalSign: z.string(),
|
|
91
|
+
FiscalDate: z.string().datetime(),
|
|
92
|
+
DeviceNumber: z.string(),
|
|
93
|
+
RegNumber: z.string(),
|
|
94
|
+
FiscalNumber: z.string(),
|
|
95
|
+
Ofd: z.number(),
|
|
96
|
+
Url: z.string(),
|
|
97
|
+
TestMode: z.boolean(),
|
|
98
|
+
ClientAdress: z.string().email(),
|
|
99
|
+
FfdVersion: z.number(),
|
|
100
|
+
KkmModelName: z.string(),
|
|
101
|
+
IsSmsDisabled: z.boolean(),
|
|
102
|
+
ReceiptQrCodeUrl: z.string(),
|
|
103
|
+
ReceiptOfdUrl: z.string(),
|
|
104
|
+
ReceiptLocalUrl: z.string(),
|
|
105
|
+
OfdName: z.string(),
|
|
106
|
+
OfdUrl: z.string(),
|
|
107
|
+
OfdInn: z.string(),
|
|
108
|
+
VatTotals: z.array(VatTotalSchema),
|
|
109
|
+
TaxationSystemDescription: z.string(),
|
|
110
|
+
AdditionalReceiptInfos: z.array(z.unknown()),
|
|
111
|
+
UserRequisiteData: z.nullable(z.unknown()),
|
|
112
|
+
AdditionalReceiptRequisite: z.nullable(z.unknown()),
|
|
113
|
+
IndustryRequisiteCollection: z.array(z.unknown()),
|
|
114
|
+
OperationReceiptRequisite: z.nullable(z.unknown()),
|
|
115
|
+
TinyUrlRefundTarget: z.nullable(z.string()),
|
|
116
|
+
Location: z.nullable(z.unknown()),
|
|
117
|
+
TaxiData: z.nullable(z.unknown()),
|
|
118
|
+
OtherContactData: z.nullable(z.unknown()),
|
|
119
|
+
});
|
package/models/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './ai-model-formatted.schema';
|
|
|
2
2
|
export * from './ai-model.schema';
|
|
3
3
|
export * from './category.schema';
|
|
4
4
|
export * from './chat.schema';
|
|
5
|
+
export * from './cloud-payments-receipt.schema';
|
|
5
6
|
export * from './course-author.schema';
|
|
6
7
|
export * from './course.schema';
|
|
7
8
|
export * from './feedback.schema';
|