Esempio n. 1
0
        public Payment Create(Payment payment)
        {
            EPayment ePayment = EPayment(payment);

            ePayment = _iDPayment.Create(ePayment);
            return(Payment(ePayment));
        }
Esempio n. 2
0
        private Payment Payment(EPayment ePayment)
        {
            Payment returnPayment = new Payment
            {
                PaymentId      = ePayment.PaymentId,
                AmountReceived = ePayment.AmountReceived,
                Payments       = ePayment.Payments,
                Discount       = ePayment.Discount,
                Balance        = ePayment.Balance,
                ClientId       = ePayment.ClientId,
                Name           = ePayment.Name
            };

            return(returnPayment);
        }
Esempio n. 3
0
        private EPayment EPayment(Payment payment)
        {
            EPayment returnEPayment = new EPayment
            {
                PaymentId      = payment.PaymentId,
                DateOfPayment  = payment.DateOfPayment,
                AmountReceived = payment.AmountReceived,
                Payments       = payment.Payments,
                Discount       = payment.Discount,
                Balance        = payment.Balance,
                ClientId       = payment.ClientId,
                Name           = payment.Name
            };

            return(returnEPayment);
        }
Esempio n. 4
0
    public InterLinkClass.Epayment.Customer InquireCust(string custRef)
    {
        EPayment ep = new EPayment();

        InterLinkClass.Epayment.Customer cust = new InterLinkClass.Epayment.Customer();
        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);
            System.Net.ServicePointManager.ServerCertificateValidationCallback = RemoteCertValidation;
            cust = ep.ValidateCustomer(custRef, Vendorcode, dpassword);
        }
        else
        {
            cust.StatusCode        = "NIL";
            cust.StatusDescription = "Your District have no access to transact on the interface, contact administrator";
        }
        return(cust);
    }
Esempio n. 5
0
        /// <summary>
        /// 企业付款
        /// </summary>
        /// <param name="payment"></param>
        /// <param name="key"></param>
        /// <param name="certpath"></param>
        /// <param name="certpwd"></param>
        /// <returns></returns>
        public static EPaymentRes EPayment(EPayment payment, string key, string certpath, string certpwd)
        {
            var url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers";

            return(PayRequest <EPaymentRes>(payment, key, url, certpath, certpwd));
        }
Esempio n. 6
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);
    }
Esempio n. 7
0
        public Payment Read(int paymentId)
        {
            EPayment ePayment = _iDPayment.Read <EPayment>(a => a.PaymentId == paymentId);

            return(Payment(ePayment));
        }