Skip to content

Commit

Permalink
Updated Authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoEigenmannCW committed Jul 13, 2017
1 parent b481a7c commit 78a4681
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 2 additions & 1 deletion lib/wallee-ruby-sdk/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ def build_request(http_method, path, opts = {})
# @param [String] path URL path (e.g. /account/new)
# @return [Hash] the authentication headers
def get_authentication_headers(http_method, path, query)
completed_path = "#{@config.base_path}#{path}"+'?'+query.map{|k,v| "#{k}=#{v}"}.join('&')
base_url = URI(@config.base_url)
completed_path = "#{base_url.path}#{path}"+'?'+query.map{|k,v| "#{k}=#{v}"}.join('&')
version = "1"
timestamp = Time.now.to_i
securedData = "#{version}|#{@config.user_id}|#{timestamp}|#{http_method.upcase}|#{completed_path}"
Expand Down
17 changes: 8 additions & 9 deletions test/transactioncreate.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'test/unit'
require 'wallee-ruby-sdk'
require 'uri'

class TestTransactionCreate < Test::Unit::TestCase

Expand All @@ -10,17 +9,17 @@ def test_create

Wallee.configure do |config|
config.user_id = ENV['APPLICATION_USER_ID']
config.authentication_key = ENV['APPLICATION_USER_KEY']
base_path = ENV['API_BASE_PATH']
unless base_path.empty?
base_url = URI(base_path)
config.scheme = base_url.scheme
config.host = base_url.host+":"+base_url.port.to_s
config.base_path = base_url.path
end
config.authentication_key = ENV['APPLICATION_AUTHENTICATION_KEY']
api_scheme = ENV['API_URL_SCHEME']
config.scheme = api_scheme unless api_scheme.nil? || api_scheme.empty?
api_host = ENV['API_URL_HOST']
config.host = api_host unless api_host.nil? || api_host.empty?
api_base_path = ENV['API_URL_BASE_PATH']
config.base_path = api_base_path unless api_base_path.nil? || api_base_path.empty?
end

transaction_service = Wallee::TransactionService.new

transaction = Wallee::TransactionCreate.new({
billingAddress: Wallee::AddressCreate.new({
city: "City",
Expand Down

0 comments on commit 78a4681

Please sign in to comment.