Skip to main content
This module contains all validation-related models used for validating orders, detecting changes, and managing order revalidation workflows.

Order Validation Models

OrderValidationResponseDTO

Response model from order validation service.
FieldTypeRequiredDescription
typestringYesValidation result: “readyForPayment”, “validationError”, “noPaymentMethod”
errorsstring[]NoValidation error messages (when type is “validationError”)
validationDataobjectNoValidation-related fields (deliveryFee, deliveryTime, etc.)
readyTimedatetimeNoWhen order will be ready for pickup
deliveryTimedatetimeNoEstimated delivery time
deliveryAddressAddressDTONoValidated delivery address
availablePaymentMethodsstring[]NoPayment methods available for this order

Validation Types

readyForPayment

Order is valid and ready for payment processing. Required validationData fields:
  • paymentType: Type of payment processing to use

validationError

Order has validation issues that must be resolved. Includes:
  • errors: Array of specific validation error messages
  • Details about what needs to be corrected

noPaymentMethod

Order is valid but no payment method is available. Includes:
  • availablePaymentMethods: List of payment options the customer can set up

Validation Data Fields

The validationData object may contain:
FieldTypeDescription
paymentTypestringRequired payment processing type
deliveryFeenumberCalculated delivery fee
deliveryTimestringEstimated delivery duration
preparationTimestringOrder preparation time
minimumAmountnumberMinimum order amount requirement
serviceFeenumberPlatform service fee

Order Change Detection Models

OrderValidationSummaryDTO

Summary of changes detected during order revalidation.
FieldTypeRequiredDescription
has_changesbooleanYesWhether any changes were detected
changesstring[]YesHuman-readable list of changes (default: [])
delivery_fee_changedbooleanYesWhether delivery fee changed (default: false)
preparation_time_changedbooleanYesWhether preparation time changed (default: false)
items_changedbooleanYesWhether items became unavailable (default: false)
price_changedbooleanYesWhether prices changed (default: false)
original_draftOrderDraftDTOYesOriginal order draft
updated_draftOrderDraftDTOYesUpdated order draft with changes
validationOrderValidationResponseDTOYesValidation result for updated draft

Change Types

The validation summary tracks different types of changes:

Price Changes

  • Product prices increased or decreased
  • Discount availability changed
  • Tax rates updated
  • Currency conversion rates changed

Availability Changes

  • Products became unavailable
  • Options no longer available
  • Deals expired or became unavailable
  • Quantity restrictions changed

Delivery Changes

  • Delivery fee changed
  • Delivery time estimates updated
  • Delivery zones modified
  • Service availability changed

Preparation Changes

  • Kitchen preparation times updated
  • Menu item preparation complexity changed
  • Staff capacity adjustments

Change Communication

Changes are presented to customers as human-readable messages: Example changes array:
[
  "Delivery fee increased from CHF 3.50 to CHF 4.00",
  "Margherita Pizza is no longer available",
  "Estimated preparation time increased by 10 minutes"
]

Combined Validation Models

OrderDraftWithValidationDTO

Combined model containing both order draft and validation results.
FieldTypeRequiredDescription
orderDraftOrderDraftDTOYesOrder draft being validated
validationOrderValidationResponseDTOYesValidation result for the draft

Model Validation

The model includes validation to ensure proper structure:
  • Missing Validation: If validation field is missing, creates error validation
  • Structural Integrity: Ensures both orderDraft and validation are present
  • Default Error: Provides “MISSING_VALIDATION_SECTION” error for malformed data

Validation Workflow

Initial Validation

  1. Draft Creation: Customer builds order draft
  2. Validation Request: System validates draft before payment
  3. Result Processing: Handle validation response
  4. Customer Communication: Present any issues or proceed to payment

Revalidation Process

  1. Change Detection: External changes affect existing order
  2. Revalidation: Re-validate order with current conditions
  3. Change Analysis: Compare original vs updated order
  4. Customer Notification: Inform customer of changes
  5. Confirmation: Customer accepts changes or modifies order

Validation Scenarios

Successful Validation

  • Order meets all requirements
  • Payment methods available
  • All items in stock
  • Delivery possible

Validation Errors

  • Missing required information
  • Items unavailable
  • Delivery not possible
  • Order below minimum amount

Revalidation Changes

  • Price fluctuations
  • Item availability changes
  • Delivery fee updates
  • Preparation time changes

Error Handling

Validation errors are categorized:

Customer Fixable

  • Missing delivery address
  • Order below minimum amount
  • Invalid payment method
  • Missing contact information

System Issues

  • Item availability synchronization
  • Pricing system errors
  • Payment gateway issues
  • Delivery service problems

Business Rules

  • Operating hours restrictions
  • Delivery area limitations
  • Item quantity limits
  • Promotional code issues
The validation system ensures order accuracy and handles dynamic changes in pricing, availability, and business conditions while maintaining transparent communication with customers.