Skip to content

Commit 45863f4

Browse files
committed
+ MetaKey related changes
1 parent 6878bc4 commit 45863f4

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

lib/AuthenticationSDK/authentication/http/GetSignatureParameter.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ def generateSignatureParameter(merchantconfig_obj, gmtdatetime, log_obj)
3030
digest_payload = Constants::SHA256 + digest
3131
signatureString << Constants::DIGEST + ': ' + digest_payload + "\n"
3232
end
33-
signatureString << Constants::V_C_MERCHANT_ID + ': ' + merchantconfig_obj.merchantId
33+
if merchantconfig_obj.useMetaKey
34+
signatureString << Constants::V_C_MERCHANT_ID + ': ' + merchantconfig_obj.portfolioID
35+
else
36+
signatureString << Constants::V_C_MERCHANT_ID + ': ' + merchantconfig_obj.merchantId
37+
end
3438
encodedSignatureString = signatureString.force_encoding(Encoding::UTF_8)
3539
decodedKey = Base64.decode64(merchantSecretKey)
3640
base64EncodedSignature = Base64.strict_encode64(OpenSSL::HMAC.digest('sha256', decodedKey, encodedSignatureString))

lib/AuthenticationSDK/core/MerchantConfig.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def initialize(cybsPropertyObj)
2626
@keyAlias = cybsPropertyObj['keyAlias']
2727
@keyPass = cybsPropertyObj['keyPass']
2828
@keyFilename = cybsPropertyObj['keyFilename']
29+
@useMetaKey = cybsPropertyObj['useMetaKey']
30+
@portfolioID = cybsPropertyObj['portfolioID']
2931
@logFilename = cybsPropertyObj['logFilename']
3032
@solutionId = cybsPropertyObj['solutionId']
3133
validateMerchantDetails()
@@ -140,6 +142,11 @@ def validateMerchantDetails()
140142
@merchantSecretKey=@merchantSecretKey.to_s
141143
end
142144
end
145+
if @useMetaKey && @portfolioID.to_s.empty?
146+
err = raise StandardError.new(Constants::ERROR_PREFIX+ Constants::PORTFOLIO_ID_MANDATORY)
147+
ApiException.new.apiexception(err,log_obj)
148+
end
149+
143150
if !@proxyAddress.instance_of? String
144151
@proxyAddress=@proxyAddress.to_s
145152
end
@@ -174,6 +181,8 @@ def logAllProperties(propertyObj)
174181
attr_accessor :keyAlias
175182
attr_accessor :keyPass
176183
attr_accessor :keyFilename
184+
attr_accessor :useMetaKey
185+
attr_accessor :portfolioID
177186
attr_accessor :requestJsonData
178187
attr_accessor :requestUrl
179188
attr_accessor :requestType

lib/AuthenticationSDK/util/Constants.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ class Constants
117117
MERCHANT_KEY_ID_MANDATORY = 'MerchantKeyId is Mandatory' unless const_defined?(:MERCHANT_KEY_ID_MANDATORY)
118118

119119
MERCHANT_SECRET_KEY_MANDATORY = 'MerchantSecretKey is Mandatory' unless const_defined?(:MERCHANT_SECRET_KEY_MANDATORY)
120+
121+
PORTFOLIO_ID_MANDATORY = 'PortfolioID is Mandatory' unless const_defined?(:PORTFOLIO_ID_MANDATORY)
120122

121123
KEY_PASS_NULL = 'keyPass is empty, Assigining merchantID value' unless const_defined?(:KEY_PASS_NULL)
122124

0 commit comments

Comments
 (0)