<%@ LANGUAGE=vbscript %> <% dim strpagecode strpagecode= "FAIRG40" session("usertype")="NUS" %> <% ' ----- Copyright -------------------------------------------------------- ' (c)2000 Copyright QSI Payments, Inc. - All Rights Reserved ' Copyright Statement: http://www.qsipayments.com/copyright/Payment_Client ' ------------------------------------------------------------------------ ' ' NAME ' ==== ' SSL_DR.asp ' ' PURPOSE ' ======= ' Receive a Digital Receipt from the Payment Server; extract and return details. ' ' PAYMENT CLIENT VERSION ' ====================== ' This module assumes v1.1.54 of the payment client. ' ' REVISION HISTORY ' ================ ' v1.0 10 March 2000 Initial version ' ' INPUTS ' ====== ' DigitalOrder Received from the Payment Server (via browser redirection) ' ' OUTPUTS ' ======= ' If no errors detected ' Receipt Details Sent to DRDetailsURL (via browser redirection) ' - SessionID ' - MerchantID ' - PurchaseAmount ' - Locale ' - ReceiptNo Receipt number - issued by Acquiring bank ' - TransactionNo ' - AcqResponseCode Acquirer Response Code ' - QSIResponseCode Summary of Acquirer Response Code ' Else ' ErrorCode Sent to sErrorPage (via browser redirection) ' Exception Returns Payment Client Exception (where generated) ' ' ErrorCode Values ' ================ ' 10 Payment Client has not initialised correctly. ' - Check the installation of the payment client. ' 11 Digital Receipt could not be decrypted ' ' 12 Digital Receipt has not created correctly. ' - No result. ' ' VARIABLES ' ========= ' objPayClient Payment Client object ' enDigitReceipt Encrypted Digital Receipt ' sDRDetailsURL Where to send the Digital Receipt details to ' sErrorPage Name of Error Handler ' nErrorCode Error Code number ' sException Payment Client Exception (where generated) ' ' ========================================================================== ' ' Initialisation ' ============== ' Define the error constants const No_Error = 0 const ERR_PayClient = 10 const ERR_Decrypt = 11 const ERR_No_Results = 12 const OK = 1 dim errmsg ' Define Error Handler sErrorPage = "/inc/commoninc/error.asp" ' Define module to receive Digital Receipt details sDRDetailsURL = "./regonlinepmtconf.asp" ' Initialise ErrorCode - set to No Errors nErrorCode = No_Error sException = "" ' Turn off default error checking, as any errors are explicitly handled on error resume next ' Stop the page being cached on the web server Response.Expires = 0 ' Retrieve Digital Order ' ====================== enDigitReceipt = Request.QueryString("DR") ' Create Payment Client Object ' ============================ ' Create Payment Client object set objPayClient = Server.CreateObject("PaymentClient.com.COMClient") ' Test the Payment Client object created corectly if objPayClient.echo("Test") <> "echo:Test" then nErrorCode = ERR_PayClient end if ' Get Digital Receipt ' =================== ' if no errors ... if nErrorCode = No_Error then ' process the returned encrypted DR string if objPayClient.decryptDigitalReceipt(enDigitReceipt) <> OK then ' Failed nErrorCode = ERR_Decrypt sException = objPayClient.getResultField("PaymentClient.Error") else ' Set ResultField array to Digital Receipt details if objPayClient.nextResult() <> OK then ' Failed nErrorCode = ERR_No_Results end if end if end if ' Get Digital Receipt details ' =========================== ' if no errors ... if nErrorCode = No_Error then ' Gather Digital Receipt variables and append to Digital Receipt Details URL sDRDetailsURL = sDRDetailsURL & _ "?SessionID=" & objPayClient.getResultField("DigitalReceipt.SessionId") & _ "&MerchantID=" & objPayClient.getResultField("DigitalReceipt.MerchantId") & _ "&PurchaseAmount=" & objPayClient.getResultField("DigitalReceipt.PurchaseAmountInteger") & _ "&Locale=" & objPayClient.getResultField("DigitalReceipt.Locale") & _ "&ReceiptNo=" & objPayClient.getResultField("DigitalReceipt.ReceiptNo") & _ "&TransactionNo=" & objPayClient.getResultField("DigitalReceipt.TransactionNo") & _ "&AcqResponseCode=" & objPayClient.getResultField("DigitalReceipt.AcqResponseCode") & _ "&QSIResponseCode=" & objPayClient.getResultField("DigitalReceipt.QSIResponseCode") ' Finished with the objPayClient object, so nullify it set objPayClient = nothing ' Pass control to the Digital Receipt details page Response.Redirect sDRDetailsURL else ' Finished with the objPayClient object, so nullify it set objPayClient = nothing DetermineError ' Pass control to the error handler sErrorPage = sErrorPage & "?errorno=" & errmsg & _ "§ion="&server.URLEncode ("Associate Member Registration") Response.Redirect sErrorPage end if Sub DetermineError() ' ' ErrorCode Values ' ================ ' 10 Payment Client has not initialised correctly. ' - Check the installation of the payment client. ' 11 Digital Order has not created correctly. ' - Check input parameters. Select Case nErrorCode Case "10" errmsg="PC1" Case "11" errmsg="PC2" Case "12" errmsg="PC3" Case Else errmsg="Payment Client Error unable to be determined." End Select End Sub %>