@doctocar/tooling 0.3.1-21 → 0.3.1-22

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 (155) hide show
  1. package/dist/emails/types/professional/ProfessionalOrderIssueReportedConfirmationEmailData.type.d.ts +1 -1
  2. package/dist/emails/types/professional/ProfessionalServiceCompletedByProfessionalEmailData.type.d.ts +1 -1
  3. package/dist/errors/enums/cloudFunctions/orders/CancelConfirmedOrInProgressOrderErrorCodes.enum.d.ts +1 -1
  4. package/dist/errors/enums/cloudFunctions/orders/CancelConfirmedOrInProgressOrderErrorCodes.enum.js +1 -1
  5. package/dist/errors/enums/cloudFunctions/orders/ConfirmServiceCompletionByServiceProviderErrorCodes.enum.d.ts +7 -0
  6. package/dist/errors/enums/cloudFunctions/orders/ConfirmServiceCompletionByServiceProviderErrorCodes.enum.js +11 -0
  7. package/dist/errors/enums/cloudFunctions/orders/StartConfirmedOrderByServiceProviderErrorCodes.enum.d.ts +6 -0
  8. package/dist/errors/enums/cloudFunctions/orders/StartConfirmedOrderByServiceProviderErrorCodes.enum.js +10 -0
  9. package/dist/errors/enums/cloudFunctions/orders/index.d.ts +2 -2
  10. package/dist/errors/enums/cloudFunctions/orders/index.js +2 -2
  11. package/dist/errors/enums/cloudFunctions/serviceProviderUsers/DeleteServiceProviderUserServiceErrorCodes.enum.d.ts +1 -1
  12. package/dist/errors/enums/cloudFunctions/serviceProviderUsers/DeleteServiceProviderUserServiceErrorCodes.enum.js +1 -1
  13. package/dist/errors/enums/cloudFunctions/serviceProviderUsers/UpdateServiceProviderUserServiceErrorCodes.enum.d.ts +1 -1
  14. package/dist/errors/enums/cloudFunctions/serviceProviderUsers/UpdateServiceProviderUserServiceErrorCodes.enum.js +1 -1
  15. package/dist/firebase/cloudFunctions/enums/OnCallCloudFunctionsNames.enum.d.ts +2 -2
  16. package/dist/firebase/cloudFunctions/enums/OnCallCloudFunctionsNames.enum.js +2 -2
  17. package/dist/firebase/cloudFunctions/enums/TaskCloudFunctionsNames.enum.d.ts +1 -1
  18. package/dist/firebase/cloudFunctions/enums/TaskCloudFunctionsNames.enum.js +1 -1
  19. package/dist/firebase/cloudFunctions/maps/OnCallCloudFunctionsTypeMappings.map.d.ts +7 -7
  20. package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderRequestData.type.d.ts +4 -0
  21. package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderRequestData.type.js +2 -0
  22. package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderResponseData.type.d.ts +1 -0
  23. package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderResponseData.type.js +2 -0
  24. package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderRequestData.type.d.ts +4 -0
  25. package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderRequestData.type.js +2 -0
  26. package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderResponseData.type.d.ts +1 -0
  27. package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderResponseData.type.js +2 -0
  28. package/dist/firebase/cloudFunctions/types/orders/index.d.ts +4 -4
  29. package/dist/firebase/cloudFunctions/types/orders/index.js +4 -4
  30. package/dist/firebase/cloudFunctions/types/users/serviceProviderUsers/UpdateServiceProviderUserServiceRequestData.type.d.ts +2 -2
  31. package/dist/firebase/firestore/constants/index.d.ts +4 -4
  32. package/dist/firebase/firestore/constants/index.js +4 -4
  33. package/dist/firebase/firestore/constants/providerLocationServiceMaxRadiusInKM.constant.d.ts +1 -0
  34. package/dist/firebase/firestore/constants/providerLocationServiceMaxRadiusInKM.constant.js +4 -0
  35. package/dist/firebase/firestore/constants/providerLocationServiceMinRadiusInKM.constant.d.ts +1 -0
  36. package/dist/firebase/firestore/constants/providerLocationServiceMinRadiusInKM.constant.js +4 -0
  37. package/dist/firebase/firestore/constants/providerServiceMinimumDurationIncrementInMinutes.constant.d.ts +1 -0
  38. package/dist/firebase/firestore/constants/providerServiceMinimumDurationIncrementInMinutes.constant.js +4 -0
  39. package/dist/firebase/firestore/constants/providerServiceMinimumPriceIncrementInCents.constant.d.ts +1 -0
  40. package/dist/firebase/firestore/constants/providerServiceMinimumPriceIncrementInCents.constant.js +4 -0
  41. package/dist/firebase/firestore/enums/FirestoreCollections.enum.d.ts +1 -1
  42. package/dist/firebase/firestore/enums/FirestoreCollections.enum.js +1 -1
  43. package/dist/firebase/firestore/enums/orders/OrderCancellationByTypes.enum.d.ts +1 -1
  44. package/dist/firebase/firestore/enums/orders/OrderCancellationByTypes.enum.js +1 -1
  45. package/dist/firebase/firestore/enums/orders/OrderServiceProviderCancellationReason.enum.d.ts +7 -7
  46. package/dist/firebase/firestore/enums/orders/OrderServiceProviderCancellationReason.enum.js +7 -7
  47. package/dist/firebase/firestore/enums/orders/dispute/OrderDisputeOpenedBy.enum.d.ts +1 -1
  48. package/dist/firebase/firestore/enums/orders/dispute/OrderDisputeOpenedBy.enum.js +1 -1
  49. package/dist/firebase/firestore/enums/orders/index.d.ts +1 -1
  50. package/dist/firebase/firestore/enums/orders/index.js +1 -1
  51. package/dist/firebase/firestore/enums/ordersIssues/CustomerOrderIssueReason.enum.d.ts +2 -2
  52. package/dist/firebase/firestore/enums/ordersIssues/CustomerOrderIssueReason.enum.js +2 -2
  53. package/dist/firebase/firestore/enums/ordersIssues/ServiceProviderOrderIssueReason.enum.d.ts +10 -0
  54. package/dist/firebase/firestore/enums/ordersIssues/ServiceProviderOrderIssueReason.enum.js +14 -0
  55. package/dist/firebase/firestore/enums/ordersIssues/index.d.ts +1 -1
  56. package/dist/firebase/firestore/enums/ordersIssues/index.js +1 -1
  57. package/dist/firebase/firestore/enums/users/professionals/ServiceProviderBadgesTypes.enum.d.ts +3 -0
  58. package/dist/firebase/firestore/enums/users/professionals/ServiceProviderBadgesTypes.enum.js +7 -0
  59. package/dist/firebase/firestore/enums/users/professionals/index.d.ts +1 -1
  60. package/dist/firebase/firestore/enums/users/professionals/index.js +1 -1
  61. package/dist/firebase/firestore/maps/FirestoreCollectionDocumentTypeMap.d.ts +2 -2
  62. package/dist/firebase/firestore/types/index.d.ts +1 -1
  63. package/dist/firebase/firestore/types/index.js +1 -1
  64. package/dist/firebase/firestore/types/order/FirestoreOrderCancellationReason.type.d.ts +2 -2
  65. package/dist/firebase/firestore/types/ordersIssues/OrderIssueReason.type.d.ts +2 -2
  66. package/dist/firebase/firestore/types/ordersReviews/FirestoreOrderReviewDocument.type.d.ts +1 -1
  67. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocument.type.d.ts +49 -0
  68. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocument.type.js +2 -0
  69. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentReviewAggregates.type.d.ts +4 -0
  70. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentReviewAggregates.type.js +2 -0
  71. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentServicesLocation.type.d.ts +4 -0
  72. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentServicesLocation.type.js +2 -0
  73. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/index.d.ts +3 -0
  74. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/index.js +19 -0
  75. package/dist/firebase/firestore/types/services/ProviderService.type.d.ts +8 -0
  76. package/dist/firebase/firestore/types/services/ProviderService.type.js +2 -0
  77. package/dist/firebase/firestore/types/services/ServiceProviderService.type.d.ts +8 -0
  78. package/dist/firebase/firestore/types/services/ServiceProviderService.type.js +2 -0
  79. package/dist/firebase/firestore/types/services/index.d.ts +1 -1
  80. package/dist/firebase/firestore/types/services/index.js +1 -1
  81. package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidProfessionalService.test.js +11 -11
  82. package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidProviderService.test.d.ts +1 -0
  83. package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidProviderService.test.js +172 -0
  84. package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidServicePricingAndDurationForVehicle.test.js +9 -9
  85. package/dist/firebase/firestore/utils/dataValidators/services/index.d.ts +1 -1
  86. package/dist/firebase/firestore/utils/dataValidators/services/index.js +1 -1
  87. package/dist/firebase/firestore/utils/dataValidators/services/isValidProfessionalService.d.ts +1 -1
  88. package/dist/firebase/firestore/utils/dataValidators/services/isValidProfessionalService.js +13 -13
  89. package/dist/firebase/firestore/utils/dataValidators/services/isValidProviderService.d.ts +2 -0
  90. package/dist/firebase/firestore/utils/dataValidators/services/isValidProviderService.js +42 -0
  91. package/dist/firebase/firestore/utils/dataValidators/services/isValidServicePricingAndDurationForVehicle.js +2 -2
  92. package/dist/firebase/firestore/utils/dataValidators/services/types/IsValidProfessionalServiceParams.type.d.ts +2 -2
  93. package/dist/firebase/firestore/utils/dataValidators/services/types/IsValidProviderServiceParams.type.d.ts +6 -0
  94. package/dist/firebase/firestore/utils/dataValidators/services/types/IsValidProviderServiceParams.type.js +2 -0
  95. package/dist/firebase/firestore/utils/dataValidators/services/types/index.d.ts +1 -1
  96. package/dist/firebase/firestore/utils/dataValidators/services/types/index.js +1 -1
  97. package/dist/firebase/firestore/utils/order/__tests__/buildOrderServicePreTaxLinesAndServicesDetails.test.js +13 -13
  98. package/dist/firebase/firestore/utils/order/buildOrderServicePreTaxLinesAndServicesDetails.d.ts +1 -1
  99. package/dist/firebase/firestore/utils/order/buildOrderServicePreTaxLinesAndServicesDetails.js +2 -2
  100. package/dist/firebase/firestore/utils/order/types/BuildOrderServicePreTaxLinesAndServicesDetailsProps.type.d.ts +2 -2
  101. package/dist/firebase/firestore/utils/reviews/__tests__/getAverageRatingFromReviewAggregates.test.d.ts +1 -0
  102. package/dist/firebase/firestore/utils/reviews/__tests__/getAverageRatingFromReviewAggregates.test.js +97 -0
  103. package/dist/firebase/firestore/utils/reviews/getAverageRatingFromReviewAggregates.d.ts +2 -0
  104. package/dist/firebase/firestore/utils/reviews/getAverageRatingFromReviewAggregates.js +13 -0
  105. package/dist/firebase/firestore/utils/reviews/index.d.ts +1 -1
  106. package/dist/firebase/firestore/utils/reviews/index.js +1 -1
  107. package/dist/firebase/firestore/utils/services/__tests__/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.test.d.ts +1 -0
  108. package/dist/firebase/firestore/utils/services/__tests__/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.test.js +101 -0
  109. package/dist/firebase/firestore/utils/services/__tests__/createServiceVehicleComboKey.test.js +4 -4
  110. package/dist/firebase/firestore/utils/services/__tests__/getBookableServiceProviderServicesForVehicleType.test.js +49 -49
  111. package/dist/firebase/firestore/utils/services/__tests__/getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow.test.js +32 -32
  112. package/dist/firebase/firestore/utils/services/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.d.ts +2 -0
  113. package/dist/firebase/firestore/utils/services/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.js +18 -0
  114. package/dist/firebase/firestore/utils/services/getBookableServiceProviderServicesForVehicleType.d.ts +3 -3
  115. package/dist/firebase/firestore/utils/services/getBookableServiceProviderServicesForVehicleType.js +11 -11
  116. package/dist/firebase/firestore/utils/services/getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow.d.ts +1 -1
  117. package/dist/firebase/firestore/utils/services/getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow.js +2 -2
  118. package/dist/firebase/firestore/utils/services/index.d.ts +1 -1
  119. package/dist/firebase/firestore/utils/services/index.js +1 -1
  120. package/dist/firebase/firestore/utils/services/types/ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs.type.d.ts +7 -0
  121. package/dist/firebase/firestore/utils/services/types/ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs.type.js +2 -0
  122. package/dist/firebase/firestore/utils/services/types/GetBookableServiceProviderServicesForVehicleTypeParams.type.d.ts +2 -2
  123. package/dist/firebase/firestore/utils/services/types/GetServiceProviderActiveServicePricingAndDurationForVehicleOrThrowParams.type.d.ts +2 -2
  124. package/dist/firebase/firestore/utils/services/types/index.d.ts +1 -1
  125. package/dist/firebase/firestore/utils/services/types/index.js +1 -1
  126. package/dist/firebase/firestore/utils/stubs/index.d.ts +1 -1
  127. package/dist/firebase/firestore/utils/stubs/index.js +1 -1
  128. package/dist/firebase/firestore/utils/stubs/ordersReviews/firestoreOrderReviewDocumentStub.js +1 -1
  129. package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/firestoreServiceProviderUserPublicDocumentStub.d.ts +2 -0
  130. package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/firestoreServiceProviderUserPublicDocumentStub.js +44 -0
  131. package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/index.d.ts +1 -0
  132. package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/index.js +17 -0
  133. package/dist/firebase/firestore/utils/stubs/services/index.d.ts +1 -1
  134. package/dist/firebase/firestore/utils/stubs/services/index.js +1 -1
  135. package/dist/firebase/firestore/utils/stubs/services/pricingAndDurationForVehicleStub.js +2 -2
  136. package/dist/firebase/firestore/utils/stubs/services/providerServiceStub.d.ts +5 -0
  137. package/dist/firebase/firestore/utils/stubs/services/providerServiceStub.js +21 -0
  138. package/dist/firebase/firestore/utils/stubs/services/serviceProviderServiceStub.d.ts +5 -0
  139. package/dist/firebase/firestore/utils/stubs/services/serviceProviderServiceStub.js +21 -0
  140. package/dist/firebase/storage/enums/FirebaseStorageBasePaths.enum.js +1 -1
  141. package/dist/gcp/cloudTask/enums/CloudTasksQueueName.enum.d.ts +1 -1
  142. package/dist/gcp/cloudTask/enums/CloudTasksQueueName.enum.js +1 -1
  143. package/dist/gcp/cloudTask/maps/CloudTaskEnvelopeMap.map.d.ts +2 -2
  144. package/dist/gcp/cloudTask/types/OnTaskRecomputeServiceProviderAvailabilityEnvelope.type.d.ts +1 -1
  145. package/dist/gcp/cloudTask/types/index.d.ts +1 -1
  146. package/dist/gcp/cloudTask/types/index.js +1 -1
  147. package/dist/gcp/cloudTask/utils/stubs/index.d.ts +1 -1
  148. package/dist/gcp/cloudTask/utils/stubs/index.js +1 -1
  149. package/dist/gcp/cloudTask/utils/stubs/onTaskRecomputeServiceProviderAvailabilityEnvelopeStub.js +1 -1
  150. package/dist/pricing/__tests__/calculateInvoiceTotalWithTax.util.test.js +3 -3
  151. package/dist/stripe/types/StripeCustomServiceProviderPayoutMetadata.type.d.ts +5 -0
  152. package/dist/stripe/types/StripeCustomServiceProviderPayoutMetadata.type.js +2 -0
  153. package/dist/stripe/types/index.d.ts +1 -1
  154. package/dist/stripe/types/index.js +1 -1
  155. package/package.json +1 -1
@@ -17,4 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./OrderIssueStatusTypes.enum"), exports);
18
18
  __exportStar(require("./OrderIssueSeverityLevel.enum"), exports);
19
19
  __exportStar(require("./CustomerOrderIssueReason.enum"), exports);
20
- __exportStar(require("./ProfessionalOrderIssueReason.enum"), exports);
20
+ __exportStar(require("./ServiceProviderOrderIssueReason.enum"), exports);
@@ -0,0 +1,3 @@
1
+ export declare enum ServiceProviderBadgesTypes {
2
+ PROFESSIONAL_LIABILITY_INSURANCE = "professional_liability_insurance"
3
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServiceProviderBadgesTypes = void 0;
4
+ var ServiceProviderBadgesTypes;
5
+ (function (ServiceProviderBadgesTypes) {
6
+ ServiceProviderBadgesTypes["PROFESSIONAL_LIABILITY_INSURANCE"] = "professional_liability_insurance";
7
+ })(ServiceProviderBadgesTypes || (exports.ServiceProviderBadgesTypes = ServiceProviderBadgesTypes = {}));
@@ -1,3 +1,3 @@
1
1
  export * from "./ProfessionalInsurancesTypes.enum";
2
2
  export * from "./ProfessionalDiplomasTypes.enum";
3
- export * from "./ProfessionalBadgesTypes.enum";
3
+ export * from "./ServiceProviderBadgesTypes.enum";
@@ -16,4 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ProfessionalInsurancesTypes.enum"), exports);
18
18
  __exportStar(require("./ProfessionalDiplomasTypes.enum"), exports);
19
- __exportStar(require("./ProfessionalBadgesTypes.enum"), exports);
19
+ __exportStar(require("./ServiceProviderBadgesTypes.enum"), exports);
@@ -1,9 +1,9 @@
1
1
  import { FirestoreCollections } from "../enums";
2
- import type { FirestoreBookedSlotDocument, FirestoreDailyMetricsDocument, FirestoreDebugPublicConfigDocument, FirestoreDeviceTokenDocument, FirestoreEmailsBlacklistDocument, FirestoreEmailsSoftBounceDocument, FirestoreEntityDocument, FirestoreEntityMemberDocument, FirestoreEntityMemberInviteDocument, FirestoreEntityUniqueKeyDocument, FirestoreFunctionsDeploymentRunsDocument, FirestoreGlobalMetricsDocument, FirestoreInvoiceCounterDocument, FirestoreMarketplaceFinancialReportsDocument, FirestoreMessageDocument, FirestoreNotificationEventDeliveryStateDocument, FirestoreNotificationEventsPublicConfigDocument, FirestoreOnTaskExecutionStateDocument, FirestoreOrderDocument, FirestoreOrderIssueDocument, FirestoreOrderReviewDocument, FirestoreOrdersPublicConfigDocument, FirestorePaymentIntentDocument, FirestorePlatformPublicConfigDocument, FirestorePricingPublicConfigDocument, FirestoreProfessionalUserPublicDocument, FirestorePromoCodeDocument, FirestoreRateLimitDocument, FirestoreServicesPublicConfigDocument, FirestoreSlotDocument, FirestoreUserDocument, FirestoreUserUploadRateLimitDocument, FirestoreVehicleDocument, FirestoreWalletsDocument, FirestoreWalletsLedgerEntryDocument, FirestoreWalletsWithdrawalIntentsDocument } from "../types";
2
+ import type { FirestoreBookedSlotDocument, FirestoreDailyMetricsDocument, FirestoreDebugPublicConfigDocument, FirestoreDeviceTokenDocument, FirestoreEmailsBlacklistDocument, FirestoreEmailsSoftBounceDocument, FirestoreEntityDocument, FirestoreEntityMemberDocument, FirestoreEntityMemberInviteDocument, FirestoreEntityUniqueKeyDocument, FirestoreFunctionsDeploymentRunsDocument, FirestoreGlobalMetricsDocument, FirestoreInvoiceCounterDocument, FirestoreMarketplaceFinancialReportsDocument, FirestoreMessageDocument, FirestoreNotificationEventDeliveryStateDocument, FirestoreNotificationEventsPublicConfigDocument, FirestoreOnTaskExecutionStateDocument, FirestoreOrderDocument, FirestoreOrderIssueDocument, FirestoreOrderReviewDocument, FirestoreOrdersPublicConfigDocument, FirestorePaymentIntentDocument, FirestorePlatformPublicConfigDocument, FirestorePricingPublicConfigDocument, FirestoreServiceProviderUserPublicDocument, FirestorePromoCodeDocument, FirestoreRateLimitDocument, FirestoreServicesPublicConfigDocument, FirestoreSlotDocument, FirestoreUserDocument, FirestoreUserUploadRateLimitDocument, FirestoreVehicleDocument, FirestoreWalletsDocument, FirestoreWalletsLedgerEntryDocument, FirestoreWalletsWithdrawalIntentsDocument } from "../types";
3
3
  type FirestoreCollectionDocumentTypeMapBase = {
4
4
  [FirestoreCollections.USERS]: FirestoreUserDocument;
5
5
  [FirestoreCollections.DEVICE_TOKENS]: FirestoreDeviceTokenDocument;
6
- [FirestoreCollections.PROFESSIONAL_USERS_PUBLIC]: FirestoreProfessionalUserPublicDocument;
6
+ [FirestoreCollections.SERVICE_PROVIDER_USERS_PUBLIC]: FirestoreServiceProviderUserPublicDocument;
7
7
  [FirestoreCollections.WALLETS]: FirestoreWalletsDocument;
8
8
  [FirestoreCollections.WALLETS_LEDGER_ENTRIES]: FirestoreWalletsLedgerEntryDocument;
9
9
  [FirestoreCollections.WALLETS_WITHDRAWAL_INTENTS]: FirestoreWalletsWithdrawalIntentsDocument;
@@ -1,7 +1,7 @@
1
1
  export * from "./userDocument";
2
2
  export * from "./messages";
3
3
  export * from "./services";
4
- export * from "./userPublicDocument";
4
+ export * from "./serviceProviderUserPublicDocument";
5
5
  export * from "./rateLimitDocument";
6
6
  export * from "./FirestoreFile.type";
7
7
  export * from "./location";
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./userDocument"), exports);
18
18
  __exportStar(require("./messages"), exports);
19
19
  __exportStar(require("./services"), exports);
20
- __exportStar(require("./userPublicDocument"), exports);
20
+ __exportStar(require("./serviceProviderUserPublicDocument"), exports);
21
21
  __exportStar(require("./rateLimitDocument"), exports);
22
22
  __exportStar(require("./FirestoreFile.type"), exports);
23
23
  __exportStar(require("./location"), exports);
@@ -1,2 +1,2 @@
1
- import type { OrderCustomerCancellationReason, OrderPaymentCancellationReason, OrderProfessionalCancellationReason, OrderSystemCancellationReason } from "../../enums";
2
- export type FirestoreOrderCancellationReason = OrderSystemCancellationReason | OrderCustomerCancellationReason | OrderProfessionalCancellationReason | OrderPaymentCancellationReason;
1
+ import type { OrderCustomerCancellationReason, OrderPaymentCancellationReason, OrderServiceProviderCancellationReason, OrderSystemCancellationReason } from "../../enums";
2
+ export type FirestoreOrderCancellationReason = OrderSystemCancellationReason | OrderCustomerCancellationReason | OrderServiceProviderCancellationReason | OrderPaymentCancellationReason;
@@ -1,2 +1,2 @@
1
- import type { CustomerOrderIssueReason, ProfessionalOrderIssueReason } from "../../enums";
2
- export type OrderIssueReason = CustomerOrderIssueReason | ProfessionalOrderIssueReason;
1
+ import type { CustomerOrderIssueReason, ServiceProviderOrderIssueReason } from "../../enums";
2
+ export type OrderIssueReason = CustomerOrderIssueReason | ServiceProviderOrderIssueReason;
@@ -5,7 +5,7 @@ export type FirestoreOrderReviewDocument = {
5
5
  updatedAt: FirestoreTimestamp;
6
6
  orderId: string;
7
7
  customerId: string;
8
- professionalId: string;
8
+ serviceProviderId: string;
9
9
  status: OrderReviewStatusType;
10
10
  rating?: number;
11
11
  comment?: string;
@@ -0,0 +1,49 @@
1
+ import type { SupportedCountryIsoCodes } from "../../../../enums";
2
+ import type { ServiceProviderBadgesTypes, ServicesTypes } from "../../enums";
3
+ import type { FirestoreTimestamp } from "../FirestoreTimestamp.type";
4
+ import type { FirestoreImageVariantSet } from "../image";
5
+ import type { ProviderService } from "../services/ProviderService.type";
6
+ import type { FirestoreServiceProviderUserPublicDocumentReviewAggregates } from "./FirestoreServiceProviderUserPublicDocumentReviewAggregates.type";
7
+ import type { FirestoreServiceProviderUserPublicDocumentServicesLocation } from "./FirestoreServiceProviderUserPublicDocumentServicesLocation.type";
8
+ export type FirestoreServiceProviderUserPublicDocument = {
9
+ createdAt: FirestoreTimestamp;
10
+ updatedAt: FirestoreTimestamp;
11
+ version: 1;
12
+ userId: string;
13
+ entityId: string;
14
+ entityDisplayName: string;
15
+ countryIsoCode: SupportedCountryIsoCodes;
16
+ isVatExempt: boolean;
17
+ profile?: {
18
+ photo?: {
19
+ storagePaths: FirestoreImageVariantSet;
20
+ updatedAt: FirestoreTimestamp;
21
+ };
22
+ };
23
+ coverPicture?: {
24
+ storagePaths: FirestoreImageVariantSet;
25
+ updatedAt: FirestoreTimestamp;
26
+ };
27
+ publicDescription?: string;
28
+ activeServicesVehiclesCombos: string[];
29
+ services: Partial<{
30
+ [T in ServicesTypes]: ProviderService<T>;
31
+ }>;
32
+ reviewAggregates: FirestoreServiceProviderUserPublicDocumentReviewAggregates;
33
+ servicesLocation: FirestoreServiceProviderUserPublicDocumentServicesLocation;
34
+ availability: {
35
+ horizonStart: FirestoreTimestamp;
36
+ horizonDays: number;
37
+ granularityMinutes: number;
38
+ encodedOpenTimeline: string;
39
+ encodedBlockedTimeline: string;
40
+ updatedAt: FirestoreTimestamp;
41
+ };
42
+ isBookable: boolean;
43
+ badges?: Partial<Record<ServiceProviderBadgesTypes, {
44
+ grantedAt: FirestoreTimestamp;
45
+ expiredAt?: FirestoreTimestamp;
46
+ metadata?: Record<string, unknown>;
47
+ }>>;
48
+ isTest: boolean;
49
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type FirestoreServiceProviderUserPublicDocumentReviewAggregates = {
2
+ reviewCount: number;
3
+ ratingSum: number;
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import type { DoctoCarLocation } from "../location";
2
+ export type FirestoreServiceProviderUserPublicDocumentServicesLocation = {
3
+ serviceLocationRadiusInKm: number;
4
+ } & DoctoCarLocation;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from "./FirestoreServiceProviderUserPublicDocument.type";
2
+ export * from "./FirestoreServiceProviderUserPublicDocumentServicesLocation.type";
3
+ export * from "./FirestoreServiceProviderUserPublicDocumentReviewAggregates.type";
@@ -0,0 +1,19 @@
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("./FirestoreServiceProviderUserPublicDocument.type"), exports);
18
+ __exportStar(require("./FirestoreServiceProviderUserPublicDocumentServicesLocation.type"), exports);
19
+ __exportStar(require("./FirestoreServiceProviderUserPublicDocumentReviewAggregates.type"), exports);
@@ -0,0 +1,8 @@
1
+ import { ServicesTypes, type VehicleTypes } from "../../enums";
2
+ import type { ServicePricingAndDurationForVehicle } from "./ServicePricingAndDurationForVehicle.type";
3
+ export type ProviderService<T extends ServicesTypes> = {
4
+ type: T;
5
+ isActive: boolean;
6
+ parentsServices?: ServicesTypes[];
7
+ pricingAndDurationByVehicleType: Partial<Record<VehicleTypes, ServicePricingAndDurationForVehicle>>;
8
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { ServicesTypes, type VehicleTypes } from "../../enums";
2
+ import type { ServicePricingAndDurationForVehicle } from "./ServicePricingAndDurationForVehicle.type";
3
+ export type ServiceProviderService<T extends ServicesTypes> = {
4
+ type: T;
5
+ isActive: boolean;
6
+ parentsServices?: ServicesTypes[];
7
+ pricingAndDurationByVehicleType: Partial<Record<VehicleTypes, ServicePricingAndDurationForVehicle>>;
8
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,2 @@
1
- export * from "./ProfessionalService.type";
1
+ export * from "./ProviderService.type";
2
2
  export * from "./ServicePricingAndDurationForVehicle.type";
@@ -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("./ProfessionalService.type"), exports);
17
+ __exportStar(require("./ProviderService.type"), exports);
18
18
  __exportStar(require("./ServicePricingAndDurationForVehicle.type"), exports);
@@ -14,7 +14,7 @@ describe("isValidProfessionalService", () => {
14
14
  let isValidServicePricingAndDurationForVehicleReturnValue;
15
15
  beforeEach(() => {
16
16
  defaultProps = {
17
- professionalService: {
17
+ providerService: {
18
18
  isActive: true,
19
19
  type: enums_2.ServicesTypes.EXTERIOR_CLEANING,
20
20
  pricingAndDurationByVehicleType: {
@@ -46,24 +46,24 @@ describe("isValidProfessionalService", () => {
46
46
  });
47
47
  describe("Active", () => {
48
48
  it("should throw if the active field is not a boolean", async () => {
49
- defaultProps.professionalService.isActive = "yes";
49
+ defaultProps.providerService.isActive = "yes";
50
50
  await expect((0, isValidProfessionalService_1.isValidProfessionalService)(defaultProps)).rejects.toThrow(new errors_1.DoctoCarError("Professional service is active is required and must be a boolean", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_IS_ACTIVE));
51
51
  expect(isValidServicePricingAndDurationForVehicleMock).not.toHaveBeenCalled();
52
52
  });
53
53
  it("should throw if the active field is not provided", async () => {
54
- defaultProps.professionalService.isActive = undefined;
54
+ defaultProps.providerService.isActive = undefined;
55
55
  await expect((0, isValidProfessionalService_1.isValidProfessionalService)(defaultProps)).rejects.toThrow(new errors_1.DoctoCarError("Professional service is active is required and must be a boolean", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_IS_ACTIVE));
56
56
  expect(isValidServicePricingAndDurationForVehicleMock).not.toHaveBeenCalled();
57
57
  });
58
58
  });
59
59
  describe("Service type", () => {
60
60
  it("should throw if the service type is not a valid ServicesTypes", async () => {
61
- defaultProps.professionalService.type = "INVALID_TYPE";
61
+ defaultProps.providerService.type = "INVALID_TYPE";
62
62
  await expect((0, isValidProfessionalService_1.isValidProfessionalService)(defaultProps)).rejects.toThrow();
63
63
  expect(isValidServicePricingAndDurationForVehicleMock).not.toHaveBeenCalled();
64
64
  });
65
65
  it("should throw if the type is not provided", async () => {
66
- defaultProps.professionalService.type = undefined;
66
+ defaultProps.providerService.type = undefined;
67
67
  await expect((0, isValidProfessionalService_1.isValidProfessionalService)(defaultProps)).rejects.toThrow();
68
68
  expect(isValidServicePricingAndDurationForVehicleMock).not.toHaveBeenCalled();
69
69
  });
@@ -82,8 +82,8 @@ describe("isValidProfessionalService", () => {
82
82
  await expect((0, isValidProfessionalService_1.isValidProfessionalService)(defaultProps)).resolves.not.toThrow();
83
83
  expect(isValidServicePricingAndDurationForVehicleMock).toHaveBeenCalledTimes(1);
84
84
  expect(isValidServicePricingAndDurationForVehicleMock).toHaveBeenCalledWith({
85
- servicePublicConfig: defaultProps.countryServicePublicConfig[defaultProps.professionalService.type],
86
- servicePricingAndDurationForVehicle: defaultProps.professionalService.pricingAndDurationByVehicleType[enums_2.VehicleTypes.SEDAN],
85
+ servicePublicConfig: defaultProps.countryServicePublicConfig[defaultProps.providerService.type],
86
+ servicePricingAndDurationForVehicle: defaultProps.providerService.pricingAndDurationByVehicleType[enums_2.VehicleTypes.SEDAN],
87
87
  });
88
88
  });
89
89
  it("Should throw if isValidServicePricingAndDurationForVehicle return false", async () => {
@@ -94,7 +94,7 @@ describe("isValidProfessionalService", () => {
94
94
  });
95
95
  describe("parentsServices", () => {
96
96
  it("Should throw if a service does not have the parents services indicated in the config", async () => {
97
- defaultProps.professionalService = {
97
+ defaultProps.providerService = {
98
98
  isActive: true,
99
99
  type: enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT,
100
100
  parentsServices: [],
@@ -111,7 +111,7 @@ describe("isValidProfessionalService", () => {
111
111
  await expect((0, isValidProfessionalService_1.isValidProfessionalService)(defaultProps)).rejects.toThrow();
112
112
  });
113
113
  it("Should not throw if a valid service have the parents services indicated in the config", async () => {
114
- defaultProps.professionalService = {
114
+ defaultProps.providerService = {
115
115
  isActive: true,
116
116
  type: enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT,
117
117
  parentsServices: [
@@ -131,7 +131,7 @@ describe("isValidProfessionalService", () => {
131
131
  await expect((0, isValidProfessionalService_1.isValidProfessionalService)(defaultProps)).resolves.not.toThrow();
132
132
  });
133
133
  it("Should throw if a valid service have the parents services indicated in the config but miss one", async () => {
134
- defaultProps.professionalService = {
134
+ defaultProps.providerService = {
135
135
  isActive: true,
136
136
  type: enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT,
137
137
  parentsServices: [enums_2.ServicesTypes.INTERIOR_CLEANING],
@@ -148,7 +148,7 @@ describe("isValidProfessionalService", () => {
148
148
  await expect((0, isValidProfessionalService_1.isValidProfessionalService)(defaultProps)).rejects.toThrow();
149
149
  });
150
150
  it("Should throw if a valid service have the parents services indicated in the config but have one more", async () => {
151
- defaultProps.professionalService = {
151
+ defaultProps.providerService = {
152
152
  isActive: true,
153
153
  type: enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT,
154
154
  parentsServices: [
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-disable @typescript-eslint/no-explicit-any */
4
+ const enums_1 = require("../../../../../../enums");
5
+ const errors_1 = require("../../../../../../errors");
6
+ const enums_2 = require("../../../../enums");
7
+ const stubs_1 = require("../../../stubs");
8
+ const isValidProviderService_1 = require("../isValidProviderService");
9
+ const isValidServicePricingAndDurationForVehicle_1 = require("../isValidServicePricingAndDurationForVehicle");
10
+ jest.mock("../isValidServicePricingAndDurationForVehicle");
11
+ describe("isValidProviderService", () => {
12
+ let defaultProps;
13
+ let isValidServicePricingAndDurationForVehicleMock;
14
+ let isValidServicePricingAndDurationForVehicleReturnValue;
15
+ beforeEach(() => {
16
+ defaultProps = {
17
+ providerService: {
18
+ isActive: true,
19
+ type: enums_2.ServicesTypes.EXTERIOR_CLEANING,
20
+ pricingAndDurationByVehicleType: {
21
+ [enums_2.VehicleTypes.SEDAN]: {
22
+ isActive: true,
23
+ type: enums_2.VehicleTypes.SEDAN,
24
+ pricePreTaxInCents: 2000,
25
+ currency: enums_1.SupportedIsoCurrency.EUR,
26
+ durationInMinutes: 30,
27
+ },
28
+ },
29
+ },
30
+ countryServicePublicConfig: (0, stubs_1.countryServicesPublicConfigStub)({
31
+ [enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.firestoreServicesPublicConfigStub)({}),
32
+ }),
33
+ };
34
+ isValidServicePricingAndDurationForVehicleMock =
35
+ isValidServicePricingAndDurationForVehicle_1.isValidServicePricingAndDurationForVehicle;
36
+ isValidServicePricingAndDurationForVehicleReturnValue = true;
37
+ isValidServicePricingAndDurationForVehicleMock.mockImplementation(() => {
38
+ return isValidServicePricingAndDurationForVehicleReturnValue;
39
+ });
40
+ });
41
+ afterEach(() => {
42
+ jest.clearAllMocks();
43
+ });
44
+ it("should not throw if is a valid service with empty pricing and empty subservice", async () => {
45
+ await expect((0, isValidProviderService_1.isValidProviderService)(defaultProps)).resolves.not.toThrow();
46
+ });
47
+ describe("Active", () => {
48
+ it("should throw if the active field is not a boolean", async () => {
49
+ defaultProps.providerService.isActive = "yes";
50
+ await expect((0, isValidProviderService_1.isValidProviderService)(defaultProps)).rejects.toThrow(new errors_1.DoctoCarError("Provider service isActive must be a boolean", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_IS_ACTIVE));
51
+ expect(isValidServicePricingAndDurationForVehicleMock).not.toHaveBeenCalled();
52
+ });
53
+ it("should throw if the active field is not provided", async () => {
54
+ defaultProps.providerService.isActive = undefined;
55
+ await expect((0, isValidProviderService_1.isValidProviderService)(defaultProps)).rejects.toThrow(new errors_1.DoctoCarError("Provider service isActive must be a boolean", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_IS_ACTIVE));
56
+ expect(isValidServicePricingAndDurationForVehicleMock).not.toHaveBeenCalled();
57
+ });
58
+ });
59
+ describe("Service type", () => {
60
+ it("should throw if the service type is not a valid ServicesTypes", async () => {
61
+ defaultProps.providerService.type = "INVALID_TYPE";
62
+ await expect((0, isValidProviderService_1.isValidProviderService)(defaultProps)).rejects.toThrow();
63
+ expect(isValidServicePricingAndDurationForVehicleMock).not.toHaveBeenCalled();
64
+ });
65
+ it("should throw if the type is not provided", async () => {
66
+ defaultProps.providerService.type = undefined;
67
+ await expect((0, isValidProviderService_1.isValidProviderService)(defaultProps)).rejects.toThrow();
68
+ expect(isValidServicePricingAndDurationForVehicleMock).not.toHaveBeenCalled();
69
+ });
70
+ });
71
+ describe("Country services public config", () => {
72
+ it("should throw if there is no public config entry for the provider service type", async () => {
73
+ defaultProps.countryServicePublicConfig = {};
74
+ await expect((0, isValidProviderService_1.isValidProviderService)(defaultProps)).rejects.toThrow(new errors_1.DoctoCarError("Country services public config has no entry for this provider service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_TYPE));
75
+ expect(isValidServicePricingAndDurationForVehicleMock).not.toHaveBeenCalled();
76
+ });
77
+ });
78
+ describe("Price and duration", () => {
79
+ it("should not throw if isValidServicePricingAndDurationForVehicle return true", async () => {
80
+ isValidServicePricingAndDurationForVehicleReturnValue = true;
81
+ isValidServicePricingAndDurationForVehicleMock.mockReturnValue(isValidServicePricingAndDurationForVehicleReturnValue);
82
+ await expect((0, isValidProviderService_1.isValidProviderService)(defaultProps)).resolves.not.toThrow();
83
+ expect(isValidServicePricingAndDurationForVehicleMock).toHaveBeenCalledTimes(1);
84
+ expect(isValidServicePricingAndDurationForVehicleMock).toHaveBeenCalledWith({
85
+ servicePublicConfig: defaultProps.countryServicePublicConfig[defaultProps.providerService.type],
86
+ servicePricingAndDurationForVehicle: defaultProps.providerService.pricingAndDurationByVehicleType[enums_2.VehicleTypes.SEDAN],
87
+ });
88
+ });
89
+ it("Should throw if isValidServicePricingAndDurationForVehicle return false", async () => {
90
+ isValidServicePricingAndDurationForVehicleReturnValue = false;
91
+ isValidServicePricingAndDurationForVehicleMock.mockReturnValue(isValidServicePricingAndDurationForVehicleReturnValue);
92
+ await expect((0, isValidProviderService_1.isValidProviderService)(defaultProps)).rejects.toThrow();
93
+ });
94
+ });
95
+ describe("parentsServices", () => {
96
+ it("Should throw if a service does not have the parents services indicated in the config", async () => {
97
+ defaultProps.providerService = {
98
+ isActive: true,
99
+ type: enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT,
100
+ parentsServices: [],
101
+ pricingAndDurationByVehicleType: {},
102
+ };
103
+ defaultProps.countryServicePublicConfig = (0, stubs_1.countryServicesPublicConfigStub)({
104
+ [enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT]: (0, stubs_1.firestoreServicesPublicConfigStub)({
105
+ parentsServices: [
106
+ enums_2.ServicesTypes.INTERIOR_CLEANING,
107
+ enums_2.ServicesTypes.INTERIOR_AND_EXTERIOR_CLEANING,
108
+ ],
109
+ }),
110
+ });
111
+ await expect((0, isValidProviderService_1.isValidProviderService)(defaultProps)).rejects.toThrow();
112
+ });
113
+ it("Should not throw if a valid service have the parents services indicated in the config", async () => {
114
+ defaultProps.providerService = {
115
+ isActive: true,
116
+ type: enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT,
117
+ parentsServices: [
118
+ enums_2.ServicesTypes.INTERIOR_CLEANING,
119
+ enums_2.ServicesTypes.INTERIOR_AND_EXTERIOR_CLEANING,
120
+ ],
121
+ pricingAndDurationByVehicleType: {},
122
+ };
123
+ defaultProps.countryServicePublicConfig = (0, stubs_1.countryServicesPublicConfigStub)({
124
+ [enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT]: (0, stubs_1.firestoreServicesPublicConfigStub)({
125
+ parentsServices: [
126
+ enums_2.ServicesTypes.INTERIOR_CLEANING,
127
+ enums_2.ServicesTypes.INTERIOR_AND_EXTERIOR_CLEANING,
128
+ ],
129
+ }),
130
+ });
131
+ await expect((0, isValidProviderService_1.isValidProviderService)(defaultProps)).resolves.not.toThrow();
132
+ });
133
+ it("Should throw if a valid service have the parents services indicated in the config but miss one", async () => {
134
+ defaultProps.providerService = {
135
+ isActive: true,
136
+ type: enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT,
137
+ parentsServices: [enums_2.ServicesTypes.INTERIOR_CLEANING],
138
+ pricingAndDurationByVehicleType: {},
139
+ };
140
+ defaultProps.countryServicePublicConfig = (0, stubs_1.countryServicesPublicConfigStub)({
141
+ [enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT]: (0, stubs_1.firestoreServicesPublicConfigStub)({
142
+ parentsServices: [
143
+ enums_2.ServicesTypes.INTERIOR_CLEANING,
144
+ enums_2.ServicesTypes.INTERIOR_AND_EXTERIOR_CLEANING,
145
+ ],
146
+ }),
147
+ });
148
+ await expect((0, isValidProviderService_1.isValidProviderService)(defaultProps)).rejects.toThrow();
149
+ });
150
+ it("Should throw if a valid service have the parents services indicated in the config but have one more", async () => {
151
+ defaultProps.providerService = {
152
+ isActive: true,
153
+ type: enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT,
154
+ parentsServices: [
155
+ enums_2.ServicesTypes.INTERIOR_CLEANING,
156
+ enums_2.ServicesTypes.INTERIOR_AND_EXTERIOR_CLEANING,
157
+ enums_2.ServicesTypes.EXTERIOR_CLEANING,
158
+ ],
159
+ pricingAndDurationByVehicleType: {},
160
+ };
161
+ defaultProps.countryServicePublicConfig = (0, stubs_1.countryServicesPublicConfigStub)({
162
+ [enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT]: (0, stubs_1.firestoreServicesPublicConfigStub)({
163
+ parentsServices: [
164
+ enums_2.ServicesTypes.INTERIOR_CLEANING,
165
+ enums_2.ServicesTypes.INTERIOR_AND_EXTERIOR_CLEANING,
166
+ ],
167
+ }),
168
+ });
169
+ await expect((0, isValidProviderService_1.isValidProviderService)(defaultProps)).rejects.toThrow();
170
+ });
171
+ });
172
+ });
@@ -12,11 +12,11 @@ describe("isValidServicePricingAndDurationForVehicle", () => {
12
12
  let maximumPriceInCents;
13
13
  let durationInMinutes;
14
14
  beforeEach(() => {
15
- minimumPriceInCents = constants_1.PROFESSIONAL_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS;
15
+ minimumPriceInCents = constants_1.PROVIDER_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS;
16
16
  maximumPriceInCents =
17
- constants_1.PROFESSIONAL_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS * 10;
17
+ constants_1.PROVIDER_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS * 10;
18
18
  durationInMinutes =
19
- constants_1.PROFESSIONAL_SERVICE_MINIMUM_DURATION_INCREMENT_IN_MINUTES;
19
+ constants_1.PROVIDER_SERVICE_MINIMUM_DURATION_INCREMENT_IN_MINUTES;
20
20
  defaultProps = {
21
21
  servicePublicConfig: (0, stubs_1.firestoreServicesPublicConfigStub)({
22
22
  byVehicleType: {
@@ -92,16 +92,16 @@ describe("isValidServicePricingAndDurationForVehicle", () => {
92
92
  it("Should return false if pricePreTaxInCents is less than the service minimum", () => {
93
93
  defaultProps.servicePricingAndDurationForVehicle.pricePreTaxInCents =
94
94
  minimumPriceInCents -
95
- constants_1.PROFESSIONAL_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS;
95
+ constants_1.PROVIDER_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS;
96
96
  expect((0, isValidServicePricingAndDurationForVehicle_1.isValidServicePricingAndDurationForVehicle)(defaultProps)).toBe(false);
97
97
  });
98
- it("Should return false if pricePreTaxInCents is more than PROFESSIONAL_SERVICE_MAXIMUM_PRICE_IN_CENTS", () => {
98
+ it("Should return false if pricePreTaxInCents is more than the configured maximum price", () => {
99
99
  defaultProps.servicePricingAndDurationForVehicle.pricePreTaxInCents =
100
100
  maximumPriceInCents +
101
- constants_1.PROFESSIONAL_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS;
101
+ constants_1.PROVIDER_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS;
102
102
  expect((0, isValidServicePricingAndDurationForVehicle_1.isValidServicePricingAndDurationForVehicle)(defaultProps)).toBe(false);
103
103
  });
104
- it("Should return false if pricePreTaxInCents is not a multiple of PROFESSIONAL_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS", () => {
104
+ it("Should return false if pricePreTaxInCents is not a multiple of PROVIDER_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS", () => {
105
105
  defaultProps.servicePricingAndDurationForVehicle.pricePreTaxInCents =
106
106
  maximumPriceInCents - 1;
107
107
  expect((0, isValidServicePricingAndDurationForVehicle_1.isValidServicePricingAndDurationForVehicle)(defaultProps)).toBe(false);
@@ -119,13 +119,13 @@ describe("isValidServicePricingAndDurationForVehicle", () => {
119
119
  it("Should return false if durationInMinutes is less than the duration for the service", () => {
120
120
  defaultProps.servicePricingAndDurationForVehicle.durationInMinutes =
121
121
  durationInMinutes -
122
- constants_1.PROFESSIONAL_SERVICE_MINIMUM_DURATION_INCREMENT_IN_MINUTES;
122
+ constants_1.PROVIDER_SERVICE_MINIMUM_DURATION_INCREMENT_IN_MINUTES;
123
123
  expect((0, isValidServicePricingAndDurationForVehicle_1.isValidServicePricingAndDurationForVehicle)(defaultProps)).toBe(false);
124
124
  });
125
125
  it("Should return false if durationInMinutes is more than the duration for the service", () => {
126
126
  defaultProps.servicePricingAndDurationForVehicle.durationInMinutes =
127
127
  durationInMinutes +
128
- constants_1.PROFESSIONAL_SERVICE_MINIMUM_DURATION_INCREMENT_IN_MINUTES;
128
+ constants_1.PROVIDER_SERVICE_MINIMUM_DURATION_INCREMENT_IN_MINUTES;
129
129
  expect((0, isValidServicePricingAndDurationForVehicle_1.isValidServicePricingAndDurationForVehicle)(defaultProps)).toBe(false);
130
130
  });
131
131
  it("Should return false if the type is not a valid vehicle type", () => {
@@ -1,2 +1,2 @@
1
1
  export * from "./isValidServicePricingAndDurationForVehicle";
2
- export * from "./isValidProfessionalService";
2
+ export * from "./isValidProviderService";
@@ -15,4 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./isValidServicePricingAndDurationForVehicle"), exports);
18
- __exportStar(require("./isValidProfessionalService"), exports);
18
+ __exportStar(require("./isValidProviderService"), exports);
@@ -1,2 +1,2 @@
1
1
  import type { IsValidProfessionalServiceParams } from "./types";
2
- export declare function isValidProfessionalService({ professionalService, countryServicePublicConfig, }: IsValidProfessionalServiceParams): Promise<void>;
2
+ export declare function isValidProfessionalService({ providerService, countryServicePublicConfig, }: IsValidProfessionalServiceParams): Promise<void>;
@@ -4,21 +4,21 @@ exports.isValidProfessionalService = isValidProfessionalService;
4
4
  const errors_1 = require("../../../../../errors");
5
5
  const enums_1 = require("../../../enums");
6
6
  const isValidServicePricingAndDurationForVehicle_1 = require("./isValidServicePricingAndDurationForVehicle");
7
- async function isValidProfessionalService({ professionalService, countryServicePublicConfig, }) {
8
- if (professionalService.isActive === undefined ||
9
- typeof professionalService.isActive !== "boolean") {
7
+ async function isValidProfessionalService({ providerService, countryServicePublicConfig, }) {
8
+ if (providerService.isActive === undefined ||
9
+ typeof providerService.isActive !== "boolean") {
10
10
  throw new errors_1.DoctoCarError("Professional service is active is required and must be a boolean", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_IS_ACTIVE);
11
11
  }
12
- if (professionalService.type === undefined ||
13
- !Object.values(enums_1.ServicesTypes).includes(professionalService.type)) {
12
+ if (providerService.type === undefined ||
13
+ !Object.values(enums_1.ServicesTypes).includes(providerService.type)) {
14
14
  throw new errors_1.DoctoCarError("Professional service type is required and must be a valid professional service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_TYPE);
15
15
  }
16
- const servicePublicConfig = countryServicePublicConfig[professionalService.type];
16
+ const servicePublicConfig = countryServicePublicConfig[providerService.type];
17
17
  if (servicePublicConfig === undefined) {
18
18
  throw new errors_1.DoctoCarError("Professional service public config is not defined for the professional service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_TYPE);
19
19
  }
20
- if (professionalService.pricingAndDurationByVehicleType !== undefined) {
21
- for (const pricingAndDuration of Object.values(professionalService.pricingAndDurationByVehicleType)) {
20
+ if (providerService.pricingAndDurationByVehicleType !== undefined) {
21
+ for (const pricingAndDuration of Object.values(providerService.pricingAndDurationByVehicleType)) {
22
22
  if (!(0, isValidServicePricingAndDurationForVehicle_1.isValidServicePricingAndDurationForVehicle)({
23
23
  servicePublicConfig: servicePublicConfig,
24
24
  servicePricingAndDurationForVehicle: pricingAndDuration,
@@ -29,13 +29,13 @@ async function isValidProfessionalService({ professionalService, countryServiceP
29
29
  }
30
30
  const parentsServices = servicePublicConfig.parentsServices;
31
31
  if (parentsServices !== undefined && parentsServices.length > 0) {
32
- if (professionalService.parentsServices === undefined ||
33
- professionalService.parentsServices.length !== parentsServices.length) {
34
- throw new errors_1.DoctoCarError("Professional service parents services are required and must match the professional service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_PARENTS_SERVICES);
32
+ if (providerService.parentsServices === undefined ||
33
+ providerService.parentsServices.length !== parentsServices.length) {
34
+ throw new errors_1.DoctoCarError("Service provider service parents services are required and must match the service provider service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_PARENTS_SERVICES);
35
35
  }
36
36
  for (const parentService of parentsServices) {
37
- if (!professionalService.parentsServices?.includes(parentService)) {
38
- throw new errors_1.DoctoCarError("Professional service parents services are required and must match the professional service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_PARENTS_SERVICES);
37
+ if (!providerService.parentsServices?.includes(parentService)) {
38
+ throw new errors_1.DoctoCarError("Service provider service parents services are required and must match the service provider service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_PARENTS_SERVICES);
39
39
  }
40
40
  }
41
41
  }