     KD.remote.api.JVM.fetchDefaultVm callback
 
   createDefaultVM: (callback)->
-
     @hasDefaultVM (err, state)->
       return warn 'Default VM already exists.'  if state
 

      width   : 500
      overlay : yes

    workflow.on 'DataCollected', @bound 'provisionVm'

    workflow.on 'Cancel', -> modal.destroy()

    workflow.enter()

  provisionVm: ({ subscription, paymentMethod, productData })->
    { plan, pack } = productData
      
    if paymentMethod and not subscription

      plan.subscribe paymentMethod.paymentMethodId, (err, subscription) =>
        return  if KD.showError err

        @provisionVm { subscription, productData }

    subscription.debit pack, (err, blah) ->
      debugger
      
      return  if KD.showError err

      debugger

  askForApprove:(command, callback)->



    productForm = new VmProductForm

    pay = KD.getSingleton 'paymentController'

    KD.whoami().fetchPlansAndSubscriptions ['vm'], (err, plansAndSubs) =>
      return  if KD.showError err
      
      { subscriptions } = pay.groupPlansBySubscription plansAndSubs

      productForm.setCurrentSubscriptions subscriptions

    productForm.on 'PackOfferingRequested', (subscription) ->
      options = targetOptions: selector: tags: 'vm'

      KD.getGroup().fetchProducts 'pack', options, (err, packs) ->
        return  if KD.showError err
        
