use warnings;
use FindBin qw( $Bin );
-use Test::More tests => 35;
+use Test::More tests => 40;
+use Koha::EDI;
BEGIN { use_ok('Koha::Edifact') }
is( $test_line->line_item_number, 18, 'correct line number returned' );
is( $test_line->item_number_id, '9780273761006', 'correct ean returned' );
is( $test_line->quantity, 1, 'quantity returned' );
+is( $test_line->price_info, 114.97, 'price returned' );
+is( $test_line->price_info_inclusive, undef, 'discounted price undefined as expected' );
my $test_title = 'International business [electronic resource]';
my $marcrec = $test_line->marc_record;
is( $branch, 'ELIB', "branch returned" );
my $fund_allocation = $test_line->girfield('fund_allocation');
is( $fund_allocation, '660BOO_2013', "fund_allocation returned" );
-my $collection_code = $test_line->girfield('collection_code');
-is( $collection_code, 'EBOO', "collection_code returned" );
+my $sequence_code = $test_line->girfield('sequence_code');
+is( $sequence_code, 'EBOO', "sequence_code returned" );
#my $shelfmark = $test_line->girfield('shelfmark');
#my $classification = $test_line->girfield('classification');
$y = $ol->girfield( 'branch', 4 );
is( $y, 'SOU', 'Copy Branch returned' );
-$y = $ol->girfield( 'collection_code', 4 );
-is( $y, 'ANF', 'Collection code returned' );
+$y = $ol->girfield( 'sequence_code', 4 );
+is( $y, 'ANF', 'Sequence code returned' );
$y = $ol->girfield( 'stock_category', 4 );
is( $y, 'RS', 'Copy stock category returned' );
+
+# test internal routines for prices
+my $dp = Koha::EDI::_discounted_price(33.0, 9);
+is( $dp, 6.03, 'Discount calculated' );
+
+$dp = Koha::EDI::_discounted_price(0.0, 9);
+is( $dp, 9.0, 'Discount calculated with discount = 0' );
+
+$dp = Koha::EDI::_discounted_price(0.0, 9, 8.0);
+is( $dp, 8.0, 'Discount overridden by incoming calculated value');