Ejemplo n.º 1
0
        public static bool ValidateSession(string PaymentSessionID)
        {
            bool valid = false;
            FrontierPayClient objFrontierPay = new FrontierPayClient();

            objPayWSDBClient = new PayWSDBClient();
            valid            = objPayWSDBClient.ValidateRequestPayment(PaymentSessionID);
            return(valid);
        }
Ejemplo n.º 2
0
        //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);
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        //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);
        }
Ejemplo n.º 6
0
        //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);
        }
Ejemplo n.º 7
0
        //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);
            }
        }
Ejemplo n.º 8
0
        //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);
            }
        }
Ejemplo n.º 9
0
        //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);
            }
        }