           @createPaymentInfo(customer, paymentInfo)
           @linkCustomerIntoGroup(customer, newCustomer.customerGroup)
         ]
-        Q.all(posts).fail (msg) =>
+        Q.all(posts).fail (msg) ->
           deferred.reject msg
-        .then (msg) =>
+        .then (msg) ->
           deferred.resolve "Customer created."
 
     deferred.promise

    @rest.POST "/customers/#{customer.id}", JSON.stringify(data), (error, response, body) ->
      if error
        deferred.reject 'Error on linking customer with group: ' + error
      if response.statusCode is 200
        deferred.resolve 'Customer linked to customer group.'
      else
        deferred.reject 'Problem on linking customer with group: ' + body


      @processInBatches posts, callback

  processInBatches: (posts, callback, numberOfParallelRequest = 20, acc = []) =>
    current = _.take posts, numberOfParallelRequest
    Q.all(current).then (msg) =>
      messages = acc.concat(msg)
