1 package Business::OnlinePayment::OCV;
5 use Business::OnlinePayment;
6 #use Business::CreditCard;
7 #use Net::SSLeay qw( make_form post_https );
8 use Business::OCV; #qw( :transaction );
9 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $DEBUG);
13 @ISA = qw(Exporter AutoLoader Business::OnlinePayment);
18 #Business::OCV exporting is broken
19 use subs qw(TRANS_APPROVED);
20 sub TRANS_APPROVED (){ '0' } # transaction status result - approved
27 # $self->server('sec.aba.net.au');
29 # $self->path('/cgi-bin/service/authint');
30 $self->build_subs(qw( account ));
35 my %content = $self->content;
37 my $action = lc($content{'action'});
38 if ( $action eq 'normal authorization' ) {
40 croak "$action not (yet) supported";
43 $content{'expiration'} =~ /^(\d+)\D+\d{0,2}(\d{2})$/
44 or croak "unparsable expiration $content{expiration}";
45 my ($month, $year) = ( $1, $2 );
47 $month = "0$month" if $month < 10;
48 my $exp = "$month$year";
51 Server => $self->server. ':'. $self->port,
52 ClientID => $content{login},
53 AccountNum => $self->account,
54 ) or die "can't create Business::OCV object: $@!";
56 my $m = $ocv->purchase(
57 'CardData' => $content{card_number},
59 'Amount' => $content{'amount'} * 100,
63 warn "Result: ". $m->Result, "\n";
65 if ( $m->Result == TRANS_APPROVED ) {
67 $self->result_code($m->Result);
68 $self->authorization($m->PreAuth); #?
71 $self->result_code($m->Result);
72 $self->error_message($m->ResponseText);
82 Business::OnlinePayment::OCV - OCV backend for Business::OnlinePayment
86 use Business::OnlinePayment;
88 my $tx = new Business::OnlinePayment("OCV");
91 login => 'test', #ClientID
92 action => 'Authorization Only',
93 description => 'Business::OnlinePayment test',
95 invoice_number => '100100',
97 card_number => '4007000000027',
98 expiration => '09/02',
102 if($tx->is_success()) {
103 print "Card processed successfully: ".$tx->authorization."\n";
105 print "Card was rejected: ".$tx->error_message."\n";
110 For detailed information see L<Business::OnlinePayment>.
116 This module is a wrapper around Business::OCV written by Benjamin
117 Low <b.d.low@unsw.edu.au>. Eventually it will be self-contained.
118 See <INSERTURLHERE> for details.
122 Ivan Kohler <ivan-ocv@420.am>
126 perl(1). L<Business::OnlinePayment>, L<Business::OCV>.