summaryrefslogtreecommitdiff
path: root/t2/credit_card.t
blob: 1f478751fb0db777bb90bce14af79ab86908cd0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
BEGIN { $| = 1; print "1..2\n"; }

use Business::OnlinePayment;

my $tx = new Business::OnlinePayment("BankOfAmerica", 'merchant_id' => 'YOURMERCHANTID' );
$tx->content(
    type           => 'VISA',
    action         => 'Authorization Only',
    description    => 'Business::OnlinePayment::BankOfAmerica visa test',
    amount         => '0.01',
    invoice_number => '100',
    customer_id    => 'jsk',
    first_name     => 'Tofu',
    last_name      => 'Beast',
    address        => '123 Anystreet',
    city           => 'Anywhere',
    state          => 'UT',
    zip            => '84058',
    country        => 'US',
    email          => 'ivan-bofa@420.am',
    card_number    => '4007000000027',
    expiration     => '12/2002',
    referer        => 'http://cleanwhisker.420.am/',
);
$tx->submit();

if($tx->is_success()) {
    print "ok 1\n";
    $auth = $tx->authorization;
    $ordernum = $tx->order_number;
    #warn "********* $auth ***********\n";
    #warn "********* $ordernum ***********\n";
} else {
    print "not ok 1\n";
#    warn '***** '. $tx->error_message. " *****\n";
    exit;
}

#exit;
my $capture = new Business::OnlinePayment("BankOfAmerica", 'merchant_id' => 'YOURMERCHANTID' );

$capture->content(
    action         => 'Post Authorization',
    login          => 'YOURLOGIN
    password       => 'YOURPASSWORD',
    order_number   => $ordernum,
    amount         => '0.01',
    authorization  => $auth,
    description    => 'Business::OnlinePayment::BankOfAmerica visa test',
);

$capture->submit();

if($capture->is_success()) { 
    print "ok 2\n";
} else {
#    warn '***** '. $capture->error_message. " *****\n";
    print "not ok 2\n";
}