Sha256: 775fd7879f2cfd7c5a9de573c334de69523e9c1dff5bc372eb5562cdc6d4366b

Contents?: true

Size: 433 Bytes

Versions: 6

Compression:

Stored size: 433 Bytes

Contents

module Workarea
  decorate Payment, with: 'gift_cards' do
    decorated do
      embeds_one :gift_card, class_name: 'Workarea::Payment::Tender::GiftCard'
      delegate :number, to: :gift_card, allow_nil: true, prefix: true
    end

    def set_gift_card(attrs)
      build_gift_card unless gift_card
      gift_card.number = attrs[:number]
      save
    end

    def reset!
      self.gift_card = nil
      super
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
workarea-gift_cards-3.4.11 app/models/workarea/payment.decorator
workarea-gift_cards-3.4.10 app/models/workarea/payment.decorator
workarea-gift_cards-3.4.9 app/models/workarea/payment.decorator
workarea-gift_cards-3.4.8 app/models/workarea/payment.decorator
workarea-gift_cards-3.4.7 app/models/workarea/payment.decorator
workarea-gift_cards-3.4.6 app/models/workarea/payment.decorator