X-Git-Url: http://git.freeside.biz/gitweb/?p=Business-OnlinePayment-PayflowPro.git;a=blobdiff_plain;f=t%2Fbop.t;h=873937970ff139f90632bbfcb407f82b63648cd5;hp=6c9274de9bfd83dfff79d0adc436bdcbe77dfc32;hb=0cd63fdf0f05f7cf304d07707ddd2dae1cce268a;hpb=ccb61d83ed0a79a4eb6a8f55beadfb22705629e8 diff --git a/t/bop.t b/t/bop.t index 6c9274d..8739379 100644 --- a/t/bop.t +++ b/t/bop.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 24; +use Test::More tests => 30; use Business::OnlinePayment; @@ -98,3 +98,43 @@ my $driver = "PayflowPro"; is( $obj->request_id($id), $id, "request_id() can be set" ); is( $obj->request_id, $id, "request_id() remains set" ); } + +{ # _get_response - response parsing + my $obj = $package->new($driver); + + is_deeply( + $obj->_get_response('%66%6F%78=%71%75%69%63%6B%20%25%26%3B&e=3+3'), + { fox => 'quick %&;', e => '3 3' }, + "_get_response 1 returns correct value" + ); + is_deeply( + $obj->_get_response('Foo=&&&&;;ab=t+t;q=2'), + { Foo => '', ab => 't t', q => '2' }, + "_get_response 2 returns correct value" + ); + is_deeply( + $obj->_get_response('f=s'), + { f => 's' }, + "_get_response 3 returns correct value" + ); + is_deeply( $obj->_get_response(''), + {}, "_get_response 4 returns correct value" ); + is_deeply( $obj->_get_response(undef), + {}, "_get_response 5 returns correct value" ); + is_deeply( + $obj->_get_response( +'RESULT=0&PNREF=QAAA1DF4B4F4&RESPMSG=Approved&AUTHCODE=111PNQ&AVSADDR=X&AVSZIP=X&CVV2MATCH=Y&IAVS=X' + ), + { + RESULT => '0', + PNREF => 'QAAA1DF4B4F4', + RESPMSG => 'Approved', + AUTHCODE => '111PNQ', + AVSADDR => 'X', + AVSZIP => 'X', + CVV2MATCH => 'Y', + IAVS => 'X' + }, + "_get_response 6 returns correct value" + ); +}