We need B:OP v3, thankyouverymuch.
[Business-OnlinePayment-Skipjack.git] / t / return_card_visa.t
1 BEGIN { $| = 1; print "1..4\n"; }
2
3 eval "use Net::SSLeay;";
4 if ( $@ ) {
5   print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit;
6 }
7
8 use Business::OnlinePayment;
9
10 my $tx = new Business::OnlinePayment("Skipjack");
11
12 #$Business::OnlinePayment::HTTPS::DEBUG = 1;
13 #$Business::OnlinePayment::HTTPS::DEBUG = 1;
14 #$Business::OnlinePayment::Skipjack::DEBUG = 1;
15 #$Business::OnlinePayment::Skipjack::DEBUG = 1;
16
17 my $login = $ENV{'sj_html_serial_number'} || '000843232776';
18 my $password = $ENV{'sj_devel_serial_number'} || '100025931874';
19
20 $tx->content(
21     type           => 'VISA',
22     login          => $login, # "HTML serial number"
23     password       => $password, # "Developer serial number"
24     action         => 'Normal Authorization',
25     description    => 'Business::OnlinePayment::Skipjack test',
26     amount         => '32',
27     card_number    => '4445999922225',
28     expiration     => '03/10',
29     cvv2           => '999',
30     name           => 'Tofu Beast',
31     address        => '8320',
32     city           => 'Anywhere',
33     state          => 'UT',
34     zip            => '85284',
35     phone          => '415-420-5454',
36     email          => 'ivan-skipjack-test@420.am',
37 );
38 $tx->test_transaction(1); # test, dont really charge
39 $tx->submit();
40
41 if($tx->is_success()) {
42     print "ok 1\n";
43 } else {
44     #warn $tx->server_response."\n";
45     warn $tx->error_message. "\n";
46     print "not ok 1\n";
47 }
48
49 # -------
50
51 my $pa_tx = new Business::OnlinePayment("Skipjack");
52
53 $pa_tx->content(
54     type  => 'VISA',
55     login          => $login, # "HTML serial number"
56     password       => $password, # "Developer serial number"
57     action         => 'Post Authorization',
58     description    => 'Business::OnlinePayment::Skipjack test',
59     order_number   => $tx->order_number(),
60 );
61
62 $pa_tx->test_transaction(1); #test
63 $pa_tx->submit();
64
65 if($pa_tx->is_success()) {
66     print "ok 2\n";
67
68 #  warn "STATUS : ". $st_tx->status(). "\n";
69 #  warn "PENDING: ". $st_tx->pending_status(). "\n";
70
71 } else {
72     #warn $pa_tx->server_response."\n";
73     warn $pa_tx->error_message. "\n";
74     print "not ok 2\n";
75 }
76
77 # -------
78
79 my $st_tx = new Business::OnlinePayment("Skipjack");
80
81 $st_tx->content(
82     type  => 'VISA',
83     login          => $login, # "HTML serial number"
84     password       => $password, # "Developer serial number"
85     action         => 'Status',
86     description    => 'Business::OnlinePayment::Skipjack test',
87     order_number   => $tx->order_number(),
88 );
89
90 $st_tx->test_transaction(1); #test
91 $st_tx->submit();
92
93 if($st_tx->is_success()) {
94     print "ok 3\n";
95
96   #warn "STATUS : ". $st_tx->status(). "\n";
97   #warn "PENDING: ". $st_tx->pending_status(). "\n";
98
99 } else {
100     #warn $st_tx->server_response."\n";
101     warn $st_tx->error_message. "\n";
102     print "not ok 3\n";
103 }
104
105 # -------
106
107 print "ok 4 # Skipped: Credit needs a settled transaction\n"; exit;
108
109 my $cr_tx = new Business::OnlinePayment("Skipjack");
110
111 $cr_tx->content(
112     type           => 'VISA',
113     login          => $login, # "HTML serial number"
114     password       => $password, # "Developer serial number"
115     action         => 'Credit',
116     description    => 'Business::OnlinePayment::Skipjack test',
117     amount         => 11,
118     order_number   => $tx->order_number(),
119 );
120
121 $cr_tx->test_transaction(1); # test, dont really charge
122 $cr_tx->submit();
123
124 if($cr_tx->is_success()) {
125     print "ok 4\n";
126 } else {
127     #warn $cr_tx->server_response."\n";
128     warn $cr_tx->error_message. "\n";
129     print "not ok 4\n";
130 }
131
132
133
134