                              you want to continue?
                            </p>
                         """
-              buildModal content, billing, yes, callback
+              @createPaymentConfirmationModal type, group, plan, content, billing, yes, callback
 
   makePayment: (type, plan, willCharge, callback)->
     vmController = KD.getSingleton('vmController')

              modal.destroy()
              callback?()

  confirmPayment: (type, plan, callback=->)->
    paymentController = KD.getSingleton('paymentController')
    group             = KD.getSingleton("groupsController").getCurrentGroup()

    getBalance = (type, cb)->
      if type is 'user'
        KD.remote.api.JRecurlyPlan.getUserBalance cb
      else
        KD.remote.api.JRecurlyPlan.getGroupBalance group, cb

    askBillingInfo = (cb)->
      paymentModal = paymentController.createPaymentMethodModal {}, (newData, onError, onSuccess)->
        if type is 'group'
          group.setBillingInfo newData, (err, result)->
            if err
              onError err
            else
              onSuccess result
              cb yes
        else
          KD.remote.api.JRecurlyPlan.setUserAccount newData, (err, result)->
            if err
              onError err
            else
              onSuccess result
              cb yes

    buildModal = (content, needBilling, willCharge, cb)->
      modal           = new KDModalView
        title         : "Confirm VM Creation"
        content       : "<div class='modalformline'>#{content}</div>"
        overlay       : yes
        buttons       :
          No          :
            title     : "Cancel"
            cssClass  : "modal-clean-gray"
            callback  : =>
              modal.destroy()
              cb()
          Billing     :
            title     : "Enter Billing Info"
            cssClass  : "modal-clean-green"
            callback  : =>
              askBillingInfo (success)->
                if success
                  modal.buttons.Yes.show()
                  modal.buttons.Billing.hide()
          Yes         :
            title     : "OK, create the VM"
            cssClass  : "modal-clean-green"
            callback  : =>
              modal.destroy()
              paymentController.makePayment type, plan, willCharge, ->
                cb()

      if needBilling
        modal.buttons.Billing.show()
        modal.buttons.Yes.hide()
      else
        modal.buttons.Billing.hide()

    getBillingInfo = (cb)->
      if type is 'group'
        group.getBillingInfo cb
      else
        KD.remote.api.JRecurlyPlan.getUserAccount cb

    group.canCreateVM
      type     : type
      planCode : plan.code
    , (err, status)->
      if not err and status
        content = """<p>
                       You already subscribed for an additional 

                  """
        buildModal content, no, no, callback
      else
        @getBillingInfo type, group, (err, account)=>
          billing = err or not account or not account.cardNumber

          @getBalance type, group, (err, balance)=>
            if not err and balance > 0
              charge = (plan.feeMonthly - balance) / 100
              balance = balance / 100
