diff options
Diffstat (limited to 'OpenECHO.pm')
-rw-r--r-- | OpenECHO.pm | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/OpenECHO.pm b/OpenECHO.pm index fdf3a56..a9eed3a 100644 --- a/OpenECHO.pm +++ b/OpenECHO.pm @@ -56,10 +56,11 @@ use strict; use Carp;
use Business::OnlinePayment 3;
use Business::OnlinePayment::HTTPS;
-use vars qw($VERSION @ISA);
+use vars qw($VERSION @ISA $DEBUG);
@ISA = qw(Business::OnlinePayment::HTTPS);
$VERSION = '0.03';
+$DEBUG = 0;
sub set_defaults {
my $self = shift;
@@ -96,6 +97,14 @@ sub map_fields { my %content = $self->content();
+ if ( lc($content{'action'}) eq 'void' ) {
+ $self->is_success(0);
+ $self->error_message( 'OpenECHO gateway does not support voids; '.
+ 'try action => "Credit" '
+ );
+ return;
+ }
+
my $avs = $self->require_avs;
$avs = 1 unless defined($avs) && length($avs); #default AVS on unless explicitly turned off
@@ -214,6 +223,8 @@ sub submit { license_num => 'ec_id_number',
license_state => 'ec_id_state',
#license_dob =>
+ payee => 'ec_payee',
+ check_number => 'ec_serial_number',
#recurring_billing => 'cnp_recurring',
);
@@ -224,14 +235,16 @@ sub submit { #XXX counter field shouldn't be just a random integer (but it does need a
#default this way i guess...
$self->{_content}{counter} = int(rand(2**31));
-
- #ccexp_month & ccexp_year
- $self->{_content}{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/
- or croak "unparsable expiration ". $self->{_content}{expiration};
- my( $month, $year ) = ( $1, $2 );
- $month = '0'. $month if $month =~ /^\d$/;
- $self->{_content}{ccexp_month} = $month;
- $self->{_content}{ccexp_year} = $year;
+
+ if ( $self->transaction_type =~ /^[EA][VS]$/ ) {
+ #ccexp_month & ccexp_year
+ $self->{_content}{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/
+ or croak "unparsable expiration ". $self->{_content}{expiration};
+ my( $month, $year ) = ( $1, $2 );
+ $month = '0'. $month if $month =~ /^\d$/;
+ $self->{_content}{ccexp_month} = $month;
+ $self->{_content}{ccexp_year} = $year;
+ }
$self->{_content}{cnp_recurring} = 'Y'
if exists($self->{_content}{recurring_billing})
@@ -244,7 +257,9 @@ sub submit { $self->required_fields();
my( $page, $response, %reply_headers) =
- $self->https_get( $self->get_fields( $self->fields ) );
+ $self->https_post( $self->get_fields( $self->fields ) );
+
+ warn "raw echo response: $page" if $DEBUG;
#XXX check $response and die if not 200?
|