@gigapay-dev/contracts 1.1.3 → 1.1.5

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.
@@ -21,3 +21,4 @@ __exportStar(require("./promocode-activations"), exports);
21
21
  __exportStar(require("./refresh-sessions"), exports);
22
22
  __exportStar(require("./consts"), exports);
23
23
  __exportStar(require("./pagination"), exports);
24
+ __exportStar(require("./payment-methods"), exports);
@@ -11,6 +11,7 @@ exports.OrderReadResponseSchema = zod_1.z.object({
11
11
  paymentId: zod_1.z.coerce.number().positive(),
12
12
  paymentMethodId: zod_1.z.coerce.number().positive().optional(),
13
13
  amount: zod_1.z.coerce.number().positive(),
14
+ comission: zod_1.z.coerce.number().positive().optional(),
14
15
  createdAt: zod_1.z.coerce.date().default(() => new Date()),
15
16
  updatedAt: zod_1.z.coerce.date().default(() => new Date()),
16
17
  });
@@ -9,4 +9,5 @@ exports.OrderUpdateRequestSchema = zod_1.z.object({
9
9
  userId: zod_1.z.coerce.number().positive().optional(),
10
10
  paymentMethodId: zod_1.z.coerce.number().positive().optional(),
11
11
  promocodeId: zod_1.z.coerce.number().positive().optional(),
12
+ comission: zod_1.z.coerce.number().positive().optional(),
12
13
  });
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PaymentMethodEndpoints = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ const read_1 = require("./read");
9
+ exports.PaymentMethodEndpoints = {
10
+ course: {
11
+ method: "GET",
12
+ path: "/course",
13
+ request: zod_1.default.object({}),
14
+ response: read_1.CourseReadResponseSchema,
15
+ },
16
+ list: {
17
+ method: "GET",
18
+ path: "/payment-methods",
19
+ request: zod_1.default.object({}),
20
+ response: zod_1.default.array(read_1.PaymentMethodReadResponseSchema),
21
+ },
22
+ getById: {
23
+ method: "GET",
24
+ path: "/payment-methods/:id",
25
+ request: zod_1.default.object({
26
+ id: zod_1.default.coerce.number().positive(),
27
+ }),
28
+ response: read_1.PaymentMethodReadResponseSchema,
29
+ },
30
+ };
@@ -0,0 +1,18 @@
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("./read"), exports);
18
+ __exportStar(require("./endpoints"), exports);
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentMethodReadResponseSchema = exports.CourseReadResponseSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.CourseReadResponseSchema = zod_1.z.object({
6
+ USD_RUB: zod_1.z.string(),
7
+ RUB_KZT: zod_1.z.string(),
8
+ USD_KZT: zod_1.z.string(),
9
+ KZT_RUB: zod_1.z.string(),
10
+ });
11
+ exports.PaymentMethodReadResponseSchema = zod_1.z.object({
12
+ id: zod_1.z.coerce.number().positive(),
13
+ name: zod_1.z.string(),
14
+ image: zod_1.z.string(),
15
+ key: zod_1.z.string(),
16
+ isActive: zod_1.z.boolean(),
17
+ type: zod_1.z.string(),
18
+ maxAmount: zod_1.z.string(),
19
+ minAmount: zod_1.z.string(),
20
+ comission: zod_1.z.string(),
21
+ serviceComission: zod_1.z.string(),
22
+ cryptoToken: zod_1.z.string(),
23
+ cryptoNetwork: zod_1.z.string(),
24
+ updatedAt: zod_1.z.string(),
25
+ createdAt: zod_1.z.string(),
26
+ });
package/commands/index.ts CHANGED
@@ -4,4 +4,5 @@ export * from './promocodes';
4
4
  export * from './promocode-activations';
5
5
  export * from './refresh-sessions';
6
6
  export * from './consts';
7
- export * from './pagination';
7
+ export * from './pagination';
8
+ export * from './payment-methods';
@@ -9,6 +9,7 @@ export const OrderReadResponseSchema = z.object({
9
9
  paymentId: z.coerce.number().positive(),
10
10
  paymentMethodId: z.coerce.number().positive().optional(),
11
11
  amount: z.coerce.number().positive(),
12
+ comission: z.coerce.number().positive().optional(),
12
13
  createdAt: z.coerce.date().default(() => new Date()),
13
14
  updatedAt: z.coerce.date().default(() => new Date()),
14
15
  });
@@ -7,6 +7,7 @@ export const OrderUpdateRequestSchema = z.object({
7
7
  userId: z.coerce.number().positive().optional(),
8
8
  paymentMethodId: z.coerce.number().positive().optional(),
9
9
  promocodeId: z.coerce.number().positive().optional(),
10
+ comission: z.coerce.number().positive().optional(),
10
11
  })
11
12
 
12
13
  export type OrderUpdateRequest = z.infer<typeof OrderUpdateRequestSchema>
@@ -0,0 +1,34 @@
1
+ import z from "zod";
2
+ import { CourseReadResponseSchema, PaymentMethodReadResponseSchema } from "./read";
3
+ import { EndpointContract } from "../../types";
4
+
5
+ export const PaymentMethodEndpoints = {
6
+ course: {
7
+ method: "GET",
8
+ path: "/course",
9
+ request: z.object({}),
10
+ response: CourseReadResponseSchema,
11
+ },
12
+ list: {
13
+ method: "GET",
14
+ path: "/payment-methods",
15
+ request: z.object({}),
16
+ response: z.array(PaymentMethodReadResponseSchema),
17
+ },
18
+ getById: {
19
+ method: "GET",
20
+ path: "/payment-methods/:id",
21
+ request: z.object({
22
+ id: z.coerce.number().positive(),
23
+ }),
24
+ response: PaymentMethodReadResponseSchema,
25
+ },
26
+ } satisfies Record<string, EndpointContract>;
27
+
28
+ export type PaymentMethodEndpointKey = keyof typeof PaymentMethodEndpoints;
29
+
30
+ export type GetPaymentMethodRequest<K extends PaymentMethodEndpointKey> =
31
+ z.infer<typeof PaymentMethodEndpoints[K]["request"]>;
32
+
33
+ export type GetPaymentMethodResponse<K extends PaymentMethodEndpointKey> =
34
+ z.infer<typeof PaymentMethodEndpoints[K]["response"]>;
@@ -0,0 +1,2 @@
1
+ export * from './read';
2
+ export * from './endpoints';
@@ -0,0 +1,28 @@
1
+ import { z } from "zod";
2
+
3
+ export const CourseReadResponseSchema = z.object({
4
+ USD_RUB: z.string(),
5
+ RUB_KZT: z.string(),
6
+ USD_KZT: z.string(),
7
+ KZT_RUB: z.string(),
8
+ });
9
+
10
+ export const PaymentMethodReadResponseSchema = z.object({
11
+ id: z.coerce.number().positive(),
12
+ name: z.string(),
13
+ image: z.string(),
14
+ key: z.string(),
15
+ isActive: z.boolean(),
16
+ type: z.string(),
17
+ maxAmount: z.string(),
18
+ minAmount: z.string(),
19
+ comission: z.string(),
20
+ serviceComission: z.string(),
21
+ cryptoToken: z.string(),
22
+ cryptoNetwork: z.string(),
23
+ updatedAt: z.string(),
24
+ createdAt: z.string(),
25
+ });
26
+
27
+ export type CourseReadResponse = z.infer<typeof CourseReadResponseSchema>;
28
+ export type PaymentMethodReadResponse = z.infer<typeof PaymentMethodReadResponseSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gigapay-dev/contracts",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "main": "./build/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",