Class: Authorization
- Inherits:
-
Object
- Object
- Authorization
- Defined in:
- lib/AuthenticationSDK/core/Authorization.rb
Overview
This function calls for the generation of Signature message depending on the authentication type.
Instance Method Summary collapse
Instance Method Details
#getToken(merchantconfig_obj, gmtdatetime, log_obj) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/AuthenticationSDK/core/Authorization.rb', line 9 def getToken(merchantconfig_obj, gmtdatetime, log_obj) authenticationType = merchantconfig_obj.authenticationType.upcase if merchantconfig_obj.requestType.to_s.empty? raise StandardError.new(Constants::ERROR_PREFIX + Constants::REQUEST_TYPE_EMPTY) end if authenticationType == Constants::AUTH_TYPE_HTTP token = GenerateHttpSignature.new.getToken(merchantconfig_obj, gmtdatetime, log_obj) elsif authenticationType == Constants::AUTH_TYPE_JWT token = GenerateJwtToken.new.getToken(merchantconfig_obj, gmtdatetime, log_obj) elsif authenticationType == Constants::AUTH_TYPE_OAUTH token = GenerateOAuthToken.new.getToken(merchantconfig_obj, gmtdatetime, log_obj) else raise StandardError.ner(Constants::ERROR_PREFIX + Constants::AUTH_ERROR) end rescue StandardError => err ApiException.new.apiexception(err,log_obj) exit! end |