Class: Spree::Paysera::ParseResponse

Inherits:
Object
  • Object
show all
Defined in:
app/domain/spree/paysera/parse_response.rb

Constant Summary collapse

PUBLIC_KEY =
'http://www.paysera.com/download/public.key'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payment_method, response) ⇒ ParseResponse

Returns a new instance of ParseResponse.



12
13
14
15
16
17
# File 'app/domain/spree/paysera/parse_response.rb', line 12

def initialize(payment_method, response)
  @payment_method = payment_method
  @data = unescape_string(response[:data])
  @ss1 = response[:ss1]
  @ss2 = decode_string(unescape_string(response[:ss2]))
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'app/domain/spree/paysera/parse_response.rb', line 4

def data
  @data
end

#payment_methodObject (readonly)

Returns the value of attribute payment_method.



4
5
6
# File 'app/domain/spree/paysera/parse_response.rb', line 4

def payment_method
  @payment_method
end

#ss1Object (readonly)

Returns the value of attribute ss1.



4
5
6
# File 'app/domain/spree/paysera/parse_response.rb', line 4

def ss1
  @ss1
end

#ss2Object (readonly)

Returns the value of attribute ss2.



4
5
6
# File 'app/domain/spree/paysera/parse_response.rb', line 4

def ss2
  @ss2
end

Class Method Details

.for(payment_method, response) ⇒ Object



8
9
10
# File 'app/domain/spree/paysera/parse_response.rb', line 8

def self.for(payment_method, response)
  new(payment_method, response).run
end

Instance Method Details

#runObject



19
20
21
22
# File 'app/domain/spree/paysera/parse_response.rb', line 19

def run
  validate!
  result
end