home *** CD-ROM | disk | FTP | other *** search
/ Datatid 2000 #2 / Datatid-2000-02.iso / internet / ecpro / setup.exe / ECCARDIN.CGI < prev    next >
Encoding:
Text File  |  1998-11-24  |  3.2 KB  |  110 lines

  1. # ECcardin.cgi script Modified for ECware(tm) 4.0
  2. # Sean Rowland - 11/24/98
  3. # No modifications required for this script
  4. # Use with CashRegister Ver. 2.1.4 
  5. ######################################################
  6. #### First things first ##############################
  7.  
  8. require 5.001;
  9. use CCLib qw(SetServer sendmserver);
  10. use CGI;
  11. $form = new CGI;
  12.  
  13. ######################################################
  14. #### Get Variables ###################################
  15.  
  16. $host = $form->param('Host');
  17. $port = $form->param('Port');
  18. $secret = $form->param('Secret');
  19. $orderID = $form->param('OrderID');
  20. $amount = $form->param('Amount');
  21. $pan = $form->param('Pan');
  22. $fname = $form->param('FName');
  23. $lname = $form->param('LName');
  24. $name = $fname .$lname;
  25. $addr = $form->param('Addr');
  26. $city = $form->param('City');
  27. $state = $form->param('State');
  28. $zip = $form->param('Zip');
  29. $country = $form->param('Country');
  30. $exp = $form->param('CardExp');
  31. $URL = $form->param('URL');
  32. $ID = $form->param('ID');
  33. $AuthType = $form->param('AuthType');
  34.  
  35. ######################################################
  36. #### Define the Host, Port & Secret ##################
  37.  
  38. %creditserver= ( 'host' => $host,
  39.                     'port' => $port,
  40.                    'secret' => $secret);
  41.  
  42. &SetServer(%creditserver);
  43.  
  44. ######################################################
  45. #### Package Results #################################
  46.  
  47. %result = &sendmserver($AuthType,
  48.         'Order-ID', $orderID,
  49.         'Amount', "usd ".$amount,
  50.         'Card-Number', $pan,
  51.         'Card-Name', $name,
  52.         'Card-Address', $addr,
  53.         'Card-City', $city,
  54.         'Card-State', $state,
  55.         'Card-Zip', $zip,
  56.         'Card-Country', $country,
  57.         'Card-Exp', $exp);
  58.  
  59. ######################################################
  60. #### Collect Data  ###################################
  61.  
  62. #This section can be used to log activity from this script
  63. #
  64. $Log ='C:\InetPub\ECscripts\cardin.log';
  65. open (Log, ">>$Log");
  66. foreach (keys(%result)) {
  67.    print Log " $_ ==> $result{$_}\n";   
  68. }
  69. print Log "$host\n";
  70. print Log "$port\n";
  71. print Log "$secret\n";
  72. close (Log);
  73.  
  74. $MStatus = $result{'MStatus'};
  75. $actioncode = $result{'action-code'};
  76. $auxmsg = $result{'aux-msg'};
  77. $custtxn = $result{'cust-txn'};
  78. $merchtxn = $result{'merch-txn'};
  79. $authcode = $result{'auth-code'};
  80. $cardtype = $result{'card-type'};
  81. $cardnumber = $result{'card-number'};
  82. $cardexp = $result{'card-exp'};
  83. $MErrMsg = $result{'MErrMsg'};
  84. $MErrLoc = $result{'MErrLoc'};
  85. $avscode = $result{'avs-code'};
  86.  
  87. $MStatus =~ tr/A-Za-z0-9\:\-\'\./+/c;
  88. $actioncode =~ tr/A-Za-z0-9\:\-\'/+/c;
  89. $authcode =~ tr/A-Za-z0-9\:\-\'/+/c;
  90. $MErrMsg =~ tr/A-Za-z0-9\:\-\'\./+/c;
  91. $avscode =~ tr/A-Za-z0-9\:\-\'/+/c;
  92. $fname =~ tr/A-Za-z0-9\:\-\'/+/c;
  93. $lname =~ tr/A-Za-z0-9\:\-\'/+/c;
  94. $name =~ tr/A-Za-z0-9\:\-\'/+/c;
  95. $addr =~ tr/A-Za-z0-9\:\-\'/+/c;
  96. $city =~ tr/A-Za-z0-9\:\-\'/+/c;
  97. $state =~ tr/A-Za-z0-9\:\-\'/+/c;
  98. $zip =~ tr/A-Za-z0-9\:\-\'/+/c;
  99. $country =~ tr/A-Za-z0-9\:\-\'/+/c;
  100.  
  101. ######################################################
  102. #### Send ThankYou ###################################
  103.  
  104. print <<"END";
  105. Content-type: text/html
  106. Location: $URL?ID=$ID&aOrderID=$orderID&Name=$fname&MStatus=$MStatus&AVSCode=$avscode&ActionCode=$actioncode&AuthCode=$authcode&CustTxn=$custtxn&MErrMsg=$MErrMsg
  107.  
  108.  
  109. END
  110.