ruby-saferpay 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ruby-saferpay.rb +11 -6
- data/lib/ruby-saferpay/version.rb +1 -1
- metadata +1 -1
data/lib/ruby-saferpay.rb
CHANGED
@@ -355,17 +355,22 @@ private
|
|
355
355
|
# Sanity check on params
|
356
356
|
raise ArgumentError, "Bad parameters. Configuration path: \"#{conf_path}\", username: \"#{username}\", password: \"#{password}\", accountid: \"#{accountid}\"" if (username.nil? || password.nil? || accountid.nil?)
|
357
357
|
|
358
|
-
account_directory = "#{conf_path}conf_for_#{accountid}"
|
358
|
+
account_directory = "#{conf_path}conf_for_#{accountid}/"
|
359
359
|
#logger.debug "#{self.class}.setup_account Will configure account in: \"#{account_directory}\""
|
360
360
|
|
361
361
|
# Is really a new account?
|
362
362
|
if File.directory? conf_path
|
363
363
|
if File.directory? account_directory
|
364
|
-
if File.exist?( account_directory + 'config.xml' )
|
365
|
-
|
364
|
+
if File.exist?( account_directory + 'config.xml' )
|
365
|
+
if File.directory?( account_directory + 'keys' )
|
366
|
+
logger.info "#{self.class}#setup_account Account already exist"
|
367
|
+
return false
|
368
|
+
# raise ConfigError, "Account already exist."
|
369
|
+
else
|
370
|
+
raise ConfigError, "Account config seems to be corrupt: missing 'keys' directory, but '#{account_directory}' exist"
|
371
|
+
end
|
366
372
|
else
|
367
|
-
|
368
|
-
raise ConfigError, "Account seems to be corrupt (missing 'config.xml' and 'keys' directory)."
|
373
|
+
raise ConfigError, "Account config seems to be corrupt: missing 'config.xml', but '#{account_directory}' exist"
|
369
374
|
end
|
370
375
|
end
|
371
376
|
else
|
@@ -398,7 +403,7 @@ private
|
|
398
403
|
# TODO: write tests
|
399
404
|
def self.account_configured?( conf_path, accountid )
|
400
405
|
raise ArgumentError, "Saferpay.check_config Bad parameters. Configuration path: \"#{conf_path}\", accountid: \"#{accountid}\"" if (accountid.nil? || conf_path.nil?)
|
401
|
-
account_directory = "#{conf_path}conf_for_#{accountid}"
|
406
|
+
account_directory = "#{conf_path}conf_for_#{accountid}/"
|
402
407
|
|
403
408
|
if File.directory? conf_path
|
404
409
|
if File.directory? account_directory
|
metadata
CHANGED