public ActionResult FrontierPayCreateProfile(CheckPaymentRequest request)
        {
            var resp = new PaymentResponse();

            if (HttpContext.Session["PaymentSessionId"] != null)
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                request.AuthKey = System.Configuration.ConfigurationManager.AppSettings["MyAccountAuthKey"];
                try
                {
                    resp = Common.CreateProfile(request);
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
                catch (Exception exp)
                {
                    resp.profileStatusCode    = -3; //Exception
                    resp.profileStatusMessage = exp.Message;
                    Common.InsertClientErrorLog("", string.Empty, request.Source, exp, "PaymentUI - FrontierPayCreateProfile");
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                resp.ResultCode = -100;
                return(Json(resp, JsonRequestBehavior.AllowGet));
            }
        }
Example #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);
            }
        }
Example #3
0
        public async Task <PaymentStatusResponse> CheckPaymentAsync(CheckPaymentRequest request)
        {
            var integrationProperties = await _partnerIntegrationPropertiesFetcherService.FetchPropertiesAsync(request.PartnerId);

            if (integrationProperties.ErrorCode != IntegrationPropertiesErrorCode.None)
            {
                return new PaymentStatusResponse
                       {
                           ErrorCode = _mapper.Map <CheckIntegrationErrorCode>(integrationProperties.ErrorCode),
                       }
            }
            ;

            var client = new PayrexxIntegrationClient(
                integrationProperties.ApiBaseUrl,
                integrationProperties.InstanceName,
                integrationProperties.ApiKey);

            try
            {
                var paymentStatus = await client.Api.GetPaymentGatewayAsync(int.Parse(request.PaymentId));

                var result = new PaymentStatusResponse {
                    ErrorCode = CheckIntegrationErrorCode.None
                };
                if (paymentStatus.Status != "success")
                {
                    result.PaymentStatus = PaymentStatus.NotFound;
                    return(result);
                }

                switch (paymentStatus.Data[0].Status)
                {
                case "waiting":
                    result.PaymentStatus = PaymentStatus.Pending;
                    break;

                case "confirmed":
                    result.PaymentStatus = PaymentStatus.Success;
                    break;

                case "authorized":
                case "reserved":
                    result.PaymentStatus = PaymentStatus.Processing;
                    break;

                default:
                    throw new NotSupportedException($"Payment status {paymentStatus.Data[0].Status} is not supported");
                }
                return(result);
            }
            catch (Exception e)
            {
                _log.Warning(null, exception: e);
                return(new PaymentStatusResponse
                {
                    ErrorCode = CheckIntegrationErrorCode.Fail,
                });
            }
        }
    }