예제 #1
0
        public ShippingNotificationResponse SendShippingNotifications(ShippingNotification request)
        {
            var payLoad = new ShippingNotificationOrderDto(request);
            var backup  = new BackupLogEntry(payLoad, nameof(SendShippingNotifications));
            var shippingNotification = new ShippingNotificationResponse();

            LogRequest(payLoad, nameof(SendShippingNotifications));
            try
            {
                var result = _atgOrderApi.SendShippingNotifications(payLoad);
                backup.AddResponse(result);
                _repository.InsertOne(backup);
                LogResponse(result);
                if (string.IsNullOrEmpty(result))
                {
                    shippingNotification.EmailSent    = false;
                    shippingNotification.ErrorMessage = "Server Error communcating with notification service.";
                }
                shippingNotification.EmailSent = Boolean.Parse(result);
            }
            catch (Exception ex)
            {
                shippingNotification.EmailSent    = false;
                shippingNotification.ErrorMessage = ex.Message;
            }

            return(shippingNotification);
        }