public ActionResult FrontierPayByProfile(ProfilePaymentRequest request)
        {
            var resp = new PaymentResponse();

            if (HttpContext.Session["PaymentSessionId"] != null)
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                request.AuthKey = System.Configuration.ConfigurationManager.AppSettings["MyAccountAuthKey"];
                try
                {
                    resp = Common.FrontierPayByProfile(request);
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
                catch (Exception exp)
                {
                    resp.profileStatusCode    = -3; //Exception
                    resp.profileStatusMessage = exp.Message;
                    Common.InsertClientErrorLog(request.Cust_no, string.Empty, request.Source, exp, "PaymentUI - FrontierPayByProfile");
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                resp.ResultCode = -100;
                return(Json(resp, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 2
0
        public static PaymentResponse FrontierPayDeletePaymentProfile(ProfilePaymentRequest request)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            var resp = new PaymentResponse();

            try
            {
                if (request.Cust_no != null && request.Cust_no != string.Empty)
                {
                    resp = DeletePaymentProfile(request);
                    resp.ResultMessage = resp.profileStatusMessage;
                    resp.ResultCode    = Convert.ToInt32(resp.profileStatusCode);
                }
                else
                {
                    resp.ResultCode    = -1;
                    resp.ResultMessage = "Invalid Request";
                }

                return(resp);
            }
            catch (Exception ex)
            {
                resp.ResultCode    = -3; //Exception
                resp.ResultMessage = ex.Message;
                InsertClientErrorLog(request.Cust_no, "", request.Source, ex, "Common_FrontierPayDeletePaymentProfile");
                return(resp);
            }
        }
        /// <summary>
        /// Pre-authorize a payment. Use this if you want to know if a customer has sufficient funds
        /// before processing a payment. A real-world example of this is pre-authorizing at the gas pump
        /// for $100 before you fill up, then end up only using $60 of gas; the customer is only charged
        /// $60. The final payment is used with PreAuthCompletion().
        ///
        /// The PreAuth is used with tokenized payments with a token generated from the Legato Javascript service.
        /// </summary>
        /// <returns>The response, in particular the payment ID that is needed to complete the purchase.</returns>
        /// <param name="paymentRequest">Payment request.</param>
        public PaymentResponse PreAuth(ProfilePaymentRequest paymentRequest)
        {
            Gateway.ThrowIfNullArgument(paymentRequest, "paymentRequest");

            paymentRequest.PaymentProfile.Complete = false;

            return(PreAuthInternal(paymentRequest));
        }
Esempio 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);
        }
Esempio n. 5
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);
        }