X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=t%2F20emit.t;h=8ba4804bc1a528d8c6728a3dfb88b0039378e29a;hb=aee9564f2cae2cd7b63aba4d52105dbf24422bae;hp=7fac2d6f25a0dabdc8c1fd7db69f87fc33f74fa6;hpb=7d2b4fcded0d2db27ee37d8a2f3421e343eb6cd5;p=Business-OnlinePayment-InternetSecure.git diff --git a/t/20emit.t b/t/20emit.t index 7fac2d6..8ba4804 100755 --- a/t/20emit.t +++ b/t/20emit.t @@ -1,4 +1,6 @@ -use Test::More tests => 4 + 2; +# vim:set syntax=perl encoding=utf-8: + +use Test::More tests => 4 + 3; BEGIN { use_ok('Business::OnlinePayment') }; BEGIN { use_ok('Business::OnlinePayment::InternetSecure') }; @@ -14,7 +16,7 @@ use constant TRANSACTIONS => ( action => 'Normal Authorization', type => 'Visa', - card_number => '0000000000000000', + card_number => '4111 1111 1111 1111', exp_date => '2004-07', cvv2 => '000', @@ -29,8 +31,8 @@ use constant TRANSACTIONS => ( email => 'fbriere@fbriere.net', amount => undef, - currency => 'CAD', - taxes => 'GST PST', + currency => 'USD', + taxes => 'HST', description => [ { @@ -42,11 +44,12 @@ use constant TRANSACTIONS => ( { amount => 5.65, description => 'Shipping', + taxes => 'GST PST', }, { amount => 10.00, description => 'Some HST example', - taxes => 'HST', + taxes => [ 'GST', 'PST' ], }, ], }, @@ -55,29 +58,46 @@ use constant TRANSACTIONS => ( action => 'Normal Authorization', - type => 'Visa', - card_number => '4000000000000000', + card_number => '5111-1111-1111-1111', exp_date => '7/2004', - name => "Fr\x{e9}d\x{e9}ric Bri\x{e8}re", + name => "\x{201c}Fr\x{e9}d\x{e9}ric Bri\x{e8}re\x{201d}", amount => 12.95, - currency => 'USD', - taxes => '', description => "Box o' goodies", + currency => 'USD', + taxes => 'GST', + }, + { + _test => -1, + + action => 'Normal Authorization', + + card_number => '5111-1111-1111-1111', + exp_date => '0704', + + name => "Fr\x{e9}d\x{e9}ric Bri\x{e8}re", + + amount => 13.95, }, ); my $txn = new Business::OnlinePayment 'InternetSecure', merchant_id => '0000'; -$/ = ''; foreach (TRANSACTIONS) { $txn->test_transaction(delete $_->{_test}); $txn->content(%$_); + + my $data = do { + # Work around bug #17687 + local $/ = ''; + scalar ; + }; + is_deeply( - xml_in(Encode::encode('utf8', $txn->to_xml)), - xml_in(scalar ) + xml_in($txn->to_xml), + xml_in($data) ); } @@ -86,12 +106,12 @@ __DATA__ 0000 - 0000000000000000 + 4111111111111111 07 2004 1 000 - 9.99::5::a 001::Some product::{CAD}{GST}{PST}|5.65::1::::Shipping::{CAD}{GST}{PST}|10.00::1::::Some HST example::{CAD}{HST} + 9.99::5::a 001::Some product::{USD}{HST}|5.65::1::::Shipping::{USD}{GST}{PST}|10.00::1::::Some HST example::{USD}{GST}{PST} Frédéric Brière 123 Street @@ -115,12 +135,41 @@ __DATA__ 0000 - 4000000000000000 + 5111111111111111 + 07 + 2004 + 0 + + 12.95::1::::Box o' goodies::{USD}{GST}{TEST} + ?Frédéric Brière? + + + + + + + + + + + + + + + + + + + + + + 0000 + 5111111111111111 07 2004 0 - 12.95::1::::Box o' goodies::{USD}{TEST} + 13.95::1::::::{CAD}{TESTD} Frédéric Brière