Sha256: 9531ab5578f6e7e51ff40a70c350c97ecc04fc2f07a3b644b420b3cddc105824

Contents?: true

Size: 925 Bytes

Versions: 6

Compression:

Stored size: 925 Bytes

Contents

module Workarea
  class Payment
    class Refund
      class GiftCard
        include OperationImplementation

        def complete!
          Payment::GiftCard.refund(tender.number, transaction.amount.cents)
          transaction.response = ActiveMerchant::Billing::Response.new(
            true,
            I18n.t(
              'workarea.gift_cards.credit',
              amount: transaction.amount,
              number: tender.number
            )
          )
        end

        def cancel!
          return unless transaction.success?

          Payment::GiftCard.purchase(tender.number, transaction.amount.cents)
          transaction.cancellation = ActiveMerchant::Billing::Response.new(
            true,
            I18n.t(
              'workarea.gift_cards.debit',
              amount: transaction.amount,
              number: tender.number
            )
          )
        end
      end
    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/refund/gift_card.rb
workarea-gift_cards-3.4.10 app/models/workarea/payment/refund/gift_card.rb
workarea-gift_cards-3.4.9 app/models/workarea/payment/refund/gift_card.rb
workarea-gift_cards-3.4.8 app/models/workarea/payment/refund/gift_card.rb
workarea-gift_cards-3.4.7 app/models/workarea/payment/refund/gift_card.rb
workarea-gift_cards-3.4.6 app/models/workarea/payment/refund/gift_card.rb