private string AccuserReception()
        {
            string sResult 		 = "";
            
            string montant           = "";
            string reference         = "";
            string MAC               = "";
            string TexteLibre        = "";
            string CodeRetour        = "";
            string dateConfirmation  = "";
            string Cvx		 = "";
            string Vld		 = "";
            string Brand		 = "";
            string Status3DS	 = "";
            string NumAuto 		 = "";
            string MotifRefus	 = "";
            string OrigineCB	 = "";
            string BinCB		 = "";
            string HPanCB		 = "";
            string IPClient		 = "";
            string OrigineTr	 = "";
            string VeRes		 = "";
            string PaRes		 = "";
            string MontantEch	 = "";

            try
            {                
                if (Request.ServerVariables["REQUEST_METHOD"] == "GET")
                {
                    montant += Request.QueryString["montant"];
                    reference += Request.QueryString["reference"];
                    MAC += Request.QueryString["MAC"];
                    TexteLibre += Request.QueryString["texte-libre"];
                    CodeRetour += Request.QueryString["code-retour"];
                    dateConfirmation += Request.QueryString["date"];
                    Cvx += Request.QueryString["cvx"];
                    Vld += Request.QueryString["vld"];
                    Brand += Request.QueryString["brand"];
                    Status3DS += Request.QueryString["status3ds"];
                    NumAuto += Request.QueryString["numauto"];
                    MotifRefus += Request.QueryString["motifrefus"];
                    OrigineCB += Request.QueryString["originecb"];
                    BinCB += Request.QueryString["bincb"];
                    HPanCB += Request.QueryString["hpancb"];
                    IPClient += Request.QueryString["ipclient"];
                    OrigineTr += Request.QueryString["originetr"];
                    VeRes += Request.QueryString["veres"];
                    PaRes += Request.QueryString["pares"];
                    MontantEch += Request.QueryString["montantech"];
                }
                else
                {
                    if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
                    {
                        montant += Request.Form["montant"];
                        reference += Request.Form["reference"];
                        MAC += Request.Form["MAC"];
                        TexteLibre += Request.Form["texte-libre"];
                        CodeRetour += Request.Form["code-retour"];
                        dateConfirmation += Request.Form["date"];
                        Cvx += Request.Form["cvx"];
                        Vld += Request.Form["vld"];
                        Brand += Request.Form["brand"];
                        Status3DS += Request.Form["status3ds"];
                        NumAuto += Request.Form["numauto"];
                        MotifRefus += Request.Form["motifrefus"];
                        OrigineCB += Request.Form["originecb"];
                        BinCB += Request.Form["bincb"];
                        HPanCB += Request.Form["hpancb"];
                        IPClient += Request.Form["ipclient"];
                        OrigineTr += Request.Form["originetr"];
                        VeRes += Request.Form["veres"];
                        PaRes += Request.Form["pares"];
                        MontantEch += Request.Form["montantech"];
                    }
                }

                bool bProdServer = (ConfigurationManager.ServerType == ConfigurationManager.EnumServerType.PROD.ToString()) ? true : false;

                Upsilab.Data.Model.Payment.CMCIC_Page CMICIC_Page = new Data.Model.Payment.CMCIC_Page("FR", bProdServer);

                CMICIC_Page.sDataToValidate = CMICIC_Page.sNumero + "*" + dateConfirmation + "*" + montant + "*" + reference + "*" + TexteLibre + "*" + CMICIC_Page.sVersion + "*";
                CMICIC_Page.sDataToValidate += CodeRetour + "*" + Cvx + "*" + Vld + "*" + Brand + "*" + Status3DS + "*" + NumAuto + "*" + MotifRefus + "*";
                CMICIC_Page.sDataToValidate += OrigineCB + "*" + BinCB + "*" + HPanCB + "*" + IPClient + "*" + OrigineTr + "*" + VeRes + "*" + PaRes + "*";


                //Just for test********************
                //TODO : Comment this code
                //CodeRetour = "payetest"; //Annulation
                //reference = "65"; //idsouscription
                //MotifRefus = "";

                //if (true) //Is valid hmac
                //Fin test*************************

                if (CMICIC_Page.oHmac.isValidHmac(CMICIC_Page.HmacString, MAC))
                {
                    switch (CodeRetour)
                    {
                        case "Annulation":
                            /* 
                            * Payment has been refused
                            * put your code here (email sending / Database update)
                            * Attention : an authorization may still be delivered later
                            */
                            break;

                        case "payetest":
                            /*
                            * Payment has been accepted on the test server
                            * put your code here (email sending / Database update)
                            */
                            this.UpdateDBAndSendMail(int.Parse(reference));
                            break;

                        case "paiement":
                            /*
                            * Payment has been accepted on the productive server
                            * put your code here (email sending / Database update)
                            */
                            this.UpdateDBAndSendMail(int.Parse(reference));

                            break;

                        /*** ONLY FOR MULTIPART PAYMENT ***/
                        case "paiement_pf2":
                        case "paiement_pf3":
                        case "paiement_pf4":
                            /*
                            * Payment has been accepted on the productive server for the part #N
                            * return code is like paiement_pf[#N]
                            * put your code here (email sending / Database update)
                            * You have the amount of the payment part in MontantEch
                            */
                            break;

                        case "Annulation_pf2":
                        case "Annulation_pf3":
                        case "Annulation_pf4":
                            /*
                            * Payment has been refused on the productive server for the part #N
                            * return code is like Annulation_pf[#N]
                            * put your code here (email sending / Database update)
                            * You have the amount of the payment part in MontantEch
                            */
                            break;
                    }

                    //Result to return to the API
                    sResult = "0"; //Ok
                }
                else
                {
                    /*
                    * your code if the HMAC doesn't match
                    */                    
                    MotifRefus = (!string.IsNullOrEmpty(MotifRefus)) ? MotifRefus : string.Format("HMAC {0} does not match", CMICIC_Page.HmacString);
                    sResult = "1\n" + CMICIC_Page.HmacString;
                }
            }
            catch (Exception ex)
            {
                CodeRetour += "UPSIRECUEIL_EXCEPTION";
                MotifRefus += ex.Message;
                sResult = "1";
            }

            //Log payment
            PaymentLog paymentLog = new PaymentLog()
            {
                idSubscription = (!string.IsNullOrEmpty(reference)) ? int.Parse(reference) : 1, // default 1
                ReturnCode = (!string.IsNullOrEmpty(CodeRetour)) ? CodeRetour : "UPSIRECUEIL_EXCEPTION",
                ReasonRefusal = MotifRefus,
                DatePayment = DateTime.Now
            };

            Upsilab.Business.Log.PaymentLogBL.Save(paymentLog);

            return sResult;
        }
Example #2
0
        public async Task <IActionResult> LogPayment([FromBody] DutyPaymentRequest model)
        {
            //if (!ModelState.IsValid)
            //    return BadRequest(new { status = HttpStatusCode.BadRequest, Message = "One or more validation failed" });
            try
            {
                var newPaymentLog = new PaymentLog
                {
                    CustomerAccount     = model.CustomerAccount,
                    Amount              = model.DutyTotalAmount,
                    StatusId            = (int)TransactionStatus.Initiated,
                    PaymentReference    = RandomPassword(),
                    AssessmentId        = model.AssessmentId,
                    DateCreated         = DateTime.Now,
                    TransactionStatusId = (int)TransactionStatus.Pending
                };

                _context.Payment.Add(newPaymentLog);
                int added = await _context.SaveChangesAsync();

                if (added == 1)
                {
                    return(Ok(new { HttpStatusCode.OK, Message = "Request completed", Data = new { PaymentReference = newPaymentLog.PaymentReference, PaymentId = newPaymentLog.Id } }));
                }

                return(BadRequest(new { HttpStatusCode.BadRequest, Message = "Request Unsuccessful" }));
            }

            catch (Exception ex)
            {
                return(BadRequest(new { HttpStatusCode.InternalServerError, Message = "An error occured", Data = ex }));
            }
        }
Example #3
0
        private dynamic HandlePaymentPostback(dynamic arg)
        {
            JObject postback = JObject.FromObject(this.Request.Form.ToDictionary());

            var soId = postback.Value <string>("order_no");
            var code = postback.Value <string>("res_cd");

            var log = PaymentLog.FromContext(this.Context);

            log.PaymentSource = PaymentMethod.TreePay;
            log.Amount        = postback.Value <decimal>("trade_mony");
            if (soId.Length == 20)
            {
                log.SaleOrderIdentifier = soId.Substring(0, 17);
            }
            else
            {
                log.SaleOrderIdentifier = soId;
            }
            log.IsErrorCode      = code != "0000";
            log.ResponseCode     = code;
            log.IsPaymentSuccess = false;

            var paymentDateString = log.FormResponse.Value <int>("trade_ymd").ToString();
            var paymentTimeString = log.FormResponse.Value <int>("trade_hms").ToString();

            if (paymentTimeString.Length < 6)
            {
                paymentTimeString = "0" + paymentTimeString;
            }

            DateTime paymentDate = DateTime.Now;

            if (!log.IsErrorCode)
            {
                if (DateTime.TryParseExact(paymentDateString + paymentTimeString,
                                           "yyyyMMddHHmmss", CultureInfo.InvariantCulture,
                                           DateTimeStyles.AssumeLocal, out paymentDate) == false)
                {
                    paymentDate = DateTime.Now;
                }
            }

            // find existing payment of same sale order
            var existing = this.SiteDatabase.Query <PaymentLog>().Where(l => l.SaleOrderIdentifier == log.SaleOrderIdentifier).ToList();

            // check for same auth_no, if it is already exists
            // return
            foreach (var item in existing)
            {
                if (log.FormResponse.auth_no == item.FormResponse.auth_no)
                {
                    return(this.Response.AsRedirect("/support/" + log.SaleOrderIdentifier));
                }
            }

            CommerceModule.HandlePayment(this.SiteDatabase, log, paymentDate);

            return(this.Response.AsRedirect("/support/" + log.SaleOrderIdentifier + "?paymentsuccess"));
        }
Example #4
0
        public async Task <IActionResult> FindByPaymentre(string PaymentReference)
        {
            try
            {
                PaymentLog getPaymentLog = _context.Payment.Where(x => x.PaymentReference.Equals(PaymentReference)).FirstOrDefault();

                if (getPaymentLog == null)
                {
                    return(BadRequest(new { status = HttpStatusCode.BadRequest, Message = "Request Unsuccessful", data = new { message = "Wrong Payment reference" } }));
                }


                Guid.TryParse(getPaymentLog.AssessmentId, out Guid assId);

                List <Tax> FindTaxes = await _context.Tax.Where(x => x.AssessmentId.Equals(assId)).ToListAsync();

                if (FindTaxes.Any())
                {
                    return(Ok(new { status = HttpStatusCode.OK, Message = "Request Successful", data = FindTaxes }));
                }
                return(NotFound(new { status = HttpStatusCode.NotFound, Message = "Request completed", data = new { message = "No tax(es) found for the payment reference" } }));
            }
            catch (Exception ex)
            {
                return(BadRequest(new { status = HttpStatusCode.InternalServerError, Message = "An error occured", data = ex }));
            }
        }
Example #5
0
 // 恢复创建谜题时候的支付日志
 // 一开始钱包创建谜题没有创建支付日志
 private ActionResult RecoverQuestionInsertLog()
 {
     using (var db = new PortalDb())
     {
         var ufqs = db.Questions.Where(n => !n.IsFinished);
         foreach (var item in ufqs)
         {
             //创建日志
             var mywallert = _paymentService.GetByUserId(item.UserId);
             //这个时候并未支付给系统账户,只是钱锁住了,充值的时候就是支付系统账户
             var paylog = new PaymentLog()
             {
                 Amount       = item.Reward,
                 Remarks      = item.Title,
                 OrderType    = OrderType.Reward,
                 FromWalletId = mywallert.Id,
                 PayType      = PayType.Wallet,
             };
             paylog.CreateTime = item.CreateTime;
             paylog.ModifyTime = item.ModifyTime;
             db.PaymentLogs.Add(paylog);
         }
         db.SaveChanges();
     }
     return(Content("recover ok"));
 }
    private void PaymentLogUpdateOrderStateChange(OrderStateChangeNotification notification)
    {
        string paymentResponse = "order-state-change-notification :: ";

        paymentResponse += "NewFinancialOrderState :" + notification.newfinancialorderstate.ToString() + ",";
        paymentResponse += "NewFulFillmentOrderState :" + notification.newfulfillmentorderstate.ToString() + ",";
        paymentResponse += "PreviousFinancialOrderState :" +
                           notification.previousfinancialorderstate.ToString() + ",";
        paymentResponse += "PreviousFulFillmentOrderState :" +
                           notification.previousfulfillmentorderstate.ToString() + ",";
        paymentResponse += "Reason :" + notification.reason + ",";
        paymentResponse += "SerialNumber :" + notification.serialnumber + ",";
        paymentResponse += "TimeStamp :" + notification.timestamp.ToString();
        Log.Debug("-*************** Check PaymentLog **************-");
        Log.Debug("notification.googleordernumber = " + notification.googleordernumber);
        Log.Debug("paymentResponse = " + paymentResponse);
        Log.Debug("GetPaymentName = " + GetPaymentName());

        string orderID = DataAccessContext.OrderRepository.GetOrderIDByGatewayID(notification.googleordernumber);

        PaymentLog paymentLog = new PaymentLog();

        paymentLog.OrderID         = orderID;
        paymentLog.PaymentResponse = paymentResponse;
        paymentLog.PaymentGateway  = GetPaymentName();
        paymentLog.PaymentType     = String.Empty;
        DataAccessContext.PaymentLogRepository.Save(paymentLog);
        Log.Debug("-************* End Check PaymentLog ************-");
    }
        protected void GdvPaymentLogList_RowCommand(object sender, CommandEventArgs e)
        {
            if (string.IsNullOrEmpty(e.CommandArgument.ToString()))
            {
                AdminPage.WriteErrMsg("<li>请指定支付单ID!</li>", "PaymentLogManage.aspx");
            }
            else
            {
                string str;
                if (((str = e.CommandName) != null) && (str == "Status"))
                {
                    int paymentLogId = Convert.ToInt32(e.CommandArgument, null);
                    switch (PaymentLog.Update(paymentLogId))
                    {
                    case 0:
                        AdminPage.WriteErrMsg("<li>找不到指定的支付单!</li>", "PaymentLogManage.aspx");
                        return;

                    case 1:
                        AdminPage.WriteSuccessMsg("<li>此支付单已经提交给银行!</li>", "PaymentLogManage.aspx");
                        return;

                    case 2:
                        this.AddBankroll(paymentLogId);
                        AdminPage.WriteSuccessMsg("<li>在线支付成功!</li>", "PaymentLogManage.aspx");
                        return;
                    }
                }
            }
        }
    private void PaymentLogUpdateNewOrderNotification(NewOrderNotification notification)
    {
        string paymentResponse = "new-order-notification :: ";

        paymentResponse += String.Format("Buyerbillingaddress: {0},", notification.buyerbillingaddress);
        paymentResponse += String.Format("BuyerID: {0},", notification.buyerid);
        paymentResponse += String.Format("Buyermarketingpreferences: {0},",
                                         notification.buyermarketingpreferences);
        paymentResponse += String.Format("Buyershippingaddress: {0},", notification.buyershippingaddress);
        paymentResponse += String.Format("Financialorderstate: {0},", notification.financialorderstate);
        paymentResponse += String.Format("Fulfillmentorderstate: {0},", notification.fulfillmentorderstate);
        paymentResponse += String.Format("Orderadjustment: {0},", notification.orderadjustment);
        paymentResponse += String.Format("Ordertotal: {0},", notification.ordertotal);
        paymentResponse += String.Format("Serialnumber: {0},", notification.serialnumber);
        paymentResponse += String.Format("ShoppingCart: {0},", notification.shoppingcart);
        paymentResponse += String.Format("Timestamp: {0},", notification.timestamp);
        Log.Debug("Start Save Payment Log");

        PaymentLog paymentLog = new PaymentLog();

        paymentLog.OrderID         = notification.googleordernumber;
        paymentLog.PaymentResponse = paymentResponse;
        paymentLog.PaymentGateway  = GetPaymentName();
        paymentLog.PaymentType     = String.Empty;
        DataAccessContext.PaymentLogRepository.Save(paymentLog);
        Log.Debug("End Save Payment Log");
    }
        private dynamic HandlePayRequest(dynamic arg)
        {
            if (!this.CurrentUser.HasClaim("admin"))
            {
                return(403);
            }

            var param = ((JObject)arg.body.Value);

            DateTime paidWhen     = param.Value <DateTime>("paidWhen").ToLocalTime();
            string   soIdentifier = param.Value <string>("saleOrderIdentifier");
            string   apCode       = param.Value <string>("apCode");
            var      form         = new JObject();

            form.Add("apCode", apCode);

            var paymentLog = new PaymentLog()
            {
                PaymentSource       = param.Value <string>("paymentMethod"),
                Amount              = param.Value <decimal>("amount"),
                IsErrorCode         = false,
                ResponseCode        = "00",
                IsPaymentSuccess    = true,
                SaleOrderIdentifier = soIdentifier,
                PaymentDate         = paidWhen,
                FormResponse        = form
            };

            CommerceModule.HandlePayment(this.SiteDatabase, paymentLog, paidWhen);

            return(paymentLog);
        }
    private void SaveDataKPayment()
    {
        string result = "IsApproved:" + IsApproved.ToString() + ", ";

        result += String.Format("RespCode:{0}, ", RespCode);
        result += String.Format("AuthCode:{0}, ", AuthCode);
        result += String.Format("UAID:{0}, ", UAID);
        result += String.Format("CardType:{0}", CardType);

        PaymentLog paymentLog = new PaymentLog();

        paymentLog.OrderID         = BankInvoiceID;
        paymentLog.PaymentResponse = result;
        paymentLog.PaymentGateway  = GetPaymentName();
        paymentLog.PaymentType     = String.Empty;
        DataAccessContext.PaymentLogRepository.Save(paymentLog);
        //PaymentLogAccess.Create( BankInvoiceID, result, GetPaymentName(), "" );

        OrderNotifyService order = new OrderNotifyService(BankInvoiceID);

        if (IsApproved)
        {
            order.SendOrderEmail();
            order.ProcessPaymentComplete();

            Response.Redirect(String.Format("~/CheckoutComplete.aspx?OrderID={0}&IsTransaction=True", BankInvoiceID));
        }
        else
        {
            order.ProcessPaymentFailed();

            Response.Redirect(String.Format("~/CheckoutNotComplete.aspx?OrderID={0}", BankInvoiceID));
        }
    }
 private Question _insertModel(Question model)
 {
     try
     {
         var user = CurrentUser;
         //处理答案
         questionDbService.InsertQuestion(user, model);
         _cacheManager.Remove(getKey());
         messageDbService.SendToAttentioned(user.Id, string.Format("你的好友{0}发布了谜题", user.Username), model.Guid);
         //创建日志
         var mywallert = _payMeentDbService.GetByUserId(user.Id);
         //这个时候并未支付给系统账户,只是钱锁住了,充值的时候就是支付系统账户
         var paylog = new PaymentLog()
         {
             Amount       = model.Reward,
             Remarks      = model.Title,
             OrderType    = OrderType.Reward,
             FromWalletId = mywallert.Id,
             PayType      = PayType.Wallet,
         };
         messageDbService.InsertPaymentLog(paylog);
         return(questionDbService.GetByGuid(model.Guid));
     }
     catch (Exception e)
     {
         Logger.Error(string.Format("用户创建谜题错误{0}", e.Message));
         return(null);
     }
 }
        private TokenRequestModel PaymentLogToTokenRequestModel(PaymentLog model, User user, Merchant merchant)
        {
            TokenRequestModel trModel = new TokenRequestModel()
            {
                msgId                         = 7,
                deviceID                      = user.PhoneDeviceToken,
                tid                           = long.Parse(model.TId),
                gatewayId                     = 0,
                amount                        = model.Amount,
                countryCode                   = model.CountryCode,
                currencyCode                  = model.CurrencyCode,
                ttime                         = model.TTime,
                vid                           = model.Email,
                shippingInfo                  = model.ShippingInfo,
                supportedNetwork              = merchant.SupportNetwork,
                merchantIdentifier            = model.MerchantId,
                merchantCapabilities          = merchant.MerchantCapabilities,
                merchantName                  = merchant.MerchantName,
                lineItems                     = model.LineItems,
                paymentMethodTokenizationType = merchant.PaymnetMethodTokenizationType,
                publicKey                     = model.PublicKey
            };

            return(trModel);
        }
Example #13
0
        private static void logPaymentData(string resSettle,
                                           string resVerify,
                                           string saleReferenceID,
                                           string orderID,
                                           int resultCode,
                                           CartStatus paymentStatus)
        {
            var bankData = new BankData
            {
                ResCode         = resultCode,
                SaleReferenceID = resultCode == 0 ? saleReferenceID : "-1",
                SettleCode      = resultCode == 0 ? Int32.Parse(resSettle) : -1,
                VerifyCode      = resultCode == 0 ? Int32.Parse(resVerify) : -1
            };

            string data = Newtonsoft.Json.JsonConvert.SerializeObject(bankData);

            var paymentLog = new PaymentLog
            {
                KeyID         = orderID,
                SettleDate    = DateTime.Now,
                PaymentStatus = paymentStatus,
                Data          = data,
                LastUpdate    = DateTime.Now
            };

            PaymentLogs.UpdateByOrderID(paymentLog);
        }
 protected void GdvPaymentLogList_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         PaymentLogInfo dataItem = e.Row.DataItem as PaymentLogInfo;
         object         obj1     = e.Row.DataItem;
         if (dataItem != null)
         {
             Label     label  = (Label)e.Row.FindControl("LblStatus");
             Label     label2 = (Label)e.Row.FindControl("LblPlatform");
             HyperLink link   = (HyperLink)e.Row.FindControl("LnkPaymentNum");
             if (this.ShowOptions == 1)
             {
                 link.Text = dataItem.PaymentNum;
             }
             else
             {
                 link.Text        = dataItem.PaymentNum;
                 link.NavigateUrl = string.Concat(new object[] { "../User/PaymentLogDetail.aspx?ReturnUrl=../Shop/OrderManage.aspx?OrderID=", dataItem.OrderId, "&PaymentLogID=", dataItem.PaymentLogId.ToString() });
             }
             label.Text = PaymentLog.GetStatusDepict(dataItem.PlatformId, dataItem.Status);
             if (dataItem.Status != 1)
             {
                 e.Row.Cells[0].Enabled = false;
             }
             label2.Text = PayPlatform.GetPayPlatformById(dataItem.PlatformId).PayPlatformName;
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         PaymentLogInfo paymentLogById = PaymentLog.GetPaymentLogById(BasePage.RequestInt32("PaymentLogID"));
         if (!paymentLogById.IsNull)
         {
             this.LblPaymentNum.Text = paymentLogById.PaymentNum;
             this.LblUserName.Text   = paymentLogById.UserName;
             PayPlatformInfo payPlatformById = PayPlatform.GetPayPlatformById(paymentLogById.PlatformId);
             if (!paymentLogById.IsNull)
             {
                 this.LblPlatform.Text = payPlatformById.PayPlatformName;
             }
             this.LblPayTime.Text      = paymentLogById.PayTime.ToString();
             this.LblMoneyPay.Text     = paymentLogById.MoneyPay.ToString("0.00");
             this.LblMoneyTrue.Text    = paymentLogById.MoneyTrue.ToString("0.00");
             this.LblStatus.Text       = PaymentLog.GetStatusDepict(paymentLogById.PlatformId, paymentLogById.Status);
             this.LblPlatformInfo.Text = paymentLogById.PlatformInfo;
             this.LblRemark.Text       = paymentLogById.Remark;
         }
         else
         {
             AdminPage.WriteErrMsg("<li>找不到对应的支付记录</li>");
         }
     }
 }
Example #16
0
        private PayOnlineState UpdatePaymentLog(string paymentNum, decimal amount, string eBankInfo, int status, string remark)
        {
            PaymentLogInfo infoByPaymentNum = PaymentLog.GetInfoByPaymentNum(paymentNum);
            PayOnlineState ok = PayOnlineState.Ok;

            if (infoByPaymentNum.IsNull)
            {
                return(PayOnlineState.PaymentLogNotFound);
            }
            if (infoByPaymentNum.MoneyTrue != amount)
            {
                return(PayOnlineState.RemittanceWrong);
            }
            this.m_OrderInfo              = Order.GetOrderById(infoByPaymentNum.OrderId);
            this.m_Point                  = infoByPaymentNum.Point;
            this.m_PlatformId             = infoByPaymentNum.PlatformId;
            this.m_PaymentLogId           = infoByPaymentNum.PaymentLogId;
            this.m_UserName               = infoByPaymentNum.UserName;
            this.m_MoneyReceipt           = infoByPaymentNum.MoneyPay;
            infoByPaymentNum.PlatformInfo = eBankInfo;
            infoByPaymentNum.Remark       = remark;
            infoByPaymentNum.Status       = status;
            PaymentLog.Update(infoByPaymentNum);
            UserInfo usersByUserName = Users.GetUsersByUserName(this.m_UserName);

            if (!usersByUserName.IsNull)
            {
                this.m_UserId   = usersByUserName.UserId;
                this.m_ClientID = usersByUserName.ClientId;
            }
            return(ok);
        }
    //private string GetPaymentName()
    //{
    //    //PaymentMethod payment;
    //    //payment = new TwoCheckoutPaymentMethod();

    //    //return payment.Name;
    //    return "2Checkout";
    //}

    protected void Page_Load(object sender, EventArgs e)
    {
        string storeUrl = DataAccessContext.StoreRetriever.GetStorefrontUrlByOrderID(OrderID);

        if (VerifyReferrer())
        {
            PaymentLog paymentLog = new PaymentLog();
            paymentLog.OrderID         = OrderID;
            paymentLog.PaymentResponse = Request.Form.ToString();
            paymentLog.PaymentGateway  = "2Checkout";
            paymentLog.PaymentType     = String.Empty;
            DataAccessContext.PaymentLogRepository.Save(paymentLog);
            //PaymentLogAccess.Create( OrderID, Request.Form.ToString(), GetPaymentName(), "" );

            if (CreditCardProcess == "Y")
            {
                UpdateOrderDetails();

                OrderNotifyService order = new OrderNotifyService(OrderID);
                order.SendOrderEmail();
                order.ProcessPaymentComplete();

                Response.Redirect(String.Format("{0}/CheckoutComplete.aspx?OrderID={1}", storeUrl, OrderID + "&IsTransaction=true"));
            }
            else
            {
                Response.Redirect(String.Format("{0}/CheckoutNotComplete.aspx?OrderID={1}", storeUrl, OrderID));
            }
        }
        else
        {
            Response.Redirect(String.Format("{0}/CheckoutNotComplete.aspx?OrderID={1}", storeUrl, OrderID));
        }
    }
Example #18
0
        private void InsertPayLog(Wallet from, decimal frombefore, Wallet to, decimal tobefore, Order order, bool istrue = true, string msg = "")
        {
            using (var db = new PortalDb())
            {
                var paylog = new PaymentLog
                {
                    Amount           = order.Amount,
                    FromWalletId     = from.Id,
                    FromBeforeAmount = frombefore,
                    FromAfterAmount  = from.Balance,
                    ToWalletId       = to.Id,
                    ToBeforeAmount   = tobefore,
                    ToAfterAmount    = to.Balance,

                    OrderId   = order.Id,
                    OrderType = order.OrderType,
                    PayType   = order.PayType,

                    Remarks   = msg,
                    IsSuccess = istrue
                };
                db.PaymentLogs.Add(paylog);
                db.SaveChanges();
            }
        }
 public void InsertPaymentLog(PaymentLog log)
 {
     if (log != null)
     {
         db.PaymentLogs.Add(log);
         db.SaveChanges();
     }
 }
 public static void Save(PaymentLog paymentLog)
 {
     using (UpsilabEntities context = new UpsilabEntities())
     {
         context.PaymentLog.AddObject(paymentLog);
         context.SaveChanges();
     }
 }
 public PayRequestReturnModel Create(PaymentLog pay)
 {
     return(new PayRequestReturnModel
     {
         Url = _UrlHelper.Link("GetPaymentById", new { id = pay.Id }),
         Id = pay.Id
     });
 }
Example #22
0
 public void InsertPaymentLog(PaymentLog log)
 {
     if (log == null)
     {
         throw new ArgumentNullException("log");
     }
     _paylogRepository.Insert(log);
 }
Example #23
0
 public async Task <PaymentLog> SavePaymentLog(PaymentLog model)
 {
     if (model != null)
     {
         PaymentContext.PaymentLog.Add(model);
         PaymentContext.SaveChanges();
     }
     return(model);
 }
Example #24
0
 private void SearchLog_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         string searchPaymentLogCondition = PaymentLog.GetSearchPaymentLogCondition(this.postdatetimeStart.SelectedDate, this.postdatetimeEnd.SelectedDate, this.Username.Text);
         this.ViewState["condition"]     = searchPaymentLogCondition;
         this.DataGrid1.CurrentPageIndex = 0;
         this.BindData();
     }
 }
        public string RequestPay(PaymentLog paymentLog)
        {
            string ret = string.Empty;

            //ret = paymentLog.Key = Guid.NewGuid().ToString("N");
            payment.Add(paymentLog);
            payment.SaveChanges();
            ret = paymentLog.Id;
            return(ret);
        }
        public IHttpActionResult TokenResponse(int msgId, string tid, string token, int status)
        {
            PaymentLog log = new PaymentLog();

            log.Token  = token;
            log.Status = status;
            paymentService.UpdatePaymentByTid(tid, log);

            return(Ok());
        }
Example #27
0
 protected override void ShowPage()
 {
     this.pagetitle = "用户控制面板";
     if (!base.IsLogin())
     {
         return;
     }
     this.payoutlogcount = PaymentLog.GetPaymentLogOutRecordCount(this.userid);
     base.BindItems(this.payoutlogcount);
     this.payloglist = PaymentLog.GetPayLogOutList(16, this.pageid, this.userid);
 }
        public PaymentLog CheckPaymentByDeviceTokenCode(string deviceToken, string code)
        {
            PaymentLog ret = null;
            User       u   = user.All().Where(m => m.PhoneDeviceToken == deviceToken).FirstOrDefault();

            if (u != null)
            {
                ret = payment.All().Where(m => m.Email == u.Email && m.CodeCheck == code).OrderByDescending(m => m.RegisteredAt).FirstOrDefault();
            }
            return(ret);
        }
Example #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PaymentLog paymentLog = new PaymentLog();

        paymentLog.OrderID         = Invoice;
        paymentLog.PaymentResponse = Request.Form.ToString();
        paymentLog.PaymentGateway  = "RBSWorldPay";
        paymentLog.PaymentType     = "RBSWorldPay";
        DataAccessContext.PaymentLogRepository.Save(paymentLog);
        //PaymentLogAccess.Create( Invoice, Request.Form.ToString(), "RBSWorldPay", "RBSWorldpay" );
        ProcessRBSWorldPayIPN();
    }
Example #30
0
        public static PayOnlineState AddPayment(int orderId, int payPlatformId, decimal money, string userName, string paymentNum)
        {
            if (orderId > 0)
            {
                OrderInfo orderById = Order.GetOrderById(orderId);
                if (orderById.IsNull)
                {
                    return(PayOnlineState.OrderNotFound);
                }
                if (orderById.MoneyTotal <= orderById.MoneyReceipt)
                {
                    return(PayOnlineState.AccountPaid);
                }
            }
            PayPlatformInfo payPlatformById = PayPlatform.GetPayPlatformById(payPlatformId);

            if (payPlatformById.IsNull)
            {
                return(PayOnlineState.PayPlatFormNotFound);
            }
            if (payPlatformById.IsDisabled)
            {
                return(PayOnlineState.PayPlatFormDisabled);
            }
            money = Math.Abs(money);
            if (money <= 0.01M)
            {
                return(PayOnlineState.TooLittleMoney);
            }
            if (string.IsNullOrEmpty(paymentNum))
            {
                return(PayOnlineState.NoPaymentNumber);
            }
            decimal        num            = money + ((money * DataConverter.CDecimal(payPlatformById.Rate)) / 100M);
            PaymentLogInfo paymentLogInfo = new PaymentLogInfo();

            paymentLogInfo.UserName     = userName;
            paymentLogInfo.OrderId      = orderId;
            paymentLogInfo.PaymentNum   = paymentNum;
            paymentLogInfo.PlatformId   = payPlatformById.PayPlatformId;
            paymentLogInfo.MoneyPay     = money;
            paymentLogInfo.MoneyTrue    = num;
            paymentLogInfo.PayTime      = new DateTime?(DateTime.Now);
            paymentLogInfo.Status       = 1;
            paymentLogInfo.PlatformInfo = "";
            paymentLogInfo.Remark       = "";
            paymentLogInfo.SuccessTime  = null;
            if (PaymentLog.Add(paymentLogInfo))
            {
                return(PayOnlineState.Ok);
            }
            return(PayOnlineState.Fail);
        }
Example #31
0
        /// <summary>
        /// Creates the payment log.
        /// </summary>
        /// <param name="invoiceId">The invoice identifier.</param>
        /// <param name="dataContext">The data context.</param>
        /// <returns></returns>
        public static PaymentLog CreatePaymentLog(int invoiceId, StageBitzDB dataContext)
        {
            // Create Payment log record.
            PaymentLog paymentLog = new PaymentLog();

            paymentLog.RelatedTableName = "Invoice";
            paymentLog.RelatedId        = invoiceId;
            paymentLog.CreatedByUserId  = paymentLog.CreatedByUserId = 0;
            paymentLog.CreatedDate      = paymentLog.LastUpdatedDate = Utils.Now;
            dataContext.PaymentLogs.AddObject(paymentLog);
            return(paymentLog);
        }
Example #32
0
 private DetailsResponse CreateDetailsResponse(PaymentLog paymentLog)
 {
     return(new DetailsResponse
     {
         Success = paymentLog.Success,
         Amount = paymentLog.Amount,
         CurrencyCode = paymentLog.CurrencyCode,
         BankMessage = paymentLog.Reason,
         Expiry = paymentLog.Expiry,
         MaskedCardNo = paymentLog.MaskedCardNo
     });
 }
        public static void Update(
            int idSubscription,
            bool isSingle,
            DateTime? datePaiement,
            string periodicite,
            decimal? montant,
            DateTime? datePremierEcheance,
            decimal? premierVersement,
            DateTime? datePremierVersement,
            int? idMode
        )
        {
            using (UpsilabEntities context = new UpsilabEntities())
            {
                var record = context.PaymentLog.FirstOrDefault(x => x.idSubscription == idSubscription);
                if (record == null)
                {
                    //ADD
                    record = new PaymentLog
                    {
                        idSubscription = idSubscription,
                        DatePayment = datePaiement,
                        DateFirstPaymentDeadline = datePremierEcheance,
                        DateFirstDeposit = datePremierVersement,
                        TotalAmount = montant,
                        AmountFirstDeposit = premierVersement,
                        Periodicity = periodicite,
                        IsSinglePayment = isSingle,
                        IdPaymentMode = idMode,
                        ReturnCode = "",
                    };
                    context.PaymentLog.AddObject(record);
                    context.SaveChanges();
                    return;
                }

                //Update
                record.IsSinglePayment = isSingle;
                record.DatePayment = datePaiement;
                record.Periodicity = periodicite;
                record.TotalAmount = montant;
                record.DateFirstPaymentDeadline = datePremierEcheance;
                record.AmountFirstDeposit = premierVersement;
                record.DateFirstDeposit = datePremierVersement;
                record.IdPaymentMode = idMode;

                context.SaveChanges();
            }
        }
 public void LogTransaction(Guid siteGuid, Guid moduleGuid, Guid storeGuid, Guid cartGuid, Guid userGuid, string providerName, string method, string serializedCart)
 {
     PaymentLog alog = new PaymentLog();
     alog.RawResponse = RawResponse;
     alog.Amount = ChargeTotal;
     alog.AuthCode = ApprovalCode;
     alog.AvsCode = AvsResultCode;
     alog.CartGuid = cartGuid;
     alog.CcvCode = CardSecurityCodeResponseCode;
     alog.Reason = ResponseReason;
     alog.ResponseCode = ResponseCode;
     alog.SiteGuid = siteGuid;
     alog.StoreGuid = storeGuid;
     alog.TransactionId = TransactionId;
     alog.TransactionType = TransactionType.ToString();
     alog.UserGuid = userGuid;
     alog.Method = method;
     alog.Save();
 }
        public void LogTransaction(Guid siteGuid, Guid moduleGuid, Guid storeGuid, Guid cartGuid, Guid userGuid, string providerName, string method, string serializedCart)
        {
            //PayPalLog payPalLog = new PayPalLog();
            //payPalLog.ProviderName = providerName;
            //payPalLog.RawResponse = RawResponse;
            //payPalLog.RequestType = "DirectPayment";
            //payPalLog.CartGuid = cartGuid;
            //payPalLog.StoreGuid = storeGuid;
            //payPalLog.UserGuid = userGuid;
            //payPalLog.SiteGuid = siteGuid;
            //payPalLog.PendingReason = ResponseReason;
            //payPalLog.ReasonCode = ReasonCode;
            //payPalLog.PaymentType = "CreditCard";
            //payPalLog.PaymentStatus = Response.ToString();
            //payPalLog.TransactionId = TransactionId;
            //payPalLog.CartTotal = ChargeTotal;
            //payPalLog.CurrencyCode = CurrencyCode;
            //payPalLog.SerializedObject = serializedCart;
            //payPalLog.Save();

            PaymentLog pnplog = new PaymentLog();
            pnplog.RawResponse = RawResponse;
            pnplog.Amount = ChargeTotal;
            pnplog.AuthCode = ApprovalCode;
            pnplog.AvsCode = AvsResultCode;
            pnplog.CartGuid = cartGuid;
            pnplog.CcvCode = CardSecurityCodeResponseCode;
            pnplog.Reason = ResponseReason;
            pnplog.ResponseCode = ResponseCode;
            pnplog.SiteGuid = siteGuid;
            pnplog.StoreGuid = storeGuid;
            pnplog.TransactionId = TransactionId;
            pnplog.TransactionType = TransactionType.ToString();
            pnplog.UserGuid = userGuid;
            pnplog.Method = method;
            pnplog.Save();
        }