@6thbridge/utils 0.2.1 → 0.2.3-7.1

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.
Files changed (100) hide show
  1. package/lib/actions/amount.action.d.ts +10 -0
  2. package/lib/actions/amount.action.js +40 -0
  3. package/lib/actions/amount.action.js.map +1 -0
  4. package/lib/actions/charge.action.d.ts +32 -2
  5. package/lib/actions/charge.action.js +191 -181
  6. package/lib/actions/charge.action.js.map +1 -1
  7. package/lib/actions/currency.action.d.ts +11 -2
  8. package/lib/actions/currency.action.js +71 -33
  9. package/lib/actions/currency.action.js.map +1 -1
  10. package/lib/actions/database.action.d.ts +20 -0
  11. package/lib/actions/database.action.js +90 -0
  12. package/lib/actions/database.action.js.map +1 -0
  13. package/lib/actions/database.action.spec.js +208 -0
  14. package/lib/actions/database.action.spec.js.map +1 -0
  15. package/lib/actions/file.action.d.ts +24 -0
  16. package/lib/actions/file.action.js +66 -0
  17. package/lib/actions/file.action.js.map +1 -0
  18. package/lib/actions/index.d.ts +9 -0
  19. package/lib/actions/index.js +10 -0
  20. package/lib/actions/index.js.map +1 -1
  21. package/lib/actions/phone-number.action.d.ts +18 -0
  22. package/lib/actions/phone-number.action.js +50 -2
  23. package/lib/actions/phone-number.action.js.map +1 -1
  24. package/lib/actions/queue.action.d.ts +3 -0
  25. package/lib/actions/queue.action.js +20 -0
  26. package/lib/actions/queue.action.js.map +1 -0
  27. package/lib/actions/route.action.d.ts +22 -0
  28. package/lib/actions/route.action.js +52 -0
  29. package/lib/actions/route.action.js.map +1 -0
  30. package/lib/cache/redis.js +1 -1
  31. package/lib/cache/redis.js.map +1 -1
  32. package/lib/database/MongoDBRepository.js.map +1 -1
  33. package/lib/database/MongoDBTypeRepository.d.ts +1 -0
  34. package/lib/database/MongoDBTypeRepository.js.map +1 -1
  35. package/lib/database/query.d.ts +3 -1
  36. package/lib/database/query.js +3 -53
  37. package/lib/database/query.js.map +1 -1
  38. package/lib/helpers/errors.d.ts +14 -1
  39. package/lib/helpers/errors.js +15 -32
  40. package/lib/helpers/errors.js.map +1 -1
  41. package/lib/helpers/index.d.ts +7 -0
  42. package/lib/helpers/index.js +35 -13
  43. package/lib/helpers/index.js.map +1 -1
  44. package/lib/http/axios.d.ts +18 -0
  45. package/lib/http/axios.js +38 -0
  46. package/lib/http/axios.js.map +1 -1
  47. package/lib/index.d.ts +3 -2
  48. package/lib/index.js +10 -2
  49. package/lib/index.js.map +1 -1
  50. package/lib/logger/logger.d.ts +3 -1
  51. package/lib/logger/logger.js +16 -8
  52. package/lib/logger/logger.js.map +1 -1
  53. package/lib/middlewares/common.d.ts +3 -2
  54. package/lib/middlewares/common.js +19 -8
  55. package/lib/middlewares/common.js.map +1 -1
  56. package/lib/middlewares/express.js +2 -2
  57. package/lib/middlewares/express.js.map +1 -1
  58. package/lib/monitoring/index.d.ts +3 -3
  59. package/lib/monitoring/index.js +6 -6
  60. package/lib/monitoring/index.js.map +1 -1
  61. package/lib/monitoring/rollbar.d.ts +15 -0
  62. package/lib/monitoring/rollbar.js +23 -0
  63. package/lib/monitoring/rollbar.js.map +1 -0
  64. package/lib/responses/express.d.ts +3 -0
  65. package/lib/responses/express.js +68 -13
  66. package/lib/responses/express.js.map +1 -1
  67. package/lib/test/actions/amount.action.test.d.ts +1 -0
  68. package/lib/test/actions/amount.action.test.js +81 -0
  69. package/lib/test/actions/amount.action.test.js.map +1 -0
  70. package/lib/test/actions/charge.action.test.js +125 -47
  71. package/lib/test/actions/charge.action.test.js.map +1 -1
  72. package/lib/test/database/test.spec.js +17 -0
  73. package/lib/test/database/test.spec.js.map +1 -1
  74. package/lib/translations/index.js +3 -6
  75. package/lib/translations/index.js.map +1 -1
  76. package/lib/tsconfig.tsbuildinfo +1 -1
  77. package/lib/types/broker.entity.d.ts +10 -0
  78. package/lib/types/custom.exception.d.ts +14 -0
  79. package/lib/types/custom.exception.js +16 -0
  80. package/lib/types/custom.exception.js.map +1 -0
  81. package/lib/types/index.d.ts +20 -83
  82. package/lib/types/index.js +25 -40
  83. package/lib/types/index.js.map +1 -1
  84. package/lib/types/integration.entity.d.ts +97 -0
  85. package/lib/types/integration.entity.js +61 -0
  86. package/lib/types/integration.entity.js.map +1 -0
  87. package/lib/types/wallet.entity.d.ts +34 -0
  88. package/lib/types/wallet.entity.js +24 -0
  89. package/lib/types/wallet.entity.js.map +1 -0
  90. package/package.json +22 -15
  91. package/readme.md +1 -1
  92. package/lib/cache/in-memory.d.ts +0 -0
  93. package/lib/cache/in-memory.js +0 -2
  94. package/lib/cache/in-memory.js.map +0 -1
  95. package/lib/logger/test.js +0 -45
  96. package/lib/logger/test.js.map +0 -1
  97. package/lib/secrets/aws.d.ts +0 -0
  98. package/lib/secrets/aws.js +0 -2
  99. package/lib/secrets/aws.js.map +0 -1
  100. /package/lib/{logger/test.d.ts → actions/database.action.spec.d.ts} +0 -0
@@ -13,3 +13,13 @@ export declare class BrokerRetryEntity {
13
13
  retryInMinutes?: number;
14
14
  retryCount?: number;
15
15
  }
16
+ export type EventBrokerPayloadEntity<T> = {
17
+ webhook?: string;
18
+ clientId: string;
19
+ event: string;
20
+ reference?: string;
21
+ domain?: string;
22
+ data: T;
23
+ deliveryId?: string;
24
+ };
25
+ export type EventBrokerPayloadBackwardCompatibilityEntity = EventBrokerPayloadEntity<any>;
@@ -0,0 +1,14 @@
1
+ declare class CustomExceptionParams {
2
+ message: string;
3
+ errorCode?: string;
4
+ statusCode?: number;
5
+ [x: string]: any;
6
+ }
7
+ export declare class CustomException extends Error {
8
+ message: string;
9
+ statusCode: string | number;
10
+ errorCode: string;
11
+ params: CustomExceptionParams;
12
+ constructor(params: CustomExceptionParams);
13
+ }
14
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomException = void 0;
4
+ class CustomExceptionParams {
5
+ }
6
+ class CustomException extends Error {
7
+ constructor(params) {
8
+ super(params.message);
9
+ this.message = params.message;
10
+ this.errorCode = params.errorCode || 'error';
11
+ this.statusCode = params.statusCode || 500;
12
+ this.params = params;
13
+ }
14
+ }
15
+ exports.CustomException = CustomException;
16
+ //# sourceMappingURL=custom.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.exception.js","sourceRoot":"","sources":["../../src/types/custom.exception.ts"],"names":[],"mappings":";;;AAAA,MAAM,qBAAqB;CAM1B;AAED,MAAa,eAAgB,SAAQ,KAAK;IAMxC,YAAY,MAA6B;QACvC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,OAAO,CAAC;QAC7C,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,GAAG,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAdD,0CAcC"}
@@ -6,7 +6,7 @@ import { LoggerInterface } from '../logger';
6
6
  import { ErrorResponse, OkResponse } from '../responses/express';
7
7
  declare module 'axios' {
8
8
  interface InternalAxiosRequestConfig {
9
- meta: any;
9
+ meta?: any;
10
10
  }
11
11
  }
12
12
  type SaveActivityLogDTO = {
@@ -19,54 +19,24 @@ type SaveActivityLogDTO = {
19
19
  message: string;
20
20
  data: any;
21
21
  };
22
- declare class FunctionResponseDTO<T> {
22
+ declare enum ErrorTypeEnum {
23
+ ProviderError = "ProviderError",
24
+ PlatformError = "PlatformError",
25
+ CustomerError = "CustomerError"
26
+ }
27
+ type FunctionResult<T> = {
23
28
  error?: string;
24
29
  statusCode?: number;
25
30
  data?: T;
31
+ errorCode?: string;
32
+ errorType?: ErrorTypeEnum | string;
33
+ errorKey?: string;
26
34
  [x: string]: any;
27
- }
28
- declare enum TransactionChargeBearer {
29
- merchant = "merchant",
30
- customer = "customer"
31
- }
32
- declare class TransactionCharge {
33
- chargeBearer?: TransactionChargeBearer;
34
- platform?: {
35
- percentage: number;
36
- fixed: number;
37
- };
38
- provider?: {
39
- percentage: number;
40
- fixed: number;
41
- };
42
- tax?: {
43
- percentage: number;
44
- fixed: number;
45
- };
46
- cap?: {
47
- minimum: number;
48
- maximum: number;
49
- };
50
- custom?: {
51
- percentage: number;
52
- fixed: number;
53
- };
54
- VATOnChargeAndFees?: number;
55
- providerPercentageFee?: number;
56
- providerFixedFee?: number;
57
- percentageAmount?: number;
58
- fixedAmount?: number;
59
- minimumCap?: number;
60
- maximumCap?: number;
61
- fixedTax?: number;
62
- percentageTax?: number;
63
- platformFixedAmount?: number;
64
- platformPercentageAmount?: number;
65
- chargeAmount?: number;
66
- chargeType?: string;
67
- [x: string]: any;
68
- }
35
+ };
36
+ type PFunctionResult<T> = Promise<FunctionResult<T>>;
37
+ type FunctionResponseDTO<T> = FunctionResult<T>;
69
38
  interface TransactionFee {
39
+ chargeBearer?: string;
70
40
  charge: number;
71
41
  provider: number;
72
42
  platform: number;
@@ -83,45 +53,12 @@ interface TransactionFee {
83
53
  merchant?: number;
84
54
  customer?: number;
85
55
  ownIntegration?: boolean;
56
+ roundUpFinalValue?: boolean;
86
57
  [x: string]: any;
87
58
  }
88
- declare enum IntegrationChargeType {
89
- flat = "flat",
90
- tier = "tier"
91
- }
92
- interface FlatIntegrationCharge {
93
- percentage?: number;
94
- fixed?: number;
95
- }
96
- interface TierIntegrationCharge {
97
- lowerBound?: number;
98
- upperBound?: number;
99
- percentage?: number;
100
- fixed?: number;
101
- }
102
- declare class IntegrationChargeEntity {
103
- type?: IntegrationChargeType;
104
- value?: FlatIntegrationCharge | TierIntegrationCharge[];
105
- }
106
- declare class IntegrationPartnerChargeEntity extends IntegrationChargeEntity {
107
- clientId?: string;
108
- }
109
- declare class IntegrationChargeBearer {
110
- customer?: number;
111
- merchant?: number;
112
- }
113
- declare class IntegrationCharge {
114
- bearer?: IntegrationChargeBearer;
115
- platform?: IntegrationChargeEntity;
116
- provider?: IntegrationChargeEntity;
117
- partner?: IntegrationPartnerChargeEntity;
118
- tax?: IntegrationChargeEntity;
119
- cap?: {
120
- minimum: number;
121
- maximum: number;
122
- };
123
- custom?: IntegrationChargeEntity;
124
- VATOnChargeAndFees?: IntegrationChargeEntity;
125
- }
126
- export { INTERNAL_REQUEST_SOURCE, ContextEntity, RequestUserEntity, RequestClientEntity, SaveActivityLogDTO, ClientEntity, UserEntity, FunctionResponseDTO, BrokerRetryEntity, BrokerDeadLetterPayloadEntity, LoggerInterface, TransactionCharge, TransactionChargeBearer, TransactionFee, OkResponse, ErrorResponse, IntegrationChargeType, IntegrationCharge, IntegrationChargeBearer, FlatIntegrationCharge, IntegrationChargeEntity, TierIntegrationCharge, };
59
+ export { INTERNAL_REQUEST_SOURCE, ContextEntity, RequestUserEntity, RequestClientEntity, SaveActivityLogDTO, ClientEntity, UserEntity, FunctionResponseDTO, FunctionResult, PFunctionResult, BrokerRetryEntity, BrokerDeadLetterPayloadEntity, LoggerInterface, TransactionFee, OkResponse, ErrorResponse, ErrorTypeEnum, };
60
+ export * from "./integration.entity";
61
+ export * from "./wallet.entity";
62
+ export * from "./broker.entity";
63
+ export * from "./custom.exception";
127
64
  export { CountryCode } from 'libphonenumber-js';
@@ -1,6 +1,20 @@
1
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
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IntegrationChargeEntity = exports.IntegrationChargeBearer = exports.IntegrationCharge = exports.IntegrationChargeType = exports.TransactionChargeBearer = exports.TransactionCharge = exports.BrokerDeadLetterPayloadEntity = exports.BrokerRetryEntity = exports.FunctionResponseDTO = exports.UserEntity = exports.ClientEntity = exports.RequestUserEntity = exports.ContextEntity = exports.INTERNAL_REQUEST_SOURCE = void 0;
17
+ exports.ErrorTypeEnum = exports.BrokerDeadLetterPayloadEntity = exports.BrokerRetryEntity = exports.UserEntity = exports.ClientEntity = exports.RequestUserEntity = exports.ContextEntity = exports.INTERNAL_REQUEST_SOURCE = void 0;
4
18
  const context_entity_1 = require("./context.entity");
5
19
  Object.defineProperty(exports, "ContextEntity", { enumerable: true, get: function () { return context_entity_1.ContextEntity; } });
6
20
  Object.defineProperty(exports, "INTERNAL_REQUEST_SOURCE", { enumerable: true, get: function () { return context_entity_1.INTERNAL_REQUEST_SOURCE; } });
@@ -12,43 +26,14 @@ Object.defineProperty(exports, "ClientEntity", { enumerable: true, get: function
12
26
  const broker_entity_1 = require("./broker.entity");
13
27
  Object.defineProperty(exports, "BrokerDeadLetterPayloadEntity", { enumerable: true, get: function () { return broker_entity_1.BrokerDeadLetterPayloadEntity; } });
14
28
  Object.defineProperty(exports, "BrokerRetryEntity", { enumerable: true, get: function () { return broker_entity_1.BrokerRetryEntity; } });
15
- class FunctionResponseDTO {
16
- }
17
- exports.FunctionResponseDTO = FunctionResponseDTO;
18
- var TransactionChargeBearer;
19
- (function (TransactionChargeBearer) {
20
- TransactionChargeBearer["merchant"] = "merchant";
21
- TransactionChargeBearer["customer"] = "customer";
22
- })(TransactionChargeBearer || (exports.TransactionChargeBearer = TransactionChargeBearer = {}));
23
- class TransactionCharge {
24
- constructor() {
25
- this.VATOnChargeAndFees = 0; //in percentage
26
- this.providerPercentageFee = 0;
27
- this.percentageAmount = 0; //deprecated
28
- this.fixedAmount = 0; //deprecated
29
- this.minimumCap = 0;
30
- this.maximumCap = 0;
31
- this.fixedTax = 0;
32
- this.percentageTax = 0;
33
- this.platformFixedAmount = 0;
34
- this.platformPercentageAmount = 0;
35
- }
36
- }
37
- exports.TransactionCharge = TransactionCharge;
38
- var IntegrationChargeType;
39
- (function (IntegrationChargeType) {
40
- IntegrationChargeType["flat"] = "flat";
41
- IntegrationChargeType["tier"] = "tier";
42
- })(IntegrationChargeType || (exports.IntegrationChargeType = IntegrationChargeType = {}));
43
- class IntegrationChargeEntity {
44
- }
45
- exports.IntegrationChargeEntity = IntegrationChargeEntity;
46
- class IntegrationPartnerChargeEntity extends IntegrationChargeEntity {
47
- }
48
- class IntegrationChargeBearer {
49
- }
50
- exports.IntegrationChargeBearer = IntegrationChargeBearer;
51
- class IntegrationCharge {
52
- }
53
- exports.IntegrationCharge = IntegrationCharge;
29
+ var ErrorTypeEnum;
30
+ (function (ErrorTypeEnum) {
31
+ ErrorTypeEnum["ProviderError"] = "ProviderError";
32
+ ErrorTypeEnum["PlatformError"] = "PlatformError";
33
+ ErrorTypeEnum["CustomerError"] = "CustomerError";
34
+ })(ErrorTypeEnum || (exports.ErrorTypeEnum = ErrorTypeEnum = {}));
35
+ __exportStar(require("./integration.entity"), exports);
36
+ __exportStar(require("./wallet.entity"), exports);
37
+ __exportStar(require("./broker.entity"), exports);
38
+ __exportStar(require("./custom.exception"), exports);
54
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,qDAA0E;AA6HxE,8FA7HO,8BAAa,OA6HP;AADb,wGA5HsB,wCAAuB,OA4HtB;AA3HzB,+CAA8D;AA6H5D,kGA7HO,+BAAiB,OA6HP;AAIjB,2FAjI0B,wBAAU,OAiI1B;AAhIZ,mDAAoE;AA+HlE,6FA/HO,4BAAY,OA+HP;AA9Hd,mDAAmF;AAkIjF,8GAlIO,6CAA6B,OAkIP;AAD7B,kGAjIsC,iCAAiB,OAiItC;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B,OAuEP;AAD7B,kGAtEsC,iCAAiB,OAsEtC;AAjDnB,IAAK,aAIJ;AAJD,WAAK,aAAa;IAChB,gDAA+B,CAAA;IAC/B,gDAA+B,CAAA;IAC/B,gDAA+B,CAAA;AACjC,CAAC,EAJI,aAAa,6BAAb,aAAa,QAIjB;AAsDD,uDAAoC;AACpC,kDAAgC;AAChC,kDAAgC;AAChC,qDAAmC"}
@@ -0,0 +1,97 @@
1
+ export declare enum IntegrationPaymentMode {
2
+ POSTPAID = "postpaid",
3
+ PREPAID = "prepaid"
4
+ }
5
+ export declare enum IntegrationChargeBearerEnum {
6
+ merchant = "merchant",
7
+ customer = "customer"
8
+ }
9
+ export declare enum IntegrationType {
10
+ Notification = "notification",
11
+ File = "file",
12
+ Payment = "payment",
13
+ Authentication = "authentication",
14
+ Disbursement = "disbursement"
15
+ }
16
+ export declare enum IntegrationStatus {
17
+ active = "active",
18
+ suspended = "suspended",
19
+ deleted = "deleted"
20
+ }
21
+ export type IntegrationEntity = {
22
+ clientId: string;
23
+ type: IntegrationType;
24
+ logo?: string;
25
+ channel: string;
26
+ provider: string;
27
+ label: string;
28
+ fields: any[];
29
+ integrationType: string;
30
+ integrationId?: string;
31
+ integrationOwnerClientId?: string;
32
+ channels?: string[];
33
+ currencies?: string[];
34
+ country?: string;
35
+ paymentMode: IntegrationPaymentMode;
36
+ webhook: string;
37
+ isDefault: boolean;
38
+ description?: string;
39
+ providerWebhook: string;
40
+ providerWebhookId: string;
41
+ authorization?: any;
42
+ status: IntegrationStatus;
43
+ [x: string]: any;
44
+ isProviderWebhookEnabled: boolean;
45
+ providerWebhookEnabled: boolean;
46
+ };
47
+ export declare enum IntegrationChargeType {
48
+ fixed = "fixed",
49
+ percentage = "percentage"
50
+ }
51
+ export declare enum IntegrationChargeType {
52
+ flat = "flat",
53
+ tier = "tier"
54
+ }
55
+ export interface FlatIntegrationCharge {
56
+ percentage?: number;
57
+ fixed?: number;
58
+ }
59
+ export interface TierIntegrationCharge {
60
+ lowerBound?: number;
61
+ upperBound?: number;
62
+ percentage?: number;
63
+ fixed?: number;
64
+ }
65
+ export declare class IntegrationChargeEntity {
66
+ type: IntegrationChargeType;
67
+ value: FlatIntegrationCharge | TierIntegrationCharge[];
68
+ }
69
+ export declare class IntegrationChargeBearer {
70
+ customer?: number;
71
+ merchant?: number;
72
+ }
73
+ export declare class IntegrationCharge {
74
+ bearer: IntegrationChargeBearer;
75
+ platform?: {
76
+ percentage: number;
77
+ fixed: number;
78
+ } | IntegrationChargeEntity;
79
+ provider?: {
80
+ percentage: number;
81
+ fixed: number;
82
+ } | IntegrationChargeEntity;
83
+ partner?: IntegrationChargeEntity & {
84
+ clientId?: string;
85
+ };
86
+ tax?: IntegrationChargeEntity;
87
+ cap?: {
88
+ minimum: number;
89
+ maximum: number;
90
+ };
91
+ custom?: {
92
+ percentage: number;
93
+ fixed: number;
94
+ } | IntegrationChargeEntity;
95
+ VATOnChargeAndFees?: IntegrationChargeEntity;
96
+ static getEmptyChargeEntity(override?: Record<string, any>): IntegrationCharge;
97
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntegrationCharge = exports.IntegrationChargeBearer = exports.IntegrationChargeEntity = exports.IntegrationChargeType = exports.IntegrationStatus = exports.IntegrationType = exports.IntegrationChargeBearerEnum = exports.IntegrationPaymentMode = void 0;
4
+ var IntegrationPaymentMode;
5
+ (function (IntegrationPaymentMode) {
6
+ IntegrationPaymentMode["POSTPAID"] = "postpaid";
7
+ IntegrationPaymentMode["PREPAID"] = "prepaid";
8
+ })(IntegrationPaymentMode || (exports.IntegrationPaymentMode = IntegrationPaymentMode = {}));
9
+ var IntegrationChargeBearerEnum;
10
+ (function (IntegrationChargeBearerEnum) {
11
+ IntegrationChargeBearerEnum["merchant"] = "merchant";
12
+ IntegrationChargeBearerEnum["customer"] = "customer";
13
+ })(IntegrationChargeBearerEnum || (exports.IntegrationChargeBearerEnum = IntegrationChargeBearerEnum = {}));
14
+ var IntegrationType;
15
+ (function (IntegrationType) {
16
+ IntegrationType["Notification"] = "notification";
17
+ IntegrationType["File"] = "file";
18
+ IntegrationType["Payment"] = "payment";
19
+ IntegrationType["Authentication"] = "authentication";
20
+ IntegrationType["Disbursement"] = "disbursement";
21
+ })(IntegrationType || (exports.IntegrationType = IntegrationType = {}));
22
+ var IntegrationStatus;
23
+ (function (IntegrationStatus) {
24
+ IntegrationStatus["active"] = "active";
25
+ IntegrationStatus["suspended"] = "suspended";
26
+ IntegrationStatus["deleted"] = "deleted";
27
+ })(IntegrationStatus || (exports.IntegrationStatus = IntegrationStatus = {}));
28
+ var IntegrationChargeType;
29
+ (function (IntegrationChargeType) {
30
+ IntegrationChargeType["fixed"] = "fixed";
31
+ IntegrationChargeType["percentage"] = "percentage";
32
+ })(IntegrationChargeType || (exports.IntegrationChargeType = IntegrationChargeType = {}));
33
+ (function (IntegrationChargeType) {
34
+ IntegrationChargeType["flat"] = "flat";
35
+ IntegrationChargeType["tier"] = "tier";
36
+ })(IntegrationChargeType || (exports.IntegrationChargeType = IntegrationChargeType = {}));
37
+ class IntegrationChargeEntity {
38
+ }
39
+ exports.IntegrationChargeEntity = IntegrationChargeEntity;
40
+ class IntegrationChargeBearer {
41
+ }
42
+ exports.IntegrationChargeBearer = IntegrationChargeBearer;
43
+ class IntegrationCharge {
44
+ static getEmptyChargeEntity(override) {
45
+ return Object.assign({ bearer: { merchant: 100, customer: 0 }, platform: {
46
+ type: IntegrationChargeType.flat,
47
+ value: {
48
+ percentage: 0.5,
49
+ fixed: 0,
50
+ },
51
+ }, provider: {
52
+ type: IntegrationChargeType.flat,
53
+ value: {
54
+ percentage: 0,
55
+ fixed: 0,
56
+ },
57
+ } }, override);
58
+ }
59
+ }
60
+ exports.IntegrationCharge = IntegrationCharge;
61
+ //# sourceMappingURL=integration.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration.entity.js","sourceRoot":"","sources":["../../src/types/integration.entity.ts"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I,EAAE,qBAAqB,CAAC,IAAI;gBAChC,KAAK,EAAE;oBACL,UAAU,EAAE,CAAC;oBACb,KAAK,EAAE,CAAC;iBACT;aACF,IACE,QAAQ,EACX;IACJ,CAAC;CACF;AAhCD,8CAgCC"}
@@ -0,0 +1,34 @@
1
+ export declare enum WalletStatus {
2
+ active = "active",
3
+ suspended = "suspended",
4
+ postNoDebit = "post-no-debit"
5
+ }
6
+ export declare enum WalletOwnerType {
7
+ client = "client",
8
+ user = "user",
9
+ charge = "charge",
10
+ platform = "platform"
11
+ }
12
+ export declare enum WalletType {
13
+ main = "main",
14
+ deposit = "deposit",
15
+ payout = "payout",
16
+ charge = "charge"
17
+ }
18
+ export type WalletEntity = {
19
+ clientId: string;
20
+ ownerType: string;
21
+ ownerId: string;
22
+ owner?: any;
23
+ type: WalletType;
24
+ currency: string;
25
+ country: string;
26
+ balance: number;
27
+ availableBalance: number;
28
+ lastSyncTime: number;
29
+ settlementDelayInDays?: number;
30
+ status: WalletStatus;
31
+ notificationLimit?: number;
32
+ notificationLimitEmailNextSentAt?: number;
33
+ [x: string]: any;
34
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WalletType = exports.WalletOwnerType = exports.WalletStatus = void 0;
4
+ var WalletStatus;
5
+ (function (WalletStatus) {
6
+ WalletStatus["active"] = "active";
7
+ WalletStatus["suspended"] = "suspended";
8
+ WalletStatus["postNoDebit"] = "post-no-debit";
9
+ })(WalletStatus || (exports.WalletStatus = WalletStatus = {}));
10
+ var WalletOwnerType;
11
+ (function (WalletOwnerType) {
12
+ WalletOwnerType["client"] = "client";
13
+ WalletOwnerType["user"] = "user";
14
+ WalletOwnerType["charge"] = "charge";
15
+ WalletOwnerType["platform"] = "platform";
16
+ })(WalletOwnerType || (exports.WalletOwnerType = WalletOwnerType = {}));
17
+ var WalletType;
18
+ (function (WalletType) {
19
+ WalletType["main"] = "main";
20
+ WalletType["deposit"] = "deposit";
21
+ WalletType["payout"] = "payout";
22
+ WalletType["charge"] = "charge";
23
+ })(WalletType || (exports.WalletType = WalletType = {}));
24
+ //# sourceMappingURL=wallet.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.entity.js","sourceRoot":"","sources":["../../src/types/wallet.entity.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,iCAAgB,CAAA;IAChB,uCAAqB,CAAA;IACrB,6CAA6B,CAAA;AAC/B,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AACD,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,gCAAa,CAAA;IACb,oCAAiB,CAAA;IACjB,wCAAqB,CAAA;AACvB,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AACD,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,2BAAa,CAAA;IACb,iCAAmB,CAAA;IACnB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;AACnB,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@6thbridge/utils",
3
- "version": "0.2.1",
3
+ "version": "0.2.37.1",
4
4
  "description": "simple interface for the our commonly used functions",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -9,10 +9,14 @@
9
9
  ],
10
10
  "scripts": {
11
11
  "test": "jest --verbose -c jest.config.js",
12
- "build": "tsc -p tsconfig.json",
12
+ "build": "rm -rf lib && tsc -p tsconfig.json",
13
13
  "prepare": "npm run build",
14
+ "format": "",
14
15
  "version": "npm run format && git add -A src",
15
- "postversion": "git push && git push --tags"
16
+ "postversion": "git push && git push --tags",
17
+ "bump-patch": "npm version patch",
18
+ "bump-minor": "npm version minor",
19
+ "bump-alpha": "npm --no-git-tag-version version prerelease"
16
20
  },
17
21
  "author": {
18
22
  "name": "Micheal Akinwonmi",
@@ -20,25 +24,28 @@
20
24
  },
21
25
  "license": "ISC",
22
26
  "dependencies": {
23
- "@aws-sdk/client-secrets-manager": "^3.504.0",
27
+ "@aws-sdk/client-secrets-manager": "^3.687.0",
24
28
  "amqp-connection-manager": "^4.1.14",
25
- "amqplib": "^0.10.3",
26
- "apitoolkit-express": "^2.2.4",
27
- "axios": "^1.6.7",
29
+ "amqplib": "^0.10.4",
30
+ "apitoolkit-express": "^2.4.6",
31
+ "axios": "^1.8.4",
32
+ "axios-better-stacktrace": "^2.1.7",
28
33
  "bignumber.js": "^9.1.2",
29
- "dayjs": "^1.11.10",
30
- "ioredis": "^5.3.2",
31
- "joi": "^17.12.2",
34
+ "csv-parse": "^5.6.0",
35
+ "dayjs": "^1.11.13",
36
+ "ioredis": "^5.4.1",
37
+ "joi": "^17.13.3",
32
38
  "kafkajs": "^2.2.4",
33
- "libphonenumber-js": "^1.10.57",
39
+ "libphonenumber-js": "^1.12.6",
34
40
  "lodash": "^4.17.21",
35
- "mongoose-paginate-v2": "^1.8.0",
41
+ "mongoose-paginate-v2": "^1.8.5",
36
42
  "node-cache": "^5.1.2",
37
- "path-to-regexp": "^6.2.2",
38
- "randomstring": "^1.3.0"
43
+ "path-to-regexp": "^6.3.0",
44
+ "randomstring": "^1.3.0",
45
+ "rollbar": "^2.26.4"
39
46
  },
40
47
  "devDependencies": {
41
- "@types/express": "^4.17.13",
48
+ "@types/express": "^4.17.21",
42
49
  "@types/jest": "^29.5.12",
43
50
  "@types/lodash": "^4.14.184",
44
51
  "@types/randomstring": "^1.1.8",
package/readme.md CHANGED
@@ -6,7 +6,7 @@ bridge-utils - This is a utility package for reused component
6
6
 
7
7
  ```json
8
8
  "dependencies": {
9
- "@6thbridge/utils": "^0.2.1" // see the "releases" section
9
+ "@6thbridge/utils": "^0.2.34" // see the "releases" section
10
10
  }
11
11
  ```
12
12
 
File without changes
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=in-memory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"in-memory.js","sourceRoot":"","sources":["../../src/cache/in-memory.ts"],"names":[],"mappings":""}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- //ts-node test.ts
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- var __importDefault = (this && this.__importDefault) || function (mod) {
13
- return (mod && mod.__esModule) ? mod : { "default": mod };
14
- };
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- const logger_1 = require("./logger");
17
- const winston_1 = __importDefault(require("winston"));
18
- const helpers_1 = require("../helpers");
19
- function testLogger() {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- const logger = new logger_1.Logger({
22
- requestId: "123",
23
- requestClientId: "client-id",
24
- contextClientId: "context-client-id",
25
- format: winston_1.default.format.json(),
26
- level: "info",
27
- });
28
- logger.info("Another info message", {
29
- info: 1
30
- });
31
- logger.critical("Another critical message", {
32
- critical: 1
33
- });
34
- logger.error("Another error message", {
35
- error: 1
36
- }, "stack trace here");
37
- logger.warn("Another warn message", {
38
- warn: 1
39
- });
40
- logger.out("Logging Debug Message", "and anotheer", "well 123", 456);
41
- yield (0, helpers_1.sleep)(1000000000);
42
- });
43
- }
44
- testLogger();
45
- //# sourceMappingURL=test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/logger/test.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;;;;;;;;;;;;AAGjB,qCAAgC;AAChC,sDAA8B;AAC9B,wCAAiC;AAGjC,SAAe,UAAU;;QACrB,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC;YACtB,SAAS,EAAE,KAAK;YAChB,eAAe,EAAE,WAAW;YAC5B,eAAe,EAAE,mBAAmB;YACpC,MAAM,EAAE,iBAAO,CAAC,MAAM,CAAC,IAAI,EAAE;YAC7B,KAAK,EAAE,MAAM;SAChB,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAG;YACjC,IAAI,EAAE,CAAC;SACV,CAAC,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,0BAA0B,EAAG;YACzC,QAAQ,EAAE,CAAC;SACd,CAAC,CAAC;QACH,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAG;YACnC,KAAK,EAAE,CAAC;SACX,EAAE,kBAAkB,CAAC,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAG;YACjC,IAAI,EAAE,CAAC;SACV,CAAC,CAAC;QACH,MAAM,CAAC,GAAG,CAAC,uBAAuB,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;QACrE,MAAM,IAAA,eAAK,EAAC,UAAU,CAAC,CAAA;IAC3B,CAAC;CAAA;AAED,UAAU,EAAE,CAAC"}
File without changes
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=aws.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aws.js","sourceRoot":"","sources":["../../src/secrets/aws.ts"],"names":[],"mappings":""}