Revisions
-
beautifulcode renamed this gist
Apr 25, 2009 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
beautifulcode revised this gist
Apr 25, 2009 . 1 changed file with 7 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,12 @@ class Order < ActiveRecord::Base def processing_fee packages_with_processing_fees = ['Package', 'FamilyPackage', 'LadiesPackage', 'CompletePackage'] fee = 0 # Only apply fee if cart contains an item with processing fees fee = 3.00 if line_items.any? {|line_item| packages_with_processing_fees.include? line_item.item.class.to_s } if customer fee = 5.00 unless "Canada United States Mexico".include? customer.country end -
darron created this gist
Apr 25, 2009 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ diff --git a/app/models/order.rb b/app/models/order.rb index 00799d0..3ae6013 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -70,11 +70,17 @@ class Order < ActiveRecord::Base end def processing_fee + # These are the packages with a processing fee. + require_processing_fee = ['Package', 'FamilyPackage', 'LadiesPackage', 'CompletePackage'] # Fee.find_by_title('processing').amount fee = 0 # Only apply fee if cart contains a basic package - if line_items.any? {|item| item.item.class.name == 'Package' } - fee = 3.00 + if line_items.any? do |item| + case item.item.class.name + when *require_processing_fee + fee = 3.00 + end + end if customer fee = 5.00 unless "Canada United States Mexico".include? customer.country end