1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

handle coupon in refunds

This commit is contained in:
Sylvain 2016-08-11 13:44:42 +02:00
parent d955f5d3e1
commit 1e0d809db9

View File

@ -147,6 +147,11 @@ class Invoice < ActiveRecord::Base
avoir.total += avoir_ii.amount
end
end
# handle coupon
unless avoir.coupon_id.nil?
discount = avoir.total * avoir.coupon.percent_off / 100
avoir.total -= discount
end
avoir
end