 
   constructor: (options = {}, data = {}) ->
 
-    @model = data  if data.planCode
+    model = data  if data.planCode
 
     options.isRecurOptional ?= yes
 
     options.callback ?= =>
-      @emit 'SaveRequested', @model, @getProductData()
+      @emit 'SaveRequested', model, @getProductData()
 
     options.buttons ?=
       Save        :

          partial     : "/ #{ data.subscriptionType ? 'mo' }"
          cssClass    : 'fr'

    if options.showOverage
      options.fields.overageEnabled =
        label         : "Overage enabled"

    subscriptionType: subscriptionType

  getProductData: ->
    do (i = @inputs) =>
      title           = i.title.getValue()
      description     = i.description.getValue()
      overageEnabled  = i.overageEnabled.getValue()
      soldAlone       = i.soldAlone.getValue()
      priceIsVolatile = i.priceIsVolatile.getValue()
      feeAmount       =
        unless priceIsVolatile
        then i.feeAmount.getValue() * 100

      { subscriptionType, feeUnit, feeInterval } = @getPlanInfo()

      {
        title         : i.title.getValue()
        description   : i.description.getValue()
        feeAmount
        feeUnit
        feeInterval
        subscriptionType
        overageEnabled
        soldAlone
        priceIsVolatile
      }

  handleSubscriptionType: ->
    subscriptionType = @inputs.subscriptionType.getValue()
