I'm trying to debug a contribution page and I see that one of the contribution parameters is not set properly. I would like to see where exactly this parameter is being set so I can understand why it is not getting the proper value.
I've been looking inside the CRM_Contribute_Form_ContributionBase class and trying to figure out where its $_params variable is being set. But I have had no success.
What I've done so far (note: I'm referring to the code for 4.6.8):
1) Determined that one of the parameters in my payment processor (Stripe) is not being correctly set, and this is the cause of the error that I am getting ("Stripe.js token was not passed! Report this message to the site administrator.").
2) Saw that the contribution parameters are being passed to my payment proc.
3) Therefore, go one level up. The class CRM_Contribute_BAO_Contribution_Utils is calling the doDirectPayment() method of my payment proc. And it is passing the parameters. This calling happens in the processConfirm() method. But the processConfirm() method is itself passed the contribution params.
4) So, one level up. Now we find ourselves in CRM_Contribute_Form_Contribution_Confirm->postProcess(). So where does this postProcess() method get the contribution params from? It gets them from $this->_params (line 1037). But the CRM_Contribute_Form_Contribution_Confirm class does not have such a field. Then let's go to its parent.
5) The parent is CRM_Contribute_Form_ContributionBase. It has a $_params field. But I have not been able to ascertain where that field is set. I only saw that later on some parameters are added, however the params that I'm interested in were already set.
P.S. If someone has any tips or resources on how to more efficiently debug situations like these, please let me know. Finding out the above took me hours. I found it quite difficult to follow these parameters that are being passed around mountains of code, and most of all I could not get to the source (i.e. where they are first being set).