--- /dev/null
+Revision history for Perl extension Business::OnlinePayment::OCV.
+
+0.01 Sat Nov 9 13:39:46 PST 2002
+ -original version; created by ivan 1.0
+ -based on Business::OCV by Benjamin Low <b.d.low@unsw.edu.au>
--- /dev/null
+OCV.pm
+Changes
+MANIFEST
+Makefile.PL
+README
+t/load.t
+t/bop.t
+t2/credit_card.t
+t2/bad_auth.t
--- /dev/null
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+ 'NAME' => 'Business::OnlinePayment::OCV',
+ 'VERSION_FROM' => 'OCV.pm', # finds $VERSION
+ 'AUTHOR' => 'Ivan Kohler <ivan-ocv@420.am>',
+ #'NORECURS' => 1, # dont descend into subdirectories
+ 'PREREQ_PM' => { 'Net::SSLeay' => 0,
+ #'Text::CSV_XS' => 0,
+ 'Business::OnlinePayment' => 0,
+ #'Business::CreditCard' => 0.27,
+ 'Business::OCV' => 0,
+ },
+);
+
--- /dev/null
+package Business::OnlinePayment::OCV;
+
+use strict;
+use Carp;
+use Business::OnlinePayment;
+#use Business::CreditCard;
+#use Net::SSLeay qw( make_form post_https );
+use Business::OCV; #qw( :transaction );
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $DEBUG);
+
+require Exporter;
+
+@ISA = qw(Exporter AutoLoader Business::OnlinePayment);
+@EXPORT = qw();
+@EXPORT_OK = qw();
+$VERSION = '0.01';
+
+#Business::OCV exporting is broken
+use subs qw(TRANS_APPROVED);
+sub TRANS_APPROVED (){ '0' } # transaction status result - approved
+
+$DEBUG = 0;
+
+
+sub set_defaults {
+ my $self = shift;
+# $self->server('sec.aba.net.au');
+# $self->port('443');
+# $self->path('/cgi-bin/service/authint');
+ $self->build_subs(qw( account ));
+}
+
+sub submit {
+ my $self = shift;
+ my %content = $self->content;
+
+ my $action = lc($content{'action'});
+ if ( $action eq 'normal authorization' ) {
+ } else {
+ croak "$action not (yet) supported";
+ }
+
+ $content{'expiration'} =~ /^(\d+)\D+\d{0,2}(\d{2})$/
+ or croak "unparsable expiration $content{expiration}";
+ my ($month, $year) = ( $1, $2 );
+ $month += 0;
+ $month = "0$month" if $month < 10;
+ my $exp = "$month$year";
+
+ my $ocv = new OCV (
+ Server => $self->server. ':'. $self->port,
+ ClientID => $content{login},
+ AccountNum => $self->account,
+ ) or die "can't create Business::OCV object: $@!";
+
+ my $m = $ocv->purchase(
+ 'CardData' => $content{card_number},
+ 'CardExpiry' => $exp,
+ 'Amount' => $content{'amount'} * 100,
+ );
+ croak $@ unless $m;
+
+ warn "Result: ". $m->Result, "\n";
+
+ if ( $m->Result == TRANS_APPROVED ) {
+ $self->is_success(1);
+ $self->result_code($m->Result);
+ $self->authorization($m->PreAuth); #?
+ } else {
+ $self->is_success(0);
+ $self->result_code($m->Result);
+ $self->error_message($m->ResponseText);
+ }
+
+}
+
+1;
+__END__
+
+=head1 NAME
+
+Business::OnlinePayment::OCV - OCV backend for Business::OnlinePayment
+
+=head1 SYNOPSIS
+
+ use Business::OnlinePayment;
+
+ my $tx = new Business::OnlinePayment("OCV");
+ $tx->content(
+ type => 'CC',
+ login => 'test', #ClientID
+ action => 'Authorization Only',
+ description => 'Business::OnlinePayment test',
+ amount => '49.95',
+ invoice_number => '100100',
+ name => 'Tofu Beast',
+ card_number => '4007000000027',
+ expiration => '09/02',
+ );
+ $tx->submit();
+
+ if($tx->is_success()) {
+ print "Card processed successfully: ".$tx->authorization."\n";
+ } else {
+ print "Card was rejected: ".$tx->error_message."\n";
+ }
+
+=head1 DESCRIPTION
+
+For detailed information see L<Business::OnlinePayment>.
+
+=head1 NOTE
+
+=head1 COMPATIBILITY
+
+This module is a wrapper around Business::OCV written by Benjamin
+Low <b.d.low@unsw.edu.au>. Eventually it will be self-contained.
+See <INSERTURLHERE> for details.
+
+=head1 AUTHOR
+
+Ivan Kohler <ivan-ocv@420.am>
+
+=head1 SEE ALSO
+
+perl(1). L<Business::OnlinePayment>, L<Business::OCV>.
+
+=cut
+
--- /dev/null
+Copyright (c) 1999/2000 University of New South Wales
+Copyright (c) 2002 Ivan Kohler
+
+All rights reserved. This program is free software; you can redistribute it
+and/or modify it under the same terms as Perl itself.
+
+This is Business::OnlinePayment::OCV, an Business::OnlinePayment backend
+module for the Ingenico Online Credit Verification Server (OCV). It is only
+useful if you have a merchant account with Ingenico:
+http://www.ingenico.com.au
+
+Currently, it is mostly a wrapper around Business::OCV written by Benjamin
+Low <b.d.low@unsw.edu.au>. Eventually it will be self-contained.
+
+There are tests in t2/ that may be useful to you once you have a test server
+setup.
+
+Ivan Kohler <ivan-ocv@420.am>
+
+Business::OnlinePayment is a generic interface for processing payments through
+online credit card processors, online check acceptance houses, etc. (If you
+like buzzwords, call it an "multiplatform ecommerce-enabling middleware
+solution").
+
--- /dev/null
+BEGIN { $| = 1; print "1..1\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use Business::OnlinePayment;
+$loaded = 1;
+print "ok 1\n";
--- /dev/null
+BEGIN { $| = 1; print "1..1\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use Business::OnlinePayment::OCV;
+$loaded = 1;
+print "ok 1\n";
--- /dev/null
+BEGIN { $| = 1; print "1..1\n"; }
+
+use Business::OnlinePayment;
+
+my $tx = new Business::OnlinePayment("OCV",
+ account => '0',
+ server => 'localhost',
+ port => 3005,
+);
+$tx->content(
+ type => 'CC',
+ login => '10009', #ClientID
+ action => 'Normal Authorization',
+ description => 'Business::OnlinePayment visa test',
+ amount => '1.01',
+ invoice_number => '100100',
+ customer_id => 'jsk',
+ first_name => 'Tofu',
+ last_name => 'Beast',
+ address => '123 Anystreet',
+ city => 'Anywhere',
+ state => 'UT',
+ zip => '84058',
+ card_number => '4111111111111112',
+ expiration => '08/06',
+);
+$tx->test_transaction(1); # test, dont really charge (NOP for this gateway)
+$tx->submit();
+
+if($tx->is_success()) {
+ print "not ok 1\n";
+ warn $tx->error_message;
+} else {
+ print "ok 1\n";
+}
--- /dev/null
+BEGIN { $| = 1; print "1..1\n"; }
+
+use Business::OnlinePayment;
+
+my $tx = new Business::OnlinePayment("OCV",
+ account => '0',
+ server => 'localhost',
+ port => 3005,
+);
+$tx->content(
+ type => 'CC',
+ login => '10009', #ClientID
+ action => 'Normal Authorization',
+ description => 'Business::OnlinePayment visa test',
+ amount => '1.00',
+ invoice_number => '100100',
+ customer_id => 'jsk',
+ name => 'Tofu Beast',
+ first_name => 'Tofu',
+ last_name => 'Beast',
+ address => '123 Anystreet',
+ city => 'Anywhere',
+ state => 'UT',
+ zip => '84058',
+ card_number => '4111111111111111',
+ expiration => '08/06',
+);
+$tx->test_transaction(1); # test, dont really charge (NOP for this gateway)
+$tx->submit();
+
+if($tx->is_success()) {
+ print "ok 1\n";
+} else {
+ warn "*******". $tx->error_message. "*******";
+ print "not ok 1\n";
+}