public CustomerResponse Create(string customerData, ICrmService crmService) { if (string.IsNullOrWhiteSpace(customerData)) { throw new ArgumentNullException(Constants.Parameters.ProcessCustomer); } if (crmService == null) { throw new ArgumentNullException(Constants.Parameters.CrmService); } var response = crmService.ExecuteActionOnCustomerEvent(customerData, OperationType.Post); if (response == null) { throw new InvalidOperationException(Constants.Messages.ResponseNull); } return(response); }
public CustomerResponse Update(string customerId, CustomerInformation customerInformation, ICrmService crmService) { if (crmService == null) { throw new ArgumentNullException(Constants.Parameters.CrmService); } customerInformation.Customer.CustomerIdentifier.CustomerId = customerId; string customerData = JsonConvert.SerializeObject(customerInformation.Customer, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore }); var response = crmService.ExecuteActionOnCustomerEvent(customerData, OperationType.Patch); if (response == null) { throw new InvalidOperationException(Constants.Messages.ResponseNull); } return(response); }