[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Sending scratch variables to UserTags
****** message to minivend-users from jojo@buchonline.net ******
On 6 Apr, Mats Andersson wrote:
> ****** message to minivend-users from "Mats Andersson" <Mats@brain.syh.fi> ******
>
> Ces't la vie! My first mail to this group turns up all hacked and
> mangled. This is how it should look:
>
> I have a UserTag 'md5hash' that accepts a string and converts it to a MD5 hash
>
> -------------
> UserTag md5hash HasEndTag
> UserTag md5hash Interpolate
> UserTag md5hash Routine <<<<EOF
> sub {
> my $val = shift;
> my $hash = MD5->hexhash($val);
> return $hash;
> }
> EOF
> -------------
>
> If I send it a value like [md5hash]foo[/md5hash] I get a correct hash
> returned.
>
> Now this tag is needed to calculate a hash for online banking. I should feed
> it a string like
> 0002&19&55&00042588INWX0000&LEHTI&
> and get a hash to check against a hash calculated by the bank. This is to
> check that payment was actually made.
>
> The values sent from the bank is captured in scratch variables. I then build
> an other scratch like
> --------
> [set name=check_hash interpolate=1]
> [scratch VERSION]&[scratch STAMP]&[scratch REF]&[scratch PAID]&LEHTI&
> [/set]
> ---------
>
> This variable i need to send to the md5hash tag. I tried
> [md5hash][scratch check_hash][/md5hash]
> but this calculates the hash from the string "[scratch check_hash]".
>
> I need to send the value of the check_hash to the tag.
>
> There must be some basic error in my tag or my thinking (probably both). I am
> fairly new to both Perl and MiniVend.
>
> Version is 3.14
>
> Any help GREATLY appreciated.
Mats,
first of all, did you look into your error.log?
Did you check the value of all scratch variables like
Test Version: [scratch VERSION]<BR>
etc...?
Hmmm...how about
-------------
UserTag md5hash Routine <<<<EOF
sub {
my $version = $Safe{'scratch'}->{'VERSION'};
my $stamp = $Safe{'scratch'}->{'STAMP'};
my $ref = $Safe{'scratch'}->{'REF'};
my $paid = $Safe{'scratch'}->{'PAID'};
my $_ = $version . "&" . $stamp . "&" . $ref . "&" . $paid . "&LEHTI&";
my $hash = MD5->hexhash($_);
return $hash;
}
EOF
-------------
and test it with
Test the hash: [md5hash] <BR>
and donīt forget to restart your minivend server. Donīt forget to look
into your error.log for any hints.
Attention: Iīm new in perl too.
Good lucks!
Regrads,
Joachim
--
Hans-Joachim Leidinger
buch online jojo@buchonline.net
Munscheidstr. 14 FAX: +49 209 1671449
45886 Gelsenkirchen FAX: 0209 1671449
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list