Skip to main content

Search & Pricing Rules

หน้านี้สกัดจาก PriceEstimationService.cs, QuoteOrchestrator.cs และ Catalog validators

Search flow

Branch validation

RuleError
Pickup branch code ต้องพบใน BranchCarProSyncPickup branch with code X not found
Pickup branch ต้อง ActivePickup branch with code X is not active
Return branch code ต้องพบใน BranchCarProSyncReturn branch with code X not found
Return branch ต้อง ActiveReturn branch with code X is not active

CarPro mapping

Local fieldSource
Car groupCarGroupPrice.CarGrop จาก CarPro
Total priceCarGroupPrice.TotalAmount
Price per dayTotalAmount / SoldDays
AvailabilityCarGroupPrice.CarAvailable
Display name/images/luggage/fuel/transmissionLocal Cars, CarImages, CarCarProSync, Fuel

Promotion/CDP fallback

ถ้า CarPro ตอบ Success != y และ VarianceReason มีคำว่า invalid cdp:

  1. Catalog เรียก CarPro ใหม่โดยไม่ส่ง promotion code
  2. map ผลลัพธ์ตามปกติ
  3. ตั้ง IsInvalidPromotionCode = true
  4. ตัด PromotionCode ออกจาก car item

ถ้า fallback ยัง fail จะ throw Price estimation failed: {reason}

Client-side filtering หลัง CarPro

FilterLogic
CarGroupต้องอยู่ใน list ที่ request ส่งมา
MinPrice / MaxPriceเทียบกับ pricePerDay
MinPricePerDayกรองหลัง map result
TransmissionTypeเทียบ ModelTransmissionDesc
FuelTypeเทียบ ModelFuelDesc

Price quote orchestration

POST /public/price/quote รวม 4 ส่วน:

ส่วนService/Source
Car pricePriceEstimationService.GetPriceEstimationAsync
Add-on priceAddOnService.GetActiveAddOnsWithPricingAsync
Fuel serviceหา car จาก car group แล้วดึง fuel
One-way rentalOneWayRentalService.GetOnWayRentalPriceAsync

Validator สำคัญ

RequestRule
Price estimationPickupBranchCode และ ReturnBranchCode ต้องเป็นค่าบวก, date dd/MM/yyyy, time HH:mm, return ต้องหลัง pickup
Promotion updatename required, image key required, description max 200, show flags not null
OWR create/updatename required, pickup required, return locations อย่างน้อย 1, min days ต้องเป็นค่าบวก, max days ต้องมากกว่า min days, price ต้องไม่ติดลบ
Signed URLImageKey required, ExpiryMinutes 2..1440