Sha256: cfce03b7705ab253ab52075bf21210bf939365b1721beb927641621f48dfa680
Contents?: true
Size: 919 Bytes
Versions: 2
Compression:
Stored size: 919 Bytes
Contents
require 'ruleby' class Transporter < Ruleby::Rulebook attr_writer :transporter_ids, :order, :cart def rules TransporterRule.find_all_by_active(true).each do |transporter| condition = transporter.conditions condition.gsub!(/Cart/,'Order') unless @cart rule eval(condition) do |context| if @cart && @cart.address_delivery && !transporter.geo_zones.empty? && transporter.geo_zones.map(&:id).include?(@cart.address_delivery.country.id) @transporter_ids << transporter.id elsif @cart && @cart.address_delivery && transporter.geo_zones.empty? p 'skipped' elsif @cart && @cart.address_delivery && !transporter.geo_zones.empty? && !transporter.geo_zones.map(&:id).include?(@cart.address_delivery.country.id) p 'skipped' else @transporter_ids << transporter.id end end end @transporter_ids end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
forgeos_commerce-1.9.1.rc1 | lib/transporter.rb |
forgeos_commerce-1.9.0 | lib/transporter.rb |