Created
April 25, 2009 22:51
-
-
Save darron/101789 to your computer and use it in GitHub Desktop.
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 characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment