Project60 / org.project60.sepa

SEPA direct debit integration with civicrm
19 stars 46 forks source link

EVENT: Mandatory key(s) missing from params array: contact_id #208

Closed magnolia61 closed 9 years ago

magnolia61 commented 9 years ago

When registering for an event I get the following after the confirmation screen Mandatory key(s) missing from params array: contact_id

What is most probable at fault here? The fact that I use 4.5.3 of my Joomla install?

bjendres commented 9 years ago

Hi @magnolia61 I'm assuming you're using the signup page and the SEPA payment processor. This is still some kind of a weak spot, see e.g. https://github.com/Project60/sepa_dd/issues/210

Our customers don't use event pages, so this has not been our focus of testing. If you could give us detailed instructions for reproduction, or even a PR, we can probably integrate this soon.

tttp commented 9 years ago

@magnolia61 https://github.com/magnolia61

can you enable debug and backtrace in your civicrm and paste the result of what is displayed? it points out where the error message comes from in greater details, will help you debugging

On 11 November 2014 12:32, SYSTOPIA notifications@github.com wrote:

Hi @magnolia61 https://github.com/magnolia61 I'm assuming you're using the signup page and the SEPA payment processor. This is still some kind of a weak spot, see e.g. #210 https://github.com/Project60/sepa_dd/issues/210

Our customers don't use event pages, so this has not been our focus of testing. If you could give us detailed instructions for reproduction, or even a PR, we can probably integrate this soon.

— Reply to this email directly or view it on GitHub https://github.com/Project60/sepa_dd/issues/208#issuecomment-62535106.

magnolia61 commented 9 years ago

Hello Xavier and Björn, Here is the backtrace of what I get after proceeding from the confirmation screen running the current master code. I hope this helps to get civisepa working for events. If more testing is needed from my side I am more than willing to help. I use civicrm both from joomla as well as drupal and in single and multi-site setting.

CiviCRM_API3_Exception: "Mandatory key(s) missing from params array: contact_id"

0 /home/stage/domains/ourdomain/public_html/sites/all/modules/civicrm_extensions/sepa_dd/CRM/Core/Payment/SDD.php(151): civicrm_api3("SepaMandate", "createfull", (Array:45))

1 /home/stage/domains/ourdomain/public_html/sites/all/modules/civicrm/CRM/Event/Form/Registration/Confirm.php(548): CRM_Core_Payment_SDD->doDirectPayment((Array:45))

2 /home/stage/domains/ourdomain/public_html/sites/all/modules/civicrm/CRM/Core/Form.php(328): CRM_Event_Form_Registration_Confirm->postProcess()

3 /home/stage/domains/ourdomain/public_html/sites/all/modules/civicrm/CRM/Core/StateMachine.php(162): CRM_Core_Form->mainProcess()

4 /home/stage/domains/ourdomain/public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(60): CRM_Core_StateMachine->perform(Object(CRM_Event_Form_Registration_Confirm), "next", "Next")

5 /home/stage/domains/ourdomain/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Event_Form_Registration_Confirm), "next")

6 /home/stage/domains/ourdomain/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Event_Form_Registration_Confirm), "next")

7 /home/stage/domains/ourdomain/public_html/sites/all/modules/civicrm/CRM/Core/Controller.php(356): HTML_QuickForm_Page->handle("next")

8 /home/stage/domains/ourdomain/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(331): CRM_Core_Controller->run((Array:3), NULL)

9 /home/stage/domains/ourdomain/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(75): CRM_Core_Invoke::runItem((Array:15))

10 /home/stage/domains/ourdomain/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))

11 /home/stage/domains/ourdomain/public_html/sites/all/modules/civicrm/drupal/civicrm.module(457): CRM_Core_Invoke::invoke((Array:3))

12 [internal function](): civicrm_invoke("event", "register")

13 /home/stage/domains/ourdomain/public_html/includes/menu.inc(517): call_user_func_array("civicrm_invoke", (Array:2))

14 /home/stage/domains/ourdomain/public_html/index.php(21): menu_execute_active_handler()

15 {main}

bjendres commented 9 years ago

@magnolia61 There seems to be something wrong with the payment processor when used in the context of events.

I'm currently working a lot on the payment processor (see this branch) since the old implementation has a couple of weak spots. I'll be happy to let you know when the basic changes are done and back in trunk. Then we can start testing the improved implementation in your scenario and make it work. I'll be out for the next week or so, but I'm planning to do this first thing next year. Does that sound good to you?

magnolia61 commented 9 years ago

@systopia Actually in another dev site I'm using your bleeding dev_pp code. That stumbles over the hidden start date. I would love to have something (maybe ugly) working when the registration for our summercamps open january 1st. But I guess that is a bridge too far. Hope to work with you guys in the coming months to help test and feedback real scenarios. Thanks a lot for your work. https://github.com/Project60/sepa_dd/commit/bd8668a7395c76b810ba94449375e9e76b029e1d

bjendres commented 9 years ago

I would love to have something (maybe ugly) working when the registration for our summercamps open january 1st.

Sorry, I won't be working on this until January 5th. But I'd be happy to have a look at your "maybe ugly" fixes then.

tttp commented 9 years ago

@systopia enjoy your holidays ;)

@magnolia61 The problem is on CRM/Core/Payment/SDD.php doDirectPayment

// get the contribution via contactID $params['contact_id'] = $this->getForm()->getVar('_contactID');

Looking quickly at other payment providers, it seems that $params["contactID"] is already set (well, and seems to be the case for at least the participants)

Can you try to replace this line: $params['contact_id'] = $this->getForm()->getVar('_contactID');

by $params['contact_id'] = $params["contactID"];

and 1) see if it works for event registration 2) see if it works for normal contribution pages

X+

magnolia61 commented 9 years ago

Unfortunately $params['contact_id'] = $params['contactID']; didn't work for me I still get a white screen and the error_reporting extension mailing me on: Mandatory key(s) missing from params array: contact_id

I have tried with &smartyDebug=1 but couldn't figure out why your supposed code would not work. A clue might be that the debug screen shows: [contact_id] => (so: an empty value for contact_id) The drupal recent error log gives two notices:

Notice: Undefined index: contributionType_name in CRM_Core_Payment_SDD->doDirectPayment() (line 131 of /home/ozk/domains/ourdomain.nl/public_html/crm/sites/all/modules/civicrm_extensions/sepa_dd/CRM/Core/Payment/SDD.php). AND Notice: Undefined variable: contact_id in CRM_Core_Payment_SDD->doDirectPayment() (line 141 of /home/ozk/domains/ourdomain.nl/public_html/crm/sites/all/modules/civicrm_extensions/sepa_dd/CRM/Core/Payment/SDD.php).

I guess not only the fact is to blame that I'm trying to use an event registration form, because using a standard contribution page I can only make recurring payments and not One Offs.

Does this help? I'd love to do some more debugging or try out possible solutions to get one-off event registrations working ;) Any idea's?

bjendres commented 9 years ago

@magnolia61 I assume this is still an event registration page, correct? And is it the "bleeding" dev_pp code?

magnolia61 commented 9 years ago

Semi-good news! After todays commits I can register for an event without fatal errors. The hidden start date is no blocker and the contact_id get's set.

Two things do not work well so far though: 1) The mandate does'nt show up after generating from the dashboard (it get's recorded in the DB correctly though) 2) The recorded contribution get's incorrectly set as 'paid by: creditcard' (instead of SEPA OOFF) 3) The credit card mentions are still in the confirmation page (and confirmation mail) Instead it would be better to show and email the Bank # and BIC code of the mandate.

I hope my testing & feedback helps to get the event registration SEPA OOFF's working :-) I am better in testing and proposing than actual coding, so thanks a lot for your work on this!

bjendres commented 9 years ago

I just merged the dev_pp code into master. We fixed some more 4.5 issues, mostly related to java script.

@magnolia61: Could you test again with today's master? And then maybe we could talk on Skype to discuss your findings...?

I hope my testing & feedback helps to get the event registration SEPA OOFF's working :-) I am better in testing and proposing than actual coding, so thanks a lot for your work on this!

Definitely. And it's going to become even more important now that we're slowly going from development into testing phase for 1.1

magnolia61 commented 9 years ago

I uploaded the current integrated master files and got the following results: 1) Notice in 1st screen: org.project60.sepa: get_parameter for unknown key: cycledays, referer: https://www.ourdomain.nl/civicrm/event/register?reset=1&id=29 2) (Fatal error) /home/ozk/domains/ourdomain.nl/public_html/crm/sites/all/modules/civicrm/CRM/Event/BAO/Event.php(1699): CRM_Core_Error::fatal("Cannot find participant ID")

Later today we could go on skype to discuss a little easier. I am glad to help getting the event part functioning.

ghost commented 9 years ago

Just a quick notice regarding this php message:

org.project60.sepa: get_parameter for unknown key: cycledays

This can happen if the extension has not been uninstalled before updating to the latest master files.

bjendres commented 9 years ago

This can happen if the extension has not been uninstalled before updating to the latest master files.

Of course. The process for updating from any source is:

  1. deactivate and uninstall extension
  2. update code
  3. install / activate extension

Otherwise all (new) changes that need to be done upon install will not be applied.

magnolia61 commented 9 years ago

After a full uninstall and clean install of the current master code the following issues remain:

1) The mandate get's recorded in civicrm_sdd_mandate with status PARTIAL, entity_id=4294967295 and with contact_id = NULL (which prevents it fro showing up in the mandate dashboard of course) 2) The recorded contribution get's incorrectly set as 'paid by: creditcard' (instead of SEPA OOFF) and with status 'complete' (instead of 'Pending')

So somehow with the new mandate creation method, the event registration mandates get only initially set but do not get finished. Some observations: a) an event registration gets recorded correctly (status: registered) b) a contribution gets recorded almost correctly c) a mandate gets recorded only partially

What can I do to help debug this further and help test to get the event registration part working? sepadd_database_mandates

bjendres commented 9 years ago

That makes perfect sense to me. After the payment processor has finished, CRM_Core_Payment_SDD::processPartialMandates() needs to be called to hook the payments up with their respective mandates. This call seems to be missing in your case. I'll take care of this.

magnolia61 commented 9 years ago

Maybe of interest for you, Björn. But after the situation in the screenshot I did a regular test-contribution again and the two event based mandates changed their mandate status by that action from partial to OOFF. The only thing that is not filled is the contact_id. So two observations: 1) You seem to be right that triggering CRM_Core_Payment_SDD::processPartialMandates() from the regular contribution screen was somewhat helpfull for the event mandates 2) The contact_id probably still needs to be set initialy, because this is still not filled. Does this sound like progress? I love that sound! sepadd_database_mandates afterdonation

bjendres commented 9 years ago

@magnolia61 Making the payment processor work for event registration pages is work in progress - we're actually on this right now. I'll ask you to test this again soon.

bjendres commented 9 years ago

@magnolia61: I have now modified/extended the payment processor to work with event registrations. Could you please test with the current master?

magnolia61 commented 9 years ago

Event registrations now work out of the box! Congratulations! The only issue right now are: 1) the missing mandate summary in confirmation email 2) the reduntant CC+billing block) in the confirmation email But these already have their issue in: https://github.com/Project60/sepa_dd/issues/217

The coming days we start with live transactions. I will get back to you with bugs, observations & suggestions :-) Thanks for making this happen!

bjendres commented 9 years ago

Thanks for testing. I moved the email issue to https://github.com/Project60/sepa_dd/issues/237