Example #1
0
        public static OmniumOrder Anonymize(this OmniumOrder order)
        {
            if (order?.OrderForm == null)
            {
                return(order);
            }

            order.CustomerName   = order.CustomerName.ToAnonymized();
            order.BillingAddress = Anonymize(order.BillingAddress);

            foreach (var shipment in order.OrderForm.Shipments)
            {
                shipment.Address = Anonymize(shipment.Address);
            }

            return(order);
        }
Example #2
0
        public virtual async Task <Response> TransferOrderToOmnium(OmniumOrder omniumOrder)
        {
            _logger.Information($"Sending order with id {omniumOrder.OrderNumber} to Omnium");

            var orderResponse = await _orderClient.AddOrderAsync(omniumOrder);

            if (orderResponse.IsSuccess())
            {
                _logger.Information($"Order with id {omniumOrder.OrderNumber} successfully sent to Omnium");
            }
            else
            {
                _logger.Warning($"Failed sending order {omniumOrder.OrderNumber} to Omnium, status {orderResponse.HttpStatusCode}");

                var exception = orderResponse.OriginalException;
                if (exception != null)
                {
                    _logger.Error(exception.Message, exception);
                }
            }
            return(orderResponse);
        }