class Stall::AuthorizeDotNet::Gateway::Response

Attributes

request[R]

Public Class Methods

new(request) click to toggle source
# File lib/stall/authorize_dot_net/gateway.rb, line 53
def initialize(request)
  @request = request
end

Public Instance Methods

cart() click to toggle source
# File lib/stall/authorize_dot_net/gateway.rb, line 89
def cart
  @cart ||= ProductList.find_by_reference(notification.invoice_num)
end
gateway() click to toggle source
# File lib/stall/authorize_dot_net/gateway.rb, line 85
def gateway
  @gateway ||= Stall::AuthorizeDotNet::Gateway.new(cart)
end
process() click to toggle source
# File lib/stall/authorize_dot_net/gateway.rb, line 65
def process
  valid? && success?
end
relay_response_partial_path() click to toggle source
# File lib/stall/authorize_dot_net/gateway.rb, line 77
def relay_response_partial_path
  [
    'stall/authorize_dot_net/',
    (success? ? 'success' : 'error'),
    '_relay_response'
  ].join
end
rendering_options() click to toggle source
# File lib/stall/authorize_dot_net/gateway.rb, line 69
def rendering_options
  {
    file: relay_response_partial_path,
    layout: false,
    locals: { gateway: gateway }
  }
end
success?() click to toggle source
# File lib/stall/authorize_dot_net/gateway.rb, line 61
def success?
  @success ||= valid? && notification.complete?
end
valid?() click to toggle source
# File lib/stall/authorize_dot_net/gateway.rb, line 57
def valid?
  @valid ||= notification.acknowledge(gateway.md5_hash, gateway.account)
end

Private Instance Methods

notification() click to toggle source
# File lib/stall/authorize_dot_net/gateway.rb, line 95
def notification
  @notification ||=
    OffsitePayments::Integrations::AuthorizeNetSim::Notification.new(
      request.raw_post
    )
end