   "<?xml?><root>#{raw}</root>"
 
 exports.XmlImport.prototype.transform = (xml, callback)->
+  that = this
   parseString xml, (err, result)->
     console.log('Error on parsing XML:' + err) if err
-    exports.XmlImport.prototype.mapProducts(result.root, callback)
+    that.mapProducts(result.root, callback)
 
 exports.XmlImport.prototype.mapProducts = (xmljs, callback)->
   products = []

{parseString} = require 'xml2js'
Config = require('../config').config
Rest = require('sphere-node-connect').Rest
OAuth2 = require('sphere-node-connect').OAuth2
Q = require('q')

# Define XmlImport object

  true

exports.XmlImport.prototype.productType =->
  deferred = Q.defer()
  @rest.GET "/product-types", (error, response, body)->
    #console.log("PT: %j", body)
    id = JSON.parse(body).results[0].id
    deferred.resolve id
  deferred.promise

exports.XmlImport.prototype.taxCategory =->
  deferred = Q.defer()
  @rest.GET "/tax-categories", (error, response, body)->
    #console.log("TC: %j", body)
    id = JSON.parse(body).results[0].id
    deferred.resolve id
  deferred.promise

exports.XmlImport.prototype.customerGroup =->
  deferred = Q.defer()
  @rest.GET "/customer-groups", (error, response, body)->
    id = JSON.parse(body).results[0].id
    #console.log("CG: %j", body)
    deferred.resolve id
