import BaseError from './base.error'; export default class OrderValidationError extends BaseError { constructor (type: any, message: any) { super({ type: (type ? type : 'INVALID_ORDER_DATA'), message: message ? message : "Invalid Order Data, Please check all the mandatory fields." }); } } export class OrderValidationErrorWithName extends BaseError { constructor (name: any, message: any) { super({ type: (name ? name : 'INVALID_ORDER_DATA'), message: message ? message : "Invalid Order Data, Please check all the mandatory fields." }); } } export class OrderValidationDuplicateOrder extends BaseError { constructor (name: any, message: any) { super({ type: (name ? name : 'DUPLICATE_ORDER'), message: message ? message : "Order with ", code:409 }); } } export const OrderValidationErrorType={ INVALID_ORDER_DATA: "INVALID_ORDER_DATA", MISSING_ORDER_DATA: "MISSING_ORDER_DATA", MISSING_PICKUP_DATA: "MISSING_PICKUP_DATA", DUPLICATE_ORDER_DATA: "DUPLICATE_ORDER_DATA" } export const OrderValidationErrorMessage={ MISSING_STORE_EXTERNAL_ID: 'storeExternalId is a required field. The field is missing.', MISSING_STORE_NAME: 'store name is a required field. The field is missing.', INVALID_STORE_EXTERNAL_ID: 'No such storeExternalId exists in our system. Please provide a valid storeExternalId.', MISSING_BRAND_EXTERNAL_ID: 'brandExternalId is a required field. The field is missing.', INVALID_BRAND_EXTERNAL_ID: 'The value for the brandExternalId field is invalid.', MISSING_DELIVERY_ADDRESS: 'deliveryAddress is a required field. The field is missing.', INVALID_DELIVERY_ADDRESS: 'The value for the deliveryAddress field is invalid.', MISSING_DELIVERY_CONTACT: 'deliveryContact is a required field. The field is missing.', INVALID_DELIVERY_CONTACT: 'The value for the deliveryContact field is invalid.', INVALID_PICKUP_ADDRESS: 'The value for the pickup address field is invalid.', INVALID_PICKUP_CONTACT: 'The value for the pickup contact field is invalid.', MISSING_PICKUP_TIME: 'userPickupTime is a required field. The field is missing.', MISSING_DROPOFF_TIME: 'dropOffTime is a required field. The field is missing.', MISSING_ORDER_VALUE: 'orderValue is a required field. The field is missing', INVALID_ORDER_VALUE: 'The value for the orderValue field is invalid.', MISSING_PACKAGES: 'packages is a required field. The field is missing', INVALID_PACKAGES: 'The value for the packages field is invalid.', MISSING_SPIRIT: 'isSpirit is a required field. The field is missing', INVALID_SPIRIT: 'The value for the isSpirit field is invalid.', MISSING_FIELD: ' is a required field. The field is missing.', INVALID_FIELD: 'The value for the {{field}} field is invalid.', INVALID_PICKUP_OR_DROPOFF_TIME: "Invalid pickup or drop-off time. Pickup time should be before drop-off time.", INVALID_ORDER_DATA: "Invalid order data.", INVALID_BUSINESS: "Business is either inactive or deleted.", INVALID_BRAND: "Brand is either inactive or deleted.", INVALID_SIGNATURE_OPTION: "Invalid Signature option. Allowed signature options are 'required','required_recipient','not_required','unattended'", INVALID_ORDER_EXTERNAL_ID: "'orderExternalId' is required.", DUPLICATE_ORDER_EXTERNAL_ID: "'{{orderExternalId}}' is already used by an existing Order. Please try with another one.", DUPLICATE_ORDER_EXTERNAL_ID_TRACKER: "'{{orderExternalId}}' is already used by an existing Tracker. Please try with another one.", MISSING_PICKUP_CONTACT: "pickup contact is a required field. The field is missing", MISSING_PICKUP_ADDRESS: 'pickup address is a required field. The field is missing', INVALID_PICKUP_ZIPCODE: 'Please enter a valid Zipcode for Pickup Address', INVALID_DELIVERY_ZIPCODE: 'Please enter a valid Zipcode for Delivery Address', INVALID_ALTERNATE_LOCATION_ZIPCODE: 'Please enter a valid Zipcode for Alternate Location Address', UNSUPPORTED_CURRENCY : 'The currency is not supported by Delivery Solutions. Please try with another one.', MISSING_DISPATCH_TIME: 'When dispatch type is scheduled, dispatch time is required.', INVALID_DISPATCH_TIME: 'THe value for dispatch time is invalid.', INVALID_DISPATCH_BASEDON: 'The value for the time dispatch is based on is invalid.', NO_PICKUP_DSP: 'There are no Pickup DSP assigned to the store', INVALID_TYPE_NOTIFYEMAIL: 'notifyEmail should be of boolean type in deliveryContact.', INVALID_TYPE_NOTIFYSMS: 'notifySms should be of boolean type in deliveryContact.', INVALID_TEMP_CONTROL_OPTION: "Invalid Temperature Control option. Allowed temperature control options are temp_control_options", INVALID_RETURN_STORE_ID: "No such returnStoreId exists with the brand '{{brandExternalId}}' in our system. Please provide a valid returnStoreId.", /* Validation errors for proposedProviers start */ MISSING_PROPOSED_PROVIDER_NAME: 'Provider name is missing in Proposed Providers', MISSING_SERVICE_ID: 'Service id is missing in Proposed Providers', PROVIDER_NOT_CONFIGURED: 'Provider not configured', SERVICE_NOT_CONFIGURED: 'Service Not Configured for Provider', PROVIDER_NOT_CONFIGURED_FOR_STORE:'Proposed provider not configured for the store', /* Validation errors for proposedProviers end */ // DL-36113 validation message INVALID_STATUS_HISTORY: 'statusHistory must be an array', STATUS_HISTORY_INVALID_OBJECT: 'Item must be an object in statusHistory at index {{index}}', STATUS_HISTORY_STATUS_MISSING: 'Status field does not exist in statusHistory for item at index {{index}}', STATUS_HISTORY_STATUS_NOT_STRING: 'Status must be a string in statusHistory for item at index {{index}}', STATUS_HISTORY_STATUS_INVALID: 'Status is invalid in statusHistory for item at index {{index}}', STATUS_HISTORY_STATUS_UPDATED_AT_MISSING: 'statusUpdatedAt field does not exist in statusHistory for item at index {{index}}', STATUS_HISTORY_STATUS_UPDATED_AT_NOT_NUMBER: 'statusUpdatedAt must be a number in statusHistory for item at index {{index}}', };