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

describe BillForward::CreditNote do
	before :all do
		@client = BillForwardTest::TEST_CLIENT
		BillForward::Client.default_client = @client
	end
	describe '::create' do
		context 'account exists' do
			context 'account has credit note payment method' do
				before :all do
					@created_account = BillForward::Account.create

					payment_method = BillForward::PaymentMethod.new({
						'accountID' => @created_account.id,
						'name' => 'Credit Notes',
						'description' => 'Pay using credit',
						# engines will link this to an invoice once paid, for the sake of refunds
						'linkID' => '',
						'gateway' => 'credit_note',
						'userEditable' => 0,
						'priority' => 100,
						'reusable' => 1
						})
					created_payment_method = BillForward::PaymentMethod::create(payment_method)
				end
				subject (:account) { @created_account }
				it 'issues credit' do
					credit_note = BillForward::CreditNote.new({
						"accountID" => account.id,
					    "nominalValue" => 15,
					    "currency" => "USD"
						})
					created_credit_note = BillForward::CreditNote.create(credit_note)

					expect(created_credit_note['@type']).to eq(BillForward::CreditNote.resource_path.entity_name)
				end
			end
		end
	end
end<commit_msg>Update credit note expectations<commit_after>require File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "spec_helper")

describe BillForward::CreditNote do
	before :all do
		@client = BillForwardTest::TEST_CLIENT
		BillForward::Client.default_client = @client
	end
	describe '::create' do
		context 'account exists' do
			context 'account has credit note payment method' do
				before :all do
					@created_account = BillForward::Account.create

					# account implicitly has these nowadays
					# payment_method = BillForward::PaymentMethod.new({
					# 	'accountID' => @created_account.id,
					# 	'name' => 'Credit Notes',
					# 	'description' => 'Pay using credit',
					# 	# engines will link this to an invoice once paid, for the sake of refunds
					# 	'linkID' => '',
					# 	'gateway' => 'credit_note',
					# 	'userEditable' => 0,
					# 	'priority' => 100,
					# 	'reusable' => 1
					# 	})
					# created_payment_method = BillForward::PaymentMethod::create(payment_method)
				end
				subject (:account) { @created_account }
				it 'issues credit' do
					credit_note = BillForward::CreditNote.new({
						"accountID" => account.id,
					    "value" => 15,
					    "currency" => "USD"
						})
					created_credit_note = BillForward::CreditNote.create(credit_note)

					expect(created_credit_note['@type']).to eq(BillForward::CreditNote.resource_path.entity_name)
				end
			end
		end
	end
end
{'fraction_non_alphanumeric': 0.12771345875542692, 'fraction_numerical': 0.005065123010130246, 'mean_word_length': 3.438202247191011, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2486953', 'n_tokens_mistral': 1120, 'n_tokens_neox': 837, 'n_words': 197}