Class: Workarea::Payment::Refund::Affirm

Inherits:
Object
  • Object
show all
Includes:
CreditCardOperation, OperationImplementation
Defined in:
app/models/workarea/payment/refund/affirm.rb

Instance Method Summary collapse

Instance Method Details

#cancel!Object



29
30
31
# File 'app/models/workarea/payment/refund/affirm.rb', line 29

def cancel!
  # No op - no cancel functionality available.
end

#complete!Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/workarea/payment/refund/affirm.rb', line 8

def complete!
  response = gateway.refund(charge_id, transaction.amount)

  transaction.response = if response.success?
   ActiveMerchant::Billing::Response.new(
     true,
     I18n.t(
       'workarea.affirm.refund',
       amount: transaction.amount
     ),
     response.body
   )
  else
   ActiveMerchant::Billing::Response.new(
     false,
     I18n.t('workarea.affirm.refund_failure'),
     response.body
   )
  end
end