class Multiwoven::Integrations::Destination::MicrosoftExcel::Client

def process_write_request(write_url, payload, token, sync_config)

def process_write_request(write_url, payload, token, sync_config)
  write_success = 0
  write_failure = 0
  log_message_array = []
  begin
    response = Multiwoven::Integrations::Core::HttpClient.request(
      write_url,
      HTTP_POST,
      payload: payload,
      headers: auth_headers(token)
    )
    if success?(response)
      write_success += 1
    else
      write_failure += 1
    end
    log_message_array << log_request_response("info", [HTTP_POST, write_url, payload], response)
  rescue StandardError => e
    handle_exception(e, {
                       context: "MICROSOFT:EXCEL:RECORD:WRITE:EXCEPTION",
                       type: "error",
                       sync_id: sync_config.sync_id,
                       sync_run_id: sync_config.sync_run_id
                     })
    write_failure += 1
    log_message_array << log_request_response("error", [HTTP_POST, write_url, payload], e.message)
  end
  tracking_message(write_success, write_failure, log_message_array)
end