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