Created
May 28, 2014 20:30
-
-
Save jakecraige/558b2f829d5cc958b716 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TwoTap = Ember.Mixin.create | |
# returns either a two tap url or the product url if it's form an unsupported | |
# vendor | |
getTwoTapUrl: (product, tracking)-> | |
return (product.get('affiliateUrl') || product.get('url')) unless tracking.get('twoTapEnabled') | |
uniqueToken = "#{product.get('id')}-#{tracking.get('id')}" | |
url = ENV.services.twotap.baseUrl | |
url += "public_token=#{ENV.services.twotap.token}" | |
url += "&callback_url=#{ENV.services.twotap.callbackUrl}" | |
#url += "&test_mode=dummy_data" unless ENV.production | |
url += "&unique_token=#{uniqueToken}" | |
url += "&user_token=#{@get('session.content.user_id')}" | |
url += "&products=#{encodeURIComponent(product.get('url'))}" | |
url += "&affiliate_links=#{encodeURIComponent(product.get('affiliateUrl'))}" | |
url += "&custom_css_url=#{encodeURIComponent(ENV.services.twotap.cssUrl)}" | |
`export default TwoTap;` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
baseUrl is
https://checkout.twotap.com/?