initial import
[Business-OnlinePayment-IPaymentTPG.git] / t / capture.t
1 BEGIN { $| = 1; print "1..2\n"; }
2
3 #print "ok 1 # Skipped: need a valid iPayment login/password to test\n";
4 #print "ok 2 # Skipped: need a valid iPayment login/password to test\n";
5 #exit;
6
7 use Business::OnlinePayment;
8
9 my $tx = new Business::OnlinePayment("IPaymentTPG");
10 $tx->content(
11     login          => 'testing',# CHANGE THESE TO TEST
12     password       => 'testing',#
13     type           => 'VISA',
14     action         => 'Authorization Only',
15     description    => 'Business::OnlinePayment visa test',
16     amount         => '49.95',
17     invoice_number => '100100',
18     customer_id    => 'jsk',
19     first_name     => 'Tofu',
20     last_name      => 'Beast',
21     address        => '123 Anystreet',
22     city           => 'Anywhere',
23     state          => 'UT',
24     zip            => '84058',
25     card_number    => '4007000000027',
26     expiration     => '08/06',
27 );
28 $tx->test_transaction(1); # test, dont really charge
29 $tx->submit();
30
31 unless($tx->is_success()) {
32     print "not ok 1\n";
33     print "not ok 2\n";
34 } else {
35     my $order_number = $tx->order_number;
36     #warn $order_number;
37     print "ok 1\n";
38
39     my $settle_tx = new Business::OnlinePayment("IPaymentTPG");
40     $settle_tx->content(
41       type           => 'VISA',
42       login          => 'testing', # CHANGE THESE TO TEST
43       password       => 'testing', #
44       action         => 'Post Authorization',
45       description    => 'Business::OnlinePayment visa test',
46       amount         => '49.95',
47       invoice_number => '100100',
48       order_number   => $order_number,
49       card_number    => '4007000000027',
50       expiration     => '08/06',
51     );
52
53     $settle_tx->test_transaction(1); # test, dont really charge
54     $settle_tx->submit();
55
56     if($settle_tx->is_success()) {
57         print "ok 2\n";
58     } else {
59         #warn $settle_tx->error_message;
60         print "not ok 2\n";
61     }
62
63 }