5 use Test::More tests => 24;
7 use Business::OnlinePayment;
9 my $package = "Business::OnlinePayment";
10 my $driver = "PayflowPro";
15 $obj = $package->new($driver);
16 isa_ok( $obj, $package );
19 can_ok( $obj, qw(vendor partner) );
20 can_ok( $obj, qw(order_number avs_code cvv2_response) );
21 can_ok( $obj, qw(request_id debug expdate_mmyy) );
24 can_ok( $obj, qw(_map_fields _revmap_fields) );
27 my $server = "payflowpro.verisign.com";
29 is( $obj->server, $server, "server($server)" );
30 is( $obj->port, "443", "port(443)" );
33 { # cvv2_response / cvv2_code
34 my $obj = $package->new($driver);
37 $obj->cvv2_response($exp);
39 is( $obj->cvv2_response, $exp, "cvv2_response() is set" );
40 is( $obj->cvv2_code, $exp, "cvv2_code() calls cvv2_response" );
43 { # client_certification_id
44 my $obj = $package->new($driver);
46 my $id = $obj->client_certification_id;
47 isnt( $id, "", "client_certification_id() is set" );
50 is( $obj->client_certification_id($id),
51 $id, "client_certification_id() can be set" );
52 is( $obj->client_certification_id,
53 $id, "client_certification_id() remains set" );
57 my $obj = $package->new($driver);
59 is( $obj->client_timeout, 45, "client_timeout() returns 45 by default" );
62 is( $obj->client_timeout($to), $to, "client_timeout() can be set" );
63 is( $obj->client_timeout, $to, "client_timeout() remains set" );
67 my $obj = $package->new($driver);
70 #OFF [qw(1999.8 0899)],
71 #OFF [qw(1984-11 1184)],
73 #OFF [qw(06-12 1206)],
79 foreach my $aref (@exp) {
80 my ( $exp, $moyr ) = @$aref;
81 my ($mmyy) = $obj->expdate_mmyy($exp);
82 is( $mmyy, $moyr, "$exp: MMYY '$mmyy' eq '$moyr' from $exp" );
87 my $obj = $package->new($driver);
89 my $id = $obj->request_id;
90 isnt( $id, "", "request_id() returns something" );
92 is( $obj->request_id, $id, "request_id() returns the same value" );
94 $obj = $package->new($driver);
95 isnt( $obj->request_id, $id, "request_id() is different for each object" );
98 is( $obj->request_id($id), $id, "request_id() can be set" );
99 is( $obj->request_id, $id, "request_id() remains set" );