//Create Profile if autopay selected BankDraft public static PaymentResponse CreateProfile(CheckPaymentRequest request) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var payResponse = new PaymentResponse(); string batchCode = System.Configuration.ConfigurationManager.AppSettings["CheckPaymantBatchCode"]; try { FrontierPayClient objFrontierPay = new FrontierPayClient(); WebEnrollmentNewDesign.PayService.FrontierPayResponse frontierPayResponse = new WebEnrollmentNewDesign.PayService.FrontierPayResponse(); var payObject = new WebEnrollmentNewDesign.PayService.FrontierPayRequest() { AuthKey = request.AuthKey, CustomerNumber = request.CustomerNumber, BatchCode = batchCode, ConfirmationType = "NONE", AccountName = request.BankAccountName, BankAccountNumber = Encrypt(request.BankAccountNumber), AccountType = request.AccountType, BankRoutingNumber = request.BankRoutingNumber, SetupAutoPay = Convert.ToString(request.SetupAutoPay), Source = request.Source }; try { frontierPayResponse = objFrontierPay.CreateCheckProfile(payObject); } catch (Exception ex) { InsertClientErrorLog(request.CustomerNumber, batchCode, payObject.Source, ex, "Common_CreateProfile"); } payResponse.ResultMessage = frontierPayResponse.ResponseMessage; payResponse.ResultCode = Convert.ToInt32(frontierPayResponse.StatusCode); payResponse.profileStatusCode = Convert.ToInt64(frontierPayResponse.ProfileID); return(payResponse); } catch (Exception ex) { payResponse.ResultCode = -3; payResponse.ResultMessage = ex.Message; InsertClientErrorLog(request.CustomerNumber, batchCode, "WebEnrollmentNewDesign - CreateProfile - " + request.Source, ex, "Common_CreateProfile"); return(payResponse); } }
public static WebEnrollmentNewDesign.PayService.FrontierPayResponse AuthorizeCard(CreditCardInfo objReq) { string Autopay = "N"; var payresponse = new WebEnrollmentNewDesign.PayService.FrontierPayResponse(); try { if (objReq.CardNumber.Trim().StartsWith("4")) // Visa { objReq.CardType = "001"; } else if (objReq.CardNumber.Trim().StartsWith("5") || objReq.CardNumber.Trim().StartsWith("2")) // Master Card { objReq.CardType = "002"; } else if (objReq.CardNumber.Trim().StartsWith("3")) //American Express { objReq.CardType = "003"; } else if (objReq.CardNumber.Trim().StartsWith("6")) //Discover { objReq.CardType = "004"; } else { objReq.CardType = "000"; } if (objReq.AutoPay) { Autopay = "Y"; } FrontierPayClient objFrontierPayClient = new FrontierPayClient(); string batchCode = System.Configuration.ConfigurationManager.AppSettings["AuthCardBatchCode"]; var payObject = new WebEnrollmentNewDesign.PayService.FrontierPayRequest() { AuthKey = objReq.AuthKey, BatchCode = batchCode, PostReceipt = "Y", SetupAutoPay = Autopay, ConfirmationType = "NONE", AccountName = objReq.CardName, CardType = objReq.CardType, CardNumber = Common.Encrypt(objReq.CardNumber), ExpirationMonth = objReq.CardExpiry.Substring(0, 2), ExpirationYear = "20" + objReq.CardExpiry.Substring(3, 2), CVCCode = Common.Encrypt(objReq.CVVCode), ZipCode = objReq.ZipCode, Amount = Convert.ToString(objReq.DepositAmount), Source = objReq.Source }; payresponse = objFrontierPayClient.AuthorizeCard(payObject); if (payresponse != null) { objPayWSDBClient = new PayWSDBClient(); objPayWSDBClient.FPUpdateRequestPayment(string.Empty, payresponse.AuthorizedRequestID, objReq.PaymentSessionID, objReq.RequestId); objReq.CardNumber = ""; objReq.CVVCode = ""; } return(payresponse); } catch (Exception ex) { Common.InsertClientErrorLog(string.Empty, string.Empty, objReq.Source, ex, "AuthorizeCard"); return(null); } }
//PaybyProfile Credit Card/Bank Draft Payment public static PaymentResponse FrontierPayByProfile(ProfilePaymentRequest request) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var payResponse = new PaymentResponse(); string batchCode = System.Configuration.ConfigurationManager.AppSettings["PayByProfileBatchCode"]; if (request.Type != null && request.Type.ToUpper() == "ACH") { batchCode = System.Configuration.ConfigurationManager.AppSettings["PayByProfileCheckPaymantBatchCode"]; } try { if (request.Cust_no != null && request.Cust_no != string.Empty) { FrontierPayClient objFrontierPay = new FrontierPayClient(); WebEnrollmentNewDesign.PayService.FrontierPayResponse frontierPayResponse = new WebEnrollmentNewDesign.PayService.FrontierPayResponse(); var payObject = new WebEnrollmentNewDesign.PayService.FrontierPayRequest() { AuthKey = request.AuthKey, CustomerNumber = request.Cust_no, BatchCode = batchCode, PostReceipt = "Y", ConfirmationType = request.ConfirmationType, Amount = Convert.ToString(request.Amount), ProfileID = request.ProfileID, Email = request.Email, PhoneNumber = request.ContactNumber, Source = request.Source, SiteIdentifier = request.SiteIdentifier }; if (request.IsCFWaived == "0" && request.Source == "Superscreen") //Convenience Fee is not waived { if (request.State.ToUpper() == "TX") { decimal CustomerServiceConvenienceFee_Amount = Convert.ToDecimal(System.Configuration.ConfigurationManager.AppSettings["CustomerServiceConvenienceFee_Amount"].ToString()); decimal CreditCardProcessingFee_Amount = Convert.ToDecimal(System.Configuration.ConfigurationManager.AppSettings["CreditCardProcessingFee_Amount"].ToString()); if (CustomerServiceConvenienceFee_Amount > 0 || CreditCardProcessingFee_Amount > 0) { payObject.AddAdjustment = "Y"; List <WebEnrollmentNewDesign.PayService.AddAdjustmentRequest> lstAdj = new List <WebEnrollmentNewDesign.PayService.AddAdjustmentRequest>(); if (CustomerServiceConvenienceFee_Amount > 0) { WebEnrollmentNewDesign.PayService.AddAdjustmentRequest adj1 = new WebEnrollmentNewDesign.PayService.AddAdjustmentRequest(); adj1.AdjustmentAmount = Convert.ToString(CustomerServiceConvenienceFee_Amount); adj1.ReasonCode = System.Configuration.ConfigurationManager.AppSettings["CustomerServiceConvenienceFee_ReasonCode"].ToString(); adj1.Note = ""; lstAdj.Add(adj1); } if (CreditCardProcessingFee_Amount > 0) { WebEnrollmentNewDesign.PayService.AddAdjustmentRequest adj2 = new WebEnrollmentNewDesign.PayService.AddAdjustmentRequest(); adj2.AdjustmentAmount = Convert.ToString(CreditCardProcessingFee_Amount); adj2.ReasonCode = System.Configuration.ConfigurationManager.AppSettings["CreditCardProcessingFee_ReasonCode"].ToString(); adj2.Note = ""; lstAdj.Add(adj2); } payObject.AddAdjustmentRequestDetails = lstAdj; } else { payObject.AddAdjustment = "N"; } } } try { frontierPayResponse = objFrontierPay.PayByProfile(payObject); } catch (Exception ex) { InsertClientErrorLog(request.Cust_no, batchCode, request.Source, ex, "Common_FrontierPayByProfile"); } payResponse.ResultMessage = frontierPayResponse.ResponseMessage; payResponse.ResultCode = Convert.ToInt32(frontierPayResponse.StatusCode); payResponse.AuthCode = frontierPayResponse.ConfirmationNo; if (string.IsNullOrEmpty(payResponse.ResultMessage)) { payResponse.ResultMessage = ""; } } else { payResponse.ResultCode = -1; payResponse.ResultMessage = "Invalid Request"; } } catch (Exception ex) { payResponse.ResultCode = -3; //Exception payResponse.ResultMessage = ex.Message; InsertClientErrorLog(request.Cust_no, batchCode, request.Source, ex, "Common_FrontierPayByProfile"); return(payResponse); } return(payResponse); }
//Credit Card Payment public static PaymentResponse FrontierPayMakePayment(CreditCardPaymentRequest req) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var payResponse = new PaymentResponse(); string batchCode = System.Configuration.ConfigurationManager.AppSettings["BatchCode"]; try { if (req.CustomerNumber != null && req.CustId != 0) { FrontierPayClient objFrontierPay = new FrontierPayClient(); WebEnrollmentNewDesign.PayService.FrontierPayResponse frontierPayResponse = new WebEnrollmentNewDesign.PayService.FrontierPayResponse(); if (req.CardNumber.Trim().StartsWith("4")) // Visa { req.CardType = "001"; } else if (req.CardNumber.Trim().StartsWith("5") || req.CardNumber.Trim().StartsWith("2")) // Master Card { req.CardType = "002"; } else if (req.CardNumber.Trim().StartsWith("3")) //American Express { req.CardType = "003"; } else if (req.CardNumber.Trim().StartsWith("6")) //Discover { req.CardType = "004"; } else { req.CardType = "000"; } var payObject = new WebEnrollmentNewDesign.PayService.FrontierPayRequest() { AuthKey = req.AuthKey, CustomerNumber = req.CustomerNumber, BatchCode = batchCode, SetupAutoPay = "N", PostReceipt = "Y", ConfirmationType = req.ConfirmationType, AccountName = req.CardName, CardType = req.CardType, CardNumber = Common.Encrypt(req.CardNumber), ExpirationMonth = req.Expiry.Substring(0, 2), ExpirationYear = "20" + req.Expiry.Substring(3, 2), CVCCode = Common.Encrypt(req.VerificationCode), ZipCode = req.ZipCode, Amount = Convert.ToString(req.Amount), Email = req.Email, PhoneNumber = req.ContactNumber, Source = req.Source, SiteIdentifier = req.SiteIdentifier }; List <WebEnrollmentNewDesign.PayService.AddAdjustmentRequest> lstAdj = new List <WebEnrollmentNewDesign.PayService.AddAdjustmentRequest>(); decimal TotfeeAmt = 0; if (req.IsCFWaived == "0" && req.Source == "Superscreen") //Convenience Fee is not waived { if (req.Addr_State.ToUpper() == "TX") { decimal CustomerServiceConvenienceFee_Amount = Convert.ToDecimal(System.Configuration.ConfigurationManager.AppSettings["CustomerServiceConvenienceFee_Amount"].ToString()); decimal CreditCardProcessingFee_Amount = Convert.ToDecimal(System.Configuration.ConfigurationManager.AppSettings["CreditCardProcessingFee_Amount"].ToString()); if (CustomerServiceConvenienceFee_Amount > 0 || CreditCardProcessingFee_Amount > 0) { payObject.AddAdjustment = "Y"; if (CustomerServiceConvenienceFee_Amount > 0) { WebEnrollmentNewDesign.PayService.AddAdjustmentRequest adj1 = new WebEnrollmentNewDesign.PayService.AddAdjustmentRequest(); adj1.AdjustmentAmount = Convert.ToString(CustomerServiceConvenienceFee_Amount); adj1.ReasonCode = System.Configuration.ConfigurationManager.AppSettings["CustomerServiceConvenienceFee_ReasonCode"].ToString(); adj1.Note = ""; lstAdj.Add(adj1); } if (CreditCardProcessingFee_Amount > 0) { WebEnrollmentNewDesign.PayService.AddAdjustmentRequest adj2 = new WebEnrollmentNewDesign.PayService.AddAdjustmentRequest(); adj2.AdjustmentAmount = Convert.ToString(CreditCardProcessingFee_Amount); adj2.ReasonCode = System.Configuration.ConfigurationManager.AppSettings["CreditCardProcessingFee_ReasonCode"].ToString(); adj2.Note = ""; lstAdj.Add(adj2); } TotfeeAmt = (CustomerServiceConvenienceFee_Amount);//CustomerServiceConvenienceFee_Amount payObject.AddAdjustmentRequestDetails = lstAdj; } else { payObject.AddAdjustment = "N"; } } } if (req.IsWriteoffAmount == 1) { if (payObject.AddAdjustment != "Y") { payObject.AddAdjustment = "Y"; } WebEnrollmentNewDesign.PayService.AddAdjustmentRequest adjbaddebit = new WebEnrollmentNewDesign.PayService.AddAdjustmentRequest(); adjbaddebit.AdjustmentAmount = Convert.ToString(req.Amount - TotfeeAmt); adjbaddebit.ReasonCode = System.Configuration.ConfigurationManager.AppSettings["BadDebtReversal_ReasonCode"].ToString(); adjbaddebit.Note = ""; lstAdj.Add(adjbaddebit); payObject.AddAdjustmentRequestDetails = lstAdj; } else { //IS Settled Amount decimal PaidAmount = (req.Amount - TotfeeAmt); if (req.IsSettledAmount == 1 && req.IsWriteoffAmount == 0 && req.ARBalanceAmount > PaidAmount && req.Addr_State.ToUpper() == "TX") { if (payObject.AddAdjustment != "Y") { payObject.AddAdjustment = "Y"; } WebEnrollmentNewDesign.PayService.AddAdjustmentRequest adjsettledamtreq = new WebEnrollmentNewDesign.PayService.AddAdjustmentRequest(); adjsettledamtreq.AdjustmentAmount = Convert.ToString(req.ARBalanceAmount - PaidAmount); adjsettledamtreq.ReasonCode = System.Configuration.ConfigurationManager.AppSettings["IsSettled_ReasonCode"].ToString(); adjsettledamtreq.Note = ""; lstAdj.Add(adjsettledamtreq); // payObject.AddAdjustmentRequestDetails = lstAdj; } } try { frontierPayResponse = objFrontierPay.PayByCard(payObject); } catch (Exception ex) { InsertClientErrorLog(req.CustomerNumber, batchCode, req.Source, ex, "Common_FrontierPayMakePayment"); } payResponse.ResultMessage = frontierPayResponse.ResponseMessage; payResponse.ResultCode = Convert.ToInt32(frontierPayResponse.StatusCode); payResponse.AuthCode = frontierPayResponse.ConfirmationNo; } else { payResponse.ResultCode = -1; payResponse.ResultMessage = "Invalid Request"; } return(payResponse); } catch (Exception ex) { payResponse.ResultCode = -3; payResponse.ResultMessage = ex.Message; InsertClientErrorLog(req.CustomerNumber, batchCode + "CardName: " + req.CardName + ";CardType" + req.CardType, req.Source, ex, "Common_FrontierPayMakePayment"); return(payResponse); } }
//BankDraft Payment public static PaymentResponse FrontierCheckPayment(CheckInfo request) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var payResponse = new PaymentResponse(); string batchCode = System.Configuration.ConfigurationManager.AppSettings["CheckPaymantBatchCode"]; try { FrontierPayClient objFrontierPay = new FrontierPayClient(); WebEnrollmentNewDesign.PayService.FrontierPayResponse frontierPayResponse = new WebEnrollmentNewDesign.PayService.FrontierPayResponse(); var payObject = new WebEnrollmentNewDesign.PayService.FrontierPayRequest() { AuthKey = request.AuthKey, CustomerNumber = request.CustomerNumber, BatchCode = batchCode, SetupAutoPay = "N", PostReceipt = "Y", ConfirmationType = request.ConfirmationType, AccountName = request.BankAccountName, BankAccountNumber = Encrypt(request.BankAccountNumber), AccountType = request.AccountType, BankRoutingNumber = request.BankRoutingNumber, Amount = Convert.ToString(request.Amount), Email = request.Email, PhoneNumber = request.ContactNumber, Source = request.Source, SiteIdentifier = request.SiteIdentifier }; List <WebEnrollmentNewDesign.PayService.AddAdjustmentRequest> lstAdj = new List <WebEnrollmentNewDesign.PayService.AddAdjustmentRequest>(); if (request.IsWriteoffAmount == 1) { if (payObject.AddAdjustment != "Y") { payObject.AddAdjustment = "Y"; } WebEnrollmentNewDesign.PayService.AddAdjustmentRequest adjbaddebit = new WebEnrollmentNewDesign.PayService.AddAdjustmentRequest(); adjbaddebit.AdjustmentAmount = Convert.ToString(request.Amount); adjbaddebit.ReasonCode = System.Configuration.ConfigurationManager.AppSettings["BadDebtReversal_ReasonCode"].ToString(); adjbaddebit.Note = ""; lstAdj.Add(adjbaddebit); // payObject.AddAdjustmentRequestDetails = lstAdj; } else { //IS Settled Amount if (request.IsSettledAmount == 1 && request.IsWriteoffAmount == 0 && request.ARBalanceAmount > request.Amount) { if (payObject.AddAdjustment != "Y") { payObject.AddAdjustment = "Y"; } WebEnrollmentNewDesign.PayService.AddAdjustmentRequest adjsettledamtreq = new WebEnrollmentNewDesign.PayService.AddAdjustmentRequest(); adjsettledamtreq.AdjustmentAmount = Convert.ToString(request.ARBalanceAmount - request.Amount); adjsettledamtreq.ReasonCode = System.Configuration.ConfigurationManager.AppSettings["IsSettled_ReasonCode"].ToString(); adjsettledamtreq.Note = ""; lstAdj.Add(adjsettledamtreq); // payObject.AddAdjustmentRequestDetails = lstAdj; } } try { frontierPayResponse = objFrontierPay.PayByCheck(payObject); } catch (Exception ex) { InsertClientErrorLog(request.CustomerNumber, batchCode, request.Source, ex, "Common_FrontierCheckPayment"); } payResponse.ResultMessage = frontierPayResponse.ResponseMessage; payResponse.ResultCode = Convert.ToInt32(frontierPayResponse.StatusCode); payResponse.AuthCode = frontierPayResponse.ConfirmationNo; return(payResponse); } catch (Exception ex) { payResponse.ResultCode = -3; payResponse.ResultMessage = ex.Message; InsertClientErrorLog(request.CustomerNumber, batchCode, request.Source, ex, "Common_FrontierCheckPayment"); return(payResponse); } }