/// <summary> /// return Payment response /// </summary> /// <returns></returns> private PaymentResponse GetPaymentResponse(PaymentRequest objPaymentRequest) { var objPaymentResonse = new PaymentResponse(); try { if (objPaymentRequest == null) { objPaymentResonse.StatusCode = (int)HttpStatusCode.BadRequest; objPaymentResonse.StatusDesc = "Invalid request format"; objPaymentResonse.MessageId = ""; } else { var objFactoryClass = new FactoryClass(); var objPaymenType = objFactoryClass.GetPaymentType(objPaymentRequest); if (objPaymenType != null) { string response; if (objPaymenType.ProcessPayment(objPaymentRequest, out response)) { objPaymentResonse.StatusCode = (int)HttpStatusCode.OK; objPaymentResonse.StatusDesc = response; objPaymentResonse.MessageId = objPaymentRequest.PaymentId.ToString(); } else { objPaymentResonse.StatusCode = (int)HttpStatusCode.NotAcceptable; objPaymentResonse.StatusDesc = response; objPaymentResonse.MessageId = objPaymentRequest.PaymentId.ToString(); } } else { objPaymentResonse.StatusCode = (int)HttpStatusCode.NotAcceptable; objPaymentResonse.StatusDesc = "Invalid payment type"; objPaymentResonse.MessageId = ""; } } } catch (Exception ex) { objPaymentResonse.StatusCode = (int)HttpStatusCode.InternalServerError; objPaymentResonse.StatusDesc = ex.Message; objPaymentResonse.MessageId = ""; } return(objPaymentResonse); }