# + v1.6.2 09/23/2003 Added DH transaction type (salim qadeer sqadeer@echo-inc.com)\r
# --------\r
# + v0.1 08/26/2004 Business::OnlinePayment implementation\r
+# + v0.2 09/13/2004\r
+# + v0.3 03/25/2006\r
#\r
# Copyright (C) 2002 Electric Pulp. <info@electricpulp.com>\r
-# Copyright (C) 2004 Ivan Kohler\r
+# Copyright (C) 2004-2006 Ivan Kohler\r
#\r
# This program is free software; you can redistribute it and/or modify\r
# it under the terms of the GNU General Public License as published by\r
use Carp;\r
use Business::OnlinePayment 3;\r
use Business::OnlinePayment::HTTPS;\r
-use vars qw($VERSION @ISA);\r
+use vars qw($VERSION @ISA $DEBUG);\r
\r
@ISA = qw(Business::OnlinePayment::HTTPS);\r
-$VERSION = '0.01';\r
+$VERSION = '0.04';\r
+$DEBUG = 0;\r
\r
sub set_defaults {\r
my $self = shift;\r
\r
my %content = $self->content();\r
\r
+ if ( lc($content{'action'}) eq 'void' ) {\r
+ $self->is_success(0);\r
+ $self->error_message( 'OpenECHO gateway does not support voids; '.\r
+ 'try action => "Credit" '\r
+ );\r
+ return;\r
+ }\r
+\r
my $avs = $self->require_avs;\r
$avs = 1 unless defined($avs) && length($avs); #default AVS on unless explicitly turned off\r
\r
#'void' => 'VOID',\r
);\r
}\r
- } elsif ( $content{'type'} =~ /^check$/i ) {\r
+ } elsif ( $content{'type'} =~ /^e?check$/i ) {\r
%map = ( 'normal authorization' => 'DD',\r
'authorization only' => 'DV',\r
'credit' => 'DC',\r
license_num => 'ec_id_number',\r
license_state => 'ec_id_state',\r
#license_dob =>\r
+ #get from new() args instead# payee => 'ec_payee',\r
+ check_number => 'ec_serial_number',\r
\r
#recurring_billing => 'cnp_recurring',\r
);\r
#default this way i guess...\r
$self->{_content}{counter} = int(rand(2**31));\r
\r
- #ccexp_month & ccexp_year\r
- $self->{_content}{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/\r
- or croak "unparsable expiration ". $self->{_content}{expiration};\r
- my( $month, $year ) = ( $1, $2 );\r
- $month = '0'. $month if $month =~ /^\d$/;\r
- $self->{_content}{ccexp_month} = $month;\r
- $self->{_content}{ccexp_year} = $year;\r
+ if ( $self->transaction_type =~ /^[EA][VS]$/ ) {\r
+ #ccexp_month & ccexp_year\r
+ $self->{_content}{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/\r
+ or croak "unparsable expiration ". $self->{_content}{expiration};\r
+ my( $month, $year ) = ( $1, $2 );\r
+ $month = '0'. $month if $month =~ /^\d$/;\r
+ $self->{_content}{ccexp_month} = $month;\r
+ $self->{_content}{ccexp_year} = $year;\r
+ }\r
+\r
+ if ( $self->transaction_type =~ /^D[DVCH]$/ ) { #echeck\r
+\r
+ #check number kludge... "periodic bill payments" don't have check #s!\r
+ #$self->{_content}{ec_serial_number} = 'RECURRIN'\r
+ $self->{_content}{ec_serial_number} = '00000000'\r
+ if ! length($self->{_content}{ec_serial_number})\r
+ && $self->{_content}{ec_payment_type} =~ /^(PPD)?$/i;\r
+\r
+ ( $self->{_content}{ec_payee} = $self->payee )\r
+ or croak "'payee' option required when instantiating new ".\r
+ "Business::OnlinePayment::OpenECHO object\n";\r
+ }\r
\r
$self->{_content}{cnp_recurring} = 'Y'\r
if exists($self->{_content}{recurring_billing})\r
$self->required_fields();\r
\r
my( $page, $response, %reply_headers) =\r
- $self->https_get( $self->get_fields( $self->fields ) );\r
+ $self->https_post( $self->get_fields( $self->fields ) );\r
+\r
+ warn "raw echo response: $page" if $DEBUG;\r
\r
#XXX check $response and die if not 200?\r
\r
\r
=head2 Check\r
\r
-Not yet implemented...\r
-#Content required: type, login, password, action, amount, first_name, last_name, account_number, routing_code, bank_name.\r
+Content required: type, login, password, action, amount, first_name, last_name, account_number, routing_code, bank_name. (...more)\r
\r
=head1 PREREQUISITES\r
\r