[interchange-cvs] interchange - heins modified 5 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Tue Apr 27 15:25:15 EDT 2004


User:      heins
Date:      2004-04-27 19:25:15 GMT
Modified:  lib/Vend Payment.pm
Modified:  lib/Vend/Payment AuthorizeNet.pm
Modified:  dist/standard/etc log_transaction profiles.order report
Log:
* Integrate AuthorizeNet ECHECK payment method.

* Change variables in STANDARD demo to match the ones that are in Payment.pm,
  i.e. check_acct -> check_account, check_route --> check_routing

* Add check_bankname, check_accttype, check_acctname to standard demo when
  the MV_ONLINE_CHECK_MODE is in use.

* Add routine in etc/log_transaction to do the ECHECK and treat it as an
  online realtime payment.

* All of this will certify and list Interchange with AuthorizeNet as a
  supported cart.

Revision  Changes    Path
2.14      +4 -2      interchange/lib/Vend/Payment.pm


rev 2.14, prev_rev 2.13
Index: Payment.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Payment.pm,v
retrieving revision 2.13
retrieving revision 2.14
diff -u -r2.13 -r2.14
--- Payment.pm	30 Mar 2004 18:56:05 -0000	2.13
+++ Payment.pm	27 Apr 2004 19:25:14 -0000	2.14
@@ -1,6 +1,6 @@
 # Vend::Payment - Interchange payment processing routines
 #
-# $Id: Payment.pm,v 2.13 2004/03/30 18:56:05 jon Exp $
+# $Id: Payment.pm,v 2.14 2004/04/27 19:25:14 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -23,7 +23,7 @@
 package Vend::Payment;
 require Exporter;
 
-$VERSION = substr(q$Revision: 2.13 $, 10);
+$VERSION = substr(q$Revision: 2.14 $, 10);
 
 @ISA = qw(Exporter);
 
@@ -123,7 +123,9 @@
 		b_state
 		b_zip
 		check_account
+		check_acctname
 		check_accttype
+		check_bankname
 		check_checktype
 		check_dl
 		check_magstripe



2.14      +50 -1     interchange/lib/Vend/Payment/AuthorizeNet.pm


rev 2.14, prev_rev 2.13
Index: AuthorizeNet.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Payment/AuthorizeNet.pm,v
retrieving revision 2.13
retrieving revision 2.14
diff -u -r2.13 -r2.14
--- AuthorizeNet.pm	11 Apr 2004 21:32:31 -0000	2.13
+++ AuthorizeNet.pm	27 Apr 2004 19:25:15 -0000	2.14
@@ -3,7 +3,7 @@
 # Connection routine for AuthorizeNet version 3 using the 'ADC Direct Response'
 # method.
 #
-# $Id: AuthorizeNet.pm,v 2.13 2004/04/11 21:32:31 racke Exp $
+# $Id: AuthorizeNet.pm,v 2.14 2004/04/27 19:25:15 mheins Exp $
 #
 # Copyright (C) 2003-2004 Interchange Development Group, http://www.icdevgroup.org/
 # Copyright (C) 1999-2002 Red Hat, Inc.
@@ -312,6 +312,8 @@
 
     $opt->{port}   ||= 443;
 
+	$opt->{method} ||= charge_param('method') || 'CC';
+
 	my $precision = $opt->{precision} 
                     || 2;
 
@@ -368,6 +370,29 @@
         $transtype = $type_map{$transtype};
     }
 
+	my %allowed_map = (
+		CC => {
+					AUTH_CAPTURE => 1,
+					AUTH_ONLY => 1,
+					CAPTURE_ONLY => 1,
+					CREDIT => 1,
+					VOID => 1,
+					PRIOR_AUTH_CAPTURE => 1,
+				},
+	    ECHECK => {
+					AUTH_CAPTURE => 1,
+					CREDIT => 1,
+					VOID => 1,
+				},
+	);
+
+	if(! $allowed_map{$opt->{method}}) {
+		::logDebug("Unknown Authorizenet method $opt->{method}");
+	}
+	elsif(! $allowed_map{$opt->{method}}{$transtype}) {
+		::logDebug("Unknown Authorizenet transtype $transtype for $opt->{method}");
+	}
+
 	$amount = $opt->{total_cost} if $opt->{total_cost};
 	
     if(! $amount) {
@@ -378,6 +403,15 @@
 	my $order_id = gen_order_id($opt);
 
 #::logDebug("auth_code=$actual->{auth_code} order_id=$opt->{order_id}");
+	my %echeck_params = (
+		x_bank_aba_code    => $actual->{check_routing},
+		x_bank_acct_num    => $actual->{check_account},
+		x_bank_acct_type   => $actual->{check_accttype},
+		x_bank_name        => $actual->{check_bankname},
+		x_bank_acct_name   => $actual->{check_acctname},
+		x_Method => 'ECHECK',
+	);
+
     my %query = (
 		x_Test_Request			=> $opt->{test} || charge_param('test'),
 		x_First_Name			=> $actual->{b_fname},
@@ -416,6 +450,21 @@
     );
 
     my @query;
+
+	my @only_cc = qw/ x_Card_Num x_Exp_Date x_Card_Code /;
+
+	if($opt->{use_transaction_key}) {
+		$query{x_Tran_Key} = delete $query{x_Password};
+	}
+
+	if($opt->{method} eq 'ECHECK') {
+		for (@only_cc) {
+			delete $query{$_};
+		}
+		for(keys %echeck_params) {
+			$query{$_} = $echeck_params{$_};
+		}
+	}
 
     for (keys %query) {
         my $key = $_;



1.2       +37 -1     interchange/dist/standard/etc/log_transaction


rev 1.2, prev_rev 1.1
Index: log_transaction
===================================================================
RCS file: /var/cvs/interchange/dist/standard/etc/log_transaction,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- log_transaction	25 Apr 2004 17:07:49 -0000	1.1
+++ log_transaction	27 Apr 2004 19:25:15 -0000	1.2
@@ -120,7 +120,43 @@
 	[/perl]
 [/elsif]
 [elsif value mv_order_profile eq online_check]
-	[set do_invoice]1[/set]
+	[if variable MV_ONLINE_CHECK_MODE]
+	[calc]
+		return if $Scratch->{tmp_total} == $Scratch->{tmp_remaining};
+		my $msg = sprintf "Your checking account was charged %.2f", $Scratch->{tmp_remaining};
+		$Scratch->{pay_cert_total} = $Scratch->{tmp_total} - $Scratch->{tmp_remaining};
+		$Scratch->{charge_total_message} = $msg;
+		return "Check will be written for $Scratch->{tmp_remaining}";
+	[/calc]
+		Online check with payment mode=[var MV_ONLINE_CHECK_MODE]
+		[tmp name="charge_succeed"][charge route="[var MV_ONLINE_CHECK_MODE]" amount="[scratch tmp_remaining]" order_id="[value mv_transaction_id]" method="[var MV_ONLINE_CHECK_METHOD]"][/tmp]
+		[if scratch charge_succeed]
+		[then]
+			[set do_invoice]1[/set]
+			[set do_payment]1[/set]
+			Real-time online check succeeded. ID=[data session payment_id] amount=[scratch tmp_remaining]
+		[/then]
+		[else]
+			Real-time online check FAILED. Reason: [data session payment_error]
+			[calc]
+				for(qw/
+						charge_total_message
+						pay_cert_total
+				/)
+				{
+					delete $Scratch->{$_};
+				}
+				die errmsg(
+						"Real-time online check failed. Reason: %s\n",
+						errmsg($Session->{cybercash_error}),
+					);
+			[/calc]
+		[/else]
+		[/if]
+	[else]
+		[set do_invoice]1[/set]
+	[/else]
+	[/if]
 [/elsif]
 [elsif value mv_order_profile eq cod]
 	[comment] do nothing [/comment]



1.2       +12 -5     interchange/dist/standard/etc/profiles.order


rev 1.2, prev_rev 1.1
Index: profiles.order
===================================================================
RCS file: /var/cvs/interchange/dist/standard/etc/profiles.order,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- profiles.order	25 Apr 2004 17:07:49 -0000	1.1
+++ profiles.order	27 Apr 2004 19:25:15 -0000	1.2
@@ -181,13 +181,20 @@
 &set = prof_mode_accepted [var CHECK_ACCEPTED]
 
 prof_mode_accepted=required This site doesn't accept online checks. You should not have been offered that option; please contact us.
-[value name=check_route filter=digits hide=1]
-check_num=required You must supply a check number for us to use.
-check_acct=required You must supply your checking account number.
-check_route=required You must supply your bank's ABA routing number. They are always 9 digits.
+[value name=check_routing filter=digits hide=1]
+check_account=required You must supply your checking account number.
+check_routing=required You must supply your bank's ABA routing number. They are always 9 digits.
 &and
-check_route=length 9-9 ABA bank route numbers are always 9 digits.
+check_routing=length 9-9 ABA bank route numbers are always 9 digits.
+[if variable MV_PAYMENT_MODE eq authorizenet]
+check_accttype=required You must supply an account type.
+check_bankname=required We need your bank's name.
+check_acctname=required We need the name on your bank account.
+[else]
+check_num=required You must supply a check number for us to use.
 check_bank_phone=required We need your bank's phone number.
+[/else]
+[/if]
 
 email=required
 email=email



1.2       +1 -1      interchange/dist/standard/etc/report


rev 1.2, prev_rev 1.1
Index: report
===================================================================
RCS file: /var/cvs/interchange/dist/standard/etc/report,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- report	25 Apr 2004 17:07:49 -0000	1.1
+++ report	27 Apr 2004 19:25:15 -0000	1.2
@@ -20,7 +20,7 @@
 ----------------
 [value mv_credit_card_info]
 [/if][if value payment_method eq credit_card]  Account Number: [value mv_credit_card_reference]      Expiration: [value mv_credit_card_exp_month]/[value mv_credit_card_exp_year]
-[/if][if value payment_method eq online_check]  Account Number: [value check_acct]  Routing Number: [value check_route]    Check Number: [value check_num]
+[/if][if value payment_method eq online_check]  Account Number: [value check_account]  Routing Number: [value check_routing]    Check Number: [value check_num]
 [/if][if value payment_method eq po]  Company Name: [value po_company]  P.O. Number: [value po_number][/if]
 
  Shipping Method: [shipping-desc][if value mv_handling]








More information about the interchange-cvs mailing list