local URLs for docs
[Business-OnlinePayment-VirtualNet.git] / t / credit_card3.t
1 BEGIN { $| = 1; print "1..2\n"; }
2
3 use Business::OnlinePayment;
4
5 $DEBUG = 0;
6 $Business::OnlinePayment::VirtualNet::DEBUG = $DEBUG;
7 $Business::OnlinePayment::VirtualNet::DEBUG += 0; #quiet warnings with old perl
8
9 #     Use this merchant information for testing only. 
10 #  
11 #     Bin= 999995 Agent = 000000 Chain = 111111 Merchant = 888000002200
12 # Store = 5999 Terminal = 1515
13 #      Mcc = 5999 .
14 #    If you are doing AVS (address Ver ) use this address  8320 zip 85284.
15
16 my $tx = new Business::OnlinePayment("VirtualNet",
17     'merchant_id' => '888000002200',
18     'store'       => '5999',
19     'terminal'    => '1515',
20     'mcc'         => '5999', #merchant category code
21     'bin'         => '999995', #acquirer BIN
22     #'bin'         => '999700', #acquirer BIN
23     'zip'         => '543211420', #merchant zip (US) or assigned city code
24
25     'agent'       => '000000', #agent bank
26     'v'           => '00000001',
27
28     'merchant_name'  => 'Internet Service Provider', #25 char max
29     'merchant_city'  => 'Gloucester', #13 char max
30     'merchant_state' => 'VA', #2 char
31
32     'seq_file'    => '/tmp/bop-virtualnet-sequence',
33     'batchnum_file' => '/tmp/bop-virtualnet-batchnum', # :/  0-999 in 5 days
34 );
35
36 $tx->content(
37     type           => 'CC',
38     action         => 'Authorization only',
39     description    => 'Business::OnlinePayment visa test',
40     #amount         => '10.00',
41     amount         => '3.20',
42     invoice_number => '100100',
43     customer_id    => 'jsk',
44     name           => 'Tofu Beast',
45     first_name     => 'Tofu',
46     last_name      => 'Beast',
47     address        => '8320 Anystreet',
48     city           => 'Anywhere',
49     state          => 'UT',
50     zip            => '84284',
51 #    card_number    => '4111111111111111',
52 #    expiration     => '09/03',
53 #    card_number    => '5499740000000057',
54 #    expiration     => '01/05',
55     card_number    => '6011000993026909',
56     expiration     => '01/04',
57
58 );
59 $tx->test_transaction(1); # test, dont really charge (doesn't do anything with VirtualNet)
60 $tx->submit();
61
62 if($tx->is_success()) {
63     print "ok 1 (". $tx->authorization. ")\n";
64     warn "(auth ok ". $tx->authorization. ")\n" if $DEBUG;
65 } else {
66     warn "(auth) ** (". $tx->result_code. ') '. $tx->error_message. "**\n"
67       if $DEBUG;
68     print "not ok 1\n";
69     exit;
70 }
71
72 $tx->content(
73   type           => 'CC',
74   action         => 'Post Authorization',
75   #amount         => '10.00',
76   amount         => '3.20',
77 #  card_number    => '4111111111111111',
78 #  expiration     => '09/03',
79 #  card_number    => '5499740000000057',
80 #  expiration     => '01/05',
81    card_number    => '6011000993026909',
82    expiration     => '01/04',
83
84   authorization             => $tx->authorization,
85   authorization_source_code => $tx->authorization_source_code,
86   returned_ACI              => $tx->returned_ACI,
87   transaction_identifier    => $tx->transaction_identifier,
88   validation_code           => $tx->validation_code,
89   transaction_sequence_num  => $tx->transaction_sequence_num,
90   local_transaction_date    => $tx->local_transaction_date,
91   local_transaction_time    => $tx->local_transaction_time,
92   AVS_result_code           => $tx->AVS_result_code,
93   #description    => 'Business::OnlinePayment::VirtualNet test',
94 );
95
96 $tx->submit();
97
98 if($tx->is_success()) { 
99     print "ok 2\n";
100 } else {
101     warn '(capture) ** ('.$tx->result_code.') '.  $tx->error_message. " **\n"
102       if $DEBUG;
103     print "not ok 2\n";
104 }
105