drastik / com.drastikbydesign.stripe

CMS Independent Stripe payment processor for CiviCRM 4.x
Other
35 stars 48 forks source link

Joomla 3.8 Webhook Issue #239

Open tmumm opened 7 years ago

tmumm commented 7 years ago

Since Joomla 3.8 update I've been getting an error on webhook. I suspect the router changes in 3.8 may have impacted this. Cron URL's were impacted as well, which was resolved in the latest Civi update. https://github.com/joomla/joomla-cms/projects/7

mattwire commented 7 years ago

@tmumm There have been a few Joomla 3.8 / Civi issues. The fixes for cron/cli.php got merged today (https://github.com/civicrm/civicrm-core/pull/11062). You'll need to provide more details:

This probably not Stripe specific, in which case it should be opened against Civi core. But more detail is required.

tmumm commented 7 years ago

Thanks. This is the URL: https://bicyclecollective.org/index.php/component/civicrm/?task=civicrm/stripe/webhook.

Stripe indicates a 500 error, Civi shows:

Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.

studio136 commented 7 years ago

Stripe 4.7.1 Civi 4.7.25 (with civicrm/civicrm-core#11062 patch) Joomla 3.8.1 I am also getting these Webhook errors. Specifically, 'You are not authorized to access that page'.

I upgraded to Stripe 4.7.2, applied the patch here https://github.com/drastik/com.drastikbydesign.stripe/pull/208/files to fix the Back-End member renewal page that was coming up blank and causing a server error. I believe this fixed the Webhook errors, but then I was receiving fatal error 'js token not passed' when processing payments on the back end.

I rolled back to Stripe 4.7.1 and can now process payments but that leaves me stuck again with the Webhook issue.

mattwire commented 7 years ago

Are you able to try this experimental version? https://github.com/mattwire/com.drastikbydesign.stripe/tree/4.7-mjwconsulting-dev

It doesn't have any specific fixes for the webhook, but is based off the 4.7.2 version and has some fairly major refactoring to fix the js token issues. It would be very helpful to get your feedback

studio136 commented 7 years ago

Thanks, I'll see if I can recreate the issue on a dev site and test this out.

studio136 commented 7 years ago

I tested this out, I immediately got 'js token not passed'. It appears that stripe.js is not loading at all. In stripe.php, if I go back to using the buildForm hook instead of the alterContent, and let stripe.js load the js.stripe.com/v2/ script, contributions are successful both on front-end and back-end. Of course this is no good for Webforms but not an issue with Joomla. I believe the webhooks are working fine.

studio136 commented 7 years ago

Update: Even if I patch this experimental version to work with Joomla, then back end event registration doesn't work, either token not passed OR billing form not loaded.

Wondering, is there any plans to get the Stripe extension working with Joomla? 4.7.1 works except for the webhook - permission denied error (the original problem posted in this issue).

I currently have 3 sites using this extension, 2 of which need the webhook to work.

mattwire commented 7 years ago

@studio136 I need to get it working on a Joomla site too... any info you can give me on where it does/doesn't work would be helpful. There is also a branch here which makes changes to the webhook functions to bring them inline with Civi: https://github.com/progressivetech/com.drastikbydesign.stripe/tree/ptp-latest @jmcclelland and I are working to merge the changes from our two branches together.

tmumm commented 7 years ago

@mattwire Also, noted this error hidden in the messy error page: Stripe Callback: cannot jsondecode data ![0-div_idcrm-containerclasscrm-containerlangenxml_langen__style_type__text_cssmediascreen__import_url_https_bicyclecollective_org_administrator_components_com_civicrm_civicrm_css_civicrm_css__import_url_https___b](https://user-images.githubusercontent.com/19676184/32016111-478e6916-b980-11e7-84aa-a14be4867719.jpg)

studio136 commented 7 years ago

@mattwire For your branch: com.drastikbydesign.stripe-4.7-mjwconsulting-dev

Backend Submit Credit Card Contribution & Backend Submit Credit Card Event Registration stripe.php -> stripe_civicrm_alterContent if (($context == 'form' && !empty($object->_paymentProcessor['class_name'])) || (($context == 'page') && !empty($object->_isPaymentProcessor)))

Neither of these is ever true, so the civicrm_stripe.js file is not loading, causing a Token Not Passed error $object->_paymentProcessor & $object->_isPaymentProcessor don't exist

Backend Submit Credit Card Membership - WORKS Frontend Contribution - WORKS Frontend Membership - WORKS Frontend Event Reg - WORKS

Webhook Test: Error 500: No such event: evt_00000000000000 I believe this would work had an acutal event id been sent

studio136 commented 7 years ago

Branch: com.drastikbydesign.stripe-ptp-latest

Backend Submit Credit Card Membership / Backend Submit Credit Card Contribution /Backend Submit Credit Card Event Registration

**stripe.php -> stripe_civicrm_alterContent**
    `if($context == 'form' && !empty($object->_paymentProcessor['class_name'])) {
  if($object->_paymentProcessor['class_name'] == 'Payment_Stripe') {`

civicrm_stripe.js file is not loading because $object->_paymentProcessor does not exist

Frontend Membership / Frontend Contribution / Frontend Event Registration

Warning: require_once(CRM/Core/Payment/Stripe.php): failed to open stream: No such file or directory in .../public_html/administrator/components/com_civicrm/civicrm/Civi/Payment/System.php on line 59

Fatal error: require_once(): Failed opening required 'CRM/Core/Payment/Stripe.php'

For Clarity, tested both of these on: Joomla 3.8.1 Civi 4.7.25

studio136 commented 7 years ago

@tmumm Curious of what version of Stripe you are using

tmumm commented 7 years ago

Are you referring to plugin version or API version? Original issue was 4.7.1, upgrading to 4.7.2, and just now upgraded to 4.7.3 and issue remains. Interestingly, when I updated to 4.7.2 I got an email from Stripe that said the webhook was fixed, but then the error returned shortly.

On Stripe API Version was outdated, and just upgraded it to the latest - no change.

Also, Joomla 3.8.1 and Civi 4.7.25

studio136 commented 7 years ago

Sorry, was referring to the extension version. One of my sites that reported the webhook was not working, is still on 4.7.1. This morning, I was notified that another extension, Sparkpost, also had an issue accessing the webhook. When I tried to go to the Outbound Email(Sparkpost) settings page, it threw me back to the main civi administrative settings page. So I cleared Civi Cache and was able to then get to the proper page. Funny thing is that right after I cleared the cache, I got a notification from Stripe saying 'Good news - we were able to successfully deliver an event to your endpoint'. So I can only assume that clearing Civi Cache resolved the issue. Thought you might want to give it a shot?

@tmumm Update: I can confirm that clearing Civi Cache resolved the webhook error on 3 sites (as well as the Sparkpost webhook error on numerous sites).

drastik commented 7 years ago

Update: I can confirm that clearing Civi Cache resolved the webhook error on 3 sites (as well as the Sparkpost webhook error on numerous sites).

This is extremely valuable info.

@tmumm Can you try clearing Civi Cache and let us know how that went? This would be great information to put in the README, I've been getting a ton of e-mails about issues w/ upgrade.

mattwire commented 7 years ago

@drastik @tmumm Clearing cache sound like it might well be the IDS system in Civi which would probably be resolved by https://github.com/drastik/com.drastikbydesign.stripe/pull/229

drastik commented 7 years ago

Clean, merged #229

tmumm commented 7 years ago

Unfortunately clearing the cache had no impact for me. I cleared both the Joomla and Civi cache.