Sha256: e5218451d016cbf2e289ca91bdeca035335edd4d03898b31d89478ec149cf472
Contents?: true
Size: 519 Bytes
Versions: 7
Compression:
Stored size: 519 Bytes
Contents
# frozen_string_literal: true require_dependency "spree/calculator" module SolidusFriendlyPromotions module Calculators class Percent < Spree::Calculator include PromotionCalculator preference :percent, :decimal, default: 0 def compute(object) preferred_currency = object.order.currency currency_exponent = ::Money::Currency.find(preferred_currency).exponent (object.discountable_amount * preferred_percent / 100).round(currency_exponent) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems