Пример #1
0
    internal string ReversePayment(int recordid, string naration)
    {
        string ret = "";

        InterLinkClass.Epayment.Transaction tr = new InterLinkClass.Epayment.Transaction();
        Responseobj resp = new Responseobj();

        datatable = dalpay.GetPaymentById(recordid);
        if (datatable.Rows.Count > 0)
        {
            string   oldreceiptno = datatable.Rows[0]["RecieptNo"].ToString();
            string   oldvendorref = datatable.Rows[0]["VendorRef"].ToString();
            string   custref      = datatable.Rows[0]["Custref"].ToString();
            string   Custname     = datatable.Rows[0]["Custname"].ToString();
            string   CustType     = datatable.Rows[0]["CustType"].ToString();
            string   Phone        = datatable.Rows[0]["CustPhone"].ToString();//CustPhone
            string   PaymentMode  = datatable.Rows[0]["PaymentMode"].ToString();
            string   PaymentType  = datatable.Rows[0]["PaymentType"].ToString();
            double   amount       = double.Parse(datatable.Rows[0]["amount"].ToString());
            double   Balance      = double.Parse(datatable.Rows[0]["Balance"].ToString());
            string   Postedby     = datatable.Rows[0]["PostedBy"].ToString();
            DateTime PayDate      = DateTime.Parse(datatable.Rows[0]["PaymentDate"].ToString());
            ////
            tr.TranIdToReverse = oldvendorref;
            tr.CustomerRef     = custref;
            tr.CustomerName    = Custname;
            tr.CustomerType    = CustType;
            tr.CustomerTel     = Phone;
            tr.TranType        = PaymentMode;
            tr.PaymentType     = PaymentType;
            double amt = 0 - amount;
            double bal = 0 - Balance;
            tr.TranAmount    = amt.ToString();
            tr.Reversal      = "1";
            tr.TranNarration = naration;
            tr.Teller        = Postedby;
            tr.PaymentDate   = PayDate.ToString("dd/MM/yyyy");
            resp             = PostPayment(tr, bal.ToString(), "", false, true);
            if (resp.Errorcode.Equals("0"))
            {
                string newvendorref = resp.VendorRef;
                string newreceiptno = resp.Receiptno;
                string user         = HttpContext.Current.Session["Username"].ToString();
                dalpay.SavePaymenReversal(oldvendorref, newvendorref, oldreceiptno, newreceiptno, user);
                ret = "POSTED";
            }
            else
            {
                ret = resp.Message;
            }
        }
        else
        {
            ret = "Failed to locate origin payment details";
        }
        return(ret);
    }
Пример #2
0
    public bool IsduplicateVendorRef(InterLinkClass.Epayment.Transaction trans)
    {
        bool      ret = false;
        DataTable dt  = dalpay.GetDuplicateVendorRef(trans);

        if (dt.Rows.Count > 0)
        {
            ret = true;
        }
        else
        {
            ret = false;
        }
        return(ret);
    }
Пример #3
0
    public Responseobj PostInternalPayment(InterLinkClass.Epayment.Transaction tr, bool sms)
    {
        Responseobj ret = new Responseobj();

        if (!IsduplicateVendorRef(tr))
        {
            string recieptNo = dalpay.PostUmemeTransaction(tr);
            if (!recieptNo.Equals(""))
            {
                string res_log = dalpay.LogInternaltran(recieptNo, tr.Teller);
                if (res_log.Equals("LOGGED"))
                {
                    // Now Reconcile the transaction
                    string res_reconcile = Reconcile_InternalTrans(recieptNo, tr.Teller);
                    ret.Errorcode = "0";
                    if (res_reconcile.Equals("RECONCILED"))
                    {
                        ret.Message = "Transaction Posted Successfully [" + recieptNo + "]";
                    }
                    else
                    {
                        ret.Message = "Transaction Posted Successfully [" + tr.VendorTranId + "] but Reconciled failed, Please reconciled it";
                    }
                    SendSms(tr, recieptNo, sms);
                }
            }
            else
            {
                ret.Errorcode = "100";
                ret.Message   = "Failure To Process Transaction Receipt number";
            }
        }
        else
        {
            ret.Errorcode = "20";
            ret.Message   = dalpay.GetStatusDescr(ret.Errorcode);
        }
        return(ret);
    }
Пример #4
0
 public void SendSms(InterLinkClass.Epayment.Transaction trans, string receiptNo, bool sms)
 {
     try
     {
         if (sms)
         {
             if (!trans.CustomerTel.Equals(""))
             {
                 double amt    = double.Parse(trans.TranAmount);
                 double amt1   = amt - (amt * 2);
                 string amount = amt.ToString("#,##0");
                 string msg    = "";
                 if (amt > 0)
                 {
                     msg = "Dear " + trans.CustomerName + ", payment of " + amount + " for a/c " + trans.CustomerRef + " received by UMEME. Payment Ref. is " + receiptNo;
                 }
                 else
                 {
                     if (trans.TranType.ToUpper().Contains("CHEQUE"))
                     {
                         msg = "Dear " + trans.CustomerName + ", cheque payment of " + amt1.ToString("#,##0") + " for a/c " + trans.CustomerRef + " has been reversed. Payment Ref. is " + receiptNo;
                     }
                     else
                     {
                         msg = "Dear " + trans.CustomerName + ", payment of " + amt1.ToString("#,##0") + " for a/c " + trans.CustomerRef + " has been reversed. Payment Ref. is " + receiptNo;
                     }
                 }
                 dalpay.InsertSmsToSend(trans.CustomerTel, trans.CustomerName, trans.CustomerRef, msg, "UMEME", "PEGPAY");
                 dalpay.UpdateLoggedSms(receiptNo);
             }
         }
     }
     catch (Exception ex)
     {
         ////
     }
 }
Пример #5
0
    public Responseobj PostPayment(InterLinkClass.Epayment.Transaction tr, string bal, string mreceiptno, bool cancelled, bool sms)
    {
        EPayment ep = new EPayment();

        InterLinkClass.Epayment.Response res = new InterLinkClass.Epayment.Response();
        Responseobj ret        = new Responseobj();
        string      Vendorcode = HttpContext.Current.Session["DistrictCode"].ToString();

        datatable = datafile.GetVendorDetails(Vendorcode);
        if (datatable.Rows.Count > 0)
        {
            string passwd       = datatable.Rows[0]["VendorPassword"].ToString();
            string dpassword    = DecryptString(passwd);
            double amount       = double.Parse(tr.TranAmount);
            double balance      = double.Parse(bal);
            int    user_Id      = int.Parse(HttpContext.Current.Session["UserID"].ToString());
            string regioncode   = HttpContext.Current.Session["AreaCode"].ToString();
            string districtcode = HttpContext.Current.Session["DistrictCode"].ToString();

            string VendorRef = dalpay.SavePayment(tr.CustomerRef, tr.CustomerName, tr.CustomerType, tr.CustomerTel, tr.PaymentType, tr.TranType, amount, balance,
                                                  regioncode, districtcode, tr.Reversal, tr.Teller, mreceiptno, cancelled);
            if (!VendorRef.Equals(""))
            {
                tr.VendorTranId = VendorRef;
                tr.VendorCode   = districtcode;
                tr.Password     = dpassword;
                if (!sms)
                {
                    tr.CustomerTel = "";
                }
                string dataToSign = tr.CustomerRef + tr.CustomerName + tr.CustomerTel + tr.CustomerType + tr.VendorTranId + tr.VendorCode + tr.Password + tr.PaymentDate + tr.PaymentType + tr.Teller + tr.TranAmount + tr.TranNarration + tr.TranType;
                tr.DigitalSignature = SignCertificate(dataToSign, districtcode);
                System.Net.ServicePointManager.ServerCertificateValidationCallback = RemoteCertValidation;
                res = ep.PostBankUmemePayment(tr);
                if (res.StatusCode.Equals("0"))
                {
                    ret.Errorcode = res.StatusCode;
                    ret.Message   = res.StatusDescription;
                    ret.Receiptno = res.ReceiptNumber;
                    ret.VendorRef = VendorRef;
                    dalpay.UpdatePayment(ret, mreceiptno, districtcode, amount, user_Id, cancelled);
                }
                else
                {
                    ret.Errorcode = res.StatusCode;
                    ret.Message   = res.StatusDescription;
                    ret.Receiptno = res.ReceiptNumber;
                    /// Now Dump this failed Payment
                    dalpay.DumpPayment(VendorRef, res.StatusDescription);
                }
            }
            else
            {
                ret.Errorcode = "111";
                ret.Message   = "Failed to Generate Payment Reference";
            }

            if (cancelled)
            {
                amount = 0 - amount;
                int tranamount = 0 - int.Parse(tr.TranAmount);
                tr.TranAmount      = tranamount.ToString();
                tr.TranIdToReverse = VendorRef;
                tr.Reversal        = "1";
                tr.TranNarration   = "Manual Receipt Cancelled";
                VendorRef          = dalpay.SavePayment(tr.CustomerRef, tr.CustomerName, tr.CustomerType, tr.CustomerTel, tr.PaymentType, tr.TranType, amount, balance,
                                                        regioncode, districtcode, tr.Reversal, tr.Teller, mreceiptno, cancelled);
                if (!VendorRef.Equals(""))
                {
                    tr.VendorTranId = VendorRef;
                    tr.VendorCode   = districtcode;
                    tr.Password     = dpassword;
                    if (!sms)
                    {
                        tr.CustomerTel = "";
                    }
                    string dataToSign = tr.CustomerRef + tr.CustomerName + tr.CustomerTel + tr.CustomerType + tr.VendorTranId + tr.VendorCode + tr.Password + tr.PaymentDate + tr.PaymentType + tr.Teller + tr.TranAmount + tr.TranNarration + tr.TranType;
                    tr.DigitalSignature = SignCertificate(dataToSign, districtcode);
                    System.Net.ServicePointManager.ServerCertificateValidationCallback = RemoteCertValidation;
                    res = ep.PostUmemePayment(tr);
                    if (res.StatusCode.Equals("0"))
                    {
                        ret.Errorcode = res.StatusCode;
                        ret.Message   = res.StatusDescription;
                        ret.Receiptno = res.ReceiptNumber;
                        ret.VendorRef = VendorRef;
                        dalpay.UpdatePayment(ret, mreceiptno, districtcode, amount, user_Id, cancelled);
                    }
                    else
                    {
                        ret.Errorcode = res.StatusCode;
                        ret.Message   = res.StatusDescription;
                        ret.Receiptno = res.ReceiptNumber;
                        /// Now Dump this failed Payment
                        dalpay.DumpPayment(VendorRef, res.StatusDescription);
                    }
                }
                else
                {
                    ret.Errorcode = "111";
                    ret.Message   = "Failed to Generate Payment Reference";
                }
            }
        }
        else
        {
            ret.Errorcode = "NIL";
            ret.Message   = "Your District have no access to transact on the interface, contact administrator";
        }
        ///

        return(ret);
    }