[ic] Verifone IPCharge

Mike Heins mike at perusion.com
Fri Mar 20 19:20:25 UTC 2009


Quoting Mike Heins (mike at perusion.com):
> 
> I think I will make these the more verbose but more self-documenting
> extra_query_params and extra_result_params. 

I have this patch:

Index: lib/Vend/Payment/BusinessOnlinePayment.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Payment/BusinessOnlinePayment.pm,v
retrieving revision 1.1
diff -u -r1.1 BusinessOnlinePayment.pm
--- lib/Vend/Payment/BusinessOnlinePayment.pm	24 Jan 2005 14:38:59 -0000	1.1
+++ lib/Vend/Payment/BusinessOnlinePayment.pm	20 Mar 2009 19:20:04 -0000
@@ -1,7 +1,7 @@
 # Vend::Payment::BusinessOnlinePayment
 # Interchange wrapper for Business::OnlinePayment modules
 #
-# $Id: BusinessOnlinePayment.pm,v 1.1 2005-01-24 14:38:59 jon Exp $
+# $Id: BusinessOnlinePayment.pm,v 1.1 2005/01/24 14:38:59 jon Exp $
 #
 # Copyright (C) 2004 Ivan Kohler.  All rights reserved.
 #
@@ -241,21 +241,18 @@
 
   $actual->{$_} =~ s/[\n\r]//g foreach keys %$actual;
 
-  $transaction->content(
+  my %params = (
     'type'            => 'CC',
     'login'           => $user,
     'password'        => $secret,
     'action'          => $action,
-    #'description'
     'amount'          => $amount,
     'card_number'     => $actual->{mv_credit_card_number},
     'expiration'      => $exp,
     'cvv2'            => $actual->{cvv2},
     'order_number'    => $actual->{order_id},
     'auth_code'       => $actual->{auth_code},
-    #'recurring_billing'
     'invoice_number'  => $actual->{mv_order_number},
-    #'customer_id'
     'last_name'       => $actual->{b_lname},
     'first_name'      => $actual->{b_fname},
     'name'            => $actual->{b_fname}. ' '. $actual->{b_lname},
@@ -279,6 +276,31 @@
     'phone'           => $actual->{phone_day},
   );
 
+=head Extra query params
+
+=item extra_query_params "customer_id  their_param=our_param"
+
+This allows you to map a passed parameter to the transaction query
+of your module. Obviously the module must support it.
+
+The parameter comes from the parameters passed to the [charge ..] tag
+or the route.
+
+The above id passes the customer_id parameter on with a key of the
+same name, while the second sets their param C<their_param> with 
+C<our_param>.
+
+=cut
+
+  my @extra = split /[\s,\0]+/, $opt->{extra_query_params};
+  for (@extra) {
+      my ( $k, $v ) = split /=/, $_;
+      $k ||= $v;
+      $params{$k} = $opt->{$v} || charge_param($v);
+  }
+
+  $transaction->content(%params);
+
   $transaction->submit();
 
   my %result;
@@ -308,6 +330,23 @@
 
   }
 
+=head Extra result params
+
+=item extra_result_params "transid=weird.module.name"
+
+This allows you to map a returned parameter to the payment result 
+hash of Interchange.
+
+=cut
+
+
+  my @result_extra = split /[\s,\0]+/, $opt->{extra_result_params};
+  for (@result_extra) {
+      my ( $k, $v ) = split /=/, $_;
+      $v ||= $k;
+	  $result{$k} = $transaction->$v if $transaction->can($v);
+  }
+
   return %result;
 
 }


-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.328.4479  <mike at perusion.com>

An amateur practices until he gets it right. A pro
practices until he can't get it wrong. -- unknown



More information about the interchange-users mailing list