Class: HhPackage::Package::Diy Private

Inherits:
Base
  • Object
show all
Includes:
ModelConcerns::AgendaType, ModelConcerns::CommonRelations, ModelConcerns::PackageTraits, ModelConcerns::Translation
Defined in:
app/models/hh_package/package/diy.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Model to save DIY package to database Auditable

DIY Package Pricing Policy ==

DIY packages are enforced to have exactly one pricing record to maintain data consistency. This prevents the issue where admin dashboard and API endpoints return different pricing data.

When updating pricing attributes through nested attributes, the existing pricing record will be updated instead of creating a new one. Multiple pricings are automatically consolidated during save operations.

Constant Summary collapse

TYPE_SHORT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'diy'.freeze
'menu_v3'.freeze

Constants included from ModelConcerns::MixAndMatch

ModelConcerns::MixAndMatch::MINIMUM_MIX_AND_MATCH

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ModelConcerns::PackageTraits

#badge_percentage, #fetch_comemore_payless, #have_menu_quantity_limit?, #prepaid_package?, #promotion_badge, #promotion_text, #promotion_type, #reservation_duration_for_display, #validate_name_and_description

Methods included from ModelConcerns::AgendaType

#agenda_type

Methods inherited from Base

#kids_price_rate, #menu_group_id, #menu_group_id=, per_pack_or_set, #reservations

Methods included from ModelConcerns::DynamicPricingsForPackage

#ala_carte?, #decide_max_seat, #decide_min_seat, #dynamic_price_comemore_payless?, #dynamic_pricings_as_json, #highest_pricing, #lowest_pricing, #price_currency, #pricing_tier, #pricing_type_humanize, #validate_comemore_payless_promotion, #validate_menu_v3_diy

Methods included from ModelConcerns::MixAndMatch

#allow_mix_and_match?, #allow_mix_ayce?, #mix_n_match_qty, #use_mix_and_match?

Methods included from SoftDelete

#soft_deleted?, #soft_destroy

Class Method Details

.pricing_typeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



106
107
108
# File 'app/models/hh_package/package/diy.rb', line 106

def self.pricing_type
  :per_item
end

Instance Method Details

#for_delivery?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


114
115
116
# File 'app/models/hh_package/package/diy.rb', line 114

def for_delivery?
  false
end

#for_dine_in?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


110
111
112
# File 'app/models/hh_package/package/diy.rb', line 110

def for_dine_in?
  true
end

#pricing_model_and_dynamic_pricing_type(package_count: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Override to provide consistent pricing model for DIY packages This ensures the validator gets the correct pricing type regardless of package_attr state



82
83
84
# File 'app/models/hh_package/package/diy.rb', line 82

def pricing_model_and_dynamic_pricing_type(package_count: nil)
  :per_item_and_normal_price
end

#route_nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



90
91
92
# File 'app/models/hh_package/package/diy.rb', line 90

def route_name
  'diy'
end

#slug_codeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



102
103
104
# File 'app/models/hh_package/package/diy.rb', line 102

def slug_code
  'DIY'
end

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



98
99
100
# File 'app/models/hh_package/package/diy.rb', line 98

def tnc_link
  AdminSetting.term_condition_link_diy.presence || nil
end

#typeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



86
87
88
# File 'app/models/hh_package/package/diy.rb', line 86

def type
  'DIY'
end

#type_shortObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



94
95
96
# File 'app/models/hh_package/package/diy.rb', line 94

def type_short
  'diy'
end