@floristcloud/api-lib 1.0.10 → 1.0.12

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.
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetClientDebtListContractQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const client_1 = require("../../schemas/client");
6
+ const GetClientDebtListRequestSchema = zod_1.z.object({
7
+ page: zod_1.z.coerce.number().optional().default(1),
8
+ count: zod_1.z.coerce.number().optional().default(10),
9
+ responsibleUserUUID: zod_1.z.string().optional(),
10
+ searchQuery: zod_1.z.string().optional(),
11
+ group: zod_1.z.string().optional(),
12
+ paymentDelayDays: zod_1.z.coerce.number().optional().default(0),
13
+ });
14
+ const GetClientDebtListResponseSchema = zod_1.z.object({
15
+ message: zod_1.z.string().optional(),
16
+ data: client_1.ClientDebtListSchema,
17
+ });
18
+ var GetClientDebtListContractQuery;
19
+ (function (GetClientDebtListContractQuery) {
20
+ GetClientDebtListContractQuery.RequestSchema = GetClientDebtListRequestSchema;
21
+ GetClientDebtListContractQuery.ResponseSchema = GetClientDebtListResponseSchema;
22
+ })(GetClientDebtListContractQuery || (exports.GetClientDebtListContractQuery = GetClientDebtListContractQuery = {}));
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./profile"), exports);
18
18
  __exportStar(require("./get-client.query"), exports);
19
19
  __exportStar(require("./get-client-list.query"), exports);
20
+ __exportStar(require("./get-client-debt-list.query"), exports);
20
21
  __exportStar(require("./create-client.command"), exports);
21
22
  __exportStar(require("./update-client.command"), exports);
22
23
  __exportStar(require("./delete-client.command"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplyPrepaymentTransactionContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const schemas_1 = require("../../schemas");
6
+ const ApplyPrepaymentTransactionRequestSchema = zod_1.z.object({
7
+ orderUUID: zod_1.z.string().uuid().optional(),
8
+ });
9
+ const ApplyPrepaymentTransactionResponseSchema = zod_1.z.object({
10
+ message: zod_1.z.string().optional(),
11
+ data: schemas_1.TransactionSchema.nullable(),
12
+ });
13
+ var ApplyPrepaymentTransactionContractCommand;
14
+ (function (ApplyPrepaymentTransactionContractCommand) {
15
+ ApplyPrepaymentTransactionContractCommand.RequestSchema = ApplyPrepaymentTransactionRequestSchema;
16
+ ApplyPrepaymentTransactionContractCommand.ResponseSchema = ApplyPrepaymentTransactionResponseSchema;
17
+ })(ApplyPrepaymentTransactionContractCommand || (exports.ApplyPrepaymentTransactionContractCommand = ApplyPrepaymentTransactionContractCommand = {}));
@@ -25,3 +25,4 @@ __exportStar(require("./generate-check-transaction.command"), exports);
25
25
  __exportStar(require("./update-transaction.command"), exports);
26
26
  __exportStar(require("./get-transaction-summary.query"), exports);
27
27
  __exportStar(require("./generate-pre-payment-check.command"), exports);
28
+ __exportStar(require("./apply-prepayment-transaction.command"), exports);
@@ -151,6 +151,7 @@ exports.ERRORS = {
151
151
  CLIENT_MARKING_ALREADY_EXISTS: { code: 'CL029', message: 'Client marking already exists', httpCode: 409 },
152
152
  CLIENT_MARKING_NOT_UPDATED: { code: 'CL030', message: 'Client marking not updated', httpCode: 500 },
153
153
  CLIENT_HAS_TRANSACTIONS: { code: 'CL031', message: 'Client has transactions', httpCode: 400 },
154
+ CLIENT_DEBT_LIST_FETCH_FAILED: { code: 'CL032', message: 'Failed to get client debt list', httpCode: 500 },
154
155
  //INDIVIDUAL PROFILE
155
156
  CLIENT_INDIVIDUAL_PROFILE_NOT_CREATED: { code: 'CL013', message: 'Failed to create client individual profile', httpCode: 500 },
156
157
  CLIENT_INDIVIDUAL_PROFILE_ALREADY_EXIST: { code: 'CL014', message: 'Individual profile already exist', httpCode: 409 },
@@ -375,6 +376,7 @@ exports.ERRORS = {
375
376
  TRANSACTION_COUNT_BY_CRITERIA_FAILED: { code: 'TR008', message: 'Failed to count transactions by criteria', httpCode: 500 },
376
377
  TRANSACTION_FETCH_SUM_FAILED: { code: 'TR009', message: 'Failed get sum transaction', httpCode: 500 },
377
378
  TRANSACTION_AMOUNT_NEGATIVE: { code: 'TR010', message: 'Transaction amount is negative', httpCode: 400 },
379
+ TRANSACTION_NOT_APPLIED: { code: 'TR011', message: 'Transaction not applied', httpCode: 500 },
378
380
  // BANK PAYMENT
379
381
  BANK_EVENT_NOT_FOUND: { code: 'BP001', message: 'Bank payment event not found', httpCode: 404 },
380
382
  BANK_EVENT_LIST_FAILED: { code: 'BP002', message: 'Error when retrieving bank payment events list', httpCode: 500 },
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientDebtListSchema = exports.ClientDebtItemSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.ClientDebtItemSchema = zod_1.z.object({
6
+ clientUUID: zod_1.z.string().uuid(),
7
+ name: zod_1.z.string(),
8
+ code: zod_1.z.string().nullable(),
9
+ group: zod_1.z.string().nullable(),
10
+ city: zod_1.z.string().nullable(),
11
+ responsibleUserName: zod_1.z.string().nullable(),
12
+ currentBalance: zod_1.z.number(),
13
+ transactionNet: zod_1.z.number(),
14
+ completedOrdersBalance: zod_1.z.number(),
15
+ completedOrdersBalanceWithDelay: zod_1.z.number(),
16
+ nonCompletedBalance: zod_1.z.number(),
17
+ });
18
+ exports.ClientDebtListSchema = zod_1.z.object({
19
+ clientList: exports.ClientDebtItemSchema.array(),
20
+ total: zod_1.z.number(),
21
+ });
@@ -18,3 +18,4 @@ __exportStar(require("./client.schema"), exports);
18
18
  __exportStar(require("./client-individual-profile.schema"), exports);
19
19
  __exportStar(require("./client-legal-profile.schema"), exports);
20
20
  __exportStar(require("./client-marking.schema"), exports);
21
+ __exportStar(require("./client-debt.schema"), exports);
@@ -68,3 +68,4 @@ __exportStar(require("./pre-order-collection-item/pre-order-collection-item-mult
68
68
  __exportStar(require("./message"), exports);
69
69
  __exportStar(require("./product-configuration/product-configuration.schema"), exports);
70
70
  __exportStar(require("./bank-payment"), exports);
71
+ __exportStar(require("./client"), exports);
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import { ClientDebtListSchema } from '../../schemas/client';
3
+
4
+ const GetClientDebtListRequestSchema = z.object({
5
+ page: z.coerce.number().optional().default(1),
6
+ count: z.coerce.number().optional().default(10),
7
+ responsibleUserUUID: z.string().optional(),
8
+ searchQuery: z.string().optional(),
9
+ group: z.string().optional(),
10
+ paymentDelayDays: z.coerce.number().optional().default(0),
11
+ });
12
+
13
+ const GetClientDebtListResponseSchema = z.object({
14
+ message: z.string().optional(),
15
+ data: ClientDebtListSchema,
16
+ });
17
+
18
+ export namespace GetClientDebtListContractQuery {
19
+ export const RequestSchema = GetClientDebtListRequestSchema;
20
+ export type Request = z.infer<typeof RequestSchema>;
21
+
22
+ export const ResponseSchema = GetClientDebtListResponseSchema;
23
+ export type Response = z.infer<typeof ResponseSchema>;
24
+ }
@@ -1,6 +1,7 @@
1
1
  export * from './profile';
2
2
  export * from './get-client.query';
3
3
  export * from './get-client-list.query';
4
+ export * from './get-client-debt-list.query';
4
5
  export * from './create-client.command';
5
6
  export * from './update-client.command';
6
7
  export * from './delete-client.command';
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { TransactionSchema } from '../../schemas';
3
+
4
+ const ApplyPrepaymentTransactionRequestSchema = z.object({
5
+ orderUUID: z.string().uuid().optional(),
6
+ });
7
+
8
+ const ApplyPrepaymentTransactionResponseSchema = z.object({
9
+ message: z.string().optional(),
10
+ data: TransactionSchema.nullable(),
11
+ });
12
+
13
+ export namespace ApplyPrepaymentTransactionContractCommand {
14
+ export const RequestSchema = ApplyPrepaymentTransactionRequestSchema;
15
+ export type Request = z.infer<typeof RequestSchema>;
16
+
17
+ export const ResponseSchema = ApplyPrepaymentTransactionResponseSchema;
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -9,3 +9,4 @@ export * from './generate-check-transaction.command';
9
9
  export * from './update-transaction.command';
10
10
  export * from './get-transaction-summary.query';
11
11
  export * from './generate-pre-payment-check.command';
12
+ export * from './apply-prepayment-transaction.command';
package/constant/error.ts CHANGED
@@ -157,6 +157,7 @@ export const ERRORS = {
157
157
  CLIENT_MARKING_ALREADY_EXISTS: { code: 'CL029', message: 'Client marking already exists', httpCode: 409 },
158
158
  CLIENT_MARKING_NOT_UPDATED: { code: 'CL030', message: 'Client marking not updated', httpCode: 500 },
159
159
  CLIENT_HAS_TRANSACTIONS: { code: 'CL031', message: 'Client has transactions', httpCode: 400 },
160
+ CLIENT_DEBT_LIST_FETCH_FAILED: { code: 'CL032', message: 'Failed to get client debt list', httpCode: 500 },
160
161
 
161
162
  //INDIVIDUAL PROFILE
162
163
  CLIENT_INDIVIDUAL_PROFILE_NOT_CREATED: { code: 'CL013', message: 'Failed to create client individual profile', httpCode: 500 },
@@ -392,6 +393,7 @@ export const ERRORS = {
392
393
  TRANSACTION_COUNT_BY_CRITERIA_FAILED: { code: 'TR008', message: 'Failed to count transactions by criteria', httpCode: 500 },
393
394
  TRANSACTION_FETCH_SUM_FAILED: { code: 'TR009', message: 'Failed get sum transaction', httpCode: 500 },
394
395
  TRANSACTION_AMOUNT_NEGATIVE: { code: 'TR010', message: 'Transaction amount is negative', httpCode: 400 },
396
+ TRANSACTION_NOT_APPLIED: { code: 'TR011', message: 'Transaction not applied', httpCode: 500 },
395
397
  // BANK PAYMENT
396
398
  BANK_EVENT_NOT_FOUND: { code: 'BP001', message: 'Bank payment event not found', httpCode: 404 },
397
399
  BANK_EVENT_LIST_FAILED: { code: 'BP002', message: 'Error when retrieving bank payment events list', httpCode: 500 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+
3
+ export const ClientDebtItemSchema = z.object({
4
+ clientUUID: z.string().uuid(),
5
+ name: z.string(),
6
+ code: z.string().nullable(),
7
+ group: z.string().nullable(),
8
+ city: z.string().nullable(),
9
+ responsibleUserName: z.string().nullable(),
10
+ currentBalance: z.number(),
11
+ transactionNet: z.number(),
12
+ completedOrdersBalance: z.number(),
13
+ completedOrdersBalanceWithDelay: z.number(),
14
+ nonCompletedBalance: z.number(),
15
+ });
16
+
17
+ export const ClientDebtListSchema = z.object({
18
+ clientList: ClientDebtItemSchema.array(),
19
+ total: z.number(),
20
+ });
@@ -2,3 +2,4 @@ export * from './client.schema';
2
2
  export * from './client-individual-profile.schema';
3
3
  export * from './client-legal-profile.schema';
4
4
  export * from './client-marking.schema';
5
+ export * from './client-debt.schema';
package/schemas/index.ts CHANGED
@@ -52,3 +52,4 @@ export * from './pre-order-collection-item/pre-order-collection-item-multiplicit
52
52
  export * from './message';
53
53
  export * from './product-configuration/product-configuration.schema';
54
54
  export * from './bank-payment';
55
+ export * from './client';