Class: Kount::KHASH

Inherits:
Object
  • Object
show all
Defined in:
app/models/kount/khash.rb

Constant Summary collapse

PREFIX_LENGTH =
6
SUFFIX_LENGTH =
16

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ KHASH

Returns a new instance of KHASH.



11
12
13
14
15
16
17
18
19
# File 'app/models/kount/khash.rb', line 11

def initialize(attrs = {})
  attrs = { value: attrs } unless attrs.is_a?(Hash)
  attrs.symbolize_keys!

  self.payment_type = RIS::Inquiry::PAYMENT_TYPES.key(attrs[:payment_type]) || attrs[:payment_type] || 'card'
  self.salt = attrs[:salt] || Kount::Configuration.salt
  self.merchant_id = attrs[:merchant_id] || Kount::Configuration.merchant_id
  self.original_value = attrs[:value]
end

Instance Attribute Details

#merchant_idObject

Returns the value of attribute merchant_id.



8
9
10
# File 'app/models/kount/khash.rb', line 8

def merchant_id
  @merchant_id
end

#original_valueObject

Returns the value of attribute original_value.



9
10
11
# File 'app/models/kount/khash.rb', line 9

def original_value
  @original_value
end

#payment_typeObject

Returns the value of attribute payment_type.



8
9
10
# File 'app/models/kount/khash.rb', line 8

def payment_type
  @payment_type
end

#saltObject

Returns the value of attribute salt.



8
9
10
# File 'app/models/kount/khash.rb', line 8

def salt
  @salt
end

#valueObject (readonly)

Returns the value of attribute value.



9
10
11
# File 'app/models/kount/khash.rb', line 9

def value
  @value
end

Instance Method Details

#to_sObject



27
28
29
# File 'app/models/kount/khash.rb', line 27

def to_s
  @value
end