[ic] Interchange and SIPS (A payement method)

alain abraham interchange-users@interchange.redhat.com
Mon Mar 4 10:30:00 2002


Hello,
after looking in the mailing list archive, I found a post wich present a
perl code for UserTag.

The code is here:
[perl]

sub sips_payment_request   {

my $path_bin = "/bin";


return'
<B>SHERLOCKS - Paiement Sécurisé sur Internet</B><br>
<H1>Test du plug-in</H1><br>';




 # initialisation des parametres dynamiques de la transactions
 # si un parametre n'est pas valorise, on l'initialise a NULL
my $merchant_id =  "014295303911111";
my  $amount = "12500";
my  $currency_code = "250";
my $language = "fr";
my  $return_context = "your_orderid";
my  $receipt_complement = "NULL";
my  $caddie = "NULL";
my  $data = "NULL";

    # load module sips_request

 my $sips_parm = "$merchant_id $amount $currency_code $language
$return_context $receipt_complement $caddie $data";
 return'$sips_parm';


 open(INFO,"$path_bin/sips_request $sips_parm|");

 @lines = <INFO>;
 close(INFO);

 my $result_sips_request = $lines[0];
 @result_sips_request_tab = split("!",$result_sips_request);


 # recuperation des parametres

 my $sips_return_code = $result_sips_request_tab[1];
 my $sips_error_message = $result_sips_request_tab[2];
my  $sips_html_message = $result_sips_request_tab[3];


 # analyze return code

 if ( ( $sips_return_code != 0 ) || ( $sips_return_code eq "" ) )
 	{
	return'(<br><hr><br>)';
	return'(<center><b><h3>)';
	return '(Erreur appel request)';
	return '(<br><br>)';
	return '(Error message : $sips_error_message )';
	return '(</h3></b></center>)';
	return '(<br><hr><br>)';

	return;
	};



 # Display cards logos and payement screen

 return'(<center>)';
 return'(<H3>Choisissez maintenant un type de paiement ci-dessous :</H3>)';
 return'(</center>)';
 return'(<br><hr><br>)';
 return'($sips_html_message)';
 return'(<br><br>)';
}
 return;
 [/perl]
[calc]sips_payment_request[/calc]


I try to make this one a UserTag because he opens a file and then need to be
a Global UserTag.
I had AllowGlobal  mynamesite in the interchange.cfg (I'm not sure of the
place to put that in the file. Is there a better place than another one ?)

To do this code a UsreTag, I delete all the [perl] and [calc] tags and had
this at the begin:

UserTag callsoge Routine <<EOF

the code here

EOF

When I do a /usr/sbin/interchange -r I got the following error:

[root@quiberon root]# /usr/sbin/interchange -r
bash: /root/.bashrc: Permission non accordée
Killing Interchange server 23993 with TERM.
Low traffic settings.
Calling UI......UI is loaded...
UserTag 'callsoge' subroutine failed compilation:

         Global symbol "@lines" requires explicit package name at (eval 93)
line 32, <GLOBAL> line 75.
Global symbol "@lines" requires explicit package name at (eval 93) line 35,
<GLOBAL> line 75.
Global symbol "@result_sips_request_tab" requires explicit package name at
(eval 93) line 36, <GLOBAL> line 75.
Global symbol "@result_sips_request_tab" requires explicit package name at
(eval 93) line 41, <GLOBAL> line 75.
Global symbol "@result_sips_request_tab" requires explicit package name at
(eval 93) line 42, <GLOBAL> line 75.
Global symbol "@result_sips_request_tab" requires explicit package name at
(eval 93) line 43, <GLOBAL> line 75.

In line 75 of the configuration file 'usertag/callsipsrequest.tag':
UserTag callsoge Routine <<EOF

Interchange V4.8.3
Configuring catalog yourbuz...Using MySQL,
DSN=dbi:mysql:test_yourbuz...done.
Interchange server started in INET and UNIX mode(s) (process id 24003)


I'm not an interchange or a perl Guru, then when somebody can help me, I'll
spend a good day.

Thanks

Alain