Skip to content

Instantly share code, notes, and snippets.

@darron
Created April 25, 2009 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save darron/101789 to your computer and use it in GitHub Desktop.
Save darron/101789 to your computer and use it in GitHub Desktop.
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