internal string PostTransaction(NWSCTransaction trans, string utilityCode)
        {
            string receiptNo = "";

            try
            {
                string    format     = "dd/MM/yyyy";
                DateTime  payDate    = DateTime.ParseExact(trans.PaymentDate, format, CultureInfo.InvariantCulture);
                string[]  parameters = { trans.CustRef, trans.CustName,   trans.CustomerType, trans.CustomerTel,                         trans.Area, "",                                       trans.TransactionAmount, "" + payDate, "" + DateTime.Now, trans.TransactionType, "", trans.VendorTransactionRef, trans.Narration,
                                         "" + false,     trans.VendorCode, trans.Teller,       "" + false /*bool.Parse(trans.Reversal)*/, "" + false, "" + false /*bool.Parse(trans.Offline)*/, utilityCode,             "",           "" + false };
                DataTable dt = pegpaydbase.ExecuteDataSet("InsertReceivedTransactions", parameters).Tables[0];

                if (dt.Rows.Count != 0)
                {
                    receiptNo = dt.Rows[0][0].ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(receiptNo);
        }
Пример #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);
            }
        }
Пример #3
0
        protected virtual bool CheckForEmptyProperties(NWSCTransaction trans)
        {
            if (string.IsNullOrEmpty(trans.CustomerType))
            {
                trans.CustomerType = "";
            }
            if (trans.CustomerTel == null)
            {
                trans.CustomerTel = "";
            }
            if (trans.Email == null)
            {
                trans.Email = "";
            }
            if (trans.CustName == null || trans.CustName.Trim().Equals(""))
            {
                resp.HandleResponse(trans, resp, "13", "");
                return(false);
            }

            else if (trans.Area == null || trans.Area.Trim().Equals(""))
            {
                resp.HandleResponse(trans, resp, "35", "");
                return(false);
            }

            else if (trans.TransactionType == null || trans.TransactionType.Trim().Equals(""))
            {
                resp.HandleResponse(trans, resp, "14", "");
                return(false);
            }

            else if (trans.VendorTransactionRef == null || trans.VendorTransactionRef.Trim().Equals(""))
            {
                resp.HandleResponse(trans, resp, "16", "");
                return(false);
            }

            else if (trans.Teller == null || trans.Teller.Trim().Equals(""))
            {
                resp.HandleResponse(trans, resp, "17", "");
                return(false);
            }

            else if (trans.DigitalSignature == null || trans.DigitalSignature.Length == 0)
            {
                resp.HandleResponse(trans, resp, "19", "");
                return(false);
            }
            else if (trans.Reversal == "1" && trans.TranIdToReverse == null)
            {
                resp.HandleResponse(trans, resp, "22", "");
                return(false);
            }
            else if (trans.Reversal == "1" && trans.TranIdToReverse.Equals(""))
            {
                resp.HandleResponse(trans, resp, "22", "");
                return(false);
            }
            else if ((trans.Reversal == "1" && trans.Narration == null) || (trans.Reversal == "1" && trans.Narration.Equals("")))
            {
                resp.HandleResponse(trans, resp, "23", "");
                return(false);
            }

            return(true);
        }