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