-
-
Save darron/101845 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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment