Skip to content

Instantly share code, notes, and snippets.

@dpickett
Created May 18, 2011 18:19
Show Gist options
  • Select an option

  • Save dpickett/979168 to your computer and use it in GitHub Desktop.

Select an option

Save dpickett/979168 to your computer and use it in GitHub Desktop.
def redirect_data
customer_options = {}
[
:first_name,
:last_name,
:email
].each do |prepopulate_attr|
if self.send(prepopulate_attr).present?
customer_options[prepopulate_attr] = self.send(prepopulate_attr)
end
end
redirect_options = { :redirect_url => redirect_url }
redirect_options.merge!({:customer => customer_options}) unless customer_options.empty?
@redirect_data ||= Braintree::TransparentRedirect.create_customer_data(redirect_options)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment