public void HandleResponse(ITransaction trans, PostResponse resp, string status, string statusDescription)
 {
     if (status == "0")
     {
         resp.PegPayPostId      = dp.PostTransaction((NWSCTransaction)trans, "NWSC");
         resp.StatusCode        = "0";
         resp.StatusDescription = dp.GetStatusDescr(resp.StatusCode);
     }
     else
     {
         resp.PegPayPostId      = "";
         resp.StatusCode        = status;
         resp.StatusDescription = string.IsNullOrEmpty(statusDescription) ? dp.GetStatusDescr(resp.StatusCode) : statusDescription;
     }
 }
示例#2
0
        public PostResponse validate(NWSCTransaction trans, PostResponse resp, DataTable vendaData)
        {
            PhoneValidator  pv = new PhoneValidator();
            DatabaseHandler dp = new DatabaseHandler();

            resp = null;
            UtilityCredentials creds      = dp.GetUtilityCreds("NWSC", trans.VendorCode);
            string             vendorType = vendaData.Rows[0]["VendorType"].ToString();

            if (!IsValidReversalStatus(trans))
            {
                resp.HandleResponse(trans, resp, "25", "");
                return(resp);
            }

            else if (!IsNumeric(trans.TransactionAmount))
            {
                resp.HandleResponse(trans, resp, "3", "");
                return(resp);
            }
            else if (!IsValidDate(trans.PaymentDate))
            {
                resp.HandleResponse(trans, resp, "4", "");
                return(resp);
            }

            else if (!isValidVendorCredentials(trans.VendorCode, trans.Password, vendaData))
            {
                resp.HandleResponse(trans, resp, "2", "");
                return(resp);
            }
            else if (!isActiveVendor(trans.VendorCode, vendaData))
            {
                resp.HandleResponse(trans, resp, "11", "");
                return(resp);
            }
            else if (!isSignatureValid(trans))
            {
                resp.HandleResponse(trans, resp, "18", "");
                return(resp);
            }
            else if (!pv.PhoneNumbersOk(trans.CustomerTel))
            {
                resp.HandleResponse(trans, resp, "12", "");
                return(resp);
            }
            else if (IsduplicateVendorRef(trans))
            {
                resp.HandleResponse(trans, resp, "20", "");
                return(resp);
            }
            else if (IsduplicateCustPayment(trans))
            {
                resp.HandleResponse(trans, resp, "21", "");
                return(resp);
            }

            else if (!HasOriginalEntry(trans))
            {
                resp.HandleResponse(trans, resp, "24", "");
                return(resp);
            }
            else if (!dp.ReverseAmountsMatch(trans))
            {
                resp.HandleResponse(trans, resp, "26", "");
                return(resp);
            }
            else if (dp.IsChequeBlacklisted(trans))
            {
                resp.HandleResponse(trans, resp, "29", "");
                return(resp);
            }

            else if ((vendorType.Equals("PREPAID")))
            {
                resp.HandleResponse(trans, resp, "29", "NOT ENABLED FOR PREPAID VENDORS");
                return(resp);
            }

            else if (creds.UtilityCode.Equals(""))
            {
                resp.HandleResponse(trans, resp, "29", "");
                return(resp);
            }

            else
            {
                return(resp);
            }
        }