Sha256: 4c472c463dfa4ed02d6f4142e5c463651a04d0f1810723c18a04312450bb4242
Contents?: true
Size: 318 Bytes
Versions: 3
Compression:
Stored size: 318 Bytes
Contents
module ShoppingCart class AddCoupon < Rectify::Command def initialize(code:, order:) @code = code @order = order end def call coupon = Coupon.find_by_code(@code) return broadcast(:invalid) unless coupon @order.update(coupon: coupon) broadcast(:ok) end end end
Version data entries
3 entries across 3 versions & 1 rubygems