public override string ProcessOnlineCheck(NewPaymentData paymentData, object operatorData) { int responseResult = 0; string param = string.Empty; var paymentResult = new PaymentResult(); try { var operatorRow = operatorData as DataRow; if (operatorRow == null) { throw new Exception("unable to extract paymentData"); } var operatorFormatString = operatorRow["OsmpFormatString"] is DBNull ? "" : operatorRow["OsmpFormatString"] as string; var formatedPaymentParams = paymentData.Params.FormatParameters(operatorFormatString); var parametersList = new StringList(formatedPaymentParams, ";"); var paymentType = (PaymentType)Enum.Parse(typeof(PaymentType), parametersList.Get("PymentType")); switch (paymentType) { case PaymentType.Prepaid: paymentResult = PrepaidValidationRequest(paymentData.CyberplatOperatorID, parametersList); if (paymentResult.Error == 0) { param = string.Format("DUEAMOUNT={0}\r\nLOWERAMOUNT=0\r\nUPPERAMOUNT=0", paymentResult.Params.Get("DueAmt")); } break; case PaymentType.Postpaid: paymentResult = BillInquiryRequest(paymentData.CyberplatOperatorID, parametersList); if (paymentResult.Error == 0) { param = string.Format("DUEAMOUNT={0}\r\nLOWERAMOUNT={1}\r\nUPPERAMOUNT={2}", paymentResult.Params.Get("DueAmt"), paymentResult.Params.Get("LOWERAMOUNT"), paymentResult.Params.Get("UPPERAMOUNT")); } break; } } catch (Exception ex) { Audit("ProcessOnlineCheck exception: " + ex.Message); responseResult = 30; } if (paymentResult.Error != 0) { responseResult = 30; } string responseString = "DATE=" + DateTime.Now.ToString("ddMMyyyy HHmmss") + "\r\n" + "SESSION=" + paymentData.Session + "\r\n" + "ERROR=" + responseResult + "\r\n" + "RESULT=" + ((responseResult == 0) ? "0" : "1") + "\r\n" + param + "\r\n"; return(responseString); }
public void ProcessOnlineCheck() { var data = new NewPaymentData { Params = "billingno=25\\nbillingcode=39" }; var row = _operatorTable.NewRow(); row["OsmpFormatString"] = "billingno=[#billingno];billingcode=[#billingcode];"; var gate = new Gateways.EfawateerGateway(); gate.Initialize(File.ReadAllText("initialize.xml")); var processOnlineCheck = gate.ProcessOnlineCheck(data, row); }
public void PostPayment() { var data = new NewPaymentData { Params = "billingno=25\\nbillingcode=39" }; var row = _operatorTable.NewRow(); row["OsmpFormatString"] = "billingno=[#billingno];billingcode=[#billingcode];"; var gate = new Gateways.EfawateerGateway(); gate.Initialize(File.ReadAllText("initialize.xml")); var processOnlineCheck = gate.ProcessOnlineCheck(data, row); var q = processOnlineCheck.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).First(s => s.StartsWith("DUE")).Replace("DUE=", string.Empty); var paymentTbl = _paymentTable.NewRow(); paymentTbl["TerminalID"] = 10; paymentTbl["StatusID"] = 1; paymentTbl["ErrorCode"] = 0; paymentTbl["Params"] = "billingno=25\\nbillingcode=39"; paymentTbl["Amount"] = Convert.ToDouble(q, CultureInfo.InvariantCulture); paymentTbl["AmountAll"] = Convert.ToDouble(q, CultureInfo.InvariantCulture); var operatorTbl = _operatorTable.NewRow(); operatorTbl["OsmpFormatString"] = "billingno=[#billingno];billingcode=[#billingcode];"; gate.ProcessPayment(paymentTbl, operatorTbl, null); }
/// <summary> /// Create View model /// </summary> /// <param name="customerID">Id of customer of new payment</param> public NewPaymentViewModel(NewPaymentData data) { Data = data; Customer = DAO.GetCustomerByID(data.CustomerId); TreatmentPlans = DAO.GetAllTreatmentPlansByID(data.CustomerId); }