[interchange-cvs] interchange - heins modified
lib/Vend/Payment/Linkpoint.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Mon May 15 12:47:48 EDT 2006
User: heins
Date: 2006-05-15 16:47:48 GMT
Modified: lib/Vend/Payment Tag: STABLE_5_4-branch Linkpoint.pm
Log:
* Improve Linkpoint module based on work provided by Josh Lavin.
-- Add ability to do POSTAUTH (settle_prior) in Interchange Admin.
-- Add check_sub capability ala Vend::Payment::Signio.
Revision Changes Path
No revision
No revision
1.5.2.1 +51 -3 interchange/lib/Vend/Payment/Linkpoint.pm
rev 1.5.2.1, prev_rev 1.5
Index: Linkpoint.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Payment/Linkpoint.pm,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- Linkpoint.pm 8 Nov 2005 18:14:46 -0000 1.5
+++ Linkpoint.pm 15 May 2006 16:47:48 -0000 1.5.2.1
@@ -1,6 +1,6 @@
# Vend::Payment::Linkpoint - Interchange Linkpoint support
#
-# $Id: Linkpoint.pm,v 1.5 2005/11/08 18:14:46 jon Exp $
+# $Id: Linkpoint.pm,v 1.5.2.1 2006/05/15 16:47:48 mheins Exp $
#
# Copyright (C) 2002-2005 Interchange Development Group
# Copyright (C) 2002 Stefan Hornburg (Racke) <racke at linuxia.de>
@@ -251,7 +251,10 @@
$actual->{mv_credit_card_exp_year} =~ s/\D//g;
$actual->{mv_credit_card_exp_year} =~ s/\d\d(\d\d)/$1/;
$actual->{mv_credit_card_number} =~ s/\D//g;
- $actual->{b_zip} =~ s/\D//g;
+ if($actual->{b_country} eq 'US') {
+ $actual->{b_zip} =~ s/\D//g;
+ $actual->{b_zip} = substr($actual->{b_zip}, 0, 5);
+ }
my $exp = sprintf '%02d%02d', $actual->{mv_credit_card_exp_month},
$actual->{mv_credit_card_exp_year};
@@ -264,6 +267,7 @@
mauthcapture => 'SALE',
mauthonly => 'PREAUTH',
sale => 'SALE',
+ settle_prior => 'POSTAUTH',
);
if (defined $type_map{$transtype}) {
@@ -293,6 +297,21 @@
$scompany =~ s/\&/ /g;
$bcompany =~ s/\&/ /g;
+ my %delmap = (
+ POSTAUTH => [
+ qw(
+ shipping
+ chargetotal
+ subtotal
+ tax
+ vattax
+ cardnumber
+ cardexpmonth
+ cardexpyear
+ )
+ ],
+ );
+
my %varmap = ( qw /
name b_name
address1 b_address1
@@ -317,6 +336,7 @@
port => '1129',
configfile => $user,
keyfile => $keyfile,
+ ordertype => $transtype,
result => 'LIVE',
terminaltype => 'UNSPECIFIED',
shipping => $shipping,
@@ -331,11 +351,18 @@
debbugging => $opt->{debuglevel},
company => $bcompany,
scompany => $scompany, # API is broken for Shipping Company per Linkpoint support
+ oid => $order_id,
);
for (keys %varmap) {
$query{$_} = $actual->{$varmap{$_}};
}
+
+ if(my $map = $delmap{$transtype}) {
+ for(@$map) {
+ delete $query{$_};
+ }
+ }
$query{saddress2} = $actual->{address1} . ' ' . $actual->{address2}; # API is broken for Shipping Address Line 1, put line 1 and line 2 in API line 2 per Linkpoint support
@@ -368,10 +395,30 @@
if defined $result{$result_map{$_}};
}
+ my $approve;
if ($result{'r_approved'} eq "APPROVED") {
+ if (my $check_sub_name = $opt->{check_sub} || charge_param('check_sub')) {
+ my $check_sub = $Vend::Cfg->{Sub}{$check_sub_name}
+ || $Global::GlobalSub->{$check_sub_name};
+
+ if (ref $check_sub eq 'CODE') {
+ $approve = $check_sub->(\%result);
+ }
+ else {
+ logError(__PACKAGE__ . ": non-existent check_sub routine %s.", $check_sub_name);
+ }
+ }
+ else {
+ $approve = 1;
+ }
+ }
+
+
+ if($approve) {
$result{'MStatus'} = 'success';
$result{'MErrMsg'} = $result{'r_code'};
- } else {
+ }
+ else {
my $msg = errmsg("Charge error: %s Please call in your order or try again.",
$result{'r_error'},
);
@@ -388,3 +435,4 @@
package Vend::Payment::Linkpoint;
1;
+
More information about the interchange-cvs
mailing list