Processing Credit Card Contribution Fails if No Email Address
Imported from: https://github.com/mattwire/com.drastikbydesign.stripe/issues/22
If a contact doesn't have an email address processing credit card transactions fails with the same error message in #21 (closed) . When the contact has no email address the checkbox to send a receipt doesn't appear on the form -- just mentioning that so it's clear that I'm not explicitly checking the send receipt box when attempting to process the transaction. This is in WordPress 4.9.8 + CiviCRM 5.4.0 + Stripe extension 5.0 beta 4. Thanks.
@mattwire commented 7 days ago @mwoodward-atd Thanks. Do you or your organisation have any funding available to help resolve this?
@mwoodward-atd commented 7 days ago Potentially -- let me know what you think it'd take and I can see what I can muster up. This is for a small community radio station where I live so budgets are very tight (I do all the work I do for them gratis), but let me know what it'd take to fix this one and #21 (closed) both. If the funding isn't doable I may take a run at fixing it and doing a pull request; I'm a Python developer but this might be a good foray into getting into CiviCRM extensions since I may need to write one. Anyway, my email is mpwoodward at gmail if it's easier to communicate that way. Let me know an estimate when you get a chance. Thanks!
@mattwire commented 20 hours ago Hi @mwoodward-atd Please can you test the https://github.com/mattwire/com.drastikbydesign.stripe/tree/5.x_noemail branch?
Please don't run on live until you are absolutely certain it doesn't break anything!
There is an upgrader which must be run for the extension. It does the following:
Add a "contact_id" column to the civicrm_stripe_customers table (new installs will not get the email column anymore). Runs a new API function Stripe.customercontactids which looks up and populates contact IDs in the civicrm_stripe_customers table based on the email address stored there. This is the part that may cause issues, for example if more than one contact has the same email address or the same contact ID is setup with more than one customer ID (different emails).
@mwoodward-atd commented 9 hours ago Thanks for the initial run at this! I tested as follows on a test server and get a blank white screen and the transaction doesn't complete (it's pending when you go back to the contact's contributions):
cd to the CiviCRM extensions directory (wp-content/uploads/civicrm/ext) Installed org.civicrm.paymentlib master: cv dl org.civicrm.paymentlib@https://github.com/mattwire/org.civicrm/paymentlib/archive/master.zip rm -rf on the existing Stripe extension directory git clone https://github.com/mattwire/com.drastikbydesign.stripe.git cd com.drastikbydesign.stripe git checkout 5.x_noemail cd ... (back to the CiviCRM extensions directory) cv en stripe Went to CiviCRM admin in browser, Administer -> System Settings -> Extensions Stripe extension shows version 5.1.alpha1 See message that the database requires upgrade -- ran those Went to contact record that didn't have an email address Clicked "Contributions" then "Submit Credit Card Contribution" Fill out contribution form and submit Get blank white screen at this URL: https:///wp-admin/admin.php?page=CiviCRM&q=civicrm/contact/view/contribution Hit back, go to contact's contributions, see contribution in list as Pending The relevant error log entry (obfuscating a couple of details) seems to be this: [Wed Sep 19 22:23:42.543596 2018] [proxy_fcgi:error] [pid 3105:tid 140244128966400] [client XXX.XXX.XXX.XXX:61442] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Cannot access protected property CRM_Core_Payment_Stripe::$_paymentProcessor in /opt/bitnami/apps/wordpress/htdocs/wp-content/uploads/civicrm/ext/com.drastikbydesign.stripe/CRM/Stripe/Customer.php:60\nStack trace:\n#0 /opt/bitnami/apps/wordpress/htdocs/wp-content/uploads/civicrm/ext/com.drastikbydesign.stripe/CRM/Core/Payment/Stripe.php(470): CRM_Stripe_Customer::create(Array, Object(CRM_Core_Payment_Stripe))\n#1 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Payment.php(1199): CRM_Core_Payment_Stripe->doDirectPayment(Array, 'contribute')\n#2 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution.php(1176): CRM_Core_Payment->doPayment(Array, 'contribute')\n#3 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution.php(1552): CRM_Contribute_Form_Contribution->processCreditCard(Array, Array, '1611')\n#4 /opt/bitnami/apps/wordpress/htdocs/wp-c...\n', referer: https:///wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fcontact%2Fview&reset=1&cid=1611&key=XXXXXX&context=advanced
Note that it DOES work with a contact that DOES have an email address.
I wasn't sure what if anything would be helpful to check directly in the database so let me know if poking around in there to see what's going on after the upgrade would help.
Thanks again for working on this. If you need more info from my side just let me know.