Fixed affiliate id
Added doc
urlencoded test
Moved code from controller to retriever