[ic] Verifone IPCharge

Bill Carr bill at bottlenose-wine.com
Fri Mar 20 18:56:14 UTC 2009


On Mar 18, 2009, at 9:53 AM, Mike Heins wrote:

> Quoting Bill Carr (bill at bottlenose-wine.com):
>>
>> On Mar 3, 2009, at 8:00 AM, Richard Siddall wrote:
>>
>>> Bill Carr wrote:
>>>> Does a module exist for implementing Verifone's IPCharge payment
>>>> gateway? If not, is there a template for making new payment gateway
>>>> modules?
>>>>
>>>> -Bill Carr
>>>>
>>>
>>> I didn't find one in a cursory web search.
>>>
>>> If you have to write your own module, please consider implementing
>>> it as
>>> a Business::OnlinePayment module and releasing it to CPAN.  That way
>>> the
>>> whole Perl community can benefit from your work.  There's a payment
>>> module for Interchange that can use Business::OnlinePayment modules.
>> Hi,
>>
>> I have taken your suggestion and have begun developing
>> Business::OnlinePayment::IPCharge (requested my PAUSE ID and all).
>>
>> My question has to do with Interchange's
>> Vend::Payment::BusinessOnlinePayment. There does not appear to be a
>> way to pass additional parameters to BOP's content method from
>> Interchange. In my case I am attempting the "Route onlinepayment
>> setting value" method. Specifically for IPCharge we need to set the
>> MERCHANTKEY and CLIENT_ID (a value different from the login name).
>> IC's BOP wrapper has the parameters for BOP's content method hard
>> coded. Any suggestions on how to get processor specific settings from
>> IC to BOP?
>
> I would think it would just be a question of a parameter to
> list the extra parameters.
>
>  Route  ipcharge   extra   "merchantkey client_id"
>
> Then just do:
>
> 	my @extra = split /[\s,\0]+/, $opt->{extra};
> 	my %params = (
> 	    'type'            => 'CC',
> 	    'login'           => $user,
> 	    'password'        => $secret,
> 	    # ....
> 	    'email'           => $actual->{email},
> 	    'phone'           => $actual->{phone_day},
> 	);
> 	for(@extra) {
> 		my ($k, $v) = split /=/, $_;
> 		$k ||= $v;
> 		$params{$k} = $opt->{$v};
> 	}
>
> 	$transaction->content(%params);
Thanks for the help. Here is a patch. This is working for me. I have  
also included a 'results_extra' option for getting options back from  
the payment processor.

--- interchange-cvs/lib/Vend/Payment/BusinessOnlinePayment.pm	 
2005-01-24 09:38:59.000000000 -0500
+++ interchange/lib/Vend/Payment/BusinessOnlinePayment.pm	2009-03-20  
14:52:35.000000000 -0400
@@ -126,6 +126,14 @@
  that your specific Business::OnlinePayment:: gateway module supports a
  test mode.

+=item extra
+
+A list of extra parameters to be passed to your backend payment  
processor.
+
+=item result_extra
+
+A list of extra parameters to be returned.
+
  =back

  In addition, any other processor options are passed to your  
gateway.  See
@@ -226,7 +235,7 @@

    #processor options!
    my %ignore = map { $_=>1 } qw(gateway processor id secret  
transaction );
-  my %options = map  { $_=>1 }
+    my %options = map { $_ => charge_param($_) }
                  grep { !$ignore{$_} } (
                                          keys(%$opt),
                                          map { s/^MV_PAYMENT_//;  
lc($_); }
@@ -241,7 +250,7 @@

    $actual->{$_} =~ s/[\n\r]//g foreach keys %$actual;

-  $transaction->content(
+    my $params = {
      'type'            => 'CC',
      'login'           => $user,
      'password'        => $secret,
@@ -277,7 +286,16 @@
      'referer'         => $referer,
      'email'           => $actual->{email},
      'phone'           => $actual->{phone_day},
-  );
+    };
+
+	my @extra = split /[\s,\0]+/, $opt->{extra};
+    for (@extra) {
+        my ( $k, $v ) = split /=/, $_;
+        $k ||= $v;
+        $params->{$k} = $opt->{$v} || charge_param($k);
+    }
+
+    $transaction->content(%$params);

    $transaction->submit();

@@ -307,9 +325,11 @@
      }

    }
-
+    my @result_extra = split /[\s,\0]+/, $opt->{result_extra};
+    for (@result_extra) {
+        $result{$_} = $transaction->$_ if $transaction->can($_);
+    }
    return %result;
-
  }

  1;

Bill Carr
Bottlenose - Wine & Spirits eBusiness Specialists
(413) 584-0400
http://www.bottlenose-wine.com



More information about the interchange-users mailing list