@purpleschool/gptbot 0.7.81 → 0.7.82

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 @@ var PayCommand;
22
22
  OperationType: zod_1.z.string(),
23
23
  InvoiceId: zod_1.z.string().optional(),
24
24
  AccountId: zod_1.z.string(),
25
+ Token: zod_1.z.string(),
25
26
  })
26
27
  .transform((data) => ({
27
28
  transactionId: data.TransactionId,
@@ -40,6 +41,7 @@ var PayCommand;
40
41
  operationType: data.OperationType,
41
42
  invoiceId: data.InvoiceId,
42
43
  accountId: data.AccountId,
44
+ token: data.Token,
43
45
  }));
44
46
  PayCommand.ResponseSchema = zod_1.z.object({
45
47
  code: zod_1.z.number(),
@@ -11,34 +11,7 @@ var DowngradeSubscriptionCommand;
11
11
  DowngradeSubscriptionCommand.RequestParamSchema = models_1.UserToSubscriptionSchema.pick({
12
12
  uuid: true,
13
13
  });
14
- const IReceiptOrderSchema = zod_1.z.object({
15
- items: zod_1.z.array(zod_1.z.object({
16
- label: zod_1.z.string(),
17
- price: zod_1.z.number(),
18
- quantity: zod_1.z.number(),
19
- amount: zod_1.z.number(),
20
- vat: zod_1.z.number(),
21
- })),
22
- email: zod_1.z.string(),
23
- isBso: zod_1.z.boolean(),
24
- amounts: zod_1.z.object({
25
- electronic: zod_1.z.number(),
26
- }),
27
- });
28
14
  DowngradeSubscriptionCommand.ResponseSchema = zod_1.z.object({
29
- publicId: zod_1.z.string(),
30
- amount: zod_1.z.number(),
31
- currency: zod_1.z.string(),
32
- accountId: zod_1.z.string(),
33
- description: zod_1.z.string(),
34
- invoiceId: zod_1.z.string(),
35
- email: zod_1.z.string(),
36
- skin: zod_1.z.string(),
37
- autoClose: zod_1.z.number(),
38
- data: zod_1.z.object({
39
- CloudPayments: zod_1.z.object({
40
- CustomerReceipt: IReceiptOrderSchema,
41
- }),
42
- }),
15
+ isSuccess: zod_1.z.boolean(),
43
16
  });
44
17
  })(DowngradeSubscriptionCommand || (exports.DowngradeSubscriptionCommand = DowngradeSubscriptionCommand = {}));
@@ -7,7 +7,7 @@ var GetSubscriptionsSummaryCommand;
7
7
  (function (GetSubscriptionsSummaryCommand) {
8
8
  GetSubscriptionsSummaryCommand.ResponseSchema = zod_1.z.object({
9
9
  features: zod_1.z.array(models_1.SubscriptionFeatureSchema),
10
- subscriptions: zod_1.z.array(models_1.UserToSubscriptionWithSubscriptionSchema),
10
+ subscriptions: zod_1.z.array(models_1.UserToSubscriptionWithDowngradeSubscriptionSchema),
11
11
  products: zod_1.z.array(models_1.UserToProductWithProductSchema),
12
12
  });
13
13
  })(GetSubscriptionsSummaryCommand || (exports.GetSubscriptionsSummaryCommand = GetSubscriptionsSummaryCommand = {}));
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CLOUD_PAYMENTS_GET_SUBSCRIPTION = exports.CLOUD_PAYMENTS_UPDATE = exports.CLOUD_PAYMENTS_CANCEL = exports.FORMATS = void 0;
3
+ exports.CLOUD_PAYMENTS_CREATE = exports.CLOUD_PAYMENTS_GET_SUBSCRIPTION = exports.CLOUD_PAYMENTS_UPDATE = exports.CLOUD_PAYMENTS_CANCEL = exports.FORMATS = void 0;
4
4
  exports.FORMATS = {
5
5
  UTF8: 'utf-8',
6
6
  BASE64: 'base64',
@@ -9,3 +9,4 @@ exports.FORMATS = {
9
9
  exports.CLOUD_PAYMENTS_CANCEL = 'https://api.cloudpayments.ru/subscriptions/cancel';
10
10
  exports.CLOUD_PAYMENTS_UPDATE = 'https://api.cloudpayments.ru/subscriptions/update';
11
11
  exports.CLOUD_PAYMENTS_GET_SUBSCRIPTION = 'https://api.cloudpayments.ru/subscriptions/get ';
12
+ exports.CLOUD_PAYMENTS_CREATE = 'https://api.cloudpayments.ru/subscriptions/create';
@@ -2301,4 +2301,14 @@ exports.ERRORS = {
2301
2301
  message: 'Минимальная сумма для вывода 5000 рублей',
2302
2302
  httpCode: 400,
2303
2303
  },
2304
+ CREATE_CLOUD_PAYMENTS_SUBSCRIPTION: {
2305
+ code: 'A469',
2306
+ message: 'Не удалось создать подписку у cloud payments',
2307
+ httpCode: 500,
2308
+ },
2309
+ SUBSCRIPTION_ALREADY_DOWNGRADED_ERROR: {
2310
+ code: 'A470',
2311
+ message: 'Подписка уже была понижена и ожидает отключения',
2312
+ httpCode: 400,
2313
+ },
2304
2314
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserToSubscriptionWithSubscriptionSchema = exports.UserToSubscriptionSchema = void 0;
3
+ exports.UserToSubscriptionWithDowngradeSubscriptionSchema = exports.UserToSubscriptionWithSubscriptionSchema = exports.UserToSubscriptionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const subscription_schema_1 = require("./subscription.schema");
6
6
  exports.UserToSubscriptionSchema = zod_1.z.object({
@@ -23,3 +23,6 @@ exports.UserToSubscriptionSchema = zod_1.z.object({
23
23
  exports.UserToSubscriptionWithSubscriptionSchema = zod_1.z.intersection(exports.UserToSubscriptionSchema, zod_1.z.object({
24
24
  subscription: subscription_schema_1.SubscriptionSchema,
25
25
  }));
26
+ exports.UserToSubscriptionWithDowngradeSubscriptionSchema = zod_1.z.intersection(exports.UserToSubscriptionWithSubscriptionSchema, zod_1.z.object({
27
+ subscriptionDowngrade: subscription_schema_1.SubscriptionSchema.optional(),
28
+ }));
@@ -19,6 +19,7 @@ export namespace PayCommand {
19
19
  OperationType: z.string(),
20
20
  InvoiceId: z.string().optional(),
21
21
  AccountId: z.string(),
22
+ Token: z.string(),
22
23
  })
23
24
  .transform((data) => ({
24
25
  transactionId: data.TransactionId,
@@ -37,6 +38,7 @@ export namespace PayCommand {
37
38
  operationType: data.OperationType,
38
39
  invoiceId: data.InvoiceId,
39
40
  accountId: data.AccountId,
41
+ token: data.Token,
40
42
  }));
41
43
 
42
44
  export type Request = z.infer<typeof RequestSchema>;
@@ -12,38 +12,8 @@ export namespace DowngradeSubscriptionCommand {
12
12
 
13
13
  export type Request = z.infer<typeof RequestSchema>;
14
14
 
15
- const IReceiptOrderSchema = z.object({
16
- items: z.array(
17
- z.object({
18
- label: z.string(),
19
- price: z.number(),
20
- quantity: z.number(),
21
- amount: z.number(),
22
- vat: z.number(),
23
- }),
24
- ),
25
- email: z.string(),
26
- isBso: z.boolean(),
27
- amounts: z.object({
28
- electronic: z.number(),
29
- }),
30
- });
31
-
32
15
  export const ResponseSchema = z.object({
33
- publicId: z.string(),
34
- amount: z.number(),
35
- currency: z.string(),
36
- accountId: z.string(),
37
- description: z.string(),
38
- invoiceId: z.string(),
39
- email: z.string(),
40
- skin: z.string(),
41
- autoClose: z.number(),
42
- data: z.object({
43
- CloudPayments: z.object({
44
- CustomerReceipt: IReceiptOrderSchema,
45
- }),
46
- }),
16
+ isSuccess: z.boolean(),
47
17
  });
48
18
 
49
19
  export type Response = z.infer<typeof ResponseSchema>;
@@ -2,13 +2,13 @@ import { z } from 'zod';
2
2
  import {
3
3
  SubscriptionFeatureSchema,
4
4
  UserToProductWithProductSchema,
5
- UserToSubscriptionWithSubscriptionSchema,
5
+ UserToSubscriptionWithDowngradeSubscriptionSchema,
6
6
  } from '../../models';
7
7
 
8
8
  export namespace GetSubscriptionsSummaryCommand {
9
9
  export const ResponseSchema = z.object({
10
10
  features: z.array(SubscriptionFeatureSchema),
11
- subscriptions: z.array(UserToSubscriptionWithSubscriptionSchema),
11
+ subscriptions: z.array(UserToSubscriptionWithDowngradeSubscriptionSchema),
12
12
  products: z.array(UserToProductWithProductSchema),
13
13
  });
14
14
 
@@ -9,3 +9,5 @@ export const CLOUD_PAYMENTS_CANCEL = 'https://api.cloudpayments.ru/subscriptions
9
9
  export const CLOUD_PAYMENTS_UPDATE = 'https://api.cloudpayments.ru/subscriptions/update';
10
10
 
11
11
  export const CLOUD_PAYMENTS_GET_SUBSCRIPTION = 'https://api.cloudpayments.ru/subscriptions/get ';
12
+
13
+ export const CLOUD_PAYMENTS_CREATE = 'https://api.cloudpayments.ru/subscriptions/create';
@@ -2309,4 +2309,14 @@ export const ERRORS = {
2309
2309
  message: 'Минимальная сумма для вывода 5000 рублей',
2310
2310
  httpCode: 400,
2311
2311
  },
2312
+ CREATE_CLOUD_PAYMENTS_SUBSCRIPTION: {
2313
+ code: 'A469',
2314
+ message: 'Не удалось создать подписку у cloud payments',
2315
+ httpCode: 500,
2316
+ },
2317
+ SUBSCRIPTION_ALREADY_DOWNGRADED_ERROR: {
2318
+ code: 'A470',
2319
+ message: 'Подписка уже была понижена и ожидает отключения',
2320
+ httpCode: 400,
2321
+ },
2312
2322
  };
@@ -25,3 +25,10 @@ export const UserToSubscriptionWithSubscriptionSchema = z.intersection(
25
25
  subscription: SubscriptionSchema,
26
26
  }),
27
27
  );
28
+
29
+ export const UserToSubscriptionWithDowngradeSubscriptionSchema = z.intersection(
30
+ UserToSubscriptionWithSubscriptionSchema,
31
+ z.object({
32
+ subscriptionDowngrade: SubscriptionSchema.optional(),
33
+ }),
34
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.7.81",
3
+ "version": "0.7.82",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",