home *** CD-ROM | disk | FTP | other *** search
- # ECcardin.cgi script Modified for ECware(tm) 4.0
- # Sean Rowland - 11/24/98
- # No modifications required for this script
- # Use with CashRegister Ver. 2.1.4
- ######################################################
- #### First things first ##############################
-
- require 5.001;
- use CCLib qw(SetServer sendmserver);
- use CGI;
- $form = new CGI;
-
- ######################################################
- #### Get Variables ###################################
-
- $host = $form->param('Host');
- $port = $form->param('Port');
- $secret = $form->param('Secret');
- $orderID = $form->param('OrderID');
- $amount = $form->param('Amount');
- $pan = $form->param('Pan');
- $fname = $form->param('FName');
- $lname = $form->param('LName');
- $name = $fname .$lname;
- $addr = $form->param('Addr');
- $city = $form->param('City');
- $state = $form->param('State');
- $zip = $form->param('Zip');
- $country = $form->param('Country');
- $exp = $form->param('CardExp');
- $URL = $form->param('URL');
- $ID = $form->param('ID');
- $AuthType = $form->param('AuthType');
-
- ######################################################
- #### Define the Host, Port & Secret ##################
-
- %creditserver= ( 'host' => $host,
- 'port' => $port,
- 'secret' => $secret);
-
- &SetServer(%creditserver);
-
- ######################################################
- #### Package Results #################################
-
- %result = &sendmserver($AuthType,
- 'Order-ID', $orderID,
- 'Amount', "usd ".$amount,
- 'Card-Number', $pan,
- 'Card-Name', $name,
- 'Card-Address', $addr,
- 'Card-City', $city,
- 'Card-State', $state,
- 'Card-Zip', $zip,
- 'Card-Country', $country,
- 'Card-Exp', $exp);
-
- ######################################################
- #### Collect Data ###################################
-
- #This section can be used to log activity from this script
- #
- $Log ='C:\InetPub\ECscripts\cardin.log';
- open (Log, ">>$Log");
- foreach (keys(%result)) {
- print Log " $_ ==> $result{$_}\n";
- }
- print Log "$host\n";
- print Log "$port\n";
- print Log "$secret\n";
- close (Log);
-
- $MStatus = $result{'MStatus'};
- $actioncode = $result{'action-code'};
- $auxmsg = $result{'aux-msg'};
- $custtxn = $result{'cust-txn'};
- $merchtxn = $result{'merch-txn'};
- $authcode = $result{'auth-code'};
- $cardtype = $result{'card-type'};
- $cardnumber = $result{'card-number'};
- $cardexp = $result{'card-exp'};
- $MErrMsg = $result{'MErrMsg'};
- $MErrLoc = $result{'MErrLoc'};
- $avscode = $result{'avs-code'};
-
- $MStatus =~ tr/A-Za-z0-9\:\-\'\./+/c;
- $actioncode =~ tr/A-Za-z0-9\:\-\'/+/c;
- $authcode =~ tr/A-Za-z0-9\:\-\'/+/c;
- $MErrMsg =~ tr/A-Za-z0-9\:\-\'\./+/c;
- $avscode =~ tr/A-Za-z0-9\:\-\'/+/c;
- $fname =~ tr/A-Za-z0-9\:\-\'/+/c;
- $lname =~ tr/A-Za-z0-9\:\-\'/+/c;
- $name =~ tr/A-Za-z0-9\:\-\'/+/c;
- $addr =~ tr/A-Za-z0-9\:\-\'/+/c;
- $city =~ tr/A-Za-z0-9\:\-\'/+/c;
- $state =~ tr/A-Za-z0-9\:\-\'/+/c;
- $zip =~ tr/A-Za-z0-9\:\-\'/+/c;
- $country =~ tr/A-Za-z0-9\:\-\'/+/c;
-
- ######################################################
- #### Send ThankYou ###################################
-
- print <<"END";
- Content-type: text/html
- Location: $URL?ID=$ID&aOrderID=$orderID&Name=$fname&MStatus=$MStatus&AVSCode=$avscode&ActionCode=$actioncode&AuthCode=$authcode&CustTxn=$custtxn&MErrMsg=$MErrMsg
-
-
- END
-