mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-28 21:07:16 +00:00
A Vine voucher is really a specific type of FlatRate voucher but because a Vine voucher can be used by mutiple enterprise, it can be considered different enough to warrant it's own class. It still share a lot of the behaviour of a FlatRate voucher, so to avoid duplication, all the shared functionality have been moved to a Vouchers::FlatRatable concern.
14 lines
392 B
Ruby
14 lines
392 B
Ruby
# frozen_string_literal: false
|
|
|
|
module Vouchers
|
|
class Vine < Voucher
|
|
include FlatRatable
|
|
|
|
# a VINE voucher :
|
|
# - can potentially be associated with mutiple enterprise
|
|
# - code ( "short code" in VINE ) can be recycled, but they shouldn't be linked to the same
|
|
# voucher_id
|
|
validates :code, uniqueness: { scope: [:enterprise_id, :external_voucher_id] }
|
|
end
|
|
end
|