コード例 #1
0
        private PayooOrder CreatePayooOrder(IOrderGroup orderGroup, IPayment payment)
        {
            var orderNumberID = _orderNumberGenerator.GenerateOrderNumber(orderGroup);

            var order = new PayooOrder();

            order.Session           = orderNumberID;
            order.BusinessUsername  = _paymentMethodConfiguration.BusinessUsername;
            order.OrderCashAmount   = (long)payment.Amount;
            order.OrderNo           = orderNumberID;
            order.ShippingDays      = 1;
            order.ShopBackUrl       = $"{HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority)}{_cmsPaymentPropertyService.GetPayooPaymentProcessingPage()}";
            order.ShopDomain        = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority);
            order.ShopID            = long.Parse(_paymentMethodConfiguration.ShopID);
            order.ShopTitle         = _paymentMethodConfiguration.ShopTitle;
            order.StartShippingDate = DateTime.Now.ToString("dd/MM/yyyy");
            order.NotifyUrl         = string.Empty;
            order.ValidityTime      = DateTime.Now.AddDays(1).ToString("yyyyMMddHHmmss");

            var customer = CustomerContext.Current.GetContactById(orderGroup.CustomerId);

            order.CustomerName    = customer.FullName ?? $"{customer.FirstName} {customer.MiddleName} {customer.LastName}";
            order.CustomerPhone   = string.Empty;
            order.CustomerEmail   = customer.Email;
            order.CustomerAddress = customer.PreferredShippingAddress?.Line1;
            order.CustomerCity    = customer.PreferredShippingAddress?.City;

            order.OrderDescription = HttpUtility.UrlEncode(OrderDescriptionHTMLFactory.CreateOrderDescription(orderGroup));
            order.Xml = PaymentXMLFactory.GetPaymentXML(order);
            return(order);
        }