Sha256: d76bea482defdf0e2c70387cd83cf67d546ea7429fb4c6cd01bc8b02d1d72104
Contents?: true
Size: 1.11 KB
Versions: 6
Compression:
Stored size: 1.11 KB
Contents
module Workarea class Payment module Authorize class GiftCard include OperationImplementation def complete! Payment::GiftCard.purchase(tender.number, transaction.amount.cents) transaction.response = ActiveMerchant::Billing::Response.new( true, I18n.t( 'workarea.gift_cards.debit', amount: transaction.amount, number: tender.number ) ) rescue Payment::InsufficientFunds transaction.response = ActiveMerchant::Billing::Response.new( false, I18n.t('workarea.gift_cards.insufficient_funds') ) end def cancel! return unless transaction.success? Payment::GiftCard.refund(tender.number, transaction.amount.cents) transaction.cancellation = ActiveMerchant::Billing::Response.new( true, I18n.t( 'workarea.gift_cards.credit', amount: transaction.amount, number: tender.number ) ) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems