コード例 #1
0
ファイル: HomeController.cs プロジェクト: omidam81/Ver1.0
        public string Molpay(OrderRecord order,
            string country,
            string firstName,
            string lastName,
            string email,
            string state,
            string phone,
            double deliveryCost)
        {

            var setting = _paymentSettingsService.GetAllSettigns()
                .FirstOrDefault(s => s.CountryRecord.Id == _countryService.GetCountryByCulture(_cultureUsed).Id);

            //var merchantId = "teeyoot1_Dev";
            //var verifyKey = "856287426298f7e8508eae9896c09c03";
            var merchantId = setting.MerchantIdMol;
            var verifyKey = setting.VerifyKey;

            //var Total = order.TotalPrice;
            var total =
                ((order.TotalPriceWithPromo != 0 ? order.TotalPriceWithPromo : order.TotalPrice) + deliveryCost)
                    .ToString("F2", CultureInfo.InvariantCulture);
            var OrderNumber = order.Id;

            var campaign =
                _campaignService.GetCampaignById(order.Products.First().CampaignProductRecord.CampaignRecord_Id);
            var title = campaign.Title;
            var campId = campaign.Id;
            var name = firstName + " " + lastName;
            var Email = email;
            var Phone = phone;
            var description = campId + ", " + title + "," + "\nOrdered from Teeyoot " + country + " " + state;

            var vCode = GetVCode(total + merchantId + OrderNumber + verifyKey);
            //var paymentUrl = "";
            //if (method == "credit")
            //    {
            //        paymentUrl = "https://www.onlinepayment.com.my/MOLPay/pay/" + merchantId + "?amount=" +
            //                  Total + "&orderid=" + OrderNumber +
            //                  "&bill_name=" + Name + "&channel=credit&bill_email=" + Email + "&bill_mobile=" + Phone +
            //                  "&bill_desc=" + Description + "&vcode=" + vCode;

            //    } else {
            var paymentUrl = "https://www.onlinepayment.com.my/MOLPay/pay/" + merchantId + "?amount=" +
                             total + "&orderid=" + OrderNumber +
                             "&bill_name=" + name + "&bill_email=" + Email + "&bill_mobile=" + Phone +
                             "&bill_desc=" + description + "&vcode=" + vCode;

            //}

            return paymentUrl;
        }
コード例 #2
0
 private MandrillMessage InitMandrillMessage(OrderRecord order)
 {
     var mandrillMessage = new MandrillMessage() { };
     mandrillMessage.MergeLanguage = MandrillMessageMergeLanguage.Handlebars;
     mandrillMessage.FromEmail = ADMIN_EMAIL;
     mandrillMessage.Subject = "Your order";
     List<MandrillMailAddress> emails = new List<MandrillMailAddress>();
     emails.Add(new MandrillMailAddress(order.Email));
     mandrillMessage.To = emails;
     return mandrillMessage;
 }
コード例 #3
0
        private void FillUserMergeVars(MandrillMessage message, OrderRecord record, string adminEmail)
        {

            message.AddRcptMergeVars(adminEmail, "FNAME", record.FirstName);
            message.AddRcptMergeVars(adminEmail, "LNAME", record.LastName);
            message.AddRcptMergeVars(adminEmail, "CITY", record.City);
            message.AddRcptMergeVars(adminEmail, "CLIENT_EMAIL", record.Email);
            message.AddRcptMergeVars(adminEmail, "STATE", record.State);
            message.AddRcptMergeVars(adminEmail, "PHONE", record.PhoneNumber);
            message.AddRcptMergeVars(adminEmail, "STREET_ADDRESS", record.StreetAddress);
            message.AddRcptMergeVars(adminEmail, "COUNTRY", record.Country);

            double totalPrice;

            if (record.TotalPriceWithPromo > 0.0)
            {
                totalPrice = record.TotalPriceWithPromo + record.Delivery;
                message.AddRcptMergeVars(adminEmail, "TOTALPRICE", totalPrice.ToString("F", CultureInfo.InvariantCulture));
            }
            else
            {
                totalPrice = record.TotalPrice + record.Delivery;
                message.AddRcptMergeVars(adminEmail, "TOTALPRICE", totalPrice.ToString("F", CultureInfo.InvariantCulture));
            }
            if (record.Delivery > 0.0)
            {
                message.AddRcptMergeVars(adminEmail, "DELIVERYPRICE", record.Delivery.ToString("F", CultureInfo.InvariantCulture));
            }
            if (record.Promotion > 0.0)
            {
                message.AddRcptMergeVars(record.Email, "PROMOTIONSIZE", record.Promotion.ToString("F", CultureInfo.InvariantCulture));
            }

        }
コード例 #4
0
ファイル: OrderService.cs プロジェクト: omidam81/Ver1.0
        public OrderRecord CreateOrder(IEnumerable<OrderProductViewModel> products)
        {
            try
            {
                var order = new OrderRecord()
                {
                    Created = DateTime.UtcNow,
                    CurrencyRecord = _currencyRepository.Get(products.First().CurrencyId),
                    OrderStatusRecord = _orderStatusRepository.Get(int.Parse(OrderStatus.Approved.ToString("d"))),
                    OrderPublicId = "",
                    IsActive = false
                };

                _orderRepository.Create(order);

                var ticks = DateTime.Now.Date.Ticks;

                while (ticks%10 == 0)
                {
                    ticks = ticks/10;
                }

                order.OrderPublicId = (ticks + order.Id).ToString();
                _orderRepository.Update(order);

                var productsList = new List<LinkOrderCampaignProductRecord>();
                double totalPrice = 0;
                foreach (var product in products)
                {
                    var campaignProduct = _campaignService.GetCampaignProductById(product.ProductId);
                    var orderProduct = new LinkOrderCampaignProductRecord()
                    {
                        Count = product.Count,
                        ProductSizeRecord = _sizeRepository.Get(product.SizeId),
                        CampaignProductRecord = campaignProduct,
                        OrderRecord = order,
                        ProductColorRecord =
                            product.ColorId == null || product.ColorId == 0
                                ? null
                                : _colorRepository.Get(product.ColorId)
                    };

                    totalPrice = totalPrice + product.Price*product.Count;


                    _ocpRepository.Create(orderProduct);
                    productsList.Add(orderProduct);
                }

                order.TotalPrice = totalPrice;
                order.Products = productsList;

                var campaignId = order.Products.First().CampaignProductRecord.CampaignRecord_Id;
                var campaign = _campaignRepository.Get(campaignId);

                // It is impossible that TeeyootUserId equals null
                if (campaign.TeeyootUserId == null)
                {
                    throw new ApplicationException(
                        "It is impossible that TeeyootUserId equals null but this finally has happened.");
                }

                var teeyootUser = _orchardServices.ContentManager.Get<TeeyootUserPart>(campaign.TeeyootUserId.Value);
                order.SellerCountry = teeyootUser.CountryRecord;

                _orderRepository.Update(order);

                return order;
            }
            catch
            {
                throw;
            }
        }
コード例 #5
0
ファイル: OrderService.cs プロジェクト: omidam81/Ver1.0
 public void UpdateOrder(OrderRecord order)
 {
     _orderRepository.Update(order);
 }
コード例 #6
0
ファイル: OrderService.cs プロジェクト: omidam81/Ver1.0
 public void UpdateOrder(OrderRecord order, OrderStatus status)
 {
     order.OrderStatusRecord = _orderStatusRepository.Get(int.Parse(status.ToString("d")));
     _orderRepository.Update(order);
 }