cybersource_rest_client 0.0.37 → 0.0.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/AuthenticationSDK/authentication/http/GetSignatureParameter.rb +13 -6
- data/lib/AuthenticationSDK/authentication/http/HttpSignatureHeader.rb +13 -5
- data/lib/AuthenticationSDK/authentication/jwt/JwtToken.rb +26 -11
- data/lib/AuthenticationSDK/authentication/oauth/OAuthToken.rb +11 -5
- data/lib/AuthenticationSDK/authentication/payloadDigest/digest.rb +2 -2
- data/lib/AuthenticationSDK/core/Authorization.rb +28 -20
- data/lib/AuthenticationSDK/core/MerchantConfig.rb +72 -78
- data/lib/AuthenticationSDK/logging/log_configuration.rb +71 -0
- data/lib/AuthenticationSDK/logging/log_factory.rb +65 -0
- data/lib/AuthenticationSDK/logging/sensitive_logging.rb +101 -0
- data/lib/AuthenticationSDK/util/Cache.rb +1 -1
- data/lib/AuthenticationSDK/util/Constants.rb +25 -17
- data/lib/AuthenticationSDK/util/ExceptionHandler.rb +26 -0
- data/lib/AuthenticationSDK/util/PropertiesUtil.rb +2 -2
- data/lib/cybersource_rest_client/api/asymmetric_key_management_api.rb +46 -46
- data/lib/cybersource_rest_client/api/capture_api.rb +16 -16
- data/lib/cybersource_rest_client/api/chargeback_details_api.rb +16 -16
- data/lib/cybersource_rest_client/api/chargeback_summaries_api.rb +16 -16
- data/lib/cybersource_rest_client/api/conversion_details_api.rb +16 -16
- data/lib/cybersource_rest_client/api/credit_api.rb +16 -16
- data/lib/cybersource_rest_client/api/customer_api.rb +61 -61
- data/lib/cybersource_rest_client/api/customer_payment_instrument_api.rb +76 -76
- data/lib/cybersource_rest_client/api/customer_shipping_address_api.rb +76 -76
- data/lib/cybersource_rest_client/api/decision_manager_api.rb +46 -46
- data/lib/cybersource_rest_client/api/download_dtd_api.rb +16 -16
- data/lib/cybersource_rest_client/api/download_xsd_api.rb +16 -16
- data/lib/cybersource_rest_client/api/instrument_identifier_api.rb +91 -91
- data/lib/cybersource_rest_client/api/interchange_clearing_level_details_api.rb +16 -16
- data/lib/cybersource_rest_client/api/invoice_settings_api.rb +31 -31
- data/lib/cybersource_rest_client/api/invoices_api.rb +91 -91
- data/lib/cybersource_rest_client/api/key_generation_api.rb +16 -16
- data/lib/cybersource_rest_client/api/net_fundings_api.rb +16 -16
- data/lib/cybersource_rest_client/api/notification_of_changes_api.rb +16 -16
- data/lib/cybersource_rest_client/api/payer_authentication_api.rb +46 -46
- data/lib/cybersource_rest_client/api/payment_batch_summaries_api.rb +16 -16
- data/lib/cybersource_rest_client/api/payment_instrument_api.rb +61 -61
- data/lib/cybersource_rest_client/api/payments_api.rb +31 -31
- data/lib/cybersource_rest_client/api/payouts_api.rb +16 -16
- data/lib/cybersource_rest_client/api/purchase_and_refund_details_api.rb +16 -16
- data/lib/cybersource_rest_client/api/refund_api.rb +31 -31
- data/lib/cybersource_rest_client/api/report_definitions_api.rb +31 -31
- data/lib/cybersource_rest_client/api/report_downloads_api.rb +16 -16
- data/lib/cybersource_rest_client/api/report_subscriptions_api.rb +76 -76
- data/lib/cybersource_rest_client/api/reports_api.rb +46 -46
- data/lib/cybersource_rest_client/api/retrieval_details_api.rb +16 -16
- data/lib/cybersource_rest_client/api/retrieval_summaries_api.rb +16 -16
- data/lib/cybersource_rest_client/api/reversal_api.rb +31 -31
- data/lib/cybersource_rest_client/api/search_transactions_api.rb +31 -31
- data/lib/cybersource_rest_client/api/secure_file_share_api.rb +31 -31
- data/lib/cybersource_rest_client/api/symmetric_key_management_api.rb +46 -46
- data/lib/cybersource_rest_client/api/taxes_api.rb +31 -31
- data/lib/cybersource_rest_client/api/tokenization_api.rb +16 -16
- data/lib/cybersource_rest_client/api/transaction_batches_api.rb +46 -46
- data/lib/cybersource_rest_client/api/transaction_details_api.rb +16 -16
- data/lib/cybersource_rest_client/api/user_management_api.rb +16 -16
- data/lib/cybersource_rest_client/api/user_management_search_api.rb +16 -16
- data/lib/cybersource_rest_client/api/verification_api.rb +31 -31
- data/lib/cybersource_rest_client/api/void_api.rb +76 -76
- data/lib/cybersource_rest_client/api_client.rb +7 -8
- data/lib/cybersource_rest_client/models/create_adhoc_report_request.rb +2 -5
- data/lib/cybersource_rest_client/models/create_payment_request.rb +19 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_captures_post201_response_order_information_amount_details.rb +20 -4
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information.rb +36 -4
- data/lib/cybersource_rest_client/models/ptsv2payments_buyer_information.rb +33 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_client_reference_information.rb +17 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_device_information.rb +17 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_invoice_details.rb +191 -0
- data/lib/cybersource_rest_client/models/ptsv2payments_merchant_information.rb +49 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_order_information_amount_details.rb +17 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_order_information_invoice_details.rb +20 -4
- data/lib/cybersource_rest_client/models/ptsv2payments_order_information_ship_to.rb +33 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information.rb +13 -4
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_bank.rb +14 -4
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_e_wallet.rb +190 -0
- data/lib/cybersource_rest_client/models/ptsv2payments_processor_information.rb +191 -0
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_payment_information.rb +14 -5
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_payment_information_bank.rb +215 -0
- data/lib/cybersource_rest_client/models/reportingv3reports_report_filters.rb +218 -0
- data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_tokenized_card.rb +17 -1
- data/lib/cybersource_rest_client/models/riskv1authentications_payment_information_tokenized_card.rb +17 -1
- data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_tokenized_card.rb +17 -1
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_installment_information.rb +14 -4
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_order_information_amount_details.rb +13 -4
- data/lib/cybersource_rest_client/utilities/flex/token_verification.rb +4 -4
- data/lib/cybersource_rest_client.rb +9 -2
- metadata +11 -4
- data/lib/AuthenticationSDK/core/Logger.rb +0 -26
- data/lib/AuthenticationSDK/util/ApiException.rb +0 -19
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative '../util/Constants.rb'
|
2
|
+
|
3
|
+
public
|
4
|
+
class LogConfiguration
|
5
|
+
# Setter/Getter
|
6
|
+
attr_accessor :enableLog
|
7
|
+
attr_accessor :loggingLevel
|
8
|
+
attr_accessor :logDirectory
|
9
|
+
attr_accessor :logFilename
|
10
|
+
attr_accessor :maxLogSize
|
11
|
+
attr_accessor :maxLogFiles
|
12
|
+
attr_accessor :enableMasking
|
13
|
+
|
14
|
+
def initialize(log_config)
|
15
|
+
@enableLog = log_config['enableLog']
|
16
|
+
@loggingLevel = log_config['loggingLevel']
|
17
|
+
@logDirectory = log_config['logDirectory']
|
18
|
+
@logFilename = log_config['logFilename']
|
19
|
+
@maxLogSize = log_config['maxLogSize']
|
20
|
+
@maxLogFiles = log_config['maxLogFiles']
|
21
|
+
@enableMasking = log_config['enableMasking']
|
22
|
+
|
23
|
+
def validate(log_message)
|
24
|
+
if @enableLog == "true"
|
25
|
+
@enableLog = true
|
26
|
+
elsif @enableLog == true
|
27
|
+
@enableLog = true
|
28
|
+
else
|
29
|
+
@enableLog = false
|
30
|
+
end
|
31
|
+
if @enableLog
|
32
|
+
if !Constants::LOG_LEVELS.include? @loggingLevel
|
33
|
+
@loggingLevel = Constants::DEFAULT_LOG_LEVEL
|
34
|
+
log_message += Constants::WARNING_PREFIX + Constants::INVALID_LOG_LEVEL + @loggingLevel
|
35
|
+
end
|
36
|
+
if @logDirectory.to_s.empty? # || !Dir.exist?(@logDirectory)
|
37
|
+
@logDirectory = Constants::DEFAULT_LOG_DIRECTORY
|
38
|
+
unless Dir.exist?(@logDirectory)
|
39
|
+
Dir.mkdir(Constants::DEFAULT_LOG_DIRECTORY)
|
40
|
+
end
|
41
|
+
log_message += Constants::WARNING_PREFIX + Constants::INVALID_LOG_DIRECTORY + File.expand_path(@logDirectory)
|
42
|
+
end
|
43
|
+
if @logFilename.to_s.empty?
|
44
|
+
@logFilename = Constants::DEFAULT_LOGFILE_NAME
|
45
|
+
elsif !@logFilename.instance_of? String
|
46
|
+
@logFilename = @logFilename.to_s
|
47
|
+
end
|
48
|
+
if @maxLogSize.nil? || @maxLogSize.to_s.empty?
|
49
|
+
@maxLogSize = Constants::DEFAULT_LOG_SIZE
|
50
|
+
log_message += Constants::WARNING_PREFIX + Constants::INVALID_MAX_LOG_SIZE + @maxLogSize
|
51
|
+
elsif !@maxLogSize.instance_of? Integer
|
52
|
+
@maxLogSize = @maxLogSize.to_i
|
53
|
+
end
|
54
|
+
if @maxLogFiles.nil? || @maxLogFiles.to_s.empty?
|
55
|
+
@maxLogFiles = Constants::DEFAULT_MAX_LOG_FILES
|
56
|
+
log_message += Constants::WARNING_PREFIX + Constants::INVALID_MAX_LOG_FILES + @maxLogFiles
|
57
|
+
elsif !@maxLogFiles.instance_of? Integer
|
58
|
+
@maxLogFiles = @maxLogFiles.to_i
|
59
|
+
end
|
60
|
+
if @enableMasking == "true"
|
61
|
+
@enableMasking = true
|
62
|
+
elsif @enableMasking == true
|
63
|
+
@enableMasking = true
|
64
|
+
else
|
65
|
+
@enableMasking = false
|
66
|
+
end
|
67
|
+
end
|
68
|
+
return log_message
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'logger'
|
2
|
+
require 'fileutils'
|
3
|
+
require_relative 'sensitive_logging.rb'
|
4
|
+
|
5
|
+
# module CyberSource
|
6
|
+
public
|
7
|
+
# Logger Class
|
8
|
+
class Log
|
9
|
+
@logger
|
10
|
+
def initialize(logConfiguration, callingProgram = '')
|
11
|
+
enableLog = logConfiguration.enableLog
|
12
|
+
loggingLevel = logConfiguration.loggingLevel
|
13
|
+
logDirectory = logConfiguration.logDirectory
|
14
|
+
logFilename = logConfiguration.logFilename
|
15
|
+
maxLogSize = logConfiguration.maxLogSize
|
16
|
+
maxLogFiles = logConfiguration.maxLogFiles
|
17
|
+
enableMasking = logConfiguration.enableMasking
|
18
|
+
|
19
|
+
callingProgram = "Generic" if callingProgram.nil? || callingProgram.empty?
|
20
|
+
|
21
|
+
#log
|
22
|
+
if enableLog == true
|
23
|
+
filename = File.join logDirectory, logFilename + '.log' # logDirectory + '/' + logFilename + '.log'
|
24
|
+
datetime = DateTime.now
|
25
|
+
if File.exist?(logDirectory)
|
26
|
+
if File.exist?(logFilename)
|
27
|
+
if File.size(filename) >= maxLogSize
|
28
|
+
updatedFileName = File.join logDirectory, logFilename + '_' + datetime.strftime('%Y%m%d%H%M%S') + '.log'
|
29
|
+
File.rename(filename, updatedFileName)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
elsif !File.exist?(logDirectory)
|
33
|
+
FileUtils.mkdir_p logDirectory
|
34
|
+
File.new(filename, "w")
|
35
|
+
end
|
36
|
+
|
37
|
+
STDOUT.sync = true
|
38
|
+
|
39
|
+
@logger = Logger.new(STDOUT, progname: callingProgram)
|
40
|
+
@logger = Logger.new(filename, shift_age = maxLogFiles, shift_size = maxLogSize, progname: callingProgram)
|
41
|
+
@logger.level = loggingLevel
|
42
|
+
@logger.datetime_format = datetime.strftime('%Y-%m-%d %H:%M:%S')
|
43
|
+
|
44
|
+
if enableMasking
|
45
|
+
@logger.formatter = SensitiveDataFilter.new
|
46
|
+
else
|
47
|
+
@logger.formatter = proc do |severity, datetime, progname, msg|
|
48
|
+
date_format = datetime.strftime("%Y-%m-%d %H:%M:%S")
|
49
|
+
log_message = "[#{date_format}] #{severity.ljust(10)} (#{progname}): #{msg}\n"
|
50
|
+
# $stdout.puts log_message
|
51
|
+
log_message
|
52
|
+
end
|
53
|
+
end
|
54
|
+
else
|
55
|
+
@logger = Logger.new(false)
|
56
|
+
end
|
57
|
+
rescue StandardError => err
|
58
|
+
# puts err
|
59
|
+
raise err
|
60
|
+
# exit!
|
61
|
+
end
|
62
|
+
|
63
|
+
attr_accessor :logger
|
64
|
+
end
|
65
|
+
# end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
class SensitiveTag
|
4
|
+
attr_accessor :tagName, :pattern, :replacement, :disableMask
|
5
|
+
def initialize(tagName, pattern, replacement, disableMask)
|
6
|
+
@tagName = tagName
|
7
|
+
@pattern = pattern
|
8
|
+
@replacement = replacement
|
9
|
+
@disableMask = disableMask
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class SensitiveDataConfigType
|
14
|
+
attr_accessor :sensitiveTags, :sensitiveStringRegexes
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@sensitiveTags = Array.new([
|
18
|
+
SensitiveTag.new("securityCode", "[0-9]{3,4}", "XXX", false),
|
19
|
+
SensitiveTag.new("number", "(\\p{N}+)(\\p{N}{4})", "XXXX-\\2", false),
|
20
|
+
SensitiveTag.new("cardNumber", "(\\p{N}+)(\\p{N}{4})", "XXXX-\\2", false),
|
21
|
+
SensitiveTag.new("expirationMonth", "[0-1][0-9]", "XXXX", false),
|
22
|
+
SensitiveTag.new("expirationYear", "2[0-9][0-9][0-9]", "XXXX", false),
|
23
|
+
SensitiveTag.new("account", "(\\p{N}+)(\\p{N}{4})", "XXXX-\\2", false),
|
24
|
+
SensitiveTag.new("routingNumber", "[0-9]+", "XXXXX", false),
|
25
|
+
SensitiveTag.new("email", "[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", "XXXXX", false),
|
26
|
+
SensitiveTag.new("firstName", "([a-zA-Z]+( )?[a-zA-Z]*'?-?[a-zA-Z]*( )?([a-zA-Z]*)?)", "xxxxx", false),
|
27
|
+
SensitiveTag.new("lastName", "([a-zA-Z]+( )?[a-zA-Z]*'?-?[a-zA-Z]*( )?([a-zA-Z]*)?)", "xxxxx", false),
|
28
|
+
SensitiveTag.new("phoneNumber", "(\\+[0-9]{1,2} )?\\(?[0-9]{3}\\)?[ .-]?[0-9]{3}[ .-]?[0-9]{4}", "xxxxx", false),
|
29
|
+
SensitiveTag.new("type", "[-A-Za-z0-9 ]+", "xxxxx", false),
|
30
|
+
SensitiveTag.new("token", "[-.A-Za-z0-9 ]+", "xxxxx", false),
|
31
|
+
SensitiveTag.new("signature", "[-.A-Za-z0-9 ]+", "xxxxx", false)
|
32
|
+
]).freeze
|
33
|
+
|
34
|
+
@sensitiveStringRegexes = [
|
35
|
+
"4\\p{N}{3}([\\ \\-]?)\\p{N}{4}\\1\\p{N}{4}\\1\\p{N}{4}",
|
36
|
+
"4\\p{N}{3}([\\ \\-]?)(?:\\p{N}{4}\\1){2}\\p{N}(?:\\p{N}{3})?",
|
37
|
+
"5[1-5]\\p{N}{2}([\\ \\-]?)\\p{N}{4}\\1\\p{N}{4}\\1\\p{N}{4}",
|
38
|
+
"6(?:011|22(?:1(?=[\\ \\-]?(?:2[6-9]|[3-9]))|[2-8]|9(?=[\\ \\-]?(?:[01]|2[0-5])))|4[4-9]\\p{N}|5\\p{N}\\p{N})([\\ \\-]?)\\p{N}{4}\\1\\p{N}{4}\\1\\p{N}{4}",
|
39
|
+
"35(?:2[89]|[3-8]\\p{N})([\\ \\-]?)\\p{N}{4}\\1\\p{N}{4}\\1\\p{N}{4}",
|
40
|
+
"3[47]\\p{N}\\p{N}([\\ \\-]?)\\p{N}{6}\\1\\p{N}{5}"
|
41
|
+
].freeze
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class SensitiveDataFilter < Logger::Formatter
|
46
|
+
@@sensitiveTagConfig = nil
|
47
|
+
@@tagPatterns = nil
|
48
|
+
@@tagReplacements = nil
|
49
|
+
@@cardPatterns = nil
|
50
|
+
|
51
|
+
def initialize
|
52
|
+
@@sensitiveTagConfig = SensitiveDataConfigType.new
|
53
|
+
@@cardPatterns = @@sensitiveTagConfig.sensitiveStringRegexes
|
54
|
+
@@tagPatterns = Array.new(@@sensitiveTagConfig.sensitiveStringRegexes.length)
|
55
|
+
@@tagReplacements = Array.new(@@sensitiveTagConfig.sensitiveTags.length)
|
56
|
+
|
57
|
+
@@sensitiveTagConfig.sensitiveTags.each_with_index do |sensitiveTag, index|
|
58
|
+
tagName = sensitiveTag.tagName
|
59
|
+
replacement = sensitiveTag.replacement
|
60
|
+
|
61
|
+
if sensitiveTag.pattern.nil? || sensitiveTag.pattern.empty?
|
62
|
+
pattern = "(.*)"
|
63
|
+
else
|
64
|
+
pattern = sensitiveTag.pattern
|
65
|
+
end
|
66
|
+
|
67
|
+
@@tagPatterns[index] = "\""+tagName+"\":\""+pattern+"\""
|
68
|
+
@@tagReplacements[index] = "\""+tagName+"\":\""+replacement+"\""
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def call(severity, time, progname, msg)
|
73
|
+
maskedMessage = maskSensitiveString(msg)
|
74
|
+
ccMasked = maskCreditCards(maskedMessage)
|
75
|
+
return formatLogEntry(severity, time, progname, ccMasked)
|
76
|
+
end
|
77
|
+
|
78
|
+
def maskCreditCards(input)
|
79
|
+
encoded_input = input #.force_encoding("UTF-8")
|
80
|
+
@@cardPatterns.each {|cardNumberRegex|
|
81
|
+
encoded_input = encoded_input.gsub(/#{cardNumberRegex}/, "XXX")
|
82
|
+
}
|
83
|
+
return encoded_input
|
84
|
+
end
|
85
|
+
|
86
|
+
def maskSensitiveString(input)
|
87
|
+
encoded_input = input #.force_encoding("UTF-8")
|
88
|
+
@@tagPatterns.each_with_index do |item, index|
|
89
|
+
encoded_input = encoded_input.gsub(/#{item}/,@@tagReplacements[index])
|
90
|
+
end
|
91
|
+
return encoded_input
|
92
|
+
end
|
93
|
+
|
94
|
+
def formatLogEntry(severity, time, progname, msg)
|
95
|
+
datetime = DateTime.now
|
96
|
+
date_format = datetime.strftime("%Y-%m-%d %H:%M:%S")
|
97
|
+
log_message = "[#{date_format}] #{severity.ljust(10)} (#{progname}): #{msg}\n"
|
98
|
+
# $stdout.puts log_message
|
99
|
+
log_message
|
100
|
+
end
|
101
|
+
end
|
@@ -12,7 +12,7 @@ public
|
|
12
12
|
certificateFromP12File = getCertificate(p12File, keyPass, cacheObj, currentFileLastModifiedTime)
|
13
13
|
return certificateFromP12File
|
14
14
|
elsif currentFileLastModifiedTime > cachedLastModifiedTimeStamp
|
15
|
-
# Function call to read the file and put values to new cache
|
15
|
+
# Function call to read the file and put values to new cache
|
16
16
|
certificateFromP12File = getCertificate(p12File, keyPass, cacheObj, currentFileLastModifiedTime)
|
17
17
|
return certificateFromP12File
|
18
18
|
else
|
@@ -61,27 +61,29 @@
|
|
61
61
|
AUTH_TYPE_OAUTH = 'OAUTH' unless const_defined?(:AUTH_TYPE_OAUTH)
|
62
62
|
|
63
63
|
AUTH_TYPE_MUTUAL_AUTH = 'MUTUAL_AUTH' unless const_defined?(:AUTH_TYPE_MUTUAL_AUTH)
|
64
|
-
|
64
|
+
|
65
65
|
AUTH_TYPE_JWT = 'JWT' unless const_defined?(:AUTH_TYPE_JWT)
|
66
66
|
|
67
67
|
OLD_RUN_ENVIRONMENT_CONSTANTS = ['CYBERSOURCE.ENVIRONMENT.SANDBOX', 'CYBERSOURCE.ENVIRONMENT.PRODUCTION', 'CYBERSOURCE.IN.ENVIRONMENT.SANDBOX', 'CYBERSOURCE.IN.ENVIRONMENT.PRODUCTION', 'BANKOFAMERICA.ENVIRONMENT.SANDBOX', 'BANKOFAMERICA.ENVIRONMENT.PRODUCTION']
|
68
68
|
|
69
69
|
# constants for fall back logic
|
70
70
|
|
71
|
-
DEFAULT_LOG_SIZE = 10485760 unless const_defined?(:DEFAULT_LOG_SIZE)
|
72
|
-
|
73
|
-
DEFAULT_PROXY_ADDRESS = 'userproxy.visa.com' unless const_defined?(:DEFAULT_PROXY_ADDRESS)
|
74
|
-
|
75
|
-
DEFAULT_PROXY_PORT = '443' unless const_defined?(:DEFAULT_PROXY_PORT)
|
71
|
+
DEFAULT_LOG_SIZE = '10485760' unless const_defined?(:DEFAULT_LOG_SIZE)
|
76
72
|
|
77
73
|
DEFAULT_TIMEOUT = '1000' unless const_defined?(:DEFAULT_TIMEOUT)
|
78
74
|
|
79
|
-
DEFAULT_LOG_DIRECTORY = '
|
75
|
+
DEFAULT_LOG_DIRECTORY = 'log' unless const_defined?(:DEFAULT_LOG_DIRECTORY)
|
80
76
|
|
81
77
|
DEFAULT_KEY_DIRECTORY = 'resource' unless const_defined?(:DEFAULT_KEY_DIRECTORY)
|
82
78
|
|
83
79
|
DEFAULT_LOGFILE_NAME = 'cybs' unless const_defined?(:DEFAULT_LOGFILE_NAME)
|
84
80
|
|
81
|
+
DEFAULT_MAX_LOG_FILES = '5' unless const_defined?(:DEFAULT_MAX_LOG_FILES)
|
82
|
+
|
83
|
+
DEFAULT_LOG_LEVEL = 'debug' unless const_defined?(:DEFAULT_LOG_LEVEL)
|
84
|
+
|
85
|
+
LOG_LEVELS = ['UNKNOWN', 'FATAL', 'ERROR', 'WARN', 'INFO', 'DEBUG'] unless const_defined?(:LOG_LEVELS)
|
86
|
+
|
85
87
|
# Constant for Fall back logic and Exception Handling
|
86
88
|
|
87
89
|
REQUEST_JSON_ERROR = 'Request Json File missing. File Path :: ' unless const_defined?(:REQUEST_JSON_ERROR)
|
@@ -110,7 +112,13 @@
|
|
110
112
|
|
111
113
|
INVALID_REQUEST_TYPE_METHOD = 'Entered Request Type should be (GET/POST/PUT)' unless const_defined?(:INVALID_REQUEST_TYPE_METHOD)
|
112
114
|
|
113
|
-
INVALID_LOG_DIRECTORY = 'Entered LogDirectory is Incorrect. Using Default Path: ' unless const_defined?(:INVALID_LOG_DIRECTORY)
|
115
|
+
INVALID_LOG_DIRECTORY = 'Entered LogDirectory is Missing/Incorrect. Using Default Path: ' unless const_defined?(:INVALID_LOG_DIRECTORY)
|
116
|
+
|
117
|
+
INVALID_MAX_LOG_SIZE = 'Entered MaxLogSize is Missing/Incorrect. Using Default Value: ' unless const_defined?(:INVALID_MAX_LOG_SIZE)
|
118
|
+
|
119
|
+
INVALID_MAX_LOG_FILES = 'Entered MaxLogFiles is Missing/Incorrect. Using Default Value: ' unless const_defined?(:INVALID_MAX_LOG_FILES)
|
120
|
+
|
121
|
+
INVALID_LOG_LEVEL = 'Entered LogLevel is Missing/Incorrect. Using Default Value: ' unless const_defined?(:INVALID_LOG_LEVEL)
|
114
122
|
|
115
123
|
RUN_ENVIRONMENT_ERROR = 'Entered RunEnvironment is Incorrect.' unless const_defined?(:RUN_ENVIRONMENT_ERROR)
|
116
124
|
|
@@ -137,22 +145,22 @@
|
|
137
145
|
INCORRECT_KEY_ALIAS = 'The Entered KeyAlias is Incorrect. Assigining merchantID value' unless const_defined?(:INCORRECT_KEY_ALIAS)
|
138
146
|
|
139
147
|
ENABLE_CLIENT_CERT_EMPTY = 'Enable Clientcert is Empty/Null.' unless const_defined?(:ENABLE_CLIENT_CERT_EMPTY)
|
140
|
-
|
148
|
+
|
141
149
|
CLIENT_CERT_DIR_EMPTY = 'Client Cert Directory is Empty/Null' unless const_defined?(:CLIENT_CERT_DIR_EMPTY)
|
142
|
-
|
150
|
+
|
143
151
|
SSL_CLIENT_CERT_EMPTY = 'SSL Client Cert is Empty/Null' unless const_defined?(:SSL_CLIENT_CERT_EMPTY)
|
144
152
|
|
145
153
|
PRIVATE_KEY_EMPTY = 'Private Key is Empty/Null' unless const_defined?(:PRIVATE_KEY_EMPTY)
|
146
|
-
|
154
|
+
|
147
155
|
SSL_KEY_PASSWORD_EMPTY = 'SSL Key Password is Empty/Null' unless const_defined?(:SSL_KEY_PASSWORD_EMPTY)
|
148
|
-
|
156
|
+
|
149
157
|
CLIENT_ID_EMPTY = 'Client Id is Empty/Null' unless const_defined?(:CLIENT_ID_EMPTY)
|
150
|
-
|
158
|
+
|
151
159
|
CLIENT_SECRET_EMPTY = 'Client Secret is Empty/Null' unless const_defined?(:CLIENT_SECRET_EMPTY)
|
152
|
-
|
160
|
+
|
153
161
|
ACCESS_TOKEN_EMPTY = 'AccessToken is Empty/Null' unless const_defined?(:ACCESS_TOKEN_REQ)
|
154
|
-
|
162
|
+
|
155
163
|
REFRESH_TOKEN_EMPTY = 'RefreshToken is Empty/Null' unless const_defined?(:REFRESH_TOKEN_REQ)
|
156
|
-
|
157
|
-
|
164
|
+
|
165
|
+
DEPRECATED_ENVIRONMENT = 'The value provided for this field `RunEnvironment` has been deprecated and will not be used anymore.\n\nPlease refer to the README file [ https://github.com/CyberSource/cybersource-rest-samples-node/blob/master/README.md ] for information about the new values that are accepted.'
|
158
166
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
public
|
2
|
+
class ExceptionHandler
|
3
|
+
@exception_message
|
4
|
+
|
5
|
+
def new_api_exception(err)
|
6
|
+
@exception_message = err.message
|
7
|
+
|
8
|
+
if !err.backtrace.to_s.empty?
|
9
|
+
@exception_message += "\n" + err.backtrace
|
10
|
+
end
|
11
|
+
|
12
|
+
@exception_message += '\nEND> ======================================='
|
13
|
+
return @exception_message
|
14
|
+
end
|
15
|
+
|
16
|
+
def new_api_warning(msg)
|
17
|
+
@exception_message = msg
|
18
|
+
return @exception_message
|
19
|
+
end
|
20
|
+
|
21
|
+
def new_custom_error(msg)
|
22
|
+
@exception_message = msg
|
23
|
+
@exception_message += '\nEND> ======================================='
|
24
|
+
return @exception_message
|
25
|
+
end
|
26
|
+
end
|
@@ -18,7 +18,7 @@ module CyberSource
|
|
18
18
|
|
19
19
|
def initialize(api_client = ApiClient.default, config)
|
20
20
|
@api_client = api_client
|
21
|
-
|
21
|
+
@api_client.set_configuration(config)
|
22
22
|
end
|
23
23
|
# Create one or more PKCS#12 keys
|
24
24
|
# 'Create one or more PKCS#12 keys'
|
@@ -36,14 +36,14 @@ module CyberSource
|
|
36
36
|
# @param [Hash] opts the optional parameters
|
37
37
|
# @return [Array<(KmsV2KeysAsymPost201Response, Fixnum, Hash)>] KmsV2KeysAsymPost201Response data, response status code and response headers
|
38
38
|
def create_p12_keys_with_http_info(create_p12_keys_request, opts = {})
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
39
|
+
|
40
|
+
if @api_client.config.debugging
|
41
|
+
begin
|
42
|
+
raise
|
43
|
+
@api_client.config.logger.debug 'Calling API: AsymmetricKeyManagementApi.create_p12_keys ...'
|
44
|
+
rescue
|
45
|
+
puts 'Cannot write to log'
|
46
|
+
end
|
47
47
|
end
|
48
48
|
# verify the required parameter 'create_p12_keys_request' is set
|
49
49
|
if @api_client.config.client_side_validation && create_p12_keys_request.nil?
|
@@ -76,13 +76,13 @@ module CyberSource
|
|
76
76
|
:auth_names => auth_names,
|
77
77
|
:return_type => 'KmsV2KeysAsymPost201Response')
|
78
78
|
if @api_client.config.debugging
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
79
|
+
begin
|
80
|
+
raise
|
81
|
+
@api_client.config.logger.debug "API called: AsymmetricKeyManagementApi#create_p12_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
82
|
+
rescue
|
83
|
+
puts 'Cannot write to log'
|
84
|
+
end
|
85
|
+
end
|
86
86
|
return data, status_code, headers
|
87
87
|
end
|
88
88
|
# Delete one or more PKCS#12 keys
|
@@ -101,14 +101,14 @@ module CyberSource
|
|
101
101
|
# @param [Hash] opts the optional parameters
|
102
102
|
# @return [Array<(KmsV2KeysAsymDeletesPost200Response, Fixnum, Hash)>] KmsV2KeysAsymDeletesPost200Response data, response status code and response headers
|
103
103
|
def delete_bulk_p12_keys_with_http_info(delete_bulk_p12_keys_request, opts = {})
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
104
|
+
|
105
|
+
if @api_client.config.debugging
|
106
|
+
begin
|
107
|
+
raise
|
108
|
+
@api_client.config.logger.debug 'Calling API: AsymmetricKeyManagementApi.delete_bulk_p12_keys ...'
|
109
|
+
rescue
|
110
|
+
puts 'Cannot write to log'
|
111
|
+
end
|
112
112
|
end
|
113
113
|
# verify the required parameter 'delete_bulk_p12_keys_request' is set
|
114
114
|
if @api_client.config.client_side_validation && delete_bulk_p12_keys_request.nil?
|
@@ -141,13 +141,13 @@ module CyberSource
|
|
141
141
|
:auth_names => auth_names,
|
142
142
|
:return_type => 'KmsV2KeysAsymDeletesPost200Response')
|
143
143
|
if @api_client.config.debugging
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
144
|
+
begin
|
145
|
+
raise
|
146
|
+
@api_client.config.logger.debug "API called: AsymmetricKeyManagementApi#delete_bulk_p12_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
147
|
+
rescue
|
148
|
+
puts 'Cannot write to log'
|
149
|
+
end
|
150
|
+
end
|
151
151
|
return data, status_code, headers
|
152
152
|
end
|
153
153
|
# Retrieves PKCS#12 key details
|
@@ -166,14 +166,14 @@ module CyberSource
|
|
166
166
|
# @param [Hash] opts the optional parameters
|
167
167
|
# @return [Array<(KmsV2KeysAsymGet200Response, Fixnum, Hash)>] KmsV2KeysAsymGet200Response data, response status code and response headers
|
168
168
|
def get_p12_key_details_with_http_info(key_id, opts = {})
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
169
|
+
|
170
|
+
if @api_client.config.debugging
|
171
|
+
begin
|
172
|
+
raise
|
173
|
+
@api_client.config.logger.debug 'Calling API: AsymmetricKeyManagementApi.get_p12_key_details ...'
|
174
|
+
rescue
|
175
|
+
puts 'Cannot write to log'
|
176
|
+
end
|
177
177
|
end
|
178
178
|
# verify the required parameter 'key_id' is set
|
179
179
|
if @api_client.config.client_side_validation && key_id.nil?
|
@@ -206,13 +206,13 @@ module CyberSource
|
|
206
206
|
:auth_names => auth_names,
|
207
207
|
:return_type => 'KmsV2KeysAsymGet200Response')
|
208
208
|
if @api_client.config.debugging
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
209
|
+
begin
|
210
|
+
raise
|
211
|
+
@api_client.config.logger.debug "API called: AsymmetricKeyManagementApi#get_p12_key_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
212
|
+
rescue
|
213
|
+
puts 'Cannot write to log'
|
214
|
+
end
|
215
|
+
end
|
216
216
|
return data, status_code, headers
|
217
217
|
end
|
218
218
|
end
|
@@ -18,7 +18,7 @@ module CyberSource
|
|
18
18
|
|
19
19
|
def initialize(api_client = ApiClient.default, config)
|
20
20
|
@api_client = api_client
|
21
|
-
|
21
|
+
@api_client.set_configuration(config)
|
22
22
|
end
|
23
23
|
# Capture a Payment
|
24
24
|
# Include the payment ID in the POST request to capture the payment amount.
|
@@ -38,14 +38,14 @@ module CyberSource
|
|
38
38
|
# @param [Hash] opts the optional parameters
|
39
39
|
# @return [Array<(PtsV2PaymentsCapturesPost201Response, Fixnum, Hash)>] PtsV2PaymentsCapturesPost201Response data, response status code and response headers
|
40
40
|
def capture_payment_with_http_info(capture_payment_request, id, opts = {})
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
|
42
|
+
if @api_client.config.debugging
|
43
|
+
begin
|
44
|
+
raise
|
45
|
+
@api_client.config.logger.debug 'Calling API: CaptureApi.capture_payment ...'
|
46
|
+
rescue
|
47
|
+
puts 'Cannot write to log'
|
48
|
+
end
|
49
49
|
end
|
50
50
|
# verify the required parameter 'capture_payment_request' is set
|
51
51
|
if @api_client.config.client_side_validation && capture_payment_request.nil?
|
@@ -82,13 +82,13 @@ module CyberSource
|
|
82
82
|
:auth_names => auth_names,
|
83
83
|
:return_type => 'PtsV2PaymentsCapturesPost201Response')
|
84
84
|
if @api_client.config.debugging
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
begin
|
86
|
+
raise
|
87
|
+
@api_client.config.logger.debug "API called: CaptureApi#capture_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
88
|
+
rescue
|
89
|
+
puts 'Cannot write to log'
|
90
|
+
end
|
91
|
+
end
|
92
92
|
return data, status_code, headers
|
93
93
|
end
|
94
94
|
end
|
@@ -18,7 +18,7 @@ module CyberSource
|
|
18
18
|
|
19
19
|
def initialize(api_client = ApiClient.default, config)
|
20
20
|
@api_client = api_client
|
21
|
-
|
21
|
+
@api_client.set_configuration(config)
|
22
22
|
end
|
23
23
|
# Get Chargeback Details
|
24
24
|
# Chargeback Detail Report Description
|
@@ -40,14 +40,14 @@ module CyberSource
|
|
40
40
|
# @option opts [String] :organization_id Valid Organization Id
|
41
41
|
# @return [Array<(ReportingV3ChargebackDetailsGet200Response, Fixnum, Hash)>] ReportingV3ChargebackDetailsGet200Response data, response status code and response headers
|
42
42
|
def get_chargeback_details_with_http_info(start_time, end_time, opts = {})
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
|
44
|
+
if @api_client.config.debugging
|
45
|
+
begin
|
46
|
+
raise
|
47
|
+
@api_client.config.logger.debug 'Calling API: ChargebackDetailsApi.get_chargeback_details ...'
|
48
|
+
rescue
|
49
|
+
puts 'Cannot write to log'
|
50
|
+
end
|
51
51
|
end
|
52
52
|
# verify the required parameter 'start_time' is set
|
53
53
|
if @api_client.config.client_side_validation && start_time.nil?
|
@@ -99,13 +99,13 @@ module CyberSource
|
|
99
99
|
:auth_names => auth_names,
|
100
100
|
:return_type => 'ReportingV3ChargebackDetailsGet200Response')
|
101
101
|
if @api_client.config.debugging
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
102
|
+
begin
|
103
|
+
raise
|
104
|
+
@api_client.config.logger.debug "API called: ChargebackDetailsApi#get_chargeback_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
105
|
+
rescue
|
106
|
+
puts 'Cannot write to log'
|
107
|
+
end
|
108
|
+
end
|
109
109
|
return data, status_code, headers
|
110
110
|
end
|
111
111
|
end
|