@doctocar/tooling 0.3.1-20 → 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.
- package/dist/emails/types/customer/CustomerConfirmedOrderCancelledEmailData.type.d.ts +1 -1
- package/dist/emails/types/customer/CustomerOrderReviewRequestedEmailData.type.d.ts +1 -1
- package/dist/emails/types/customer/CustomerServiceCompletedByProfessionalEmailData.type.d.ts +1 -1
- package/dist/emails/types/customer/CustomerServiceStartedEmailData.type.d.ts +1 -1
- package/dist/emails/types/customer/CustomerUpcomingOrderReminderEmailData.type.d.ts +1 -1
- package/dist/emails/types/professional/ProfessionalConfirmedOrderCancelledEmailData.type.d.ts +1 -1
- package/dist/emails/types/professional/ProfessionalOrderIssueReportedConfirmationEmailData.type.d.ts +1 -1
- package/dist/emails/types/professional/ProfessionalOrderNewMessageReceivedEmailData.type.d.ts +1 -1
- package/dist/emails/types/professional/ProfessionalServiceCompletedByProfessionalEmailData.type.d.ts +1 -1
- package/dist/errors/enums/cloudFunctions/orders/CancelConfirmedOrInProgressOrderErrorCodes.enum.d.ts +1 -1
- package/dist/errors/enums/cloudFunctions/orders/CancelConfirmedOrInProgressOrderErrorCodes.enum.js +1 -1
- package/dist/errors/enums/cloudFunctions/orders/ConfirmServiceCompletionByServiceProviderErrorCodes.enum.d.ts +7 -0
- package/dist/errors/enums/cloudFunctions/orders/ConfirmServiceCompletionByServiceProviderErrorCodes.enum.js +11 -0
- package/dist/errors/enums/cloudFunctions/orders/StartConfirmedOrderByServiceProviderErrorCodes.enum.d.ts +6 -0
- package/dist/errors/enums/cloudFunctions/orders/StartConfirmedOrderByServiceProviderErrorCodes.enum.js +10 -0
- package/dist/errors/enums/cloudFunctions/orders/index.d.ts +2 -2
- package/dist/errors/enums/cloudFunctions/orders/index.js +2 -2
- package/dist/errors/enums/cloudFunctions/serviceProviderUsers/DeleteServiceProviderUserServiceErrorCodes.enum.d.ts +1 -1
- package/dist/errors/enums/cloudFunctions/serviceProviderUsers/DeleteServiceProviderUserServiceErrorCodes.enum.js +1 -1
- package/dist/errors/enums/cloudFunctions/serviceProviderUsers/UpdateServiceProviderUserServiceErrorCodes.enum.d.ts +1 -1
- package/dist/errors/enums/cloudFunctions/serviceProviderUsers/UpdateServiceProviderUserServiceErrorCodes.enum.js +1 -1
- package/dist/firebase/cloudFunctions/enums/OnCallCloudFunctionsNames.enum.d.ts +2 -2
- package/dist/firebase/cloudFunctions/enums/OnCallCloudFunctionsNames.enum.js +2 -2
- package/dist/firebase/cloudFunctions/enums/TaskCloudFunctionsNames.enum.d.ts +1 -1
- package/dist/firebase/cloudFunctions/enums/TaskCloudFunctionsNames.enum.js +1 -1
- package/dist/firebase/cloudFunctions/maps/OnCallCloudFunctionsTypeMappings.map.d.ts +7 -7
- package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderRequestData.type.d.ts +4 -0
- package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderRequestData.type.js +2 -0
- package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderResponseData.type.d.ts +1 -0
- package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderResponseData.type.js +2 -0
- package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderRequestData.type.d.ts +4 -0
- package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderRequestData.type.js +2 -0
- package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderResponseData.type.d.ts +1 -0
- package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderResponseData.type.js +2 -0
- package/dist/firebase/cloudFunctions/types/orders/index.d.ts +4 -4
- package/dist/firebase/cloudFunctions/types/orders/index.js +4 -4
- package/dist/firebase/cloudFunctions/types/users/serviceProviderUsers/UpdateServiceProviderUserServiceRequestData.type.d.ts +2 -2
- package/dist/firebase/firestore/constants/index.d.ts +4 -4
- package/dist/firebase/firestore/constants/index.js +4 -4
- package/dist/firebase/firestore/constants/providerLocationServiceMaxRadiusInKM.constant.d.ts +1 -0
- package/dist/firebase/firestore/constants/providerLocationServiceMaxRadiusInKM.constant.js +4 -0
- package/dist/firebase/firestore/constants/providerLocationServiceMinRadiusInKM.constant.d.ts +1 -0
- package/dist/firebase/firestore/constants/providerLocationServiceMinRadiusInKM.constant.js +4 -0
- package/dist/firebase/firestore/constants/providerServiceMinimumDurationIncrementInMinutes.constant.d.ts +1 -0
- package/dist/firebase/firestore/constants/providerServiceMinimumDurationIncrementInMinutes.constant.js +4 -0
- package/dist/firebase/firestore/constants/providerServiceMinimumPriceIncrementInCents.constant.d.ts +1 -0
- package/dist/firebase/firestore/constants/providerServiceMinimumPriceIncrementInCents.constant.js +4 -0
- package/dist/firebase/firestore/enums/FirestoreCollections.enum.d.ts +1 -1
- package/dist/firebase/firestore/enums/FirestoreCollections.enum.js +1 -1
- package/dist/firebase/firestore/enums/orders/OrderCancellationByTypes.enum.d.ts +1 -1
- package/dist/firebase/firestore/enums/orders/OrderCancellationByTypes.enum.js +1 -1
- package/dist/firebase/firestore/enums/orders/OrderServiceProviderCancellationReason.enum.d.ts +7 -7
- package/dist/firebase/firestore/enums/orders/OrderServiceProviderCancellationReason.enum.js +7 -7
- package/dist/firebase/firestore/enums/orders/dispute/OrderDisputeOpenedBy.enum.d.ts +1 -1
- package/dist/firebase/firestore/enums/orders/dispute/OrderDisputeOpenedBy.enum.js +1 -1
- package/dist/firebase/firestore/enums/orders/index.d.ts +1 -1
- package/dist/firebase/firestore/enums/orders/index.js +1 -1
- package/dist/firebase/firestore/enums/ordersIssues/CustomerOrderIssueReason.enum.d.ts +2 -2
- package/dist/firebase/firestore/enums/ordersIssues/CustomerOrderIssueReason.enum.js +2 -2
- package/dist/firebase/firestore/enums/ordersIssues/ServiceProviderOrderIssueReason.enum.d.ts +10 -0
- package/dist/firebase/firestore/enums/ordersIssues/ServiceProviderOrderIssueReason.enum.js +14 -0
- package/dist/firebase/firestore/enums/ordersIssues/index.d.ts +1 -1
- package/dist/firebase/firestore/enums/ordersIssues/index.js +1 -1
- package/dist/firebase/firestore/enums/users/professionals/ServiceProviderBadgesTypes.enum.d.ts +3 -0
- package/dist/firebase/firestore/enums/users/professionals/ServiceProviderBadgesTypes.enum.js +7 -0
- package/dist/firebase/firestore/enums/users/professionals/index.d.ts +1 -1
- package/dist/firebase/firestore/enums/users/professionals/index.js +1 -1
- package/dist/firebase/firestore/maps/FirestoreCollectionDocumentTypeMap.d.ts +2 -2
- package/dist/firebase/firestore/types/index.d.ts +1 -1
- package/dist/firebase/firestore/types/index.js +1 -1
- package/dist/firebase/firestore/types/order/FirestoreOrderCancellationReason.type.d.ts +2 -2
- package/dist/firebase/firestore/types/ordersIssues/OrderIssueReason.type.d.ts +2 -2
- package/dist/firebase/firestore/types/ordersReviews/FirestoreOrderReviewDocument.type.d.ts +1 -1
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocument.type.d.ts +49 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocument.type.js +2 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentReviewAggregates.type.d.ts +4 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentReviewAggregates.type.js +2 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentServicesLocation.type.d.ts +4 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentServicesLocation.type.js +2 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/index.d.ts +3 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/index.js +19 -0
- package/dist/firebase/firestore/types/services/ProviderService.type.d.ts +8 -0
- package/dist/firebase/firestore/types/services/ProviderService.type.js +2 -0
- package/dist/firebase/firestore/types/services/ServiceProviderService.type.d.ts +8 -0
- package/dist/firebase/firestore/types/services/ServiceProviderService.type.js +2 -0
- package/dist/firebase/firestore/types/services/index.d.ts +1 -1
- package/dist/firebase/firestore/types/services/index.js +1 -1
- package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidProfessionalService.test.js +11 -11
- package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidProviderService.test.d.ts +1 -0
- package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidProviderService.test.js +172 -0
- package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidServicePricingAndDurationForVehicle.test.js +9 -9
- package/dist/firebase/firestore/utils/dataValidators/services/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/dataValidators/services/index.js +1 -1
- package/dist/firebase/firestore/utils/dataValidators/services/isValidProfessionalService.d.ts +1 -1
- package/dist/firebase/firestore/utils/dataValidators/services/isValidProfessionalService.js +13 -13
- package/dist/firebase/firestore/utils/dataValidators/services/isValidProviderService.d.ts +2 -0
- package/dist/firebase/firestore/utils/dataValidators/services/isValidProviderService.js +42 -0
- package/dist/firebase/firestore/utils/dataValidators/services/isValidServicePricingAndDurationForVehicle.js +2 -2
- package/dist/firebase/firestore/utils/dataValidators/services/types/IsValidProfessionalServiceParams.type.d.ts +2 -2
- package/dist/firebase/firestore/utils/dataValidators/services/types/IsValidProviderServiceParams.type.d.ts +6 -0
- package/dist/firebase/firestore/utils/dataValidators/services/types/IsValidProviderServiceParams.type.js +2 -0
- package/dist/firebase/firestore/utils/dataValidators/services/types/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/dataValidators/services/types/index.js +1 -1
- package/dist/firebase/firestore/utils/order/__tests__/buildOrderServicePreTaxLinesAndServicesDetails.test.js +13 -13
- package/dist/firebase/firestore/utils/order/buildOrderServicePreTaxLinesAndServicesDetails.d.ts +1 -1
- package/dist/firebase/firestore/utils/order/buildOrderServicePreTaxLinesAndServicesDetails.js +2 -2
- package/dist/firebase/firestore/utils/order/types/BuildOrderServicePreTaxLinesAndServicesDetailsProps.type.d.ts +2 -2
- package/dist/firebase/firestore/utils/reviews/__tests__/getAverageRatingFromReviewAggregates.test.d.ts +1 -0
- package/dist/firebase/firestore/utils/reviews/__tests__/getAverageRatingFromReviewAggregates.test.js +97 -0
- package/dist/firebase/firestore/utils/reviews/getAverageRatingFromReviewAggregates.d.ts +2 -0
- package/dist/firebase/firestore/utils/reviews/getAverageRatingFromReviewAggregates.js +13 -0
- package/dist/firebase/firestore/utils/reviews/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/reviews/index.js +1 -1
- package/dist/firebase/firestore/utils/services/__tests__/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.test.d.ts +1 -0
- package/dist/firebase/firestore/utils/services/__tests__/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.test.js +101 -0
- package/dist/firebase/firestore/utils/services/__tests__/createServiceVehicleComboKey.test.js +4 -4
- package/dist/firebase/firestore/utils/services/__tests__/getBookableServiceProviderServicesForVehicleType.test.js +49 -49
- package/dist/firebase/firestore/utils/services/__tests__/getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow.test.js +32 -32
- package/dist/firebase/firestore/utils/services/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.d.ts +2 -0
- package/dist/firebase/firestore/utils/services/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.js +18 -0
- package/dist/firebase/firestore/utils/services/getBookableServiceProviderServicesForVehicleType.d.ts +3 -3
- package/dist/firebase/firestore/utils/services/getBookableServiceProviderServicesForVehicleType.js +11 -11
- package/dist/firebase/firestore/utils/services/getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow.d.ts +1 -1
- package/dist/firebase/firestore/utils/services/getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow.js +2 -2
- package/dist/firebase/firestore/utils/services/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/services/index.js +1 -1
- package/dist/firebase/firestore/utils/services/types/ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs.type.d.ts +7 -0
- package/dist/firebase/firestore/utils/services/types/ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs.type.js +2 -0
- package/dist/firebase/firestore/utils/services/types/GetBookableServiceProviderServicesForVehicleTypeParams.type.d.ts +2 -2
- package/dist/firebase/firestore/utils/services/types/GetServiceProviderActiveServicePricingAndDurationForVehicleOrThrowParams.type.d.ts +2 -2
- package/dist/firebase/firestore/utils/services/types/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/services/types/index.js +1 -1
- package/dist/firebase/firestore/utils/stubs/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/stubs/index.js +1 -1
- package/dist/firebase/firestore/utils/stubs/ordersReviews/firestoreOrderReviewDocumentStub.js +1 -1
- package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/firestoreServiceProviderUserPublicDocumentStub.d.ts +2 -0
- package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/firestoreServiceProviderUserPublicDocumentStub.js +44 -0
- package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/index.d.ts +1 -0
- package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/index.js +17 -0
- package/dist/firebase/firestore/utils/stubs/services/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/stubs/services/index.js +1 -1
- package/dist/firebase/firestore/utils/stubs/services/pricingAndDurationForVehicleStub.js +2 -2
- package/dist/firebase/firestore/utils/stubs/services/providerServiceStub.d.ts +5 -0
- package/dist/firebase/firestore/utils/stubs/services/providerServiceStub.js +21 -0
- package/dist/firebase/firestore/utils/stubs/services/serviceProviderServiceStub.d.ts +5 -0
- package/dist/firebase/firestore/utils/stubs/services/serviceProviderServiceStub.js +21 -0
- package/dist/firebase/storage/enums/FirebaseStorageBasePaths.enum.js +1 -1
- package/dist/gcp/cloudTask/enums/CloudTasksQueueName.enum.d.ts +1 -1
- package/dist/gcp/cloudTask/enums/CloudTasksQueueName.enum.js +1 -1
- package/dist/gcp/cloudTask/maps/CloudTaskEnvelopeMap.map.d.ts +2 -2
- package/dist/gcp/cloudTask/types/OnTaskRecomputeServiceProviderAvailabilityEnvelope.type.d.ts +1 -1
- package/dist/gcp/cloudTask/types/index.d.ts +1 -1
- package/dist/gcp/cloudTask/types/index.js +1 -1
- package/dist/gcp/cloudTask/utils/stubs/index.d.ts +1 -1
- package/dist/gcp/cloudTask/utils/stubs/index.js +1 -1
- package/dist/gcp/cloudTask/utils/stubs/onTaskRecomputeServiceProviderAvailabilityEnvelopeStub.js +1 -1
- package/dist/pricing/__tests__/calculateInvoiceTotalWithTax.util.test.js +3 -3
- package/dist/stripe/types/StripeCustomServiceProviderPayoutMetadata.type.d.ts +5 -0
- package/dist/stripe/types/StripeCustomServiceProviderPayoutMetadata.type.js +2 -0
- package/dist/stripe/types/index.d.ts +1 -1
- package/dist/stripe/types/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare enum CustomerOrderIssueReason {
|
|
2
|
-
|
|
2
|
+
SERVICE_PROVIDER_BEHAVIOR_ISSUE = "service_provider_behavior_issue",
|
|
3
3
|
VEHICLE_DAMAGE_OR_THEFT = "vehicle_damage_or_theft",
|
|
4
|
-
|
|
4
|
+
SERVICE_PROVIDER_ABSENT_OR_LATE = "service_provider_absent_or_late",
|
|
5
5
|
SERVICE_QUALITY_ISSUE = "service_quality_issue",
|
|
6
6
|
PAYMENT_ISSUE = "payment_issue",
|
|
7
7
|
OTHER = "other"
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CustomerOrderIssueReason = void 0;
|
|
4
4
|
var CustomerOrderIssueReason;
|
|
5
5
|
(function (CustomerOrderIssueReason) {
|
|
6
|
-
CustomerOrderIssueReason["
|
|
6
|
+
CustomerOrderIssueReason["SERVICE_PROVIDER_BEHAVIOR_ISSUE"] = "service_provider_behavior_issue";
|
|
7
7
|
CustomerOrderIssueReason["VEHICLE_DAMAGE_OR_THEFT"] = "vehicle_damage_or_theft";
|
|
8
|
-
CustomerOrderIssueReason["
|
|
8
|
+
CustomerOrderIssueReason["SERVICE_PROVIDER_ABSENT_OR_LATE"] = "service_provider_absent_or_late";
|
|
9
9
|
CustomerOrderIssueReason["SERVICE_QUALITY_ISSUE"] = "service_quality_issue";
|
|
10
10
|
CustomerOrderIssueReason["PAYMENT_ISSUE"] = "payment_issue";
|
|
11
11
|
CustomerOrderIssueReason["OTHER"] = "other";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum ServiceProviderOrderIssueReason {
|
|
2
|
+
CUSTOMER_BEHAVIOR_ISSUE = "customer_behavior_issue",
|
|
3
|
+
SAFETY_OR_SECURITY_ISSUE = "safety_or_security_issue",
|
|
4
|
+
CUSTOMER_ABSENT_OR_UNRESPONSIVE = "customer_absent_or_unresponsive",
|
|
5
|
+
LOCATION_ACCESS_ISSUE = "location_access_issue",
|
|
6
|
+
VEHICLE_NOT_COMPLIANT = "vehicle_not_compliant",
|
|
7
|
+
PAYMENT_OR_PAYOUT_ISSUE = "payment_or_payout_issue",
|
|
8
|
+
WEATHER_CONDITIONS_ISSUE = "weather_conditions_issue",
|
|
9
|
+
OTHER = "other"
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceProviderOrderIssueReason = void 0;
|
|
4
|
+
var ServiceProviderOrderIssueReason;
|
|
5
|
+
(function (ServiceProviderOrderIssueReason) {
|
|
6
|
+
ServiceProviderOrderIssueReason["CUSTOMER_BEHAVIOR_ISSUE"] = "customer_behavior_issue";
|
|
7
|
+
ServiceProviderOrderIssueReason["SAFETY_OR_SECURITY_ISSUE"] = "safety_or_security_issue";
|
|
8
|
+
ServiceProviderOrderIssueReason["CUSTOMER_ABSENT_OR_UNRESPONSIVE"] = "customer_absent_or_unresponsive";
|
|
9
|
+
ServiceProviderOrderIssueReason["LOCATION_ACCESS_ISSUE"] = "location_access_issue";
|
|
10
|
+
ServiceProviderOrderIssueReason["VEHICLE_NOT_COMPLIANT"] = "vehicle_not_compliant";
|
|
11
|
+
ServiceProviderOrderIssueReason["PAYMENT_OR_PAYOUT_ISSUE"] = "payment_or_payout_issue";
|
|
12
|
+
ServiceProviderOrderIssueReason["WEATHER_CONDITIONS_ISSUE"] = "weather_conditions_issue";
|
|
13
|
+
ServiceProviderOrderIssueReason["OTHER"] = "other";
|
|
14
|
+
})(ServiceProviderOrderIssueReason || (exports.ServiceProviderOrderIssueReason = ServiceProviderOrderIssueReason = {}));
|
|
@@ -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("./
|
|
20
|
+
__exportStar(require("./ServiceProviderOrderIssueReason.enum"), exports);
|
|
@@ -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 = {}));
|
|
@@ -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("./
|
|
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,
|
|
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.
|
|
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 "./
|
|
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("./
|
|
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,
|
|
2
|
-
export type FirestoreOrderCancellationReason = OrderSystemCancellationReason | OrderCustomerCancellationReason |
|
|
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,
|
|
2
|
-
export type OrderIssueReason = CustomerOrderIssueReason |
|
|
1
|
+
import type { CustomerOrderIssueReason, ServiceProviderOrderIssueReason } from "../../enums";
|
|
2
|
+
export type OrderIssueReason = CustomerOrderIssueReason | ServiceProviderOrderIssueReason;
|
|
@@ -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,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,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
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
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("./
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
86
|
-
servicePricingAndDurationForVehicle: defaultProps.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
151
|
+
defaultProps.providerService = {
|
|
152
152
|
isActive: true,
|
|
153
153
|
type: enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT,
|
|
154
154
|
parentsServices: [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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.
|
|
15
|
+
minimumPriceInCents = constants_1.PROVIDER_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS;
|
|
16
16
|
maximumPriceInCents =
|
|
17
|
-
constants_1.
|
|
17
|
+
constants_1.PROVIDER_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS * 10;
|
|
18
18
|
durationInMinutes =
|
|
19
|
-
constants_1.
|
|
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.
|
|
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
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
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 "./
|
|
2
|
+
export * from "./isValidProviderService";
|