Sha256: f3be7d2e1b77cee84978f401be51c05ef43f429f856e1b8c2464a6d5f909cf3c

Contents?: true

Size: 1.92 KB

Versions: 14

Compression:

Stored size: 1.92 KB

Contents

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

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

		# Authorize.Net credentials used to test tokenizing a card
		@authorize_net_customer_profile_id = BillForwardTest::AUTHORIZE_NET_CUSTOMER_PROFILE_ID
		@authorize_net_customer_payment_profile_id = BillForwardTest::AUTHORIZE_NET_CUSTOMER_PAYMENT_PROFILE_ID
		@authorize_net_card_last_4_digits = BillForwardTest::AUTHORIZE_NET_CARD_LAST_4_DIGITS
	end
	describe '::create' do
		context 'account exists' do
			context 'using Authorize.Net payment gateway' do
				before :all do
					organisations = BillForward::Organisation.get_mine
					first_org = organisations.first
					
					@created_account = BillForward::Account.create
					authorize_net_token = BillForward::AuthorizeNetToken.new({
						'accountID' => @created_account.id,
						'customerProfileID' => @authorize_net_customer_profile_id,
						'customerPaymentProfileID' => @authorize_net_customer_payment_profile_id,
						'lastFourDigits' => @authorize_net_card_last_4_digits,
						'organizationID' => first_org.id
						})

					@created_token = BillForward::AuthorizeNetToken.create(authorize_net_token)
				end
				subject (:token) { @created_token }
				subject (:account) { @created_account }
				it 'creates a payment method' do

					payment_method = BillForward::PaymentMethod.new({
						'accountID' => account.id,
						'linkID' => token.id,
						'name' => 'Authorize.Net',
						'description' => 'Pay via Authorize.Net',
						'gateway' => 'authorizeNet',
						'userEditable' => 0,
						'priority' => 100,
						'reusable' => 1
						})
					created_payment_method = BillForward::PaymentMethod::create(payment_method)

					expect(created_payment_method['@type']).to eq(BillForward::PaymentMethod.resource_path.entity_name)
				end
			end
		end
	end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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