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( |
Get Take My Money now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.