@floristcloud/api-lib 1.0.4 → 1.0.6

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,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetBankPaymentListContractQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const date_helper_1 = require("../../helpers/date.helper");
6
+ const bank_payment_event_status_enum_1 = require("../../enum/bank-payment-event-status.enum");
7
+ const bank_payment_schema_1 = require("../../schemas/bank-payment/bank-payment.schema");
8
+ const GetBankPaymentListRequestSchema = zod_1.z
9
+ .object({
10
+ page: zod_1.z.coerce.number().optional().default(1),
11
+ count: zod_1.z.coerce.number().optional().default(20),
12
+ status: zod_1.z.nativeEnum(bank_payment_event_status_enum_1.BankPaymentEventStatusEnum).optional(),
13
+ searchQuery: zod_1.z.string().optional(),
14
+ startDate: zod_1.z.coerce.date().optional(),
15
+ endDate: zod_1.z.coerce.date().optional(),
16
+ })
17
+ .refine(value => {
18
+ const { startDate, endDate } = value;
19
+ if (startDate && endDate) {
20
+ return (0, date_helper_1.dateRangeCheck)(startDate, endDate);
21
+ }
22
+ return true;
23
+ }, {
24
+ message: 'End date must be greater than start date',
25
+ path: ['endDate', 'startDate'],
26
+ });
27
+ const GetBankPaymentListResponseSchema = zod_1.z.object({
28
+ message: zod_1.z.string().optional(),
29
+ data: zod_1.z.object({
30
+ list: bank_payment_schema_1.BankPaymentSchema.array(),
31
+ total: zod_1.z.number(),
32
+ }),
33
+ });
34
+ var GetBankPaymentListContractQuery;
35
+ (function (GetBankPaymentListContractQuery) {
36
+ GetBankPaymentListContractQuery.RequestSchema = GetBankPaymentListRequestSchema;
37
+ GetBankPaymentListContractQuery.ResponseSchema = GetBankPaymentListResponseSchema;
38
+ })(GetBankPaymentListContractQuery || (exports.GetBankPaymentListContractQuery = GetBankPaymentListContractQuery = {}));
@@ -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("./get-bank-payment-list.query"), exports);
@@ -58,3 +58,4 @@ __exportStar(require("./product-configuration/get-product-configuration-list.que
58
58
  __exportStar(require("./product-configuration/create-product-configuration.command"), exports);
59
59
  __exportStar(require("./product-configuration/update-product-configuration.command"), exports);
60
60
  __exportStar(require("./product-configuration/delete-product-configuration.command"), exports);
61
+ __exportStar(require("./bank-payment"), exports);
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CheckoutPreOrderWebshopContractCommand = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const schemas_1 = require("../../../schemas");
6
- const CheckoutPreOrderWebshopRequestSchema = zod_1.z.object({});
6
+ const CheckoutPreOrderWebshopRequestSchema = zod_1.z.object({
7
+ comment: zod_1.z.string().nullable().optional(),
8
+ branchUUID: zod_1.z.string().nullable().optional(),
9
+ });
7
10
  const CheckoutPreOrderWebshopResponseSchema = zod_1.z.object({
8
11
  message: zod_1.z.string().optional(),
9
12
  data: schemas_1.PreOrderSchema,
@@ -375,6 +375,22 @@ exports.ERRORS = {
375
375
  TRANSACTION_COUNT_BY_CRITERIA_FAILED: { code: 'TR008', message: 'Failed to count transactions by criteria', httpCode: 500 },
376
376
  TRANSACTION_FETCH_SUM_FAILED: { code: 'TR009', message: 'Failed get sum transaction', httpCode: 500 },
377
377
  TRANSACTION_AMOUNT_NEGATIVE: { code: 'TR010', message: 'Transaction amount is negative', httpCode: 400 },
378
+ // BANK PAYMENT
379
+ BANK_EVENT_NOT_FOUND: { code: 'BP001', message: 'Bank payment event not found', httpCode: 404 },
380
+ BANK_EVENT_LIST_FAILED: { code: 'BP002', message: 'Error when retrieving bank payment events list', httpCode: 500 },
381
+ BANK_EVENT_GET_FAILED: { code: 'BP003', message: 'Error when retrieving bank payment event', httpCode: 500 },
382
+ BANK_EVENT_UPSERT_FAILED: { code: 'BP004', message: 'Failed to upsert bank payment event', httpCode: 500 },
383
+ BANK_EVENT_UNSUPPORTED_STATUS: { code: 'BP005', message: 'Unsupported bank payment event status', httpCode: 400 },
384
+ BANK_EVENT_ALREADY_APPLIED: { code: 'BP006', message: 'Bank payment event already applied', httpCode: 400 },
385
+ BANK_EVENT_UPDATE_STATUS_FAILED: { code: 'BP007', message: 'Failed to update bank payment event status', httpCode: 500 },
386
+ BANK_PAYMENT_APPLY_FAILED: { code: 'BP008', message: 'Failed to apply bank payment event', httpCode: 500 },
387
+ BANK_EVENT_NOT_FOUND_OR_NOT_NEW: {
388
+ code: 'BP009',
389
+ message: 'Bank payment event not found or not in NEW status',
390
+ httpCode: 400,
391
+ },
392
+ MONEY_ACCOUNT_REQUIRED: { code: 'BP010', message: 'moneyAccountUUID is required to apply bank payment event', httpCode: 400 },
393
+ TRANSACTION_CREATE_FAILED: { code: 'BP011', message: 'Failed to create transaction', httpCode: 500 },
378
394
  // EXCEL
379
395
  EXCEL_CREATE_FAILED: { code: 'E001', message: 'Failed to create excel', httpCode: 500 },
380
396
  EXCEL_GET_DATA_BY_BUFFER_FAILED: { code: 'E002', message: 'Failed to get buffer', httpCode: 500 },
@@ -418,6 +434,8 @@ exports.ERRORS = {
418
434
  FILE_NOT_DELETED: { code: 'F003', message: 'File not deleted', httpCode: 500 },
419
435
  FILE_SIZE_LIMIT_EXCEEDED: { code: 'F004', message: 'File size limit exceeded', httpCode: 400 },
420
436
  FILE_GET_INFO_FAILED: { code: 'F005', message: 'Failed to get file info', httpCode: 500 },
437
+ FILE_NOT_SUPPORTED: { code: 'F006', message: 'File not supported', httpCode: 400 },
438
+ FILE_S3_FORBIDDEN: { code: 'F007', message: 'File S3 forbidden', httpCode: 403 },
421
439
  //WHATSAPP
422
440
  WHATSAPP_TEXT_NOT_SENT: { code: 'W001', message: 'Failed to send text message', httpCode: 500 },
423
441
  WHATSAPP_FILE_NOT_SENT: { code: 'W002', message: 'Failed to send file message', httpCode: 500 },
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BankPaymentEventStatusEnum = void 0;
4
+ var BankPaymentEventStatusEnum;
5
+ (function (BankPaymentEventStatusEnum) {
6
+ BankPaymentEventStatusEnum["NEW"] = "NEW";
7
+ BankPaymentEventStatusEnum["IGNORED"] = "IGNORED";
8
+ BankPaymentEventStatusEnum["APPLIED"] = "APPLIED";
9
+ })(BankPaymentEventStatusEnum || (exports.BankPaymentEventStatusEnum = BankPaymentEventStatusEnum = {}));
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BankPaymentRuleMatchTypeEnum = void 0;
4
+ var BankPaymentRuleMatchTypeEnum;
5
+ (function (BankPaymentRuleMatchTypeEnum) {
6
+ BankPaymentRuleMatchTypeEnum["CONTAINS"] = "CONTAINS";
7
+ BankPaymentRuleMatchTypeEnum["STARTS_WITH"] = "STARTS_WITH";
8
+ BankPaymentRuleMatchTypeEnum["ENDS_WITH"] = "ENDS_WITH";
9
+ BankPaymentRuleMatchTypeEnum["EQUALS"] = "EQUALS";
10
+ })(BankPaymentRuleMatchTypeEnum || (exports.BankPaymentRuleMatchTypeEnum = BankPaymentRuleMatchTypeEnum = {}));
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BankProviderEnum = void 0;
4
+ var BankProviderEnum;
5
+ (function (BankProviderEnum) {
6
+ BankProviderEnum["MODULBANK"] = "MODULBANK";
7
+ })(BankProviderEnum || (exports.BankProviderEnum = BankProviderEnum = {}));
@@ -4,4 +4,5 @@ exports.FileExpirePrefixEnum = void 0;
4
4
  var FileExpirePrefixEnum;
5
5
  (function (FileExpirePrefixEnum) {
6
6
  FileExpirePrefixEnum["D3"] = "3d";
7
+ FileExpirePrefixEnum["D30"] = "30d";
7
8
  })(FileExpirePrefixEnum || (exports.FileExpirePrefixEnum = FileExpirePrefixEnum = {}));
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BankPaymentSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const bank_provider_enum_1 = require("../../enum/bank-provider.enum");
6
+ const bank_payment_event_status_enum_1 = require("../../enum/bank-payment-event-status.enum");
7
+ exports.BankPaymentSchema = zod_1.z.object({
8
+ uuid: zod_1.z.string().uuid(),
9
+ provider: zod_1.z.nativeEnum(bank_provider_enum_1.BankProviderEnum),
10
+ externalEventId: zod_1.z.string(),
11
+ accountNumber: zod_1.z.string(),
12
+ amount: zod_1.z.coerce.number(),
13
+ currency: zod_1.z.string(),
14
+ purpose: zod_1.z.string(),
15
+ status: zod_1.z.nativeEnum(bank_payment_event_status_enum_1.BankPaymentEventStatusEnum),
16
+ docNumber: zod_1.z.string().nullable(),
17
+ clientName: zod_1.z.string().nullable(),
18
+ clientInn: zod_1.z.string().nullable(),
19
+ valueDate: zod_1.z.coerce.date(),
20
+ clientUUID: zod_1.z.string().uuid().nullable(),
21
+ moneyAccountUUID: zod_1.z.string().uuid().nullable(),
22
+ moneyAccountName: zod_1.z.string().nullable(),
23
+ payload: zod_1.z.unknown(),
24
+ appliedTransactionUUID: zod_1.z.string().uuid().nullable(),
25
+ });
@@ -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("./bank-payment.schema"), exports);
@@ -67,3 +67,4 @@ __exportStar(require("./pre-order/pre-order-copy.schema"), exports);
67
67
  __exportStar(require("./pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema"), exports);
68
68
  __exportStar(require("./message"), exports);
69
69
  __exportStar(require("./product-configuration/product-configuration.schema"), exports);
70
+ __exportStar(require("./bank-payment"), exports);
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod';
2
+ import { dateRangeCheck } from '../../helpers/date.helper';
3
+ import { BankPaymentEventStatusEnum } from '../../enum/bank-payment-event-status.enum';
4
+ import { BankPaymentSchema } from '../../schemas/bank-payment/bank-payment.schema';
5
+
6
+ const GetBankPaymentListRequestSchema = z
7
+ .object({
8
+ page: z.coerce.number().optional().default(1),
9
+ count: z.coerce.number().optional().default(20),
10
+ status: z.nativeEnum(BankPaymentEventStatusEnum).optional(),
11
+ searchQuery: z.string().optional(),
12
+ startDate: z.coerce.date().optional(),
13
+ endDate: z.coerce.date().optional(),
14
+ })
15
+ .refine(
16
+ value => {
17
+ const { startDate, endDate } = value;
18
+ if (startDate && endDate) {
19
+ return dateRangeCheck(startDate, endDate);
20
+ }
21
+ return true;
22
+ },
23
+ {
24
+ message: 'End date must be greater than start date',
25
+ path: ['endDate', 'startDate'],
26
+ },
27
+ );
28
+
29
+ const GetBankPaymentListResponseSchema = z.object({
30
+ message: z.string().optional(),
31
+ data: z.object({
32
+ list: BankPaymentSchema.array(),
33
+ total: z.number(),
34
+ }),
35
+ });
36
+
37
+ export namespace GetBankPaymentListContractQuery {
38
+ export const RequestSchema = GetBankPaymentListRequestSchema;
39
+ export type Request = z.infer<typeof RequestSchema>;
40
+
41
+ export const ResponseSchema = GetBankPaymentListResponseSchema;
42
+ export type Response = z.infer<typeof ResponseSchema>;
43
+ }
@@ -0,0 +1 @@
1
+ export * from './get-bank-payment-list.query';
package/commands/index.ts CHANGED
@@ -42,3 +42,4 @@ export * from './product-configuration/get-product-configuration-list.query';
42
42
  export * from './product-configuration/create-product-configuration.command';
43
43
  export * from './product-configuration/update-product-configuration.command';
44
44
  export * from './product-configuration/delete-product-configuration.command';
45
+ export * from './bank-payment';
@@ -1,7 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import { PreOrderSchema } from '../../../schemas';
3
3
 
4
- const CheckoutPreOrderWebshopRequestSchema = z.object({});
4
+ const CheckoutPreOrderWebshopRequestSchema = z.object({
5
+ comment: z.string().nullable().optional(),
6
+ branchUUID: z.string().nullable().optional(),
7
+ });
5
8
 
6
9
  const CheckoutPreOrderWebshopResponseSchema = z.object({
7
10
  message: z.string().optional(),
package/constant/error.ts CHANGED
@@ -392,6 +392,22 @@ export const ERRORS = {
392
392
  TRANSACTION_COUNT_BY_CRITERIA_FAILED: { code: 'TR008', message: 'Failed to count transactions by criteria', httpCode: 500 },
393
393
  TRANSACTION_FETCH_SUM_FAILED: { code: 'TR009', message: 'Failed get sum transaction', httpCode: 500 },
394
394
  TRANSACTION_AMOUNT_NEGATIVE: { code: 'TR010', message: 'Transaction amount is negative', httpCode: 400 },
395
+ // BANK PAYMENT
396
+ BANK_EVENT_NOT_FOUND: { code: 'BP001', message: 'Bank payment event not found', httpCode: 404 },
397
+ BANK_EVENT_LIST_FAILED: { code: 'BP002', message: 'Error when retrieving bank payment events list', httpCode: 500 },
398
+ BANK_EVENT_GET_FAILED: { code: 'BP003', message: 'Error when retrieving bank payment event', httpCode: 500 },
399
+ BANK_EVENT_UPSERT_FAILED: { code: 'BP004', message: 'Failed to upsert bank payment event', httpCode: 500 },
400
+ BANK_EVENT_UNSUPPORTED_STATUS: { code: 'BP005', message: 'Unsupported bank payment event status', httpCode: 400 },
401
+ BANK_EVENT_ALREADY_APPLIED: { code: 'BP006', message: 'Bank payment event already applied', httpCode: 400 },
402
+ BANK_EVENT_UPDATE_STATUS_FAILED: { code: 'BP007', message: 'Failed to update bank payment event status', httpCode: 500 },
403
+ BANK_PAYMENT_APPLY_FAILED: { code: 'BP008', message: 'Failed to apply bank payment event', httpCode: 500 },
404
+ BANK_EVENT_NOT_FOUND_OR_NOT_NEW: {
405
+ code: 'BP009',
406
+ message: 'Bank payment event not found or not in NEW status',
407
+ httpCode: 400,
408
+ },
409
+ MONEY_ACCOUNT_REQUIRED: { code: 'BP010', message: 'moneyAccountUUID is required to apply bank payment event', httpCode: 400 },
410
+ TRANSACTION_CREATE_FAILED: { code: 'BP011', message: 'Failed to create transaction', httpCode: 500 },
395
411
 
396
412
  // EXCEL
397
413
  EXCEL_CREATE_FAILED: { code: 'E001', message: 'Failed to create excel', httpCode: 500 },
@@ -440,6 +456,8 @@ export const ERRORS = {
440
456
  FILE_NOT_DELETED: { code: 'F003', message: 'File not deleted', httpCode: 500 },
441
457
  FILE_SIZE_LIMIT_EXCEEDED: { code: 'F004', message: 'File size limit exceeded', httpCode: 400 },
442
458
  FILE_GET_INFO_FAILED: { code: 'F005', message: 'Failed to get file info', httpCode: 500 },
459
+ FILE_NOT_SUPPORTED: { code: 'F006', message: 'File not supported', httpCode: 400 },
460
+ FILE_S3_FORBIDDEN: { code: 'F007', message: 'File S3 forbidden', httpCode: 403 },
443
461
 
444
462
  //WHATSAPP
445
463
  WHATSAPP_TEXT_NOT_SENT: { code: 'W001', message: 'Failed to send text message', httpCode: 500 },
@@ -0,0 +1,5 @@
1
+ export enum BankPaymentEventStatusEnum {
2
+ NEW = 'NEW',
3
+ IGNORED = 'IGNORED',
4
+ APPLIED = 'APPLIED',
5
+ }
@@ -0,0 +1,6 @@
1
+ export enum BankPaymentRuleMatchTypeEnum {
2
+ CONTAINS = 'CONTAINS',
3
+ STARTS_WITH = 'STARTS_WITH',
4
+ ENDS_WITH = 'ENDS_WITH',
5
+ EQUALS = 'EQUALS',
6
+ }
@@ -0,0 +1,3 @@
1
+ export enum BankProviderEnum {
2
+ MODULBANK = 'MODULBANK',
3
+ }
@@ -1,3 +1,4 @@
1
1
  export enum FileExpirePrefixEnum {
2
2
  D3 = '3d',
3
+ D30 = '30d',
3
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { BankProviderEnum } from '../../enum/bank-provider.enum';
3
+ import { BankPaymentEventStatusEnum } from '../../enum/bank-payment-event-status.enum';
4
+
5
+ export const BankPaymentSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ provider: z.nativeEnum(BankProviderEnum),
8
+ externalEventId: z.string(),
9
+ accountNumber: z.string(),
10
+ amount: z.coerce.number(),
11
+ currency: z.string(),
12
+ purpose: z.string(),
13
+ status: z.nativeEnum(BankPaymentEventStatusEnum),
14
+ docNumber: z.string().nullable(),
15
+ clientName: z.string().nullable(),
16
+ clientInn: z.string().nullable(),
17
+ valueDate: z.coerce.date(),
18
+ clientUUID: z.string().uuid().nullable(),
19
+ moneyAccountUUID: z.string().uuid().nullable(),
20
+ moneyAccountName: z.string().nullable(),
21
+ payload: z.unknown(),
22
+ appliedTransactionUUID: z.string().uuid().nullable(),
23
+ });
@@ -0,0 +1 @@
1
+ export * from './bank-payment.schema';
package/schemas/index.ts CHANGED
@@ -51,3 +51,4 @@ export * from './pre-order/pre-order-copy.schema';
51
51
  export * from './pre-order-collection-item/pre-order-collection-item-multiplicity-option.schema';
52
52
  export * from './message';
53
53
  export * from './product-configuration/product-configuration.schema';
54
+ export * from './bank-payment';