class EpayTools::HashGenerator

Constants

KEYS_ORDER

Attributes

epay_md5_key[R]
params[R]

Public Class Methods

new(epay_md5_key:, params:) click to toggle source
# File lib/epay_tools/hash_generator.rb, line 6
def initialize(epay_md5_key:, params:)
  @epay_md5_key = epay_md5_key
  @params = params.reject { |key, _value| key.to_s == "hash" }
end

Public Instance Methods

execute!() click to toggle source
# File lib/epay_tools/hash_generator.rb, line 11
def execute!
  ServicePattern::Response.new(result: calculate_hash)
end

Private Instance Methods

calculate_hash() click to toggle source
# File lib/epay_tools/hash_generator.rb, line 17
def calculate_hash
  require "digest/md5"
  @_calculate_hash ||= Digest::MD5.hexdigest("#{params.values.join}#{epay_md5_key}")
end