From cb4e9138aa4caf1e38f24484d79e024d85a11ee5 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Sat, 20 Oct 2012 03:16:13 -0700 Subject: [PATCH] fix voids --- Changes | 3 +++ MANIFEST | 1 - eSelectPlus.pm | 16 ++++++++++------ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Changes b/Changes index 15dbf93..0173368 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension Business::OnlinePayment::eSelectPlus +0.04 Sat Oct 20 03:15:54 PDT 2012 + - Fix voids + 0.03 Tue Mar 1 13:40:08 PST 2011 - Update for compatibility with US Moneris. Backwards-compatibility note: Users of previous versions must now specify 'currency'=>'CAD' diff --git a/MANIFEST b/MANIFEST index 557efb5..9f4a58a 100644 --- a/MANIFEST +++ b/MANIFEST @@ -14,4 +14,3 @@ t/bad_card_ca.t t/bad_card_us.t t/crypt_bad_card_ca.t t/crypt_bad_card_us.t -META.yml Module meta-data (added by MakeMaker) diff --git a/eSelectPlus.pm b/eSelectPlus.pm index 677771a..8ba1495 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.03'; +$VERSION = '0.04'; $DEBUG = 0; sub set_defaults { @@ -33,7 +33,8 @@ sub set_defaults { sub submit { my($self) = @_; - if ( $self->{_content}{'currency'} eq 'CAD' ) { + if ( defined( $self->{_content}{'currency'} ) + && $self->{_content}{'currency'} eq 'CAD' ) { $self->server('www3.moneris.com'); $self->path('/gateway2/servlet/MpgRequest'); } else { #sorry, default to USD @@ -42,7 +43,8 @@ sub submit { } if ($self->test_transaction) { - if ( $self->{_content}{'currency'} eq 'CAD' ) { + if ( defined( $self->{_content}{'currency'} ) + && $self->{_content}{'currency'} eq 'CAD' ) { $self->server('esqa.moneris.com'); $self->{_content}{'login'} = 'store2'; # store[123] $self->{_content}{'password'} = 'yesguy'; @@ -95,7 +97,7 @@ sub submit { } elsif ( $self->{_content}{'action'} =~ /^\s*post\s*authorization\s*$/i ) { $action = 'completion'; } elsif ( $self->{_content}{'action'} =~ /^\s*void\s*$/i ) { - $action = 'void'; + $action = 'purchasecorrection'; } elsif ( $self->{_content}{'action'} =~ /^\s*credit\s*$/i ) { if ( $self->{_content}{'authorization'} ) { $action = 'refund'; @@ -121,7 +123,7 @@ sub submit { $self->{_content}{amount} = sprintf('%.2f', $self->{_content}{amount} ); - } elsif ( $action eq 'completion' || $action eq 'void' ) { + } elsif ( $action eq 'completion' || $action eq 'purchasecorrection' ) { $self->required_fields( qw( login password order_number authorization ) ); @@ -136,7 +138,9 @@ sub submit { # E-Commerce Indicator (see eSelectPlus docs) $self->{_content}{'crypt_type'} ||= 7; - $action = "us_$action" unless $self->{_content}{'currency'} eq 'CAD'; + $action = "us_$action" + unless defined( $self->{_content}{'currency'} ) + && $self->{_content}{'currency'} eq 'CAD'; #no, values aren't escaped for XML. their "mpgClasses.pl" example doesn't #appear to do so, i dunno -- 2.11.0