Class: EpayTools::HashGenerator

Inherits:
ServicePattern::Service
  • Object
show all
Defined in:
lib/epay_tools/hash_generator.rb

Constant Summary collapse

KEYS_ORDER =
%w[txnid orderid amount currency date time txnfee paymenttype cardno hash].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(epay_md5_key:, params:) ⇒ HashGenerator

Returns a new instance of HashGenerator.



6
7
8
9
# 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

Instance Attribute Details

#epay_md5_keyObject (readonly)

Returns the value of attribute epay_md5_key.



2
3
4
# File 'lib/epay_tools/hash_generator.rb', line 2

def epay_md5_key
  @epay_md5_key
end

#paramsObject (readonly)

Returns the value of attribute params.



2
3
4
# File 'lib/epay_tools/hash_generator.rb', line 2

def params
  @params
end

Instance Method Details

#execute!Object



11
12
13
# File 'lib/epay_tools/hash_generator.rb', line 11

def execute!
  ServicePattern::Response.new(result: calculate_hash)
end