1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 11;
use Business::OnlinePayment;
my $package = "Business::OnlinePayment";
my $driver = "PayflowPro";
{ # new
my $obj;
$obj = $package->new($driver);
isa_ok( $obj, $package );
# convenience methods
can_ok( $obj, qw(vendor partner) );
can_ok( $obj, qw(order_number avs_code cvv2_response) );
can_ok( $obj, qw(request_id debug expdate_mmyy) );
# internal methods
can_ok( $obj, qw(_map_fields _revmap_fields) );
# defaults
my $server = "payflowpro.verisign.com";
is( $obj->server, $server, "server($server)" );
is( $obj->port, "443", "port(443)" );
}
{ # expdate
my $obj = $package->new($driver);
my @exp = (
#OFF [qw(1999.8 0899)],
#OFF [qw(1984-11 1184)],
#OFF [qw(06/7 0706)],
#OFF [qw(06-12 1206)],
[qw(12/06 1206)],
[qw(6/2000 0600)],
[qw(10/2000 1000)],
[qw(1/99 0199)],
);
foreach my $aref (@exp) {
my ( $exp, $moyr ) = @$aref;
my ($mmyy) = $obj->expdate_mmyy($exp);
is( $mmyy, $moyr, "$exp: MMYY '$mmyy' eq '$moyr' from $exp" );
}
}
|