private static ResolvedArrayParameter <OrderDataHandler> GetOrderDataHandlerParams()
        {
            // We resolve the parameters manually to control the order the OrderHandlers are applied.
            var orderDataHandlerParams = new ResolvedArrayParameter <OrderDataHandler>(
                new ResolvedParameter <OrderDataHandler>("Reseller"),
                new ResolvedParameter <OrderDataHandler>("LanguageHandler"),
                new ResolvedParameter <OrderDataHandler>("Currency"),
                new ResolvedParameter <OrderDataHandler>("MainContact"),
                new ResolvedParameter <OrderDataHandler>("BillingContact"),
                new ResolvedParameter <OrderDataHandler>("OrderAttributes"),
                new ResolvedParameter <OrderDataHandler>("CampaignCode"),
                new ResolvedParameter <OrderDataHandler>("VatValidation"),
                new ResolvedParameter <OrderDataHandler>("IpAddress"),
                new ResolvedParameter <OrderDataHandler>("RegisterDomain"),
                new ResolvedParameter <OrderDataHandler>("TransferDomain"),
                new ResolvedParameter <OrderDataHandler>("OwnDomain"),
                new ResolvedParameter <OrderDataHandler>("SetupFees"),

                // This is a good position for TLD specific handlers.

                // Default should be placed after all other handlers that add items form the cart to the order, or there is risk of adding the same item twice.
                new ResolvedParameter <OrderDataHandler>("Default"),

                // This is a good position for handlers that add extra items depending on other items in cart, e.g. like HST-APPY in old order page.

                // RemovePostOrder should be placed last to make sure any added postal fees are removed, since they will be added by Atomia Billing.
                new ResolvedParameter <OrderDataHandler>("RemovePostOrder")
                );

            return(orderDataHandlerParams);
        }
        public void CreatingResolvedArrayParameterWithValuesOfNonCompatibleType()
        {
            // Arrange
            ILogger logger2 = new SpecialLogger();

            //Act
            var resolver = new ResolvedArrayParameter <ILogger>(
                new ResolvedParameter <ILogger>("log1"),
                typeof(int),
                logger2);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Register order placement serivce and related handlers.
        /// </summary>
        private static void RegisterOrderHandling(UnityContainer container)
        {
            // Transaction data handler
            container.RegisterType <TransactionDataHandler, Atomia.Store.PublicOrderHandlers.TransactionDataHandlers.RequestParamsHandler>("RequestParamsHandler");
            container.RegisterType <TransactionDataHandler, Atomia.Store.PublicOrderHandlers.TransactionDataHandlers.PaymentProfileHandler>("PaymentProfilesHandler");

            // Order data handlers and order placement service
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.ResellerHandler>("Reseller");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.LanguageHandler>("LanguageHandler");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.CurrencyHandler>("Currency");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.ContactDataHandlers.MainContactDataHandler>("MainContact");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.ContactDataHandlers.BillingContactDataHandler>("BillingContact");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.OrderAttributesHandler>("OrderAttributes");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.CampaignCodeHandler>("CampaignCode");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.VatValidationHandler>("VatValidation");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.IpAddressHandler>("IpAddress");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.CartItemHandlers.RegisterDomainHandler>("RegisterDomain");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.CartItemHandlers.TransferDomainHandler>("TransferDomain");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.CartItemHandlers.OwnDomainHandler>("OwnDomain");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.CartItemHandlers.DefaultHandler>("Default");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.CartItemHandlers.SetupFeesHandler>("SetupFees");
            container.RegisterType <OrderDataHandler, Atomia.Store.PublicOrderHandlers.CartItemHandlers.RemovePostOrderHandler>("RemovePostOrder");

            container.RegisterType <IOrderPlacementService, Atomia.Store.PublicBillingApi.Adapters.OrderPlacementService>();

            // We resolve the parameters manually to control the order the OrderHandlers are applied.
            var orderDataHandlerParams = new ResolvedArrayParameter <OrderDataHandler>(
                new ResolvedParameter <OrderDataHandler>("Reseller"),
                new ResolvedParameter <OrderDataHandler>("LanguageHandler"),
                new ResolvedParameter <OrderDataHandler>("Currency"),
                new ResolvedParameter <OrderDataHandler>("MainContact"),
                new ResolvedParameter <OrderDataHandler>("BillingContact"),
                new ResolvedParameter <OrderDataHandler>("OrderAttributes"),
                new ResolvedParameter <OrderDataHandler>("CampaignCode"),
                new ResolvedParameter <OrderDataHandler>("VatValidation"),
                new ResolvedParameter <OrderDataHandler>("IpAddress"),
                new ResolvedParameter <OrderDataHandler>("RegisterDomain"),
                new ResolvedParameter <OrderDataHandler>("TransferDomain"),
                new ResolvedParameter <OrderDataHandler>("OwnDomain"),
                new ResolvedParameter <OrderDataHandler>("SetupFees"),

                // This is a good position for TLD specific handlers.

                // Default should be placed after all other handlers that add items form the cart to the order, or there is risk of adding the same item twice.
                new ResolvedParameter <OrderDataHandler>("Default"),

                // This is a good position for handlers that add extra items depending on other items in cart, e.g. like HST-APPY in old order page.

                // RemovePostOrder should be placed last to make sure any added postal fees are removed, since they will be added by Atomia Billing.
                new ResolvedParameter <OrderDataHandler>("RemovePostOrder")
                );

            bool loginAfterOrder;
            var  loginAfterOrderSetting = ConfigurationManager.AppSettings["LoginAfterOrder"] as String;

            if (!Boolean.TryParse(loginAfterOrderSetting, out loginAfterOrder))
            {
                throw new ConfigurationErrorsException("Could not parse boolean from 'LoginAfterOrder' setting or it is missing.");
            }

            if (loginAfterOrder)
            {
                container.RegisterType <OrderCreator, Atomia.Store.PublicBillingApi.TokenLoginOrderCreator>(
                    new InjectionConstructor(new ResolvedParameter <PaymentUrlProvider>(), orderDataHandlerParams, new ResolvedParameter <PublicBillingApiProxy>()));
            }
            else
            {
                container.RegisterType <OrderCreator, Atomia.Store.PublicBillingApi.SimpleOrderCreator>(
                    new InjectionConstructor(orderDataHandlerParams, new ResolvedParameter <PublicBillingApiProxy>(), new ResolvedParameter <IAuditLogger>()));
            }

            container.RegisterType <PaymentTransactionCreator, Atomia.Store.PublicBillingApi.PaymentTransactionCreator>();

            // These are required since Unity does not handle IEnumerable<T> automatically.
            container.RegisterType <IEnumerable <PaymentDataHandler>, PaymentDataHandler[]>();
            container.RegisterType <IEnumerable <OrderDataHandler>, OrderDataHandler[]>();
            container.RegisterType <IEnumerable <TransactionDataHandler>, TransactionDataHandler[]>();
        }
Exemplo n.º 4
0
 public static ConvertedParameterValue <ResolvedArrayParameter <TFrom>, TFrom[], TTo> Convert <TFrom, TTo>(
     this ResolvedArrayParameter <TFrom> parameter,
     Func <TFrom[], TTo> converter) =>
 new ConvertedParameterValue <ResolvedArrayParameter <TFrom>, TFrom[], TTo>(parameter, converter);