Exemplo n.º 1
0
 /// <summary>
 /// Overloaded constructor for testing
 /// </summary>
 public OrderController(IOrderService cartService,
                        ICatalogService catalogService, IAddressValidationService addressValidator)
 {
     _orderService     = cartService;
     _catalogService   = catalogService;
     _addressValidator = addressValidator;
 }
Exemplo n.º 2
0
 public AddressHistoryController(
     IAddressValidationService addressValidator,
     TransactionHistoryService transactionHistoryService)
 {
     _addressValidator          = addressValidator;
     _transactionHistoryService = transactionHistoryService;
 }
Exemplo n.º 3
0
        public void Startup()
        {
            _orderRepository = new TestOrderRepository();
            _catalogRepository = new TestCatalogRepository();
            _addressValidation = new TestAddressValidator();
            _shippingRepository = new TestShippingRepository();
            _shippingService = new SimpleShippingService(_shippingRepository);
            _taxRepository = new TestTaxRepository();
            _taxService = new RegionalSalesTaxService(_taxRepository);
            _orderService = new OrderService(_orderRepository,_catalogRepository,_shippingRepository,_shippingService);
            _personalizationRepository = new TestPersonalizationRepository();
            _personalizationService = new PersonalizationService(_personalizationRepository,_orderRepository, _orderService,_catalogRepository);
            _catalogService = new CatalogService(_catalogRepository,_orderService);
            _paymentService = new FakePaymentService();
            _incentiveRepository = new TestIncentiveRepository();
            _incentiveService = new IncentiveService(_incentiveRepository);

            //this service throws the sent mailers into a collection
            //and does not use SMTP
            _mailerService = new TestMailerService();
            _inventoryRepository = new TestInventoryRepository();
            _inventoryService = new InventoryService(_inventoryRepository,_catalogService);
            _mailerRepository = new TestMailerRepository();
            _pipeline=new DefaultPipeline(
                _addressValidation,_paymentService,
                _orderService,_mailerService,
                _inventoryService
                );


        }
Exemplo n.º 4
0
        public void Startup()
        {
            _orderRepository           = new TestOrderRepository();
            _catalogRepository         = new TestCatalogRepository();
            _addressValidation         = new TestAddressValidator();
            _shippingRepository        = new TestShippingRepository();
            _shippingService           = new SimpleShippingService(_shippingRepository);
            _taxRepository             = new TestTaxRepository();
            _taxService                = new RegionalSalesTaxService(_taxRepository);
            _orderService              = new OrderService(_orderRepository, _catalogRepository, _shippingRepository, _shippingService);
            _personalizationRepository = new TestPersonalizationRepository();
            _personalizationService    = new PersonalizationService(_personalizationRepository, _orderRepository, _orderService, _catalogRepository);
            _catalogService            = new CatalogService(_catalogRepository, _orderService);
            _paymentService            = new FakePaymentService();
            _incentiveRepository       = new TestIncentiveRepository();
            _incentiveService          = new IncentiveService(_incentiveRepository);

            //this service throws the sent mailers into a collection
            //and does not use SMTP
            _mailerService       = new TestMailerService();
            _inventoryRepository = new TestInventoryRepository();
            _inventoryService    = new InventoryService(_inventoryRepository, _catalogService);
            _mailerRepository    = new TestMailerRepository();
            _pipeline            = new DefaultPipeline(
                _addressValidation, _paymentService,
                _orderService, _mailerService,
                _inventoryService
                );
        }
Exemplo n.º 5
0
 public BalanceController(ILog log,
                          BalanceService service,
                          IAddressValidationService addressValidator)
 {
     _log              = log;
     _service          = service;
     _addressValidator = addressValidator;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Overloaded constructor for testing
 /// </summary>
 public OrderController (IOrderService cartService,
     ICatalogService catalogService,IAddressValidationService addressValidator)
 {
     
     _orderService = cartService;
     _catalogService = catalogService;
     _addressValidator = addressValidator;
 }
 public TransactionController(
     IAddressValidationService addressValidationService,
     IUnsignedTransactionService txBuilderService,
     ITransactionBroadcastService txBroadcastService)
 {
     _addressValidationService = addressValidationService;
     _txBuilderService         = txBuilderService;
     _txBroadcastService       = txBroadcastService;
 }
Exemplo n.º 8
0
 public TransactionHistoryService(
     ITransactionRepository txRepo,
     IAddressValidationService addressValidator,
     INosqlRepo <BroadcastedTransactionByHash> broadcastTxHashRepo,
     INosqlRepo <ObservableAddressEntity> operationRepo)
 {
     _txRepo              = txRepo;
     _addressValidator    = addressValidator;
     _broadcastTxHashRepo = broadcastTxHashRepo;
     _operationRepo       = operationRepo;
 }
Exemplo n.º 9
0
 public AvaTaxController(ILogger <AvaTaxController> log, Func <IAvaTaxSettings, AvaTaxClient> avaTaxClientFactory, IOrdersSynchronizationService ordersSynchronizationService,
                         IAddressValidationService addressValidationService, IPushNotificationManager pushNotificationManager, IUserNameResolver userNameResolver, IOptions <AvaTaxSecureOptions> options)
 {
     _logger = new AvalaraLogger(log);
     _avaTaxClientFactory          = avaTaxClientFactory;
     _ordersSynchronizationService = ordersSynchronizationService;
     _addressValidationService     = addressValidationService;
     _pushNotificationManager      = pushNotificationManager;
     _userNameResolver             = userNameResolver;
     _options = options.Value;
 }
 public BalanceService(
     INosqlRepo <ObservableWalletEntity> observableWalletRepository,
     IAddressRepository addressRepository,
     IDcrdClient dcrdClient,
     IAddressValidationService addressValidator)
 {
     _observableWalletRepository = observableWalletRepository;
     _addressRepository          = addressRepository;
     _dcrdClient       = dcrdClient;
     _addressValidator = addressValidator;
 }
        public WindowsWorkflowPipeline(
            IAddressValidationService addressValidation,
            IPaymentService paymentService,
            IOrderService orderService,
            IMailerService mailerService,
            IInventoryService inventoryService
            ) {
            _addressValidation = addressValidation;
            _paymentService = paymentService;
            _orderService = orderService;
            _mailerService = mailerService;
            _inventoryService = inventoryService;

        }
Exemplo n.º 12
0
 public DefaultPipeline(
     IAddressValidationService addressValidation,
     IPaymentService paymentService,
     IOrderService orderService,
     IMailerService mailerService,
     IInventoryService inventoryService
     )
 {
     _addressValidation = addressValidation;
     _paymentService    = paymentService;
     _orderService      = orderService;
     _mailerService     = mailerService;
     _inventoryService  = inventoryService;
 }
Exemplo n.º 13
0
        /// <summary>
        /// Overloaded constructor for testing
        /// </summary>
        public OrderController(IOrderService cartService,
            ICatalogService catalogService, 
            IAddressValidationService addressValidator, 
            IShippingService shippingService,
            IPaymentService paymentService,
            IPipelineEngine pipeline,
            ISalesTaxService taxService,
            IIncentiveService incentiveService
            ) {

            _orderService = cartService;
            _catalogService = catalogService;
            _addressValidator = addressValidator;
            _shippingService = shippingService;
            _paymentService = paymentService;
            _pipeline = pipeline;
            _taxService = taxService;
            _incentiveService = incentiveService;
        }
Exemplo n.º 14
0
 /// <summary>
 /// Overloaded constructor for testing
 /// </summary>
 public OrderController(IOrderService cartService,
                        ICatalogService catalogService,
                        IAddressValidationService addressValidator,
                        IShippingService shippingService,
                        IPaymentService paymentService,
                        IPipelineEngine pipeline,
                        ISalesTaxService taxService,
                        IIncentiveService incentiveService
                        )
 {
     _orderService     = cartService;
     _catalogService   = catalogService;
     _addressValidator = addressValidator;
     _shippingService  = shippingService;
     _paymentService   = paymentService;
     _pipeline         = pipeline;
     _taxService       = taxService;
     _incentiveService = incentiveService;
 }
Exemplo n.º 15
0
        private static IAddressValidationService Create(Country country)
        {
            IAddressValidationService processor = null;
            string processorTypeAsString        = country.AddressVerificationTypeName;

            if (string.IsNullOrEmpty(processorTypeAsString) == false)
            {
                try
                {
                    Type processorType = BuildManager.GetType(processorTypeAsString, true);
                    processor = (IAddressValidationService)Activator.CreateInstance(processorType);
                }
                catch (HttpException e)
                {
                    throw new PXException(e, Messages.AddressVerificationServiceCreationErrorHTTP, processorTypeAsString);
                }
                catch (Exception e)
                {
                    throw new PXException(e, Messages.AddressVerificationServiceCreationError, processorTypeAsString);
                }
            }
            return(processor);
        }
Exemplo n.º 16
0
        public static bool Validate <T>(PXGraph aGraph, T aAddress, bool aSynchronous, bool updateToValidAddress)
            where T : IAddressBase, IValidatedAddress
        {
            CS.Country country = PXSelect <CS.Country, Where <CS.Country.countryID, Equal <Required <CS.Country.countryID> > > > .Select(aGraph, aAddress.CountryID);

            if (string.IsNullOrEmpty(country.AddressVerificationTypeName))
            {
                if (aSynchronous)
                {
                    PXCache cache            = aGraph.Caches[typeof(T)];
                    string  countryFieldName = GetFieldName(typeof(T), Fields.CountryID);
                    cache.RaiseExceptionHandling(countryFieldName, aAddress, aAddress.CountryID,
                                                 new PXSetPropertyException(Messages.AddressVerificationServiceIsNotSetup,
                                                                            PXErrorLevel.Warning, aAddress.CountryID));
                    return(false);
                }
                else
                {
                    throw new PXException(Messages.AddressVerificationServiceIsNotSetup, aAddress.CountryID);
                }
            }

            IAddressValidationService service = Create(country);

            if (service != null)
            {
                PXCache cache = aGraph.Caches[typeof(T)];
                if (!service.IsServiceActive(aGraph))
                {
                    if (aSynchronous)
                    {
                        string countryFieldName = GetFieldName(typeof(T), Fields.CountryID);
                        cache.RaiseExceptionHandling(countryFieldName, aAddress, aAddress.CountryID,
                                                     new PXSetPropertyException(Messages.AddressVerificationServiceIsNotActive,
                                                                                PXErrorLevel.Error, aAddress.CountryID));
                        return(false);
                    }
                    else
                    {
                        throw new PXException(Messages.AddressVerificationServiceIsNotActive, aAddress.CountryID);
                    }
                }
                service.SetupService(aGraph);
                bool isValid;
                Dictionary <Fields, string> messages = new Dictionary <Fields, string>();

                T copy = (T)cache.CreateCopy(aAddress);
                if (!service.ValidateAddress(copy, out isValid, messages))
                {
                    throw new PXException(Messages.UnknownErrorOnAddressValidation);
                }
                if (isValid)
                {
                    T copyToUpdate = copy;
                    if (!updateToValidAddress)
                    {
                        copyToUpdate = (T)cache.CreateCopy(aAddress);                        //Clear changes made by ValidateAddress
                    }
                    copyToUpdate.IsValidated = true;
                    aAddress = (T)cache.Update(copyToUpdate);
                    if (!updateToValidAddress && aSynchronous)
                    {
                        string[] fields = { GetFieldName(typeof(T), Fields.AddressLine1),
                                            GetFieldName(typeof(T), Fields.AddressLine2),
                                            GetFieldName(typeof(T), Fields.City),
                                            GetFieldName(typeof(T), Fields.State),
                                            GetFieldName(typeof(T), Fields.PostalCode) };
                        foreach (string iFld in fields)
                        {
                            string ourValue = ((string)cache.GetValue(aAddress, iFld)) ?? String.Empty;
                            string extValue = ((string)cache.GetValue(copy, iFld)) ?? String.Empty;

                            if (String.Compare(ourValue.Trim(), extValue.Trim(), true) != 0)
                            {
                                cache.RaiseExceptionHandling(iFld, aAddress, ourValue,
                                                             new PXSetPropertyException(Messages.AddressVerificationServiceReturnsField, PXErrorLevel.Warning, extValue));
                            }
                        }
                    }
                }
                else
                {
                    string        message        = string.Empty;
                    StringBuilder messageBuilder = new StringBuilder();
                    int           count          = 0;
                    foreach (KeyValuePair <Fields, string> iMsg in messages)
                    {
                        string fieldName = GetFieldName(typeof(T), iMsg.Key);
                        if (!aSynchronous)
                        {
                            if (count > 0)
                            {
                                messageBuilder.Append(",");
                            }
                            messageBuilder.AppendFormat("{0}:{1}", fieldName, iMsg.Value);
                            count++;
                        }
                        else
                        {
                            object value = cache.GetValue(aAddress, fieldName);
                            cache.RaiseExceptionHandling(fieldName, aAddress, value, new PXSetPropertyException(iMsg.Value));
                        }
                    }
                    if (!aSynchronous)
                    {
                        throw new PXException(messageBuilder.ToString());
                    }
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 17
0
 public BalanceController(BalanceService service,
                          IAddressValidationService addressValidator)
 {
     _service          = service;
     _addressValidator = addressValidator;
 }
 public AddressesController(
     IAddressValidationService addressValidationService)
 {
     _addressValidationService = addressValidationService;
 }
Exemplo n.º 19
0
 private void InitService()
 {
     _svc = new AddressValidationService(_db.Object, _mockConfig.Object, HttpClient);
 }
Exemplo n.º 20
0
 public AddressController(IAddressValidationService addressValidator)
 {
     _addressValidator = addressValidator;
 }
Exemplo n.º 21
0
 public Office365AddressValidationConsumer(IAddressValidationService addressValidationService)
 {
     _addressValidationService = addressValidationService;
 }
 public LoadValidationService(LoadshopDataContext context, IAddressValidationService addressValidationService)
 {
     _context = context;
     _addressValidationService = addressValidationService;
 }