summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-08-21 11:59:52 -0700
committerIvan Kohler <ivan@freeside.biz>2013-08-21 11:59:52 -0700
commitf1a879e6989d8d9687fd5033a46488e8b13448e1 (patch)
tree7812a40970ccbbea0af0cd639c5379507988ebe1
parenteba22f02d42477d467b870179eb01cc752960c1d (diff)
cust_id: Use customer number instead of invoice number / order_id: Append "-invoice_num" per documentation
-rw-r--r--Changes4
-rw-r--r--MANIFEST1
-rw-r--r--eSelectPlus.pm11
-rw-r--r--t/order_num_ca.t38
4 files changed, 51 insertions, 3 deletions
diff --git a/Changes b/Changes
index 538c875..276cb1b 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
Revision history for Perl extension Business::OnlinePayment::eSelectPlus
+0.07 Wed Aug 21 11:53:36 PDT 2013
+ - eSelectPlus cust_id: Use customer number instead of invoice number
+ - eSelectPlus order_id: Append "-invoice_num" per documentation
+
0.06 Mon Nov 12 14:28:16 PST 2012
- Fix voids even if an amount is passed (now ignored)
- Add missing t/void_{ca,us}.t tests
diff --git a/MANIFEST b/MANIFEST
index 93cf9a5..00069b0 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -18,3 +18,4 @@ t/capture_ca.t
t/capture_us.t
t/void_us.t
t/void_ca.t
+t/order_num_ca.t
diff --git a/eSelectPlus.pm b/eSelectPlus.pm
index 3357703..ebe0203 100644
--- a/eSelectPlus.pm
+++ b/eSelectPlus.pm
@@ -8,7 +8,7 @@ use Business::OnlinePayment::HTTPS 0.03;
use vars qw($VERSION $DEBUG @ISA);
@ISA = qw(Business::OnlinePayment::HTTPS);
-$VERSION = '0.06';
+$VERSION = '0.07';
$DEBUG = 0;
sub set_defaults {
@@ -55,6 +55,10 @@ sub submit {
}
}
+ my %cust_id = ( 'invoice_number' => 'cust_id' );
+
+ my $invoice_number = $self->{_content}{invoice_number};
+
# BOP field => eSelectPlus field
#$self->map_fields();
$self->remap_fields(
@@ -81,8 +85,7 @@ sub submit {
# => 'expdate',
'amount' => 'amount',
- invoice_number => 'cust_id',
- #customer_id => 'cust_id',
+ customer_id => 'cust_id',
order_number => 'order_id', # must be unique number
authorization => 'txn_number' # reference to previous trans
@@ -121,6 +124,8 @@ sub submit {
$self->generate_order_id;
+ $self->{_content}{order_id} .= '-'. ($invoice_number || 0);
+
$self->{_content}{amount} = sprintf('%.2f', $self->{_content}{amount} );
} elsif ( $action =~ /^(completion|purchasecorrection|refund)$/ ) {
diff --git a/t/order_num_ca.t b/t/order_num_ca.t
new file mode 100644
index 0000000..baebba4
--- /dev/null
+++ b/t/order_num_ca.t
@@ -0,0 +1,38 @@
+BEGIN { $| = 1; print "1..1\n"; }
+
+eval "use Net::SSLeay;";
+if ( $@ ) {
+ print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit;
+}
+
+use Business::OnlinePayment;
+
+my $tx = new Business::OnlinePayment("eSelectPlus");
+
+#$Business::OnlinePayment::HTTPS::DEBUG = 1;
+#$Business::OnlinePayment::HTTPS::DEBUG = 1;
+$Business::OnlinePayment::eSelectPlus::DEBUG = 1;
+$Business::OnlinePayment::eSelectPlus::DEBUG = 1;
+
+$tx->content(
+ type => 'VISA',
+ login => 'moot',
+ password => 'moot',
+ action => 'Normal Authorization',
+ amount => '0.80',
+ currency => 'CAD',
+ card_number => '4242424242424242',
+ expiration => '01/12',
+ invoice_number => '540',
+);
+$tx->test_transaction(1); # test, dont really charge
+$tx->submit();
+ warn $tx->order_number."\n";
+
+if ( $tx->order_number =~ /-540$/ ) {
+ print "ok 1\n";
+} else {
+ warn $tx->order_number."\n";
+ print "not ok 1\n";
+}
+