static private void Process_Record_Refund(ARC_Cybersource_Log_Refund arcRecord, RequestMessage request, System.Web.UI.WebControls.Label lbl) { #region Process Refund try { ReplyMessage reply = SoapClient.RunTransaction(request); string template = GetTemplate(reply.decision.ToUpper()); string content = GetContent(reply); arcRecord.ccContent = content; if (reply.decision == "ACCEPT") { arcRecord.Status = "Refunded"; } else if (reply.decision == "REJECT") { arcRecord.Status = "Rejected"; } else { arcRecord.Status = "Error"; } arcRecord.decision = reply.decision; arcRecord.merchantReferenceCode = reply.merchantReferenceCode; arcRecord.reasonCode = reply.reasonCode; arcRecord.requestID = reply.requestID; arcRecord.requestToken = reply.requestToken; if (reply.ccCreditReply != null) { arcRecord.ccCreditReply_amount = (reply.ccCreditReply.amount != null) ? arcRecord.ccCreditReply_amount = reply.ccCreditReply.amount : "0"; arcRecord.ccCreditReply_reasonCode = (reply.ccCreditReply.reasonCode != null) ? reply.ccCreditReply.reasonCode : ""; arcRecord.ccCreditReply_reconciliationID = (reply.ccCreditReply.reconciliationID != null) ? reply.ccCreditReply.reconciliationID : ""; arcRecord.ccCreditReply_requestDateTime = (reply.ccCreditReply.requestDateTime != null) ? reply.ccCreditReply.requestDateTime.Replace("T", " ").Replace("Z", "") : ""; } arcRecord.msgProcess = "success"; } catch (Exception ex) { ErrorLog.ErrorLog_Display(ex, "Refund Processing - Record Process", lbl); arcRecord.Status = "error"; arcRecord.msgProcess = "Process_Record_Refund - error<br />" + ex.Message; } finally { // Try to save even if we failed? Save_Record_Refund(arcRecord, lbl); } #endregion Process Refund }
static private void Save_Record_Refund(ARC_Cybersource_Log_Refund arcRecord, System.Web.UI.WebControls.Label lbl) { #region Processing Start - SQL - Try string cmdText = ""; try { #region SqlConnection String sqlStr = Connection.GetConnectionString("Default", ""); // Controlled by Web Config ARC_Live | ARC_Stage using (SqlConnection con = new SqlConnection(sqlStr)) { #region SqlCommand cmd using (SqlCommand cmd = new SqlCommand("", con)) { #region Populate the SQL Command cmd.CommandTimeout = 600; cmd.CommandText = "[dbo].[sp_cybersource_refund]"; cmd.CommandType = CommandType.StoredProcedure; #endregion Populate the SQL Command #region Populate the SQL Params cmd.Parameters.Add(new SqlParameter("@Source", "Web")); cmd.Parameters.Add(new SqlParameter("@CBAuthID", arcRecord.CBAuthID)); cmd.Parameters.Add(new SqlParameter("@ExternalID", arcRecord.ExternalID)); cmd.Parameters.Add(new SqlParameter("@User", HttpContext.Current.User.Identity.Name)); cmd.Parameters.Add(new SqlParameter("@Reason", arcRecord.RefundReason)); cmd.Parameters.Add(new SqlParameter("@ReasonNotes", arcRecord.RefundReasonNotes)); cmd.Parameters.Add(new SqlParameter("@Status", arcRecord.Status)); cmd.Parameters.Add(new SqlParameter("@CreateDate", arcRecord.CreateDate)); cmd.Parameters.Add(new SqlParameter("@decision", arcRecord.decision)); cmd.Parameters.Add(new SqlParameter("@merchantReferenceCode", arcRecord.merchantReferenceCode)); cmd.Parameters.Add(new SqlParameter("@reasonCode", arcRecord.reasonCode)); cmd.Parameters.Add(new SqlParameter("@requestID", arcRecord.requestID)); cmd.Parameters.Add(new SqlParameter("@requestToken", arcRecord.requestToken)); cmd.Parameters.Add(new SqlParameter("@ccAuthReversalReply_amount", arcRecord.ccAuthReversalReply_amount)); cmd.Parameters.Add(new SqlParameter("@ccAuthReversalReply_authorizationCode", arcRecord.ccAuthReversalReply_authorizationCode)); cmd.Parameters.Add(new SqlParameter("@ccAuthReversalReply_processorResponse", arcRecord.ccAuthReversalReply_processorResponse)); cmd.Parameters.Add(new SqlParameter("@ccAuthReversalReply_reasonCode", arcRecord.ccAuthReversalReply_reasonCode)); cmd.Parameters.Add(new SqlParameter("@ccAuthReversalReply_requestDateTime", arcRecord.ccAuthReversalReply_requestDateTime)); cmd.Parameters.Add(new SqlParameter("@ccCreditReply_amount", arcRecord.ccCreditReply_amount)); cmd.Parameters.Add(new SqlParameter("@ccCreditReply_ownerMerchantID", arcRecord.ccCreditReply_ownerMerchantID)); cmd.Parameters.Add(new SqlParameter("@ccCreditReply_reasonCode", arcRecord.ccCreditReply_reasonCode)); cmd.Parameters.Add(new SqlParameter("@ccCreditReply_reconciliationID", arcRecord.ccCreditReply_reconciliationID)); cmd.Parameters.Add(new SqlParameter("@ccCreditReply_requestDateTime", arcRecord.ccCreditReply_requestDateTime)); cmd.Parameters.Add(new SqlParameter("@voidReply_amount", arcRecord.voidReply_amount)); cmd.Parameters.Add(new SqlParameter("@voidReply_currency", arcRecord.voidReply_currency)); cmd.Parameters.Add(new SqlParameter("@voidReply_reasonCode", arcRecord.voidReply_reasonCode)); cmd.Parameters.Add(new SqlParameter("@voidReply_requestDateTime", arcRecord.voidReply_requestDateTime)); cmd.Parameters.Add(new SqlParameter("@ccContent", arcRecord.ccContent)); cmdText = "\n" + cmd.CommandText; bool cmdFirst = true; foreach (SqlParameter param in cmd.Parameters) { cmdText += "\n" + ((cmdFirst) ? "" : ",") + param.ParameterName + " = " + ((param.Value != null) ? "'" + param.Value.ToString() + "'" : "default"); cmdFirst = false; } #endregion Populate the SQL Params #region Process SQL Command - Try try { if (con.State == ConnectionState.Closed) { con.Open(); } using (SqlDataReader sqlRdr = cmd.ExecuteReader()) { if (sqlRdr.HasRows) { while (sqlRdr.Read()) { //arcNewID = sqlRdr["Response"].ToString(); //rplResponse.Text = "Record Updated: " + sqlRdr[0].ToString(); } } else { //arcNewID = 0; } } } #endregion Process SQL Command - Try #region Process SQL Command - Catch catch (Exception ex) { ErrorLog.ErrorLog_Display(ex, "Refund Processing - Record Save", lbl); arcRecord.msgSave = "Process_Record_Refund - error"; } #endregion Process SQL Command - Catch } #endregion SqlCommand cmd } #endregion SqlConnection } #endregion Processing Start - SQL - Try #region Processing Start - SQL - Catch catch (Exception ex) { ErrorLog.ErrorLog_Display(ex, "DoRefund - Follow On", lbl); } #endregion Processing Start - SQL - Catch }
static private String sqlStr = Connection.GetConnectionString("Default", ""); // Controlled by Web Config ARC_Live | ARC_Stage /// <summary> /// Perform a Follow On Refund /// This is based on the user selecting this method /// We still validate it; but if the validation fails we just let the user know /// </summary> /// <param name="cybid">Cybersource Log Auth ID</param> /// <param name="amount">Refund Amount</param> /// <param name="reason">Refund Reason ID</param> /// <param name="reasonnote">Refund Reason Note</param> /// <returns></returns> #region Processing - Refunds static public cybProcess cybRefundFollowOn(int cybid, double amount, string reason, string reasonnotes, System.Web.UI.WebControls.Label lbl) { cybProcess cybProc = new cybProcess(); ARC_Cybersource_Log_Refund arcRecord = new ARC_Cybersource_Log_Refund(); arcRecord.CBAuthID = cybid; arcRecord.RefundReason = reason; arcRecord.RefundReasonNotes = reasonnotes; cybProc.message = "processing..."; #region Process Refund try { /// <summary> /// Follow-On transactions only need the RequestID, Token, and Amount of the refund /// </summary /// bool doRefund = false; int callid = 0; #region Initiliaze RequestMessage request = new RequestMessage(); #endregion Initiliaze #region Get the SQL Record #region SqlConnection using (SqlConnection con = new SqlConnection(sqlStr)) { #region SqlCommand cmd using (SqlCommand cmd = new SqlCommand("", con)) { #region Populate the SQL Command cmd.CommandTimeout = 600; #region Build cmdText String cmdText = ""; cmdText += @" -- Did this for recurring transactions which are linked differently IF EXISTS( SELECT TOP 1 1 FROM [dbo].[cybersource_log_auth] [cb] WITH(NOLOCK) JOIN [dbo].[donationccinfo] [di] WITH(NOLOCK) ON [di].[id] = [cb].[externalid] JOIN [dbo].[callinfo] [ci] WITH(NOLOCK) ON [ci].[callid] = [di].[callid] WHERE 1=1 AND [cb].[id] = @sp_cybid ) BEGIN SELECT [cb].[id] ,[cb].[status] ,[cb].[createdate] ,[cb].[requestid] ,[cb].[requesttoken] ,[cb].[merchantreferencecode] ,[di].[callid] ,[cb].[externalid] ,[di].[donationamount] [amount] ,(SELECT SUM([cr].[cccreditreply_amount]) FROM [dbo].[cybersource_log_refund] [cr] WITH(NOLOCK) WHERE [cr].[externalid] = [di].[id] AND [cr].[reasoncode] = '100') [amount_ref] ,[di].[ccnum] ,[di].[ccexpmonth] ,[di].[ccexpyear] ,[ci].[fname] ,[ci].[lname] ,[ci].[address] ,[ci].[suitenumber] ,[ci].[zip] ,[ci].[city] ,[ci].[state] ,[cb].[source] ,[cb].[decision] ,[cb].[reasoncode] ,[cb].[ccauthreply_amount] ,[cb].[cccapturereply_amount] ,[cb].[cccontent] FROM [dbo].[cybersource_log_auth] [cb] WITH(NOLOCK) JOIN [dbo].[donationccinfo] [di] WITH(NOLOCK) ON [di].[id] = [cb].[externalid] JOIN [dbo].[callinfo] [ci] WITH(NOLOCK) ON [ci].[callid] = [di].[callid] WHERE 1=1 AND [cb].[id] = @sp_cybid END ELSE BEGIN SELECT [cb].[id] ,[cb].[status] ,[cb].[createdate] ,[cb].[requestid] ,[cb].[requesttoken] ,[cb].[merchantreferencecode] ,[di].[callid] ,[cb].[externalid] ,[di].[donationamount] [amount] ,(SELECT SUM([cr].[cccreditreply_amount]) FROM [dbo].[cybersource_log_refund] [cr] WITH(NOLOCK) WHERE [cr].[externalid] = [di].[id] AND [cr].[reasoncode] = '100') [amount_ref] ,[di].[ccnum] ,[di].[ccexpmonth] ,[di].[ccexpyear] ,[ci].[fname] ,[ci].[lname] ,[ci].[address] ,[ci].[suitenumber] ,[ci].[zip] ,[ci].[city] ,[ci].[state] ,[cb].[source] ,[cb].[decision] ,[cb].[reasoncode] ,[cb].[ccauthreply_amount] ,[cb].[cccapturereply_amount] ,[cb].[cccontent] FROM [dbo].[cybersource_log_auth] [cb] WITH(NOLOCK) JOIN [dbo].[donation_recurring_log] [drl] WITH(NOLOCK) ON [drl].[recurringid] = [cb].[externalid] JOIN [dbo].[donationccinfo] [di] WITH(NOLOCK) ON [di].[id] = [drl].[donationid] JOIN [dbo].[callinfo] [ci] WITH(NOLOCK) ON [ci].[callid] = [di].[callid] WHERE 1=1 AND [cb].[id] = @sp_cybid END "; #endregion Build cmdText cmd.CommandText = cmdText; cmd.CommandType = CommandType.Text; cmd.Parameters.Clear(); #endregion Populate the SQL Command #region Populate the SQL Params cmd.Parameters.Add(new SqlParameter("@sp_cybid", cybid)); #endregion Populate the SQL Params #region Process SQL Command - Try try { if (con.State == ConnectionState.Closed) { con.Open(); } using (SqlDataReader sqlRdr = cmd.ExecuteReader()) { if (sqlRdr.HasRows) { while (sqlRdr.Read()) { // Ensure we have a valid record for [Follow On] //cybProc.message = "sql record..." + sqlRdr["status"].ToString(); DateTime dtChargeDate; DateTime.TryParse(sqlRdr["createdate"].ToString(), out dtChargeDate); Int32 foLimit = 59; // Days that a Follow On Credit can be performed callid = Convert.ToInt32(sqlRdr["callid"].ToString()); arcRecord.ExternalID = Convert.ToInt32(sqlRdr["externalid"].ToString()); if (sqlRdr["status"].ToString() == "Settled") { // We're good, don't do anything? } else if (sqlRdr["status"].ToString() == "Cancelled" && sqlRdr["decision"].ToString() == "ACCEPT") { // We're good, don't do anything? } else if (sqlRdr["status"].ToString() == "Refunded") { // We did this validation, just need to do it again because AGENTS double dvAmount = 0; double dvAmountRef = 0; Double.TryParse(sqlRdr["amount_ref"].ToString(), out dvAmountRef); if (dvAmountRef > 0) { Double.TryParse(sqlRdr["amount"].ToString(), out dvAmount); if (dvAmount > 0) { if ((dvAmount - dvAmountRef) > 0) { dvAmount = dvAmount - dvAmountRef; if (dvAmount >= amount) { doRefund = true; } } } } if (!doRefund) { throw new Exception("Invalid Donation/Refund Amounts"); } } else { throw new Exception("Invalid Donation Status"); } if (dtChargeDate != null && (DateTime.UtcNow - dtChargeDate).TotalDays < foLimit) { // We're good, don't do anything? } else { cybProc.message = "Error:"; cybProc.message += "<br />cybid: " + cybid.ToString(); cybProc.message += "<br />Charge Date: " + dtChargeDate.ToString(); cybProc.message += "<br />"; doRefund = false; throw new Exception("Invalid Donation Date"); } // Add the required data to the request request.ccCreditService = new CCCreditService(); request.ccCreditService.run = "true"; request.ccCreditService.captureRequestID = sqlRdr["requestid"].ToString().Trim(); request.ccCreditService.captureRequestToken = sqlRdr["requesttoken"].ToString().Trim(); request.merchantReferenceCode = sqlRdr["merchantreferencecode"].ToString().Trim(); PurchaseTotals purchaseTotals = new PurchaseTotals(); purchaseTotals.currency = "USD"; purchaseTotals.grandTotalAmount = amount.ToString(); request.purchaseTotals = purchaseTotals; doRefund = true; } } else { cybProc.message = "sql No records..."; } } } #endregion Process SQL Command - Try #region Process SQL Command - Catch catch (Exception ex) { cybProc.message += "sql error"; ErrorLog.ErrorLog_Display(ex, "DoRefund - Follow On", lbl); } #endregion Process SQL Command - Catch } #endregion SqlCommand cmd } #endregion SqlConnection #endregion Get the SQL Record #region Processing CyberSource Attempt if (doRefund) { //ReplyMessage reply = SoapClient.RunTransaction(request); //string template = GetTemplate(reply.decision.ToUpper()); //string content = GetContent(reply); Process_Record_Refund(arcRecord, request, lbl); cybProc.status = arcRecord.Status; cybProc.message += "<br />process complete"; } else { } #endregion Processing CyberSource Attempt } catch (Exception ex) { cybProc.message = "error"; ErrorLog.ErrorLog_Display(ex, "DoRefund - Follow On", lbl); } finally { //InstantEmail_RefundReport(); } #endregion return(cybProc); }
protected void Record_Save(ARC_Cybersource_Log_Refund arcRecord) { #region Processing Start - SQL - Try string cmdText = ""; try { #region SqlConnection using (SqlConnection con = new SqlConnection(sqlStr)) { #region SqlCommand cmd using (SqlCommand cmd = new SqlCommand("", con)) { #region Populate the SQL Command cmd.CommandTimeout = 600; cmd.CommandText = "[dbo].[sp_cybersource_refund]"; cmd.CommandType = CommandType.StoredProcedure; #endregion Populate the SQL Command #region Populate the SQL Params cmd.Parameters.Add(new SqlParameter("@Source", "Web")); cmd.Parameters.Add(new SqlParameter("@CBAuthID", arcRecord.CBAuthID)); cmd.Parameters.Add(new SqlParameter("@ExternalID", arcRecord.ExternalID)); cmd.Parameters.Add(new SqlParameter("@User", Page.User.Identity.Name)); string strReason = refundReason.SelectedValue; if (strReason == "Other" && refundReasonOther.Text.Length > 0) { strReason = refundReasonOther.Text; } cmd.Parameters.Add(new SqlParameter("@Reason", strReason)); cmd.Parameters.Add(new SqlParameter("@Status", arcRecord.Status)); cmd.Parameters.Add(new SqlParameter("@CreateDate", arcRecord.CreateDate)); cmd.Parameters.Add(new SqlParameter("@decision", arcRecord.decision)); cmd.Parameters.Add(new SqlParameter("@merchantReferenceCode", arcRecord.merchantReferenceCode)); cmd.Parameters.Add(new SqlParameter("@reasonCode", arcRecord.reasonCode)); cmd.Parameters.Add(new SqlParameter("@requestID", arcRecord.requestID)); cmd.Parameters.Add(new SqlParameter("@requestToken", arcRecord.requestToken)); cmd.Parameters.Add(new SqlParameter("@ccAuthReversalReply_amount", arcRecord.ccAuthReversalReply_amount)); cmd.Parameters.Add(new SqlParameter("@ccAuthReversalReply_authorizationCode", arcRecord.ccAuthReversalReply_authorizationCode)); cmd.Parameters.Add(new SqlParameter("@ccAuthReversalReply_processorResponse", arcRecord.ccAuthReversalReply_processorResponse)); cmd.Parameters.Add(new SqlParameter("@ccAuthReversalReply_reasonCode", arcRecord.ccAuthReversalReply_reasonCode)); cmd.Parameters.Add(new SqlParameter("@ccAuthReversalReply_requestDateTime", arcRecord.ccAuthReversalReply_requestDateTime)); cmd.Parameters.Add(new SqlParameter("@ccCreditReply_amount", arcRecord.ccCreditReply_amount)); cmd.Parameters.Add(new SqlParameter("@ccCreditReply_ownerMerchantID", arcRecord.ccCreditReply_ownerMerchantID)); cmd.Parameters.Add(new SqlParameter("@ccCreditReply_reasonCode", arcRecord.ccCreditReply_reasonCode)); cmd.Parameters.Add(new SqlParameter("@ccCreditReply_reconciliationID", arcRecord.ccCreditReply_reconciliationID)); cmd.Parameters.Add(new SqlParameter("@ccCreditReply_requestDateTime", arcRecord.ccCreditReply_requestDateTime)); cmd.Parameters.Add(new SqlParameter("@voidReply_amount", arcRecord.voidReply_amount)); cmd.Parameters.Add(new SqlParameter("@voidReply_currency", arcRecord.voidReply_currency)); cmd.Parameters.Add(new SqlParameter("@voidReply_reasonCode", arcRecord.voidReply_reasonCode)); cmd.Parameters.Add(new SqlParameter("@voidReply_requestDateTime", arcRecord.voidReply_requestDateTime)); cmd.Parameters.Add(new SqlParameter("@ccContent", arcRecord.ccContent)); cmdText = "\n" + cmd.CommandText; bool cmdFirst = true; foreach (SqlParameter param in cmd.Parameters) { cmdText += "\n" + ((cmdFirst) ? "" : ",") + param.ParameterName + " = " + ((param.Value != null) ? "'" + param.Value.ToString() + "'" : "default"); cmdFirst = false; } #endregion Populate the SQL Params #region Process SQL Command - Try try { if (con.State == ConnectionState.Closed) { con.Open(); } using (SqlDataReader sqlRdr = cmd.ExecuteReader()) { if (sqlRdr.HasRows) { while (sqlRdr.Read()) { //arcNewID = sqlRdr["Response"].ToString(); rplResponse.Text = "Record Updated: " + sqlRdr[0].ToString(); } } else { //arcNewID = 0; } } } #endregion Process SQL Command - Try #region Process SQL Command - Catch catch (Exception ex) { msgLabel.Text = "Oops"; Error_Save(ex, "RunTransaction"); //Log_Exception("Error 001", ex, "standard", "Step 1 Catch"); //Log(cmdText, "sqlFailed"); sqlMsg.Text = cmdText.Replace("\n", "<br />") + "<br />"; } #endregion Process SQL Command - Catch } #endregion SqlCommand cmd } #endregion SqlConnection } #endregion Processing Start - SQL - Try #region Processing Start - SQL - Catch catch (Exception ex) { msgLabel.Text = "Oops"; sqlMsg.Text = cmdText.Replace("\n", "<br />") + "<br />"; Error_Save(ex, "RunTransaction"); //Log_Exception("Error 001", ex, "standard", "Step 1 Catch"); } #endregion Processing Start - SQL - Catch }
protected void ProcessRefund_FollowOn() { WriteToLabel("add", "Red", "<br />" + "Processing: Follow-On Transaction - Start", dtlLabel); #region Process Refund try { /// <summary> /// Follow-On transactions only need the RequestID, Token, and Amount of the refund /// </summary #region Processing CyberSource Attempt RequestMessage request = new RequestMessage(); request.ccCreditService = new CCCreditService(); request.ccCreditService.run = "true"; DateTime dtChargeDate; DateTime.TryParse(CreateDate.Text, out dtChargeDate); if (dtChargeDate == null) { // Throw an Exception since the date is not valid throw new Exception("Invalid Donation Date"); } //dtlLabel.Text = (dtChargeDate - DateTime.UtcNow).TotalDays.ToString(); #region Stand-Alone Credit if ((DateTime.UtcNow - dtChargeDate).TotalDays > foLimit) { // Stand Alone BillTo billTo = new BillTo(); billTo.firstName = FirstName.Text; billTo.lastName = LastName.Text; billTo.street1 = Address1.Text; billTo.postalCode = Zip.Text; billTo.city = City.Text; billTo.state = ddlState.Text; billTo.country = ddlCountry.Text; billTo.email = "*****@*****.**"; request.billTo = billTo; Card card = new Card(); card.accountNumber = CardNumberFull.Value; card.expirationMonth = CardMonth.Text; card.expirationYear = CardYear.Text; if (CardTypeFull.Value.Length > 0) { card.cardType = CardTypeFull.Value; } request.card = card; } #endregion Stand-Alone Credit #region Follow On Credit else { // Follow On // Credit Required Fields request.ccCreditService.captureRequestID = RequestID.Text.Trim(); request.ccCreditService.captureRequestToken = RequestToken.Text.Trim(); } #endregion Follow On Credit request.merchantReferenceCode = ReferenceNum.Text.Trim(); PurchaseTotals purchaseTotals = new PurchaseTotals(); purchaseTotals.currency = "USD"; purchaseTotals.grandTotalAmount = Amount.Text.Trim(); request.purchaseTotals = purchaseTotals; //Attempt processing the request, handle excepts Console.WriteLine(" "); WriteToLabel("add", "Red", "<br />" + "Sending Request", dtlLabel); #endregion Processing CyberSource Attempt #region RunTransaction: Try try { ARC_Cybersource_Log_Refund arcRecord = new ARC_Cybersource_Log_Refund(); ReplyMessage reply = SoapClient.RunTransaction(request); string template = GetTemplate(reply.decision.ToUpper()); string content = GetContent(reply); lblTemplate.Text = String.Format(template, content); arcRecord.ccContent = content; arcRecord.ExternalID = lblExternalID.Text; arcRecord.CBAuthID = lblCBAuthID.Text; if (reply.decision == "ACCEPT") { arcRecord.Status = "Refunded"; } else if (reply.decision == "REJECT") { arcRecord.Status = "Rejected"; } else { arcRecord.Status = "Error"; } arcRecord.decision = reply.decision; arcRecord.merchantReferenceCode = reply.merchantReferenceCode; arcRecord.reasonCode = reply.reasonCode; arcRecord.requestID = reply.requestID; arcRecord.requestToken = reply.requestToken; if (reply.ccCreditReply != null) { arcRecord.ccCreditReply_amount = (reply.ccCreditReply.amount != null) ? arcRecord.ccCreditReply_amount = reply.ccCreditReply.amount : "0"; arcRecord.ccCreditReply_reasonCode = (reply.ccCreditReply.reasonCode != null) ? reply.ccCreditReply.reasonCode : ""; arcRecord.ccCreditReply_reconciliationID = (reply.ccCreditReply.reconciliationID != null) ? reply.ccCreditReply.reconciliationID : ""; arcRecord.ccCreditReply_requestDateTime = (reply.ccCreditReply.requestDateTime != null) ? reply.ccCreditReply.requestDateTime.Replace("T", " ").Replace("Z", "") : ""; } //ProcessRefund_SQLUpdate() rplDecision.Text = arcRecord.decision; rplMerchantReferenceCode.Text = arcRecord.merchantReferenceCode; rplReasonCode.Text = arcRecord.reasonCode; rplRequestID.Text = arcRecord.requestID; rplRequestToken.Text = arcRecord.requestToken; rplAmount.Text = arcRecord.ccCreditReply_amount; rplReasonCode2.Text = arcRecord.ccCreditReply_reasonCode; rplReconciliationID.Text = arcRecord.ccCreditReply_reconciliationID; rplReconciliationID.ForeColor = System.Drawing.Color.Blue; rplReconciliationID.Font.Bold = true; rplRequestDateTime.Text = arcRecord.ccCreditReply_requestDateTime; Record_Save(arcRecord); Record_Get(Convert.ToInt32(Request["cbid"])); } #endregion RunTransaction: Try #region RunTransaction: Catch catch (Exception ex) { msgLabel.Text = "Oops"; rplDecision.Text = "!! ERROR - NOT COMPLETED !!"; msgRefund = ex.Message; Error_Save(ex, "RunTransaction"); } #endregion RunTransaction: Catch } catch (Exception ex) { msgLabel.Text = "Oops"; rplDecision.Text = "!! ERROR - NOT COMPLETED !!"; msgRefund = ex.Message; Error_Save(ex, "Processing_CyberSource"); } finally { InstantEmail_RefundReport(); } #endregion WriteToLabel("add", "Red", "<br />" + "Processing: Follow-On Transaction - End", dtlLabel); }