Pricing Engine - Enum Values Reference
Complete reference for all enum fields in the Pricing Engine API.
PricingRule Enums
rule_type
Field: pricing_rule.rule_type
Type: String (required)
Default: "specific_date_time"
| Value | Description | Status |
|---|---|---|
specific_date_time | Date & Time based pricing rules | ✅ Implemented |
demand_capacity | Capacity-based dynamic pricing | 🔮 Future |
performance_based | Performance metric based rules | 🔮 Future |
advance_last_minute | Booking window based rules | 🔮 Future |
Example:
{
"rule_type": "specific_date_time"
}
date_type (PricingRule Level)
Field: pricing_rule.date_type
Type: String (nullable)
Applies to: specific_date_time rules only
| Value | Description | Fields Used |
|---|---|---|
specific_date | Only date-based validity | start_date, end_date, is_no_end_date |
specific_date_time | Both date and time validity | start_date, end_date, start_time, end_time, is_no_end_date, is_no_end_time, is_anytime |
Example:
{
"rule_type": "specific_date_time",
"date_type": "specific_date",
"start_date": "2024-12-15",
"end_date": "2024-12-31",
"is_no_end_date": false
}
Example (Ongoing):
{
"date_type": "specific_date",
"start_date": "2024-01-01",
"end_date": null,
"is_no_end_date": true
}
DateTimeCondition Enums
date_type (Condition Level)
Field: date_time_condition.date_type
Type: String (required)
| Value | Description | Uses condition_items | Uses days_of_week | Example Use Case |
|---|---|---|---|---|
everyday | Applies every day | ❌ | ❌ | All-month promotion |
specific_date | Specific dates only | ✅ Date fields | ❌ | Valentine’s Day, New Year |
specific_time | Specific times daily | ✅ Time fields | ❌ | Happy Hour (daily 5-7pm) |
specific_date_time | Specific dates + times | ✅ Date + Time | ❌ | New Year’s Eve 8pm-midnight |
day_of_week | Specific weekdays | ❌ | ✅ | Weekend surge pricing |
day_time_of_week | Weekdays + time ranges | ✅ Time fields | ✅ | Friday-Sunday 7-10pm |
Examples:
Everyday:
{
"date_type": "everyday",
"action_type": "increase",
"value_type": "percentage",
"value": 1000 // 10%
}
Weekend Only:
{
"date_type": "day_of_week",
"days_of_week": [0, 6], // Sunday, Saturday
"action_type": "increase",
"value_type": "percentage",
"value": 2000 // 20%
}
Friday Night Special:
{
"date_type": "day_time_of_week",
"days_of_week": [5], // Friday
"action_type": "decrease",
"value_type": "percentage",
"value": 1500, // 15% off
"condition_items_attributes": [{
"start_time": "17:00",
"end_time": "19:00",
"is_anytime": false
}]
}
action_type
Field: date_time_condition.action_type
Type: String (required when value is specified)
| Value | Description | Effect |
|---|---|---|
increase | Raise the price | Adds to base price |
decrease | Lower the price | Subtracts from base price |
Example:
{
"action_type": "increase"
}
value_type
Field: date_time_condition.value_type
Type: String (required when value is specified)
| Value | Description | Value Format | Example |
|---|---|---|---|
percentage | Percentage adjustment | Basis points (100 = 1%) | 1500 = 15% |
fixed | Fixed amount adjustment | Cents | 50000 = ฿500.00 |
Examples:
15% increase:
{
"value_type": "percentage",
"value": 1500 // 15% = 1500 basis points
}
฿500 increase:
{
"value_type": "fixed",
"value": 50000 // ฿500 = 50000 cents
}
period_mode
Field: date_time_condition.period_mode
Type: String (nullable)
| Value | Description |
|---|---|
single | Single occurrence |
range | Range of dates/times |
Example:
{
"period_mode": "range"
}
days_of_week
Field: date_time_condition.days_of_week
Type: Integer Array
Values: 0-6
| Integer | Day | Abbreviation |
|---|---|---|
0 | Sunday | Sun |
1 | Monday | Mon |
2 | Tuesday | Tue |
3 | Wednesday | Wed |
4 | Thursday | Thu |
5 | Friday | Fri |
6 | Saturday | Sat |
Examples:
Weekends:
{
"days_of_week": [0, 6] // Sunday and Saturday
}
Weekdays:
{
"days_of_week": [1, 2, 3, 4, 5] // Mon-Fri
}
Friday Only:
{
"days_of_week": [5]
}
Calculation Examples
Base Price: ฿1,000 (100000 cents)
Percentage Adjustments
| Action | Value | Calculation | Result |
|---|---|---|---|
increase | 1000 (10%) | 1000 + (1000 × 0.10) | ฿1,100 |
increase | 1500 (15%) | 1000 + (1000 × 0.15) | ฿1,150 |
increase | 2500 (25%) | 1000 + (1000 × 0.25) | ฿1,250 |
decrease | 1000 (10%) | 1000 - (1000 × 0.10) | ฿900 |
decrease | 2000 (20%) | 1000 - (1000 × 0.20) | ฿800 |
Fixed Amount Adjustments
| Action | Value (cents) | Calculation | Result |
|---|---|---|---|
increase | 50000 (฿500) | 1000 + 500 | ฿1,500 |
increase | 20000 (฿200) | 1000 + 200 | ฿1,200 |
decrease | 10000 (฿100) | 1000 - 100 | ฿900 |
decrease | 50000 (฿500) | 1000 - 500 | ฿500 |
Value Conversion Reference
Percentage (Basis Points)
| Display | Basis Points | Decimal |
|---|---|---|
| 1% | 100 | 0.01 |
| 5% | 500 | 0.05 |
| 10% | 1000 | 0.10 |
| 15% | 1500 | 0.15 |
| 20% | 2000 | 0.20 |
| 25% | 2500 | 0.25 |
| 50% | 5000 | 0.50 |
Formula:basis_points = percentage × 100percentage = basis_points / 100
Fixed Amount (Cents)
| Display | Cents |
|---|---|
| ฿1.00 | 100 |
| ฿10.00 | 1000 |
| ฿50.00 | 5000 |
| ฿100.00 | 10000 |
| ฿500.00 | 50000 |
| ฿1000.00 | 100000 |
Formula:cents = baht × 100baht = cents / 100
Common Patterns
Weekend Surge (20% increase)
{
"pricing_rule": {
"name": "Weekend Surge",
"rule_type": "specific_date_time",
"date_type": "specific_date",
"start_date": "2024-01-01",
"is_no_end_date": true,
"requires_approval": false,
"date_time_conditions_attributes": [{
"date_type": "day_of_week",
"days_of_week": [0, 6],
"action_type": "increase",
"value_type": "percentage",
"value": 2000
}]
}
}
Happy Hour (15% discount, Mon-Fri 5-7pm)
{
"pricing_rule": {
"name": "Happy Hour",
"rule_type": "specific_date_time",
"date_type": "specific_date",
"start_date": "2024-01-01",
"is_no_end_date": true,
"date_time_conditions_attributes": [{
"date_type": "day_time_of_week",
"days_of_week": [1, 2, 3, 4, 5],
"action_type": "decrease",
"value_type": "percentage",
"value": 1500,
"condition_items_attributes": [{
"start_time": "17:00",
"end_time": "19:00"
}]
}]
}
}
Holiday Special (New Year’s Eve)
{
"pricing_rule": {
"name": "New Year's Eve Special",
"rule_type": "specific_date_time",
"date_type": "specific_date_time",
"start_date": "2024-12-31",
"end_date": "2024-12-31",
"start_time": "20:00",
"end_time": "23:59",
"requires_approval": true,
"date_time_conditions_attributes": [{
"date_type": "specific_date_time",
"action_type": "increase",
"value_type": "fixed",
"value": 100000, // ฿1000
"condition_items_attributes": [{
"start_date": "2024-12-31",
"end_date": "2024-12-31",
"start_time": "20:00",
"end_time": "23:59"
}]
}]
}
}
Validation Rules
Required Fields
PricingRule:
name(string)rule_type(enum)priority(integer, 0-1000)
DateTimeCondition:
date_type(enum)action_type(enum) - when value specifiedvalue_type(enum) - when value specifiedvalue(integer) - when action specified
Conditional Requirements
If date_type is day_of_week or day_time_of_week:
days_of_weekarray is required
If date_type is specific_date, specific_time, specific_date_time, or day_time_of_week:
- At least one
condition_itemis required
If end_date is provided:
- Must be >=
start_date - If
is_no_end_dateis true,end_dateis ignored
If end_time is provided:
- Must be >=
start_time - If
is_no_end_timeoris_anytimeis true, times are ignored
API Response Format
{
"data": {
"id": 123,
"restaurant_id": "rest_abc123",
"name": "Weekend Surge",
"rule_type": "specific_date_time",
"priority": 100,
"active": true,
"requires_approval": false,
"date_type": "specific_date",
"start_date": "2024-01-01",
"end_date": null,
"start_time": null,
"end_time": null,
"is_no_end_date": true,
"is_no_end_time": false,
"is_anytime": false,
"ongoing": true,
"apply_to_all_packages": true,
"package_ids": [],
"date_time_conditions": [
{
"id": 456,
"date_type": "day_of_week",
"period_mode": "range",
"action_type": "increase",
"value_type": "percentage",
"value": 2000,
"days_of_week": [0, 6],
"condition_items": []
}
],
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
}