#!/usr/local/bin/perl # webscr - web cgi routine to emulate PayPal shopping cart # # Dave Stoddard - 5/29/04 # dgs@accelix.com # # Copyright # --------- # Copyright(c) 2004, Accelix LLC. All Rights Reserved. # # Description # ----------- # This program provides a set of functions for emlating the PayPal shopping # cart. It allows previous users of PayPal to be able to use Authoriuze.Net # as a payment gateway without having to make a lot of modifications to # existing code on their website. # # RCS Information # --------------- # $Id$ # $Log$ # # package main; use strict 'vars'; use strict 'subs'; # use warnings; # use diagnostics; # load application modules use cart; # shopping cart support routines # --------------------------- # DECLARATIONS AND PROTOTYPES # --------------------------- # local elements my %form = (); # data from form (name/value pairs) my %state = (); # state persistence data hash my %sess = (); # session hash ### ### START PROGRAM ### # initialize the program %form = ReadForm (); # read the form %state = GetState (%form); # get current state data (cookies) # map paypal field names to shopping cart field names $form{price} = $form{amount} if (defined $form{amount}); $form{quantity} = $form{add} if (defined $form{add}); $form{itemno} = $form{item_number} if (defined $form{item_number}); $form{title} = $form{item_name} if (defined $form{item_name}); $form{optname1} = $form{on0} if (defined $form{on0}); $form{optval1} = $form{os0} if (defined $form{os0}); $form{optname2} = $form{on1} if (defined $form{on1}); $form{optval2} = $form{os1} if (defined $form{os1}); $form{optname3} = $form{on2} if (defined $form{on2}); $form{optval3} = $form{os2} if (defined $form{os2}); # determine if this is a display request if (exists $form{display}) { if ($form{display}) { %sess = GetSession (%form,%state); DisplayCart ($sess{sessid}); ExitProgram (); } } # check for add request if (exists $form{add}) { if ($form{add}) { AddCartItem (%form,%state); ExitProgram (); } } # default is display %sess = GetSession (%form,%state); DisplayCart ($sess{sessid}); ExitProgram (); ### End Main Program ###