Sha256: 0607698b9f4250f0a3a2d2a39b04c382411f9fdf4f7c9f2e27aa78964ff4b6e6

Contents?: true

Size: 1.29 KB

Versions: 15

Compression:

Stored size: 1.29 KB

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "..", "spec_helper")

describe BillForward::Organisation do
	before :all do
		@client = BillForwardTest::TEST_CLIENT
		BillForward::Client.default_client = @client

		# Authorize.Net credentials used to test adding a payment gateway
		@authorize_net_login_id = BillForwardTest::AUTHORIZE_NET_LOGIN_ID
		@authorize_net_transaction_key = BillForwardTest::AUTHORIZE_NET_TRANSACTION_KEY
	end
	describe '.api_configurations' do
		it "can be updated" do
			organisations = BillForward::Organisation.get_mine
			first_org = organisations.first


			# remove all existing AuthorizeNetConfigurations (if any)
			filtered = first_org.apiConfigurations.reject do |config|
				config['@type'] == 'AuthorizeNetConfiguration'
			end

			first_org.apiConfigurations = filtered


			#add a new AuthorizeNetConfiguration
			first_org.apiConfigurations.push BillForward::APIConfiguration.new({
				 "@type" =>          "AuthorizeNetConfiguration",
			     "APILoginID" =>     @authorize_net_login_id,
			     "transactionKey" => @authorize_net_transaction_key,
			     "environment" =>    "Sandbox"
				})
			updated_org = first_org.save

			added_config = updated_org.apiConfigurations.last
			expect(added_config.APILoginID).to eq(@authorize_net_login_id)
		end
	end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
bill_forward-2.2016.241 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-2.2016.227 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-2.2016.222 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-2.2016.209 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-1.2016.117 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-1.2016.101 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-1.2016.26 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-1.2015.321.1 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-1.2015.321 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-1.2015.299 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-1.2015.217.1 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-1.2015.217 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-1.2015.186 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-1.2015.183 spec/functional/bad_citizen/situational/organisation_spec.rb
bill_forward-1.2014.296 spec/functional/bad_citizen/situational/organisation_spec.rb