@doctocar/tooling 0.3.1-3 → 0.3.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.
Files changed (154) hide show
  1. package/dist/emails/enums/AWSSESEmailSenders.enum.d.ts +1 -1
  2. package/dist/emails/enums/AWSSESEmailSenders.enum.js +1 -1
  3. package/dist/emails/enums/AWSSESEmailsTemplatesNames.enum.d.ts +2 -3
  4. package/dist/emails/enums/AWSSESEmailsTemplatesNames.enum.js +3 -4
  5. package/dist/emails/maps/EmailTemplateDataMap.map.d.ts +3 -4
  6. package/dist/emails/types/customer/index.d.ts +0 -1
  7. package/dist/emails/types/customer/index.js +0 -1
  8. package/dist/emails/types/entity/EntityVatVerificationFailedEmailData.type.d.ts +4 -0
  9. package/dist/emails/types/entity/EntityVatVerificationSucceededEmailData.type.d.ts +3 -0
  10. package/dist/emails/types/entity/index.d.ts +2 -0
  11. package/dist/{notifications/pushNotifications/types/company → emails/types/entity}/index.js +2 -2
  12. package/dist/emails/types/index.d.ts +1 -1
  13. package/dist/emails/types/index.js +1 -1
  14. package/dist/errors/enums/cloudFunctions/customers/index.d.ts +0 -1
  15. package/dist/errors/enums/cloudFunctions/customers/index.js +0 -1
  16. package/dist/errors/enums/cloudFunctions/entities/CreateNewEntityErrorCodes.enum.d.ts +26 -0
  17. package/dist/errors/enums/cloudFunctions/entities/CreateNewEntityErrorCodes.enum.js +30 -0
  18. package/dist/errors/enums/cloudFunctions/entities/index.d.ts +1 -0
  19. package/dist/{emails/types/company → errors/enums/cloudFunctions/entities}/index.js +1 -2
  20. package/dist/errors/enums/cloudFunctions/index.d.ts +1 -0
  21. package/dist/errors/enums/cloudFunctions/index.js +1 -0
  22. package/dist/firebase/cloudFunctions/enums/OnCallCloudFunctionsNames.enum.d.ts +1 -1
  23. package/dist/firebase/cloudFunctions/enums/OnCallCloudFunctionsNames.enum.js +2 -1
  24. package/dist/firebase/cloudFunctions/maps/OnCallCloudFunctionsTypeMappings.map.d.ts +5 -5
  25. package/dist/firebase/cloudFunctions/types/entities/CreateNewEntityPayload.type.d.ts +16 -0
  26. package/dist/firebase/cloudFunctions/types/entities/CreateNewEntityRequestData.type.d.ts +3 -0
  27. package/dist/firebase/cloudFunctions/types/entities/CreateNewEntityResponseData.type.d.ts +3 -0
  28. package/dist/firebase/cloudFunctions/types/entities/index.d.ts +3 -0
  29. package/dist/firebase/cloudFunctions/types/entities/index.js +19 -0
  30. package/dist/firebase/cloudFunctions/types/index.d.ts +1 -0
  31. package/dist/firebase/cloudFunctions/types/index.js +1 -0
  32. package/dist/firebase/cloudFunctions/types/users/customers/index.d.ts +0 -2
  33. package/dist/firebase/cloudFunctions/types/users/customers/index.js +0 -2
  34. package/dist/firebase/firestore/enums/FirestoreCollections.enum.d.ts +2 -1
  35. package/dist/firebase/firestore/enums/FirestoreCollections.enum.js +1 -0
  36. package/dist/firebase/firestore/enums/entities/EntityRegistrationIdentifierVerificationSource.enum.d.ts +3 -0
  37. package/dist/firebase/firestore/enums/entities/EntityRegistrationIdentifierVerificationSource.enum.js +7 -0
  38. package/dist/firebase/firestore/enums/entities/EntityRegistrationIdentifierVerificationStatus.enum.d.ts +6 -0
  39. package/dist/firebase/firestore/enums/entities/EntityRegistrationIdentifierVerificationStatus.enum.js +10 -0
  40. package/dist/firebase/firestore/enums/entities/index.d.ts +2 -0
  41. package/dist/firebase/firestore/enums/entities/index.js +2 -0
  42. package/dist/firebase/firestore/enums/index.d.ts +1 -0
  43. package/dist/firebase/firestore/enums/index.js +1 -0
  44. package/dist/firebase/firestore/enums/notificationEvent/NotificationEventDeliveryStateStatus.enum.d.ts +5 -0
  45. package/dist/firebase/firestore/enums/notificationEvent/NotificationEventDeliveryStateStatus.enum.js +9 -0
  46. package/dist/firebase/firestore/enums/notificationEvent/index.d.ts +1 -0
  47. package/dist/firebase/firestore/enums/notificationEvent/index.js +17 -0
  48. package/dist/firebase/firestore/maps/FirestoreCollectionDocumentTypeMap.d.ts +2 -1
  49. package/dist/firebase/firestore/types/company/FrenchCompanyRegistration.type.d.ts +1 -1
  50. package/dist/firebase/firestore/types/entities/EntityLegalDetails.type.d.ts +8 -1
  51. package/dist/firebase/firestore/types/entities/EntityLegalRepresentative.type.d.ts +2 -2
  52. package/dist/firebase/firestore/types/entities/index.d.ts +1 -1
  53. package/dist/firebase/firestore/types/entities/index.js +1 -1
  54. package/dist/firebase/firestore/types/entityUniqueKeys/FirestoreEntityUniqueKeyDocument.type.d.ts +6 -0
  55. package/dist/firebase/firestore/types/entityUniqueKeys/index.d.ts +1 -0
  56. package/dist/firebase/firestore/types/entityUniqueKeys/index.js +17 -0
  57. package/dist/firebase/firestore/types/index.d.ts +1 -0
  58. package/dist/firebase/firestore/types/index.js +1 -0
  59. package/dist/firebase/firestore/types/notificationEvent/FirestoreNotificationEventDeliveryStateDocument.type.d.ts +2 -1
  60. package/dist/firebase/firestore/types/paymentProviders/stripes/StripeConnectAccountSummary.type.d.ts +1 -0
  61. package/dist/firebase/firestore/types/userDocument/FirestoreUserDocumentCustomerInfos.type.d.ts +0 -7
  62. package/dist/firebase/firestore/utils/stubs/company/frenchCompanyRegistrationStub.js +2 -2
  63. package/dist/firebase/firestore/utils/stubs/configs/firestoreNotificationEventsPublicConfigDocumentStub.js +25 -32
  64. package/dist/firebase/firestore/utils/stubs/entityUniqueKeys/firestoreEntityUniqueKeyDocumentStub.d.ts +2 -0
  65. package/dist/firebase/firestore/utils/stubs/entityUniqueKeys/firestoreEntityUniqueKeyDocumentStub.js +12 -0
  66. package/dist/firebase/firestore/utils/stubs/entityUniqueKeys/index.d.ts +1 -0
  67. package/dist/firebase/firestore/utils/stubs/entityUniqueKeys/index.js +17 -0
  68. package/dist/firebase/firestore/utils/stubs/index.d.ts +1 -0
  69. package/dist/firebase/firestore/utils/stubs/index.js +1 -0
  70. package/dist/firebase/firestore/utils/stubs/notificationEvent/firestoreNotificationEventDeliveryStateDocumentStub.js +2 -1
  71. package/dist/firebase/storage/utils/__tests__/buildStoragePeriodSlug.test.js +7 -0
  72. package/dist/gcp/pubsub/enums/PubSubTopics.enum.d.ts +2 -1
  73. package/dist/gcp/pubsub/enums/PubSubTopics.enum.js +1 -0
  74. package/dist/gcp/pubsub/maps/PubSubTopicMessageMap.map.d.ts +2 -1
  75. package/dist/gcp/pubsub/types/PubSubNotificationEventMessage.type.d.ts +1 -1
  76. package/dist/gcp/pubsub/types/entities/PubSubEntityVatNumberVerificationRequestedMessage.type.d.ts +3 -0
  77. package/dist/gcp/pubsub/types/entities/index.d.ts +1 -0
  78. package/dist/gcp/pubsub/types/entities/index.js +17 -0
  79. package/dist/gcp/pubsub/types/index.d.ts +1 -0
  80. package/dist/gcp/pubsub/types/index.js +1 -0
  81. package/dist/gcp/pubsub/utils/stubs/entities/index.d.ts +1 -0
  82. package/dist/gcp/pubsub/utils/stubs/entities/index.js +17 -0
  83. package/dist/gcp/pubsub/utils/stubs/entities/pubSubEntityVatNumberVerificationRequestedMessageStub.d.ts +2 -0
  84. package/dist/gcp/pubsub/utils/stubs/entities/pubSubEntityVatNumberVerificationRequestedMessageStub.js +9 -0
  85. package/dist/gcp/pubsub/utils/stubs/index.d.ts +1 -0
  86. package/dist/gcp/pubsub/utils/stubs/index.js +1 -0
  87. package/dist/notifications/enums/CustomerNotificationEventType.d.ts +1 -2
  88. package/dist/notifications/enums/CustomerNotificationEventType.js +0 -1
  89. package/dist/notifications/enums/EntityNotificationEventType.d.ts +4 -0
  90. package/dist/notifications/enums/EntityNotificationEventType.js +8 -0
  91. package/dist/notifications/enums/index.d.ts +1 -1
  92. package/dist/notifications/enums/index.js +1 -1
  93. package/dist/notifications/pushNotifications/enums/EntityPushNotificationType.d.ts +4 -0
  94. package/dist/notifications/pushNotifications/enums/EntityPushNotificationType.js +8 -0
  95. package/dist/notifications/pushNotifications/enums/index.d.ts +1 -1
  96. package/dist/notifications/pushNotifications/enums/index.js +1 -1
  97. package/dist/notifications/pushNotifications/maps/EntityPushNotificationDataMap.d.ts +9 -0
  98. package/dist/notifications/pushNotifications/maps/EntityPushNotificationDataMap.js +6 -0
  99. package/dist/notifications/pushNotifications/maps/index.d.ts +1 -0
  100. package/dist/notifications/pushNotifications/maps/index.js +1 -0
  101. package/dist/notifications/pushNotifications/types/PushNotificationDataMap.type.d.ts +2 -3
  102. package/dist/notifications/pushNotifications/types/entity/EntityVatVerificationFailedPushNotificationData.type.d.ts +4 -0
  103. package/dist/notifications/pushNotifications/types/entity/EntityVatVerificationSucceededPushNotificationData.type.d.ts +4 -0
  104. package/dist/notifications/pushNotifications/types/entity/index.d.ts +2 -0
  105. package/dist/notifications/pushNotifications/types/entity/index.js +18 -0
  106. package/dist/notifications/pushNotifications/types/index.d.ts +1 -1
  107. package/dist/notifications/pushNotifications/types/index.js +1 -1
  108. package/dist/notifications/types/NotificationEvent.type.d.ts +2 -2
  109. package/dist/utils/regex/__tests__/isValidCompanyLegalName.util.test.js +5 -0
  110. package/dist/utils/vat/__tests__/extractVatNumberAndCountryCode.test.js +39 -0
  111. package/dist/utils/vat/__tests__/{validateVATFormat.util.test.js → validateVatNumberFormat.test.js} +3 -3
  112. package/dist/utils/vat/extractVatNumberAndCountryCode.d.ts +4 -0
  113. package/dist/utils/vat/{extractVATNumber.util.js → extractVatNumberAndCountryCode.js} +2 -2
  114. package/dist/utils/vat/index.d.ts +2 -2
  115. package/dist/utils/vat/index.js +2 -2
  116. package/dist/utils/vat/types/{ValidateVATFormatArgs.type.d.ts → ValidateVatNumberFormatArgs.type.d.ts} +1 -1
  117. package/dist/utils/vat/types/ValidateVatNumberFormatArgs.type.js +2 -0
  118. package/dist/utils/vat/types/index.d.ts +1 -1
  119. package/dist/utils/vat/types/index.js +1 -1
  120. package/dist/utils/vat/validateVatNumberFormat.d.ts +2 -0
  121. package/dist/utils/vat/{validateVATFormat.util.js → validateVatNumberFormat.js} +2 -2
  122. package/package.json +1 -1
  123. package/dist/emails/types/company/CompanyVatRejectedEmailData.type.d.ts +0 -5
  124. package/dist/emails/types/company/CompanyVatVerifiedEmailData.type.d.ts +0 -3
  125. package/dist/emails/types/company/index.d.ts +0 -2
  126. package/dist/emails/types/customer/CustomerWelcomeEmailData.type.d.ts +0 -1
  127. package/dist/errors/enums/cloudFunctions/customers/ProcessCustomerUserOnboardingErrorCodes.enum.d.ts +0 -22
  128. package/dist/errors/enums/cloudFunctions/customers/ProcessCustomerUserOnboardingErrorCodes.enum.js +0 -26
  129. package/dist/firebase/cloudFunctions/types/users/customers/ProcessCustomerUserOnboardingRequestData.type.d.ts +0 -15
  130. package/dist/firebase/cloudFunctions/types/users/customers/ProcessCustomerUserOnboardingResponseData.type.d.ts +0 -1
  131. package/dist/notifications/enums/CompanyNotificationEventType.d.ts +0 -4
  132. package/dist/notifications/enums/CompanyNotificationEventType.js +0 -8
  133. package/dist/notifications/pushNotifications/enums/CompanyPushNotificationType.d.ts +0 -4
  134. package/dist/notifications/pushNotifications/enums/CompanyPushNotificationType.js +0 -8
  135. package/dist/notifications/pushNotifications/maps/CompanyPushNotificationDataMap.d.ts +0 -6
  136. package/dist/notifications/pushNotifications/types/company/CompanyVatVerificationFailedPushNotificationData.type.d.ts +0 -4
  137. package/dist/notifications/pushNotifications/types/company/CompanyVatVerificationSucceededPushNotificationData.type.d.ts +0 -4
  138. package/dist/notifications/pushNotifications/types/company/index.d.ts +0 -2
  139. package/dist/utils/vat/__tests__/extractVATNumber.util.test.js +0 -39
  140. package/dist/utils/vat/extractVATNumber.util.d.ts +0 -4
  141. package/dist/utils/vat/validateVATFormat.util.d.ts +0 -2
  142. /package/dist/emails/types/{company/CompanyVatRejectedEmailData.type.js → entity/EntityVatVerificationFailedEmailData.type.js} +0 -0
  143. /package/dist/emails/types/{company/CompanyVatVerifiedEmailData.type.js → entity/EntityVatVerificationSucceededEmailData.type.js} +0 -0
  144. /package/dist/{emails/types/customer/CustomerWelcomeEmailData.type.js → firebase/cloudFunctions/types/entities/CreateNewEntityPayload.type.js} +0 -0
  145. /package/dist/firebase/cloudFunctions/types/{users/customers/ProcessCustomerUserOnboardingRequestData.type.js → entities/CreateNewEntityRequestData.type.js} +0 -0
  146. /package/dist/firebase/cloudFunctions/types/{users/customers/ProcessCustomerUserOnboardingResponseData.type.js → entities/CreateNewEntityResponseData.type.js} +0 -0
  147. /package/dist/firebase/firestore/types/entities/{EntityRegistration.enum.d.ts → EntityRegistration.type.d.ts} +0 -0
  148. /package/dist/firebase/firestore/types/entities/{EntityRegistration.enum.js → EntityRegistration.type.js} +0 -0
  149. /package/dist/{notifications/pushNotifications/maps/CompanyPushNotificationDataMap.js → firebase/firestore/types/entityUniqueKeys/FirestoreEntityUniqueKeyDocument.type.js} +0 -0
  150. /package/dist/{notifications/pushNotifications/types/company/CompanyVatVerificationFailedPushNotificationData.type.js → gcp/pubsub/types/entities/PubSubEntityVatNumberVerificationRequestedMessage.type.js} +0 -0
  151. /package/dist/notifications/pushNotifications/types/{company/CompanyVatVerificationSucceededPushNotificationData.type.js → entity/EntityVatVerificationFailedPushNotificationData.type.js} +0 -0
  152. /package/dist/{utils/vat/types/ValidateVATFormatArgs.type.js → notifications/pushNotifications/types/entity/EntityVatVerificationSucceededPushNotificationData.type.js} +0 -0
  153. /package/dist/utils/vat/__tests__/{extractVATNumber.util.test.d.ts → extractVatNumberAndCountryCode.test.d.ts} +0 -0
  154. /package/dist/utils/vat/__tests__/{validateVATFormat.util.test.d.ts → validateVatNumberFormat.test.d.ts} +0 -0
@@ -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("./EntityVatVerificationFailedPushNotificationData.type"), exports);
18
+ __exportStar(require("./EntityVatVerificationSucceededPushNotificationData.type"), exports);
@@ -1,4 +1,4 @@
1
1
  export * from "./customer";
2
2
  export * from "./professional";
3
+ export * from "./entity";
3
4
  export * from "./PushNotificationDataMap.type";
4
- export * from "./company";
@@ -16,5 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./customer"), exports);
18
18
  __exportStar(require("./professional"), exports);
19
+ __exportStar(require("./entity"), exports);
19
20
  __exportStar(require("./PushNotificationDataMap.type"), exports);
20
- __exportStar(require("./company"), exports);
@@ -1,2 +1,2 @@
1
- import { type CompanyNotificationEventType, type CustomerNotificationEventType, type ProfessionalNotificationEventType } from "../enums";
2
- export type NotificationEvent = CustomerNotificationEventType | ProfessionalNotificationEventType | CompanyNotificationEventType;
1
+ import { type CustomerNotificationEventType, type EntityNotificationEventType, type ProfessionalNotificationEventType } from "../enums";
2
+ export type NotificationEvent = CustomerNotificationEventType | ProfessionalNotificationEventType | EntityNotificationEventType;
@@ -97,6 +97,11 @@ const cases = [
97
97
  input: "123456",
98
98
  expected: true,
99
99
  },
100
+ {
101
+ name: "John Doe",
102
+ input: "John Doe",
103
+ expected: true,
104
+ },
100
105
  {
101
106
  name: "contains newline character",
102
107
  input: "Company\nName",
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const extractVatNumberAndCountryCode_1 = require("../extractVatNumberAndCountryCode");
4
+ describe("extractVatNumberAndCountryCode", () => {
5
+ test("should extract country code and VAT number correctly", () => {
6
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)("FR123456789")).toEqual({
7
+ countryISOCode: "FR",
8
+ vatNumber: "123456789",
9
+ });
10
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)("DE987654321")).toEqual({
11
+ countryISOCode: "DE",
12
+ vatNumber: "987654321",
13
+ });
14
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)("IT12345678901")).toEqual({
15
+ countryISOCode: "IT",
16
+ vatNumber: "12345678901",
17
+ });
18
+ });
19
+ test("should return null for invalid VAT number formats", () => {
20
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)("123456789")).toBeNull();
21
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)("FR")).toBeNull();
22
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)("fr123456789")).toBeNull();
23
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)("F123456789")).toBeNull();
24
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)("FR-123456789")).toBeNull();
25
+ });
26
+ test("should handle edge cases", () => {
27
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)("GBGD123")).toEqual({
28
+ countryISOCode: "GB",
29
+ vatNumber: "GD123",
30
+ });
31
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)("ESX1234567")).toEqual({
32
+ countryISOCode: "ES",
33
+ vatNumber: "X1234567",
34
+ });
35
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)("")).toBeNull();
36
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)(" ")).toBeNull();
37
+ expect((0, extractVatNumberAndCountryCode_1.extractVatNumberAndCountryCode)("FR 123456789")).toBeNull();
38
+ });
39
+ });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  /* eslint-disable @typescript-eslint/no-explicit-any */
4
- const validateVATFormat_util_1 = require("../validateVATFormat.util");
4
+ const validateVatNumberFormat_1 = require("../validateVatNumberFormat");
5
5
  const france = [
6
6
  {
7
7
  name: "🇫🇷 FR valid simple digits",
@@ -319,9 +319,9 @@ const allCases = [
319
319
  ...portugal,
320
320
  ...belgium,
321
321
  ];
322
- describe("validateVATFormat", () => {
322
+ describe("validateVatNumberFormat", () => {
323
323
  test.each(allCases)("should match the result for $name", ({ countryCode, vatNumber, result }) => {
324
- expect((0, validateVATFormat_util_1.validateVATFormat)({
324
+ expect((0, validateVatNumberFormat_1.validateVatNumberFormat)({
325
325
  vatNumber,
326
326
  countryCode,
327
327
  })).toBe(result);
@@ -0,0 +1,4 @@
1
+ export declare function extractVatNumberAndCountryCode(vatNumber: string): {
2
+ countryISOCode: string;
3
+ vatNumber: string;
4
+ } | null;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractVATNumber = extractVATNumber;
4
- function extractVATNumber(vatNumber) {
3
+ exports.extractVatNumberAndCountryCode = extractVatNumberAndCountryCode;
4
+ function extractVatNumberAndCountryCode(vatNumber) {
5
5
  const match = vatNumber.match(/^([A-Z]{2})([A-Z0-9]+)$/);
6
6
  if (!match) {
7
7
  return null;
@@ -1,2 +1,2 @@
1
- export * from "./validateVATFormat.util";
2
- export * from "./extractVATNumber.util";
1
+ export * from "./validateVatNumberFormat";
2
+ export * from "./extractVatNumberAndCountryCode";
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./validateVATFormat.util"), exports);
18
- __exportStar(require("./extractVATNumber.util"), exports);
17
+ __exportStar(require("./validateVatNumberFormat"), exports);
18
+ __exportStar(require("./extractVatNumberAndCountryCode"), exports);
@@ -1,4 +1,4 @@
1
- export type ValidateVATFormatArgs = {
1
+ export type ValidateVatNumberFormatArgs = {
2
2
  countryCode: string;
3
3
  vatNumber: string;
4
4
  };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1 @@
1
- export * from "./ValidateVATFormatArgs.type";
1
+ export * from "./ValidateVatNumberFormatArgs.type";
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ValidateVATFormatArgs.type"), exports);
17
+ __exportStar(require("./ValidateVatNumberFormatArgs.type"), exports);
@@ -0,0 +1,2 @@
1
+ import type { ValidateVatNumberFormatArgs } from "./types";
2
+ export declare function validateVatNumberFormat({ countryCode, vatNumber, }: ValidateVatNumberFormatArgs): boolean;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateVATFormat = validateVATFormat;
4
- function validateVATFormat({ countryCode, vatNumber, }) {
3
+ exports.validateVatNumberFormat = validateVatNumberFormat;
4
+ function validateVatNumberFormat({ countryCode, vatNumber, }) {
5
5
  const cleaned = vatNumber.replace(/\s+/g, "").toUpperCase();
6
6
  switch (countryCode.toUpperCase()) {
7
7
  case "FR":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doctocar/tooling",
3
- "version": "0.3.1-3",
3
+ "version": "0.3.1-5",
4
4
  "description": "A set of tools for DoctoCar projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,5 +0,0 @@
1
- export type CompanyVatRejectedEmailData = {
2
- vatNumber: string;
3
- supportUrl: string;
4
- rejectionReason?: string;
5
- };
@@ -1,3 +0,0 @@
1
- export type CompanyVatVerifiedEmailData = {
2
- vatNumber: string;
3
- };
@@ -1,2 +0,0 @@
1
- export * from "./CompanyVatRejectedEmailData.type";
2
- export * from "./CompanyVatVerifiedEmailData.type";
@@ -1 +0,0 @@
1
- export type CustomerOnboardingCompletedEmailData = Record<string, never>;
@@ -1,22 +0,0 @@
1
- export declare enum ProcessCustomerUserOnboardingErrorCodes {
2
- REQUEST_DATA_VALIDATION_FAILED = "REQUEST_DATA_VALIDATION_FAILED",
3
- CONTEXT_VALIDATION_FAILED = "CONTEXT_VALIDATION_FAILED",
4
- USER_DOCUMENT_MISSING_CONTACT_INFO = "processCustomerUserOnboardingErrorCodes/userDocumentMissingContactInfo",
5
- INVALID_ENTITY_LEGAL_TYPE = "processCustomerUserOnboardingErrorCodes/invalidEntityLegalType",
6
- USER_ALREADY_HAVE_AN_ENTITY = "processCustomerUserOnboardingErrorCodes/userAlreadyHaveAnEntity",
7
- ONBOARDING_ALREADY_COMPLETED = "processCustomerUserOnboardingErrorCodes/onboardingAlreadyCompleted",
8
- USER_DOCUMENT_MISSING_PHONE_NUMBER = "processCustomerUserOnboardingErrorCodes/userDocumentMissingPhoneNumber",
9
- MISSING_COMPANY_DETAILS = "processCustomerUserOnboardingErrorCodes/missingCompanyDetails",
10
- INVALID_LEGAL_REPRESENTATIVE_FIRST_NAME = "processCustomerUserOnboardingErrorCodes/invalidLegalRepresentativeFirstName",
11
- INVALID_LEGAL_REPRESENTATIVE_LAST_NAME = "processCustomerUserOnboardingErrorCodes/invalidLegalRepresentativeLastName",
12
- INVALID_BILLING_ADDRESS_PLACE_ID = "processCustomerUserOnboardingErrorCodes/invalidBillingAddressPlaceId",
13
- INVALID_COMPANY_LEGAL_NAME = "processCustomerUserOnboardingErrorCodes/invalidCompanyLegalName",
14
- VAT_NUMBER_IS_REQUIRED = "processCustomerUserOnboardingErrorCodes/vatNumberIsRequired",
15
- INVALID_COMPANY_LEGAL_ADDRESS_PLACE_ID = "processCustomerUserOnboardingErrorCodes/invalidCompanyLegalAddressPlaceId",
16
- INVALID_VAT_NUMBER = "processCustomerUserOnboardingErrorCodes/invalidVatNumber",
17
- USER_EMAIL_NOT_SET = "processCustomerUserOnboardingErrorCodes/userEmailNotSet",
18
- USER_EMAIL_NOT_VERIFIED = "processCustomerUserOnboardingErrorCodes/userEmailNotVerified",
19
- USER_IS_ANONYMOUS = "processCustomerUserOnboardingErrorCodes/userIsAnonymous",
20
- STRIPE_CUSTOMER_CREATION_FAILED = "processCustomerUserOnboardingErrorCodes/stripeCustomerCreationFailed",
21
- USER_DOCUMENT_NOT_FOUND = "processCustomerUserOnboardingErrorCodes/userDocumentNotFound"
22
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProcessCustomerUserOnboardingErrorCodes = void 0;
4
- var ProcessCustomerUserOnboardingErrorCodes;
5
- (function (ProcessCustomerUserOnboardingErrorCodes) {
6
- ProcessCustomerUserOnboardingErrorCodes["REQUEST_DATA_VALIDATION_FAILED"] = "REQUEST_DATA_VALIDATION_FAILED";
7
- ProcessCustomerUserOnboardingErrorCodes["CONTEXT_VALIDATION_FAILED"] = "CONTEXT_VALIDATION_FAILED";
8
- ProcessCustomerUserOnboardingErrorCodes["USER_DOCUMENT_MISSING_CONTACT_INFO"] = "processCustomerUserOnboardingErrorCodes/userDocumentMissingContactInfo";
9
- ProcessCustomerUserOnboardingErrorCodes["INVALID_ENTITY_LEGAL_TYPE"] = "processCustomerUserOnboardingErrorCodes/invalidEntityLegalType";
10
- ProcessCustomerUserOnboardingErrorCodes["USER_ALREADY_HAVE_AN_ENTITY"] = "processCustomerUserOnboardingErrorCodes/userAlreadyHaveAnEntity";
11
- ProcessCustomerUserOnboardingErrorCodes["ONBOARDING_ALREADY_COMPLETED"] = "processCustomerUserOnboardingErrorCodes/onboardingAlreadyCompleted";
12
- ProcessCustomerUserOnboardingErrorCodes["USER_DOCUMENT_MISSING_PHONE_NUMBER"] = "processCustomerUserOnboardingErrorCodes/userDocumentMissingPhoneNumber";
13
- ProcessCustomerUserOnboardingErrorCodes["MISSING_COMPANY_DETAILS"] = "processCustomerUserOnboardingErrorCodes/missingCompanyDetails";
14
- ProcessCustomerUserOnboardingErrorCodes["INVALID_LEGAL_REPRESENTATIVE_FIRST_NAME"] = "processCustomerUserOnboardingErrorCodes/invalidLegalRepresentativeFirstName";
15
- ProcessCustomerUserOnboardingErrorCodes["INVALID_LEGAL_REPRESENTATIVE_LAST_NAME"] = "processCustomerUserOnboardingErrorCodes/invalidLegalRepresentativeLastName";
16
- ProcessCustomerUserOnboardingErrorCodes["INVALID_BILLING_ADDRESS_PLACE_ID"] = "processCustomerUserOnboardingErrorCodes/invalidBillingAddressPlaceId";
17
- ProcessCustomerUserOnboardingErrorCodes["INVALID_COMPANY_LEGAL_NAME"] = "processCustomerUserOnboardingErrorCodes/invalidCompanyLegalName";
18
- ProcessCustomerUserOnboardingErrorCodes["VAT_NUMBER_IS_REQUIRED"] = "processCustomerUserOnboardingErrorCodes/vatNumberIsRequired";
19
- ProcessCustomerUserOnboardingErrorCodes["INVALID_COMPANY_LEGAL_ADDRESS_PLACE_ID"] = "processCustomerUserOnboardingErrorCodes/invalidCompanyLegalAddressPlaceId";
20
- ProcessCustomerUserOnboardingErrorCodes["INVALID_VAT_NUMBER"] = "processCustomerUserOnboardingErrorCodes/invalidVatNumber";
21
- ProcessCustomerUserOnboardingErrorCodes["USER_EMAIL_NOT_SET"] = "processCustomerUserOnboardingErrorCodes/userEmailNotSet";
22
- ProcessCustomerUserOnboardingErrorCodes["USER_EMAIL_NOT_VERIFIED"] = "processCustomerUserOnboardingErrorCodes/userEmailNotVerified";
23
- ProcessCustomerUserOnboardingErrorCodes["USER_IS_ANONYMOUS"] = "processCustomerUserOnboardingErrorCodes/userIsAnonymous";
24
- ProcessCustomerUserOnboardingErrorCodes["STRIPE_CUSTOMER_CREATION_FAILED"] = "processCustomerUserOnboardingErrorCodes/stripeCustomerCreationFailed";
25
- ProcessCustomerUserOnboardingErrorCodes["USER_DOCUMENT_NOT_FOUND"] = "processCustomerUserOnboardingErrorCodes/userDocumentNotFound";
26
- })(ProcessCustomerUserOnboardingErrorCodes || (exports.ProcessCustomerUserOnboardingErrorCodes = ProcessCustomerUserOnboardingErrorCodes = {}));
@@ -1,15 +0,0 @@
1
- import type { EntityLegalType } from "../../../../firestore";
2
- import { BaseOnCallRequestData } from "../../BaseOncallRequestData";
3
- export type ProcessCustomerUserOnboardingRequestData = BaseOnCallRequestData & ({
4
- entityLegalType: EntityLegalType.INDIVIDUAL;
5
- } | {
6
- entityLegalType: EntityLegalType.COMPANY;
7
- companyLegalName: string;
8
- companyLegalAddressPlaceId: string;
9
- legalRepresentativeFirstName: string;
10
- legalRepresentativeLastName: string;
11
- companyIsVATExempt: boolean;
12
- companyVATNumber?: string;
13
- billingAddressIsSameAsLegalAddress?: boolean;
14
- billingAddressPlaceId?: string;
15
- });
@@ -1 +0,0 @@
1
- export type ProcessCustomerUserOnboardingResponseData = void;
@@ -1,4 +0,0 @@
1
- export declare enum CompanyNotificationEventType {
2
- COMPANY_VAT_VERIFICATION_FAILED = "company/vatVerificationFailed",
3
- COMPANY_VAT_VERIFICATION_SUCCEEDED = "company/vatVerificationSucceeded"
4
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CompanyNotificationEventType = void 0;
4
- var CompanyNotificationEventType;
5
- (function (CompanyNotificationEventType) {
6
- CompanyNotificationEventType["COMPANY_VAT_VERIFICATION_FAILED"] = "company/vatVerificationFailed";
7
- CompanyNotificationEventType["COMPANY_VAT_VERIFICATION_SUCCEEDED"] = "company/vatVerificationSucceeded";
8
- })(CompanyNotificationEventType || (exports.CompanyNotificationEventType = CompanyNotificationEventType = {}));
@@ -1,4 +0,0 @@
1
- export declare enum CompanyPushNotificationType {
2
- COMPANY_VAT_VERIFICATION_FAILED = "COMPANY_VAT_VERIFICATION_FAILED",
3
- COMPANY_VAT_VERIFICATION_SUCCEEDED = "COMPANY_VAT_VERIFICATION_SUCCEEDED"
4
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CompanyPushNotificationType = void 0;
4
- var CompanyPushNotificationType;
5
- (function (CompanyPushNotificationType) {
6
- CompanyPushNotificationType["COMPANY_VAT_VERIFICATION_FAILED"] = "COMPANY_VAT_VERIFICATION_FAILED";
7
- CompanyPushNotificationType["COMPANY_VAT_VERIFICATION_SUCCEEDED"] = "COMPANY_VAT_VERIFICATION_SUCCEEDED";
8
- })(CompanyPushNotificationType || (exports.CompanyPushNotificationType = CompanyPushNotificationType = {}));
@@ -1,6 +0,0 @@
1
- import type { CompanyPushNotificationType } from "../enums";
2
- import type { CompanyVatVerificationFailedPushNotificationData, CompanyVatVerificationSucceededPushNotificationData } from "../types";
3
- export type CompanyPushNotificationDataMap = {
4
- [CompanyPushNotificationType.COMPANY_VAT_VERIFICATION_FAILED]: CompanyVatVerificationFailedPushNotificationData;
5
- [CompanyPushNotificationType.COMPANY_VAT_VERIFICATION_SUCCEEDED]: CompanyVatVerificationSucceededPushNotificationData;
6
- };
@@ -1,4 +0,0 @@
1
- import type { CompanyPushNotificationType } from "../../enums";
2
- export type CompanyVatVerificationFailedPushNotificationData = {
3
- type: CompanyPushNotificationType.COMPANY_VAT_VERIFICATION_FAILED;
4
- };
@@ -1,4 +0,0 @@
1
- import type { CompanyPushNotificationType } from "../../enums";
2
- export type CompanyVatVerificationSucceededPushNotificationData = {
3
- type: CompanyPushNotificationType.COMPANY_VAT_VERIFICATION_SUCCEEDED;
4
- };
@@ -1,2 +0,0 @@
1
- export * from "./CompanyVatVerificationFailedPushNotificationData.type";
2
- export * from "./CompanyVatVerificationSucceededPushNotificationData.type";
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const extractVATNumber_util_1 = require("../extractVATNumber.util");
4
- describe("extractVATNumber", () => {
5
- test("should extract country code and VAT number correctly", () => {
6
- expect((0, extractVATNumber_util_1.extractVATNumber)("FR123456789")).toEqual({
7
- countryISOCode: "FR",
8
- vatNumber: "123456789",
9
- });
10
- expect((0, extractVATNumber_util_1.extractVATNumber)("DE987654321")).toEqual({
11
- countryISOCode: "DE",
12
- vatNumber: "987654321",
13
- });
14
- expect((0, extractVATNumber_util_1.extractVATNumber)("IT12345678901")).toEqual({
15
- countryISOCode: "IT",
16
- vatNumber: "12345678901",
17
- });
18
- });
19
- test("should return null for invalid VAT number formats", () => {
20
- expect((0, extractVATNumber_util_1.extractVATNumber)("123456789")).toBeNull();
21
- expect((0, extractVATNumber_util_1.extractVATNumber)("FR")).toBeNull();
22
- expect((0, extractVATNumber_util_1.extractVATNumber)("fr123456789")).toBeNull();
23
- expect((0, extractVATNumber_util_1.extractVATNumber)("F123456789")).toBeNull();
24
- expect((0, extractVATNumber_util_1.extractVATNumber)("FR-123456789")).toBeNull();
25
- });
26
- test("should handle edge cases", () => {
27
- expect((0, extractVATNumber_util_1.extractVATNumber)("GBGD123")).toEqual({
28
- countryISOCode: "GB",
29
- vatNumber: "GD123",
30
- });
31
- expect((0, extractVATNumber_util_1.extractVATNumber)("ESX1234567")).toEqual({
32
- countryISOCode: "ES",
33
- vatNumber: "X1234567",
34
- });
35
- expect((0, extractVATNumber_util_1.extractVATNumber)("")).toBeNull();
36
- expect((0, extractVATNumber_util_1.extractVATNumber)(" ")).toBeNull();
37
- expect((0, extractVATNumber_util_1.extractVATNumber)("FR 123456789")).toBeNull();
38
- });
39
- });
@@ -1,4 +0,0 @@
1
- export declare function extractVATNumber(vatNumber: string): {
2
- countryISOCode: string;
3
- vatNumber: string;
4
- } | null;
@@ -1,2 +0,0 @@
1
- import type { ValidateVATFormatArgs } from "./types";
2
- export declare function validateVATFormat({ countryCode, vatNumber, }: ValidateVATFormatArgs): boolean;