         deferred.resolve unsyncedOrders
     deferred.promise
 
+  getTaxCategory: (rest) ->
+    deferred = Q.defer()
+    rest.GET "/tax-categories?limit=1", (error, response, body) ->
+      if error?
+        deferred.reject "Error on fetching tax category: " + error
+      else if response.statusCode isnt 200
+        deferred.reject "Problem on fetching tax category (status: #{response.statusCode}): " + body
+      else
+        if _.size(body.results) is 1
+          deferred.resolve body.results[0]
+        else
+          deferred.reject "Can't find tax category."
+    deferred.promise
+
   getRetailerProductByMasterSKU: (sku) ->
     deferred = Q.defer()
     query = encodeURIComponent "variants.attributes.mastersku:\"#{sku.toLowerCase()}\""
     @retailerRest.GET "/product-projections/search?staged=true&lang=de&filter=#{query}" , (error, response, body) ->
-      if error
+      if error?
         deferred.reject "Error on fetching products: " + error
       else if response.statusCode isnt 200
         deferred.reject "Problem on fetching products (status: #{response.statusCode}): " + body


  importOrder: (order) ->
    deferred = Q.defer()
    @retailerRest.POST "/orders/import", order, (error, response, body) ->
      if error
        deferred.reject "Error on importing order: " + error
      else if response.statusCode isnt 201
        humanReadable = JSON.stringify body, null, ' '

        externalId: externalId
      ]
    rest.POST "/orders/#{orderId}", data, (error, response, body) ->
      if error?
        deferred.reject "Error on setting sync info: " + error
      else if response.statusCode isnt 200
        humanReadable = JSON.stringify body, null, ' '
