Revision history for Perl extension Business::OnlinePayment::eSelectPlus
-0.04 Sat Oct 20 03:15:54 PDT 2012
- - Fix voids
+0.05 Sat Nov 10 14:20:42 PST 2012
+ - Pre-auth, capture/completion, voids and credits are now supported.
+ Note: testing preauth seems to work only with test store #1 (CAD).
+ - Backwards-compatibility note (align usage of 'authorization' &
+ 'order_number' with notes_for_module_writers_v3 (3.0.1)):
+ + authorization() now returns gateway transaction number (TransId)
+ rather than bank authorization code (AuthCode)
+ + order_number() now returns ReceiptId rather than ReferenceNum
+ - by Randall Whitman <www.whizman.com> on contract to
+ DonorWare LLC dba donor.com <cpan @ donor . com>.
+
+0.04 unreleased
+ - Fix voids ("purchasecorrection" not "void")
0.03 Tue Mar 1 13:40:08 PST 2011
- Update for compatibility with US Moneris. Backwards-compatibility
- Remove extra spaces and other odd characters in Message.
- by Randall Whitman <www.whizman.com> on contract to
DonorWare LLC dba donor.com <cpan @ donor . com>.
- - fix tests, die on connction errors per B:OP spec
+ - fix tests, die on connection errors per B:OP spec (ivan)
0.01 Wed Mar 16 02:39:29 PST 2005
- original version; created by ivan 1.0
t/bad_card_us.t
t/crypt_bad_card_ca.t
t/crypt_bad_card_us.t
+t/capture_ca.t
+t/capture_us.t
+t/void_us.t
+t/void_ca.t
Copyright (c) 2004 Ivan Kohler
-Copyright (c) 2008 DonorWare LLC
+Copyright (c) 2012 Freeside Internet Services, Inc.
+Copyright (c) 2008-2011 DonorWare LLC
All rights reserved. This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
use vars qw($VERSION $DEBUG @ISA);
@ISA = qw(Business::OnlinePayment::HTTPS);
-$VERSION = '0.04';
+$VERSION = '0.05';
$DEBUG = 0;
sub set_defaults {
} elsif ( $action eq 'completion' || $action eq 'purchasecorrection' ) {
+ $self->{_content}{comp_amount} = delete $self->{_content}{amount}
+ if $action eq 'completion';
+
$self->required_fields( qw( login password order_number authorization ) );
} elsif ( $action eq 'refund' ) {
my( $page, $response, @reply_headers) = $self->https_post( $post_data );
- #my %reply_headers = @reply_headers;
- #warn join('', map { " $_ => $reply_headers{$_}\n" } keys %reply_headers )
- # if $DEBUG;
+ if ($DEBUG > 1) {
+ my %reply_headers = @reply_headers;
+ warn join('', map { " $_ => $reply_headers{$_}\n" } keys %reply_headers)
+ }
if ($response !~ /^200/) {
# Connection error
$self->is_success(0);
my $diag_message = $response || "connection error";
die $diag_message;
-
}
# avs_code - eSELECTplus_Perl_IG.pdf Appendix F
die "gateway error: ". $self->GetXMLProp( $page, 'Message' )
if $result =~ /^null$/i;
- # New unique reference created by the gateway
- $self->order_number($self->GetXMLProp($page, 'ReferenceNum'));
# Original order_id supplied to the gateway
- #$self->order_number($self->GetXMLProp($page, 'ReceiptId'));
+ $self->order_number($self->GetXMLProp($page, 'ReceiptId'));
# We (Whizman & DonorWare) do not have enough info about "ISO"
# response codes to make use of them.
if ( $result =~ /^\d+$/ && $result < 50 ) {
$self->is_success(1);
- $self->authorization($self->GetXMLProp($page, 'AuthCode'));
+ $self->authorization($self->GetXMLProp($page, 'TransID'));
} elsif ( $result =~ /^\d+$/ ) {
$self->is_success(0);
my $tmp_msg = $self->GetXMLProp( $page, 'Message' );
For detailed information see L<Business::OnlinePayment>.
-=head1 Note for Canadian merchants upgrading to 0.03
+=head1 NOTES
+
+=head2 Note for Canadian merchants upgrading to 0.03
As of version 0.03, this module now defaults to the US Moneris. Make sure to
pass currency=>'CAD' for Canadian transactions.
+=head2 Note for upgrading to 0.05
+
+As of version 0.05, the bank authorization code is discarded (AuthCode),
+so that authorization() and order_number() can return the 2 fields needed
+for capture. See also
+cpansearch.perl.org/src/IVAN/Business-OnlinePayment-3.02/notes_for_module_writers_v3
+
=head1 AUTHOR
Ivan Kohler <ivan-eselectplus@420.am>
-Randall Whitman <www.whizman.com>
+Randall Whitman L<whizman.com|http://whizman.com>
=head1 SEE ALSO
--- /dev/null
+#!/usr/bin/perl -w
+
+# B:OP eSelectPlus Canadian Pre-Auth & Capture
+# Portions loosely adapted from B:OP AuthorizeNet via B:OP Exact
+
+use Test::More;
+plan tests => 5;
+
+use_ok 'Business::OnlinePayment';
+
+my $amount;
+$amount = '1.00';
+my $order_id;
+$order_id = 'B:OP' . time; # Caller generates order_id; cf. capture-us.t;
+
+my $tx = new Business::OnlinePayment("eSelectPlus");
+$tx->content(
+ login => 'moot',
+ password => 'moot',
+ action => 'Authorization Only',
+ order_id => $order_id,
+# description => 'Business::OnlinePayment visa test',
+ amount => $amount,
+ currency => 'CAD',
+# name => 'eSelectPlus Tester',
+ card_number => '4242424242424242',
+ expiration => '12/14',
+);
+
+$tx->test_transaction(1); # test, dont really charge
+
+$tx->submit();
+
+my $flag =
+ ok($tx->is_success(), 'Pre-Auth') or diag $tx->error_message;
+
+# note: long
+# use Data::Dumper;
+# diag(Dumper $tx);
+
+my $auth = $tx->authorization; # TransID
+my $order_number = $tx->order_number;
+#$order_id = $tx->order_id;
+like $auth, qr/\d+/, 'authorization';
+like $order_number, qr/\d+/, 'order number';
+#ok $order_id, 'order ID';
+
+#warn "auth: $auth\n";
+#warn "order_number: $order_number\n";
+SKIP: {
+ skip 'Need pre-auth success, in order to test capture', 1
+ unless $flag;
+
+my $settle_tx = new Business::OnlinePayment("eSelectPlus");
+$settle_tx->content(
+ login => 'moot',
+ password => 'moot',
+ action => 'Post Authorization',
+# description => 'Business::OnlinePayment visa test',
+ currency => 'CAD',
+ amount => $amount,
+ authorization => $auth,
+# order_id => $order_id,
+ order_number => $order_number,
+# name => 'eSelectPlus Tester',
+# card_number => '4242424242424242',
+# expiration => '12/12',
+);
+
+$settle_tx->test_transaction(1); # test, dont really charge
+$settle_tx->submit();
+
+ok($settle_tx->is_success(), 'Capture') || diag $settle_tx->error_message;
+} # /skip or test
--- /dev/null
+#!/usr/bin/perl -w
+
+# B:OP eSelectPlus USA Pre-Auth & Capture
+# Portions loosely adapted from B:OP AuthorizeNet via B:OP Exact
+
+use Test::More;
+plan tests => 5;
+
+use_ok 'Business::OnlinePayment';
+
+my $amount;
+$amount = '1.00';
+my $order_id;
+#$order_id = 'B:OP' . time; # Generate inside B:OP; cf. capture_ca.t
+
+my $tx = new Business::OnlinePayment("eSelectPlus");
+$tx->content(
+ login => 'moot',
+ password => 'moot',
+ action => 'Authorization Only',
+# order_id => $order_id, # Generate inside B:OP
+# description => 'Business::OnlinePayment visa test',
+ amount => $amount,
+# name => 'eSelectPlus Tester',
+ card_number => '4242424242424242',
+ expiration => '12/12',
+# invoice_number => 'freeform',
+);
+
+$tx->test_transaction(1); # test, dont really charge
+
+$tx->submit();
+
+my $flag =
+ ok($tx->is_success(), 'Pre-Auth') or diag $tx->error_message;
+
+# note: long
+# use Data::Dumper;
+# diag(Dumper $tx);
+
+my $auth = $tx->authorization; # TransID
+my $order_number = $tx->order_number;
+#$order_id = $tx->order_id;
+like $auth, qr/\d+/, 'authorization';
+like $order_number, qr/\d+/, 'order number';
+#ok $order_id, 'order ID';
+
+#warn "auth: $auth\n";
+#warn "order_number: $order_number\n";
+SKIP: {
+ skip 'Need pre-auth success, in order to test capture', 1
+ unless $flag;
+
+my $settle_tx = new Business::OnlinePayment("eSelectPlus");
+$settle_tx->content(
+ login => 'moot',
+ password => 'moot',
+ action => 'Post Authorization',
+# description => 'Business::OnlinePayment visa test',
+ amount => $amount,
+ authorization => $auth,
+# order_id => $order_id,
+ order_number => $order_number,
+# name => 'eSelectPlus Tester',
+# card_number => '4242424242424242', # not required
+# expiration => '12/12',
+);
+
+$settle_tx->test_transaction(1); # test, dont really charge
+$settle_tx->submit();
+
+ok($settle_tx->is_success(), 'Capture') || diag $settle_tx->error_message;
+} # /skip or test