Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Interchange: users

Minor patch for XML gateways in Payment.pm

 

 

Interchange users RSS feed   Index | Next | Previous | View Threaded


chris.keane at zzgi

Oct 27, 2009, 10:45 AM

Post #1 of 2 (166 views)
Permalink
Minor patch for XML gateways in Payment.pm

I have a client in Canada using PsiGate, now only accepting payment
submissions via XML. Thinking that more and more gateways are going to
insist on this I ended up patching Payment.pm to optionally transform
$query into XML rather than & joined values. Quick and dirty but
potentially useful to someone.

In catalog.cfg,

# use_xml value is the XML root tag name, e.g. <Order>...xml...</Order>
Route psigate use_get /usr/bin/wget
Route psigate use_xml Order

--- Payment.pm 2009-10-27 17:40:07.000000000 +0000
+++ Payment.pm.new 2009-10-27 17:39:04.000000000 +0000
@@ -642,12 +642,22 @@
my $cmd = $opt->{use_wget} =~ m{/} ? $opt->{use_wget} :
'wget';

my @post;
- while( my ($k,$v) = each %$query ) {
- $k = hexify($k);
- $v = hexify($v);
- push @post, "$k=$v";
- }
- my $post = join "&", @post;
+ my $post;
+ if ($opt->{use_xml}) {
+ require XML::Simple;
+
+ my $xs = XML::Simple->new();
+ my $order;
+ $order->{$opt->{use_xml}} = $query;
+ $post = $xs->XMLout($order, NoAttr=>1,
KeepRoot=>1 );
+ } else {
+ while( my ($k,$v) = each %$query ) {
+ $k = hexify($k);
+ $v = hexify($v);
+ push @post, "$k=$v";
+ }
+ $post = join "&", @post;
+ }
open WIN, "> $infile"
or die errmsg("Cannot create wget post input
file %s: %s", $infile, $!) . "\n";
print WIN $post;


_______________________________________________
interchange-users mailing list
interchange-users[at]icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users


jon at endpoint

Oct 29, 2009, 6:42 PM

Post #2 of 2 (145 views)
Permalink
Re: Minor patch for XML gateways in Payment.pm [In reply to]

On Tue, 27 Oct 2009, Chris Keane wrote:

> I have a client in Canada using PsiGate, now only accepting payment
> submissions via XML. Thinking that more and more gateways are going to
> insist on this I ended up patching Payment.pm to optionally transform
> $query into XML rather than & joined values. Quick and dirty but
> potentially useful to someone.
>
> In catalog.cfg,
>
> # use_xml value is the XML root tag name, e.g. <Order>...xml...</Order>
> Route psigate use_get /usr/bin/wget
> Route psigate use_xml Order

Chris,

Thanks for writing about this.

If PsiGate is only accepting payment submissions via XML, and they always
require the XML root tag be Order, we really should just update the
PsiGate module to do this automatically, shouldn't we? That is, rather
than modifying Vend::Payment in a way that really only applies to PsiGate.

I'd like to figure out how to get your change into the Interchange core in
the most appropriate way keeping the other payment modules in mind.

Thanks,
Jon


--
Jon Jensen
End Point Corporation
http://www.endpoint.com/

_______________________________________________
interchange-users mailing list
interchange-users[at]icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users

Interchange users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.