Module: DigestUtils

Defined in:
lib/citypay_api_client/utils/digest_utils.rb

Class Method Summary collapse

Class Method Details

.validate_digest(auth_response, licence_key) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/citypay_api_client/utils/digest_utils.rb', line 5

def validate_digest(auth_response, licence_key)

  string_to_convert = auth_response.authcode +
    auth_response.amount.to_s +
    auth_response.result_code +
    auth_response.merchantid.to_s +
    auth_response.transno.to_s +
    auth_response.identifier +
    licence_key

  auth_response.sha256 == Digest::SHA256.base64digest(string_to_convert)
end