Example #1
0
 public EcmaValue this[PropertyDefinitionType type] {
     set {
         if (type != PropertyDefinitionType.Spread)
         {
             throw new ArgumentException("Property definiton type must be Spread", "type");
         }
         properties.Add(new PropertyDefinition(PropertyDefinitionType.Spread, default, value));
        public LocalizationPageService()
        {
            CachedLocalizationPages = new ConcurrentDictionary <string, ContentReference>();

            _stringPropertyDefinitionType = _propertyDefinitionTypeRepository.Service.Load(
                PropertyDefinitionType.ResolvePropertyDataType(PropertyDataType.LongString));
        }
        public LocalizationPageService()
        {
            CachedLocalizationPages = new ConcurrentDictionary<string, ContentReference>();

            _stringPropertyDefinitionType = _propertyDefinitionTypeRepository.Service.Load(
                PropertyDefinitionType.ResolvePropertyDataType(PropertyDataType.LongString));
        }
Example #4
0
 public EcmaValue this[IStaticModifier staticModifier, PropertyDefinitionType type, EcmaPropertyKey key] {
     set {
         Guard.ArgumentNotNull(staticModifier, "staticModifier");
         if (staticModifier.IsStatic)
         {
             EnsureBuilder(ref staticProperties).Add(new PropertyDefinition(type, key, value));
         }
         else
         {
             this[type, key] = value;
         }
     }
 }
        private void InstallPayPalPaymentProvider()
        {
            var startPageData = DataFactory.Instance.GetPage(ContentReference.StartPage).CreateWritableClone();

            _startPageContentType = _contentTypeRepository.Service.Load(startPageData.ContentTypeID);
            _pageReferenceType    = _propertyDefinitionTypeRepository.Service.List().FirstOrDefault(x => x.Name == "PageReference");
            _shortcutTab          = _tabDefinitionRepository.Service.Load("Shortcut");

            var allMarkets = _marketService.Service.GetAllMarkets().Where(x => x.IsEnabled).ToList();

            foreach (var language in allMarkets.SelectMany(x => x.Languages).Distinct())
            {
                var paymentMethodDto = PaymentManager.GetPaymentMethods(language.TwoLetterISOLanguageName);

                if (!paymentMethodDto.PaymentMethod.Any(p => p.SystemKeyword.Equals("PayPal")))
                {
                    AddPaymentMethod(Guid.NewGuid(),
                                     "PayPal",
                                     "PayPal",
                                     "PayPal",
                                     "EPiServer.Business.Commerce.Payment.PayPal.Orders.PayPalPayment, EPiServer.Business.Commerce.Payment.PayPal",
                                     "EPiServer.Business.Commerce.Payment.PayPal.PayPalPaymentGateway, EPiServer.Business.Commerce.Payment.PayPal",
                                     false, 0, allMarkets, language, paymentMethodDto);
                }
            }

            AddPropertyToStartPage("PayPalPaymentPage");
            AddPropertyToStartPage("PayPalPaymentLandingPage");

            var contentType  = _contentTypeRepository.Service.Load <OrderConfirmationPage>();
            var contentUsage = _contentModelUsage.Service.ListContentOfContentType(contentType).FirstOrDefault();

            if (contentUsage != null)
            {
                var orderConfirmationPageLink = contentUsage.ContentLink;
                startPageData.Property["PayPalPaymentLandingPage"].Value = orderConfirmationPageLink;
            }
            else
            {
                var orderConfirmationPage = _contentRepository.Service.GetDefault <OrderConfirmationPage>(ContentReference.StartPage).CreateWritableClone() as OrderConfirmationPage;
                orderConfirmationPage.Name = "Order confirmation page";
                var orderConfirmationPageLink = _contentRepository.Service.Save(orderConfirmationPage, SaveAction.Publish, AccessLevel.NoAccess);

                startPageData.Property["PayPalPaymentLandingPage"].Value = orderConfirmationPageLink;
            }

            contentType  = _contentTypeRepository.Service.Load <PayPalPage>();
            contentUsage = _contentModelUsage.Service.ListContentOfContentType(contentType).FirstOrDefault();
            if (contentUsage != null)
            {
                startPageData.Property["PayPalPaymentPage"].Value = contentUsage.ContentLink;
            }
            else
            {
                var PayPalPage = _contentRepository.Service.GetDefault <PayPalPage>(ContentReference.StartPage).CreateWritableClone() as PayPalPage;
                PayPalPage.Name = "PayPal process page";
                var PayPalPageLink = _contentRepository.Service.Save(PayPalPage, SaveAction.Publish, AccessLevel.NoAccess);
                startPageData.Property["PayPalPaymentPage"].Value = PayPalPageLink;
            }

            _contentRepository.Service.Save(startPageData, SaveAction.Publish, AccessLevel.NoAccess);
        }
Example #6
0
 public EcmaValue this[PropertyDefinitionType type, EcmaPropertyKey key] {
     set { EnsureBuilder(ref properties).Add(new PropertyDefinition(type, key, value)); }
 }
Example #7
0
 public PropertyDefinition(PropertyDefinitionType type, EcmaPropertyKey key, EcmaValue value)
 {
     this.Type         = type;
     this.PropertyName = key;
     this.Value        = value;
 }
Example #8
0
        private void InstallDIBSPaymentProvider()
        {
            var startPageData = DataFactory.Instance.GetPage(ContentReference.StartPage).CreateWritableClone();

            _startPageContentType = _contentTypeRepository.Service.Load(startPageData.ContentTypeID);
            _pageReferenceType    = _propertyDefinitionTypeRepository.Service.List().FirstOrDefault(x => x.Name == "PageReference");
            _shortcutTab          = _tabDefinitionRepository.Service.Load("Shortcut");

            // Creating payment method in all available languages.
            var allMarkets = _marketService.Service.GetAllMarkets().Where(x => x.IsEnabled).ToList();

            foreach (var language in allMarkets.SelectMany(x => x.Languages).Distinct())
            {
                var paymentMethodDto = PaymentManager.GetPaymentMethods(language.TwoLetterISOLanguageName);

                if (!paymentMethodDto.PaymentMethod.Any(p => p.SystemKeyword.Equals("DIBS")))
                {
                    AddPaymentMethod(Guid.NewGuid(),
                                     "DIBS",
                                     "DIBS",
                                     "DIBS",
                                     "Mediachase.Commerce.Orders.OtherPayment, Mediachase.Commerce",
                                     "EPiServer.Business.Commerce.Payment.DIBS.DIBSPaymentGateway, EPiServer.Business.Commerce.Payment.DIBS",
                                     false, 0, allMarkets, language, paymentMethodDto);
                }
            }

            // Adding Properties to StartPage page type.
            AddPropertyToStartPage("DIBSPaymentPage");
            AddPropertyToStartPage("DIBSPaymentLandingPage");

            // Setting OrderConfirmationPage page to payment landing page.
            var contentType  = _contentTypeRepository.Service.Load <OrderConfirmationPage>();
            var contentUsage = _contentModelUsage.Service.ListContentOfContentType(contentType).FirstOrDefault();

            if (contentUsage != null)
            {
                var orderConfirmationPageLink = contentUsage.ContentLink;
                startPageData.Property["DIBSPaymentLandingPage"].Value = orderConfirmationPageLink;
            }
            else
            {
                var orderConfirmationPage = _contentRepository.Service.GetDefault <OrderConfirmationPage>(ContentReference.StartPage).CreateWritableClone() as OrderConfirmationPage;
                orderConfirmationPage.Name = "Order confirmation page";
                var orderConfirmationPageLink = _contentRepository.Service.Save(orderConfirmationPage, SaveAction.Publish, AccessLevel.NoAccess);

                startPageData.Property["DIBSPaymentLandingPage"].Value = orderConfirmationPageLink;
            }

            // Creating payment processing page then setting it to payment home page property.
            contentType  = _contentTypeRepository.Service.Load <DIBSPage>();
            contentUsage = _contentModelUsage.Service.ListContentOfContentType(contentType).FirstOrDefault();
            if (contentUsage != null)
            {
                startPageData.Property["DIBSPaymentPage"].Value = contentUsage.ContentLink;
            }
            else
            {
                var dibsPage = _contentRepository.Service.GetDefault <DIBSPage>(ContentReference.StartPage).CreateWritableClone() as DIBSPage;
                dibsPage.Name = "DIBS process page";
                var dibsPageLink = _contentRepository.Service.Save(dibsPage, SaveAction.Publish, AccessLevel.NoAccess);
                startPageData.Property["DIBSPaymentPage"].Value = dibsPageLink;
            }

            // Publish start page.
            _contentRepository.Service.Save(startPageData, SaveAction.Publish, AccessLevel.NoAccess);
        }
Example #9
0
 public EcmaValue this[PropertyDefinitionType type, EcmaPropertyKey key] {
     set { properties.Add(new PropertyDefinition(type, key, value)); }
 }
 private bool IsStringType(PropertyDefinitionType propertyType)
 {
     return(propertyType.Type == typeof(string) || propertyType.TypeName == "XhtmlString");
 }