def verify_payment_profile(user)            
      resp = self.gateway.get_customer_profile({ :customer_profile_id => user.authnet_customer_profile_id })      
      if resp.success?
        arr = resp.params['profile']['payment_profiles']      
        arr = [arr] if arr && arr.is_a?(Hash)
        if arr.nil? || arr.count == 0
          self.create_empty_payment_profile(user)
          user.valid_authnet_payment_profile_id = false        
        else                
          h = arr[0]
          user.authnet_payment_profile_id = h['customer_payment_profile_id']                 
          user.valid_authnet_payment_profile_id = h['bill_to'] && h['bill_to']['address'] && h['bill_to']['address'].strip.length > 0                    
          user.save
        end
      end    
    end
def verify_payment_profile(user)            
      resp = self.gateway.get_customer_profile({ :customer_profile_id => user.authnet_customer_profile_id })      
      if resp.success?
        arr = resp.params['profile']['payment_profiles']      
        arr = [arr] if arr && arr.is_a?(Hash)
        if arr.nil? || arr.count == 0
          self.create_empty_payment_profile(user)
          user.valid_authnet_payment_profile_id = false        
        else                
          h = arr[0]
          user.authnet_payment_profile_id = h['customer_payment_profile_id']                 
          user.valid_authnet_payment_profile_id = h['bill_to'] && h['bill_to']['address'] && h['bill_to']['address'].strip.length > 0                    
          user.save
        end
      end    
    end
=============================================================================
 Verifies that the user has a payment profile and that the payment profile is valid.
 Creates an empty payment profile for the user if the payment profile is missing or invalid.