//Enabling ACH Autopay public static PaymentResponse ManageACHPaymentProfile(CheckInfo payment) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; PaymentResponse pmtResponse = new PaymentResponse(); string batchCode = System.Configuration.ConfigurationManager.AppSettings["ACHManageProfileBatchCode"]; try { FrontierPayClient objFrontierPay = new FrontierPayClient(); WebEnrollmentNewDesign.PayService.PaymentProfileResponse frontierPaymentProfileResponse = new WebEnrollmentNewDesign.PayService.PaymentProfileResponse(); if (payment.AccountType.ToUpper() == "C") // CHECKING { payment.AccountType = "CHECKING"; } else if (payment.AccountType.ToUpper() == "S") // SAVING { payment.AccountType = "SAVING"; } else if (payment.AccountType.ToUpper() == "X") // Corporate checking { payment.AccountType = "BUSINESS"; } else { payment.AccountType = "CHECKING"; } var payObject = new WebEnrollmentNewDesign.PayService.PaymentProfileRequest() { AuthKey = payment.AuthKey, BatchCode = batchCode, ConfirmationType = payment.ConfirmationType, CustomerNumber = payment.CustomerNumber, AccountName = payment.BankAccountName, BankAccountNumber = Encrypt(payment.BankAccountNumber), BankRoutingNumber = payment.BankRoutingNumber, AccountType = payment.AccountType, BankAccountEncrypted = "Y", ProfileType = "FROPAYDD", RequestType = "DIRECTDEBIT", RequestAction = "UPDATE", Email = payment.Email, PhoneNumber = payment.ContactNumber, Source = payment.Source, FirstName = payment.FirstName, LastName = payment.LastName }; try { frontierPaymentProfileResponse = objFrontierPay.ManagePaymentProfile(payObject); } catch (Exception ex) { InsertClientErrorLog(payment.CustomerNumber, batchCode, payment.Source, ex, "Common_ManageACHPaymentProfile"); } if (frontierPaymentProfileResponse.Message == null || string.IsNullOrEmpty(frontierPaymentProfileResponse.Message)) { frontierPaymentProfileResponse.Message = "An Error has occured. Please try again later."; } pmtResponse.profileStatusMessage = frontierPaymentProfileResponse.Message; pmtResponse.profileStatusCode = Convert.ToInt32(frontierPaymentProfileResponse.Status); pmtResponse.ResultMessage = frontierPaymentProfileResponse.Message; pmtResponse.ResultCode = Convert.ToInt32(frontierPaymentProfileResponse.Status); } catch (Exception ex) { pmtResponse.ResultCode = -3; //Exception pmtResponse.ResultMessage = ex.Message; InsertClientErrorLog(payment.CustomerNumber, batchCode, payment.Source, ex, "Common_ManageACHPaymentProfile"); return(pmtResponse); } return(pmtResponse); }
public static PaymentResponse DeletePaymentProfile(ProfilePaymentRequest request) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; PaymentResponse pmtResponse = new PaymentResponse(); string batchCode = string.Empty; try { FrontierPayClient objFrontierPay = new FrontierPayClient(); WebEnrollmentNewDesign.PayService.PaymentProfileResponse frontierPaymentProfileResponse = new WebEnrollmentNewDesign.PayService.PaymentProfileResponse(); //default to delete card profile settings batchCode = "WFCARDDELETEPROFILE"; string profileType = "FROPAYCC"; string requestType = "CREDITCARD"; if ((!string.IsNullOrEmpty(request.Type)) && request.Type.ToUpper() == "ACH")// for delete ACH profile { batchCode = "WFACHDELETEPROFILE"; profileType = "FROPAYDD"; requestType = "DIRECTDEBIT"; } var payObject = new WebEnrollmentNewDesign.PayService.PaymentProfileRequest() { AuthKey = request.AuthKey, BatchCode = batchCode, ConfirmationType = request.ConfirmationType, CustomerNumber = request.Cust_no, ProfileType = profileType, RequestType = requestType, RequestAction = "DELETE", Email = request.Email, PhoneNumber = request.ContactNumber, Source = request.Source, FirstName = request.FirstName, LastName = request.LastName }; try { frontierPaymentProfileResponse = objFrontierPay.ManagePaymentProfile(payObject); } catch (Exception ex) { InsertClientErrorLog(request.Cust_no, batchCode, request.Source, ex, "Common_DeletePaymentProfile"); } if (frontierPaymentProfileResponse.Message == null || string.IsNullOrEmpty(frontierPaymentProfileResponse.Message)) { frontierPaymentProfileResponse.Message = "An Error has occured. Please try again later."; } pmtResponse.profileStatusMessage = frontierPaymentProfileResponse.Message; pmtResponse.profileStatusCode = Convert.ToInt32(frontierPaymentProfileResponse.Status); } catch (Exception ex) { pmtResponse.ResultCode = -3; //Exception pmtResponse.ResultMessage = ex.Message; InsertClientErrorLog(request.Cust_no, batchCode, request.Source, ex, "Common_DeletePaymentProfile"); return(pmtResponse); } return(pmtResponse); }
//Create Profile if autopay selected CreditCard public static PaymentResponse ManagePaymentProfile(CreditCardPaymentRequest payment) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var payResponse = new PaymentResponse(); string batchCode = System.Configuration.ConfigurationManager.AppSettings["CardManageProfileBatchCode"]; try { FrontierPayClient objFrontierPay = new FrontierPayClient(); WebEnrollmentNewDesign.PayService.PaymentProfileResponse frontierPaymentProfileResponse = new WebEnrollmentNewDesign.PayService.PaymentProfileResponse(); if (payment.CardNumber.Trim().StartsWith("4")) // Visa { payment.CardType = "VISA"; } else if (payment.CardNumber.Trim().StartsWith("5") || payment.CardNumber.Trim().StartsWith("2")) // Master Card { payment.CardType = "MASTERCARD"; } else if (payment.CardNumber.Trim().StartsWith("3")) //American Express { payment.CardType = "AMEX"; } else if (payment.CardNumber.Trim().StartsWith("6")) //Discover { payment.CardType = "DISCOVER"; } else { payment.CardType = "NA"; } var payObject = new WebEnrollmentNewDesign.PayService.PaymentProfileRequest() { AuthKey = payment.AuthKey, BatchCode = batchCode, ConfirmationType = payment.ConfirmationType, CustomerNumber = payment.CustomerNumber, CardType = payment.CardType, CardName = payment.CardName, CardNumber = Encrypt(payment.CardNumber), ExpirationMonth = payment.Expiry.Substring(0, 2), ExpirationYear = payment.Expiry.Substring(3, 2), CVCCode = Encrypt(payment.VerificationCode), CardZip = payment.ZipCode, CardEncrypted = "Y", RequestType = "CREDITCARD", RequestAction = "UPDATE", Email = payment.Email, PhoneNumber = payment.ContactNumber, Source = payment.Source, FirstName = payment.FirstName, LastName = payment.LastName }; try { frontierPaymentProfileResponse = objFrontierPay.ManagePaymentProfile(payObject); } catch (Exception ex) { InsertClientErrorLog(payment.CustomerNumber, batchCode, payment.Source, ex, "Common_ManagePaymentProfile"); } if (frontierPaymentProfileResponse.Message == null || string.IsNullOrEmpty(frontierPaymentProfileResponse.Message)) { frontierPaymentProfileResponse.Message = "An Error has occured. Please try again later."; } payResponse.ResultMessage = frontierPaymentProfileResponse.Message; payResponse.ResultCode = Convert.ToInt32(frontierPaymentProfileResponse.Status); payResponse.profileStatusMessage = frontierPaymentProfileResponse.Message; payResponse.profileStatusCode = Convert.ToInt32(frontierPaymentProfileResponse.Status); return(payResponse); } catch (Exception ex) { payResponse.ResultCode = -3; payResponse.ResultMessage = ex.Message; InsertClientErrorLog(payment.CustomerNumber, batchCode, payment.Source, ex, "Common_ManagePaymentProfile"); return(payResponse); } }