[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Using external online payment systems with minivend?
At 01:44 PM 9/21/99 +0200, you wrote:
>****** message to minivend-users from jojo@buchonline.net ******
>
>Hi Jarno,
>
>[SNIP]
>> So how I can fetc the information that the bank returns to me, is it like
>> in normal perl? Or does minivend have special tools for that
>
>Without any informations about the names of the variables from your
>bank? 8-)
>Can you write an example, what you get?
>Can you translate the part of the interface document?
>It is possible to save the real form page from your bank (with your
>browser) to see the variables and the values?
Heres an example what i get from the bank
http://jarnomn-linux/cgi-bin/triosoft/ord/checkout?PTA8XtsJ&KNRO=00000000000
0&VALUUTTA=FIM&VIITE=13&SUMMA=10,00&VERSIO=2&STATUS=2&TARKISTE=CCF3D89D463EA
ADCFC58782B6253429F
The structure you can see from above elements, and the fields are
KNRO (customer number)
VALUUTTA (currency)
VIITE (bank reference)
VERSIO (system version)
STATUS
TARKISTE (checksum formed with MD5 algorithm from the above)
The problem however is that the minivend gives an internal server error
when the bank
tries to send the user back with this URL.
The odd thing however is that when I change the '&' signs to '?',
the URL works perfectly. My knowledge about HTTP encoding is a bit rusty,
do you have any idea what might cause this behavior.
I can of course do a do a Java servlet which takes in that URL and reforms
it into
acceptable form for minivend.
>With post methode, you get variable names and values of this variables!
>Without any knowledge about the structure or format of the cgi query
>string (i don't know the right words), it is difficult to solve your
>problem. A simple example
>callback via browser agent:
>
>http://www.yourdomain.com/cgi-bin/yourshop/ok-or-failure-page?uid=1234&time
=12:15:00&date=09/21/1999&status=ok-or-what?mv-session-id
>
>(all in one line).
>
>In your ok-or-failure-page, you have some codes like e.g.
>
>[perl arg="cgi scratch"]
> $Safe{'scratch'}->{"uid"} = $Safe{'cgi'}->{"uid"};
> $Safe{'scratch'}->{"time"} = $Safe{'cgi'}->{"time"};
> $Safe{'scratch'}->{"date"} = $Safe{'cgi'}->{"date"};
> $Safe{'scratch'}->{"status"} = $Safe{'cgi'}->{"status"};
>"";
>[/perl]
>
Hey, thats easy :)
So what I do is to is to read the values in a perl block,
calculate the MD5 checksum and set the status to OK/FAIL
by whether the the checksum is correct or not.
[if scratch status eq ok]
[tag op=header interpolate=1]
Status: 302 moved
Location: [area href="your-ok-page-or-checkout-page.html"]
[/tag]
[/if]
[if scratch status eq fail]
[tag op=header interpolate=1]
Status: 302 moved
Location: [area href="checksumfailed.html"]
[/tag]
[/if]
Now the only problem that remains is how to make sure that the order is
processed only
once...
Because otherwise some clever user might reload the checkout page several
times after
it has processed the order, to make several orders, but paying just once.
I think that the value mv_order_number could be used in this (I use it in
VIITE field)
[if scracth viite !eq mv_order_number)
[tag op=header interpolate=1]
Status: 302 moved
Location: [area href="nicetry.html"]
[/tag]
[/if]
Jarno.