Class: SolidusSixSaferpay::GatewayResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/solidus_six_saferpay/gateway_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(success, message, api_response, options = {}) ⇒ GatewayResponse

Returns a new instance of GatewayResponse.



6
7
8
9
10
# File 'lib/solidus_six_saferpay/gateway_response.rb', line 6

def initialize(success, message, api_response, options = {})
  @success, @message, @api_response = success, message, api_response
  @error_name = options[:error_name]
  @authorization = options[:authorization]
end

Instance Attribute Details

#api_responseObject (readonly)

Returns the value of attribute api_response.



4
5
6
# File 'lib/solidus_six_saferpay/gateway_response.rb', line 4

def api_response
  @api_response
end

#authorizationObject (readonly)

Returns the value of attribute authorization.



4
5
6
# File 'lib/solidus_six_saferpay/gateway_response.rb', line 4

def authorization
  @authorization
end

#error_nameObject (readonly)

Returns the value of attribute error_name.



4
5
6
# File 'lib/solidus_six_saferpay/gateway_response.rb', line 4

def error_name
  @error_name
end

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/solidus_six_saferpay/gateway_response.rb', line 4

def message
  @message
end

#testObject (readonly)

Returns the value of attribute test.



4
5
6
# File 'lib/solidus_six_saferpay/gateway_response.rb', line 4

def test
  @test
end

Instance Method Details

#avs_resultObject

To ensure that solidus sets the response_code after successful capture, we need to pass it as an “authorization”, however if we do this then solidus also expects there to be an “avs_result”

see github.com/solidusio/solidus/blob/master/core/app/models/spree/payment/processing.rb#L171



25
26
27
# File 'lib/solidus_six_saferpay/gateway_response.rb', line 25

def avs_result
  {}
end

#cvv_resultObject

To ensure that solidus sets the response_code after successful capture, we need to pass it as an “authorization”, however if we do this then solidus also expects this response to respond to :cvv_result

see github.com/solidusio/solidus/blob/master/core/app/models/spree/payment/processing.rb#L171



34
35
36
# File 'lib/solidus_six_saferpay/gateway_response.rb', line 34

def cvv_result
  nil
end

#success?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/solidus_six_saferpay/gateway_response.rb', line 12

def success?
  @success
end

#to_sObject



16
17
18
# File 'lib/solidus_six_saferpay/gateway_response.rb', line 16

def to_s
  message
end