Sha256: 140644f1317b301e3c0c97385d13d6f49552af300175d114dea155474b10c692

Contents?: true

Size: 725 Bytes

Versions: 5

Compression:

Stored size: 725 Bytes

Contents

module Workarea
  class Payment
    module Purchase
      class GiftCard
        include OperationImplementation
        include GiftCardOperation

        def complete!
          response = gateway.purchase(transaction.amount.cents, tender)

          transaction.response = ActiveMerchant::Billing::Response.new(
            response.success?,
            response.message
          )
        end

        def cancel!
          return unless transaction.success?

          response = gateway.refund(transaction.amount.cents, tender)

          transaction.cancellation = ActiveMerchant::Billing::Response.new(
            response.success?,
            response.message
          )
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
workarea-gift_cards-4.0.3 app/models/workarea/payment/purchase/gift_card.rb
workarea-gift_cards-4.0.2 app/models/workarea/payment/purchase/gift_card.rb
workarea-gift_cards-4.0.1 app/models/workarea/payment/purchase/gift_card.rb
workarea-gift_cards-4.0.0 app/models/workarea/payment/purchase/gift_card.rb
workarea-gift_cards-4.0.0.beta.1 app/models/workarea/payment/purchase/gift_card.rb