Skip to content

Commit 78a4681

Browse files
Updated Authentication
1 parent b481a7c commit 78a4681

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/wallee-ruby-sdk/api_client.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ def build_request(http_method, path, opts = {})
146146
# @param [String] path URL path (e.g. /account/new)
147147
# @return [Hash] the authentication headers
148148
def get_authentication_headers(http_method, path, query)
149-
completed_path = "#{@config.base_path}#{path}"+'?'+query.map{|k,v| "#{k}=#{v}"}.join('&')
149+
base_url = URI(@config.base_url)
150+
completed_path = "#{base_url.path}#{path}"+'?'+query.map{|k,v| "#{k}=#{v}"}.join('&')
150151
version = "1"
151152
timestamp = Time.now.to_i
152153
securedData = "#{version}|#{@config.user_id}|#{timestamp}|#{http_method.upcase}|#{completed_path}"

test/transactioncreate.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require 'test/unit'
22
require 'wallee-ruby-sdk'
3-
require 'uri'
43

54
class TestTransactionCreate < Test::Unit::TestCase
65

@@ -10,17 +9,17 @@ def test_create
109

1110
Wallee.configure do |config|
1211
config.user_id = ENV['APPLICATION_USER_ID']
13-
config.authentication_key = ENV['APPLICATION_USER_KEY']
14-
base_path = ENV['API_BASE_PATH']
15-
unless base_path.empty?
16-
base_url = URI(base_path)
17-
config.scheme = base_url.scheme
18-
config.host = base_url.host+":"+base_url.port.to_s
19-
config.base_path = base_url.path
20-
end
12+
config.authentication_key = ENV['APPLICATION_AUTHENTICATION_KEY']
13+
api_scheme = ENV['API_URL_SCHEME']
14+
config.scheme = api_scheme unless api_scheme.nil? || api_scheme.empty?
15+
api_host = ENV['API_URL_HOST']
16+
config.host = api_host unless api_host.nil? || api_host.empty?
17+
api_base_path = ENV['API_URL_BASE_PATH']
18+
config.base_path = api_base_path unless api_base_path.nil? || api_base_path.empty?
2119
end
2220

2321
transaction_service = Wallee::TransactionService.new
22+
2423
transaction = Wallee::TransactionCreate.new({
2524
billingAddress: Wallee::AddressCreate.new({
2625
city: "City",

0 commit comments

Comments
 (0)