Class: Inpay::Checksum::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/inpay/checksum.rb

Overview

checksum base class should only be used as a subclass

Direct Known Subclasses

CreateInvoice, Postback

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Base

Returns a new instance of Base.



11
12
13
# File 'lib/inpay/checksum.rb', line 11

def initialize params
  @params = params
end

Instance Method Details

#param_stringObject

build a param_string from given parameters



21
22
23
24
25
# File 'lib/inpay/checksum.rb', line 21

def param_string
  keys.collect do |p|
    "#{ p }=#{ CGI.escape(@params[:"#{ p }"].to_s) }"
  end.join('&')
end

#resultObject

build a checksum from given parameters



16
17
18
# File 'lib/inpay/checksum.rb', line 16

def result
  @_result ||= Digest::MD5.hexdigest(param_string)
end