@purpleschool/gptbot 0.12.7 → 0.12.9

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.
@@ -22,6 +22,7 @@ export const TEAM_ACCOUNT_ROUTES = {
22
22
  CREATE_MANUAL_PRODUCT: 'manual/product',
23
23
  CREATE_INVOICE_PAYMENT: 'invoice-payment',
24
24
  ADMIN_FIND_BY_NAME: 'admin/find',
25
+ ADMIN_GET_INVOICES: 'admin/invoices',
25
26
  ADMIN_GET_CURRENT_SUBSCRIPTIONS: (teamAccountId: string) =>
26
27
  `admin/subscriptions/current/${teamAccountId}`,
27
28
  ADMIN_GET_PAYMENT_HISTORY: (teamAccountId: string) => `admin/payments/history/${teamAccountId}`,
package/api/routes.ts CHANGED
@@ -206,6 +206,7 @@ export const REST_API = {
206
206
  CREATE_MANUAL_PRODUCT: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.CREATE_MANUAL_PRODUCT}`,
207
207
  CREATE_INVOICE_PAYMENT: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.CREATE_INVOICE_PAYMENT}`,
208
208
  ADMIN_FIND_BY_NAME: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_FIND_BY_NAME}`,
209
+ ADMIN_GET_INVOICES: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_GET_INVOICES}`,
209
210
  ADMIN_GET_CURRENT_SUBSCRIPTIONS: (teamAccountId: string) =>
210
211
  `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_GET_CURRENT_SUBSCRIPTIONS(teamAccountId)}`,
211
212
  ADMIN_GET_PAYMENT_HISTORY: (teamAccountId: string) =>
@@ -24,6 +24,7 @@ exports.TEAM_ACCOUNT_ROUTES = {
24
24
  CREATE_MANUAL_PRODUCT: 'manual/product',
25
25
  CREATE_INVOICE_PAYMENT: 'invoice-payment',
26
26
  ADMIN_FIND_BY_NAME: 'admin/find',
27
+ ADMIN_GET_INVOICES: 'admin/invoices',
27
28
  ADMIN_GET_CURRENT_SUBSCRIPTIONS: (teamAccountId) => `admin/subscriptions/current/${teamAccountId}`,
28
29
  ADMIN_GET_PAYMENT_HISTORY: (teamAccountId) => `admin/payments/history/${teamAccountId}`,
29
30
  };
@@ -205,6 +205,7 @@ exports.REST_API = {
205
205
  CREATE_MANUAL_PRODUCT: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.CREATE_MANUAL_PRODUCT}`,
206
206
  CREATE_INVOICE_PAYMENT: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.CREATE_INVOICE_PAYMENT}`,
207
207
  ADMIN_FIND_BY_NAME: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_FIND_BY_NAME}`,
208
+ ADMIN_GET_INVOICES: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_GET_INVOICES}`,
208
209
  ADMIN_GET_CURRENT_SUBSCRIPTIONS: (teamAccountId) => `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_GET_CURRENT_SUBSCRIPTIONS(teamAccountId)}`,
209
210
  ADMIN_GET_PAYMENT_HISTORY: (teamAccountId) => `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ADMIN_GET_PAYMENT_HISTORY(teamAccountId)}`,
210
211
  },
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetInvoiceForPaymentCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var GetInvoiceForPaymentCommand;
7
+ (function (GetInvoiceForPaymentCommand) {
8
+ GetInvoiceForPaymentCommand.RequestQuerySchema = zod_1.z
9
+ .object({
10
+ invoiceId: zod_1.z.string().uuid().optional(),
11
+ userId: zod_1.z.string().uuid().optional(),
12
+ teamAccountId: zod_1.z.string().uuid().optional(),
13
+ inn: zod_1.z.string().optional(),
14
+ invoiceNumber: zod_1.z.string().optional(),
15
+ })
16
+ .refine((value) => [
17
+ value.invoiceId,
18
+ value.userId,
19
+ value.teamAccountId,
20
+ value.inn,
21
+ value.invoiceNumber,
22
+ ].filter(Boolean).length === 1, {
23
+ message: 'Must provide exactly one filter',
24
+ });
25
+ GetInvoiceForPaymentCommand.ResponseSchema = zod_1.z.object({
26
+ data: zod_1.z.array(models_1.InvoiceForPaymentSchema),
27
+ });
28
+ })(GetInvoiceForPaymentCommand || (exports.GetInvoiceForPaymentCommand = GetInvoiceForPaymentCommand = {}));
@@ -38,4 +38,5 @@ __exportStar(require("./create-manual-team-subscription.command"), exports);
38
38
  __exportStar(require("./create-manual-team-product.command"), exports);
39
39
  __exportStar(require("./find-team-accounts-by-name.command"), exports);
40
40
  __exportStar(require("./create-team-account-invoice-payment.command"), exports);
41
+ __exportStar(require("./get-invoice-for-payment.command"), exports);
41
42
  __exportStar(require("./get-team-account-payment-history.command"), exports);
@@ -38,6 +38,7 @@ __exportStar(require("./order.schema"), exports);
38
38
  __exportStar(require("./page.schema"), exports);
39
39
  __exportStar(require("./payment-history-item.schema"), exports);
40
40
  __exportStar(require("./payment.schema"), exports);
41
+ __exportStar(require("./invoice-for-payment.schema"), exports);
41
42
  __exportStar(require("./post.schema"), exports);
42
43
  __exportStar(require("./product.schema"), exports);
43
44
  __exportStar(require("./promocode.schema"), exports);
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvoiceForPaymentSchema = exports.InvoiceForPaymentPayloadSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.InvoiceForPaymentPayloadSchema = zod_1.z.object({
6
+ email: zod_1.z.string().email(),
7
+ name: zod_1.z.string(),
8
+ inn: zod_1.z.string(),
9
+ amount: zod_1.z.number(),
10
+ itemName: zod_1.z.string(),
11
+ });
12
+ exports.InvoiceForPaymentSchema = zod_1.z.object({
13
+ uuid: zod_1.z.string().uuid(),
14
+ userId: zod_1.z.string().uuid(),
15
+ teamAccountId: zod_1.z.string().uuid(),
16
+ invoiceNumber: zod_1.z.string(),
17
+ sum: zod_1.z.number(),
18
+ pdfUrl: zod_1.z.string(),
19
+ payload: exports.InvoiceForPaymentPayloadSchema,
20
+ orderId: zod_1.z.string().uuid().nullable(),
21
+ paymentId: zod_1.z.string().uuid().nullable(),
22
+ createdAt: zod_1.z.date(),
23
+ updatedAt: zod_1.z.date(),
24
+ });
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { InvoiceForPaymentSchema } from '../../models';
3
+
4
+ export namespace GetInvoiceForPaymentCommand {
5
+ export const RequestQuerySchema = z
6
+ .object({
7
+ invoiceId: z.string().uuid().optional(),
8
+ userId: z.string().uuid().optional(),
9
+ teamAccountId: z.string().uuid().optional(),
10
+ inn: z.string().optional(),
11
+ invoiceNumber: z.string().optional(),
12
+ })
13
+ .refine(
14
+ (value) =>
15
+ [
16
+ value.invoiceId,
17
+ value.userId,
18
+ value.teamAccountId,
19
+ value.inn,
20
+ value.invoiceNumber,
21
+ ].filter(Boolean).length === 1,
22
+ {
23
+ message: 'Must provide exactly one filter',
24
+ },
25
+ );
26
+
27
+ export type RequestQuery = z.infer<typeof RequestQuerySchema>;
28
+
29
+ export const ResponseSchema = z.object({
30
+ data: z.array(InvoiceForPaymentSchema),
31
+ });
32
+
33
+ export type Response = z.infer<typeof ResponseSchema>;
34
+ }
@@ -22,4 +22,5 @@ export * from './create-manual-team-subscription.command';
22
22
  export * from './create-manual-team-product.command';
23
23
  export * from './find-team-accounts-by-name.command';
24
24
  export * from './create-team-account-invoice-payment.command';
25
+ export * from './get-invoice-for-payment.command';
25
26
  export * from './get-team-account-payment-history.command';
package/models/index.ts CHANGED
@@ -22,6 +22,7 @@ export * from './order.schema';
22
22
  export * from './page.schema';
23
23
  export * from './payment-history-item.schema';
24
24
  export * from './payment.schema';
25
+ export * from './invoice-for-payment.schema';
25
26
  export * from './post.schema';
26
27
  export * from './product.schema';
27
28
  export * from './promocode.schema';
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+
3
+ export const InvoiceForPaymentPayloadSchema = z.object({
4
+ email: z.string().email(),
5
+ name: z.string(),
6
+ inn: z.string(),
7
+ amount: z.number(),
8
+ itemName: z.string(),
9
+ });
10
+
11
+ export const InvoiceForPaymentSchema = z.object({
12
+ uuid: z.string().uuid(),
13
+ userId: z.string().uuid(),
14
+ teamAccountId: z.string().uuid(),
15
+ invoiceNumber: z.string(),
16
+ sum: z.number(),
17
+ pdfUrl: z.string(),
18
+ payload: InvoiceForPaymentPayloadSchema,
19
+ orderId: z.string().uuid().nullable(),
20
+ paymentId: z.string().uuid().nullable(),
21
+ createdAt: z.date(),
22
+ updatedAt: z.date(),
23
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.12.7",
3
+ "version": "0.12.9",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",