Class: Workarea::Payment::Authorize::GiftCard

Inherits:
Object
  • Object
show all
Includes:
OperationImplementation, GiftCardOperation
Defined in:
app/models/workarea/payment/authorize/gift_card.rb

Instance Method Summary collapse

Methods included from GiftCardOperation

#gateway

Instance Method Details

#cancel!Object



17
18
19
20
21
22
23
24
25
26
# File 'app/models/workarea/payment/authorize/gift_card.rb', line 17

def cancel!
  return unless transaction.success?

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

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

#complete!Object



8
9
10
11
12
13
14
15
# File 'app/models/workarea/payment/authorize/gift_card.rb', line 8

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

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