Class: OffsitePayments::Integrations::Dwolla::Return

Inherits:
Return
  • Object
show all
Includes:
Common
Defined in:
lib/offsite_payments/integrations/dwolla.rb

Instance Attribute Summary

Attributes inherited from Return

#notification, #params

Instance Method Summary collapse

Methods included from Common

#verify_signature

Methods inherited from Return

#cancelled?, #message, #parse

Constructor Details

#initialize(data, options) ⇒ Return


120
121
122
123
124
125
126
127
128
# File 'lib/offsite_payments/integrations/dwolla.rb', line 120

def initialize(data, options)
  params = parse(data)

  if params['error'] != 'failure'
    verify_signature(params['checkoutId'], params['amount'], params['signature'], options[:credential3])
  end

  super
end

Instance Method Details

#callback_success?Boolean


154
155
156
# File 'lib/offsite_payments/integrations/dwolla.rb', line 154

def callback_success?
  (params['postback'] != "failure")
end

#checkout_idObject


142
143
144
# File 'lib/offsite_payments/integrations/dwolla.rb', line 142

def checkout_id
  params['checkoutId']
end

#errorObject


134
135
136
# File 'lib/offsite_payments/integrations/dwolla.rb', line 134

def error
  params['error']
end

#error_descriptionObject


138
139
140
# File 'lib/offsite_payments/integrations/dwolla.rb', line 138

def error_description
  params['error_description']
end

#success?Boolean


130
131
132
# File 'lib/offsite_payments/integrations/dwolla.rb', line 130

def success?
  (self.error.nil? && self.callback_success?)
end

#test?Boolean


150
151
152
# File 'lib/offsite_payments/integrations/dwolla.rb', line 150

def test?
  params['test'] != nil
end

#transactionObject


146
147
148
# File 'lib/offsite_payments/integrations/dwolla.rb', line 146

def transaction
  params['transaction']
end