O'Reilly logo

Take My Money by Noel Rappin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Transferring Payments to Affiliate Accounts

With the affiliate accounts created, we now need to pull them into our workflow so that our affiliates can get paid. The first step is to identify when an affiliate tag comes in via a URL so that we can associate the shopping cart with the affiliate. The expectation here is that the URL will be something like http://www.snowglobe.com/?tag=abcde, and we’ll extract the “abcde” and associate the active shopping cart with the correct affiliate.

I wrote a few tests to cover the main case and some special cases:

 require ​"rails_helper"
 
 RSpec.describe AddsAffiliateToCart ​do
 
  let(​:user​) { create(​:user​) }
  let!(​:affiliate​) { create(​

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required