示例#1
0
        public void PaymentOk(String orderStatus = "040", Boolean sendEmails = true)
        {
            NBrightBuyUtils.ProcessEventProvider(EventActions.BeforePaymentOK, PurchaseInfo);

            if (!PurchaseInfo.GetXmlPropertyBool("genxml/stopprocess"))
            {
                // only process this on waiting for bank, incomplete or cancelled.  Cancel might be sent back from bank if client fails on first payment try.
                if (OrderStatus == "020" || OrderStatus == "010" || OrderStatus == "030")
                {
                    var discountprov = DiscountCodeInterface.Instance();
                    if (discountprov != null)
                    {
                        PurchaseInfo = discountprov.UpdatePercentUsage(PortalId, UserId, PurchaseInfo);
                        PurchaseInfo = discountprov.UpdateVoucherAmount(PortalId, UserId, PurchaseInfo);
                    }

                    PurchaseTypeCode = "ORDER";
                    CreatedDate      = DateTime.Now.ToString("O");
                    ApplyModelTransQty();
                    OrderStatus = orderStatus;
                    SavePurchaseData();

                    // Send emails
                    if (sendEmails)
                    {
                        NBrightBuyUtils.SendEmailOrderToClient("ordercreatedclientemail.html", PurchaseInfo.ItemID, "ordercreatedemailsubject");
                        NBrightBuyUtils.SendEmailToManager("ordercreatedemail.html", PurchaseInfo, "ordercreatedemailsubject");
                    }
                }
            }
            NBrightBuyUtils.ProcessEventProvider(EventActions.AfterPaymentOK, PurchaseInfo);
        }
示例#2
0
        private void PageLoad()
        {
            if (UserId > 0 && _cartInfo.UserId == -1) // user may have just logged in.
            {
                _cartInfo.UserId = UserId;
                _cartInfo.Save();
            }

            var orderid = Utils.RequestQueryStringParam(Context, "orderid");

            if ((_provList.Count == 0 || _cartInfo.PurchaseInfo.GetXmlPropertyDouble("genxml/appliedtotal") <= 0) && orderid == "")
            {
                #region "No Payment providers, so process as a ordering system"

                if (_cartInfo != null && _cartInfo.IsValidated())
                {
                    _cartInfo.SaveModelTransQty(); // move qty into trans
                    _cartInfo.ConvertToOrder(DebugMode);
                    _cartInfo.ApplyModelTransQty();

                    // Send emails
                    NBrightBuyUtils.SendEmailOrderToClient("ordercreatedclientemail.html", _cartInfo.PurchaseInfo.ItemID, "ordercreatedemailsubject");
                    NBrightBuyUtils.SendEmailToManager("ordercreatedemail.html", _cartInfo.PurchaseInfo, "ordercreatedemailsubject");

                    // update status to completed
                    _orderData = new OrderData(PortalId, _cartInfo.PurchaseInfo.ItemID);
                    _orderData.SavePurchaseData();

                    var cartL = new List <NBrightInfo>();
                    cartL.Add(_cartInfo.GetInfo());

                    // display payment OK for order
                    rpDetailDisplay.DataSource = cartL;
                    rpDetailDisplay.DataBind();
                }

                #endregion
            }
            else
            {
                #region "Payment Details"

                if (Utils.IsNumeric(orderid))
                {
                    // orderid exists, so must be return from bank; Process it!!
                    _orderData = new OrderData(PortalId, Convert.ToInt32(orderid));
                    DoDetail(rpDetailDisplay, _orderData.PurchaseInfo);
                }
                else
                {
                    // display return page
                    DoDetail(rpDetailDisplay, _cartInfo.PurchaseInfo);
                    DoDetail(rpPaymentGateways, _cartInfo.PurchaseInfo);
                    DoDetail(rpDetailFooter, _cartInfo.PurchaseInfo);
                }


                #endregion
            }
        }
示例#3
0
        private void SendOrderEmail(int orderid, String emailtemplate, String emailsubjectresxkey)
        {
            var emailmsg = GenXmlFunctions.GetField(rpDataF, "emailmsg");

            NBrightBuyUtils.SendEmailOrderToClient(emailtemplate, orderid, emailsubjectresxkey, "", emailmsg);
        }