Module: PackageBooking::CustomPackagePricing

Included in:
Owners::Update, Users::Update
Defined in:
app/my_lib/package_booking/custom_package_pricing.rb

Overview

typed: false frozen_string_literal: true

Instance Method Summary collapse

Instance Method Details

#apply_custom_package_pricing_featureObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/my_lib/package_booking/custom_package_pricing.rb', line 5

def apply_custom_package_pricing_feature
  return unless reservation.custom_package_pricing?

  self.package = package.map do |pack|
    custom_pack = reservation.custom_package_pricing.find { |rpack| rpack['id'].to_s == pack['id'].to_s }
    if custom_pack
      pack.merge custom_pack
    else
      pack
    end
  end
end