Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error when submitting single payment for event #48

Open
twomice opened this issue Mar 31, 2016 · 5 comments
Open

Fatal error when submitting single payment for event #48

twomice opened this issue Mar 31, 2016 · 5 comments

Comments

@twomice
Copy link

twomice commented Mar 31, 2016

In CiviCRM 4.7.4, when submitting a payment for an event registration, through a payment processor of type ewayrecurring, upon clicking the "continue" button on the confirmation page, this error message is displayed:

Fatal error: Class 'GatewayRequest' not found in [extensions_directory]/com.chrischinchilla.ewayrecurring/CRM/Core/Payment/Ewayrecurring.php on line 614

This appears to be very similar to https://issues.civicrm.org/jira/browse/CRM-18070, in which it's been noticed that somehow the class constructor, where EWay class files are being included, is somehow never called. I've confirmed that such is the case here, though I can't quite understand how that's happening.

@twomice
Copy link
Author

twomice commented Mar 31, 2016

As a clumsy workaround, I've patched the code to include the files just before the classes are referenced:

index 810281d..ea8bf53 100644
--- a/CRM/Core/Payment/Ewayrecurring.php
+++ b/CRM/Core/Payment/Ewayrecurring.php
@@ -611,6 +611,10 @@ class CRM_Core_Payment_Ewayrecurring extends CRM_Core_Payment {
    * @throws \CRM_Core_Exception
    */
   protected function getEwayRequest(&$params) {
+
+    require_once 'packages/eWAY/eWAY_GatewayRequest.php';
+    require_once 'packages/eWAY/eWAY_GatewayResponse.php';
+
     $eWAYRequest = new GatewayRequest();

     if (($eWAYRequest == NULL) || (!($eWAYRequest instanceof GatewayRequest))) {
@@ -702,6 +706,10 @@ class CRM_Core_Payment_Ewayrecurring extends CRM_Core_Payment {
     if ($this->getDummySuccessResult()) {
       return $this->getDummySuccessResult();
     }
+
+    require_once 'packages/eWAY/eWAY_GatewayRequest.php';
+    require_once 'packages/eWAY/eWAY_GatewayResponse.php';
+
     $eWAYResponse = new GatewayResponse();

     if (($eWAYResponse == NULL) || (!($eWAYResponse instanceof GatewayResponse))) {

@eileenmcnaughton
Copy link
Collaborator

I'm happy to merge that here if you submit it as a patch

@twomice
Copy link
Author

twomice commented Mar 31, 2016

Yep, can do. But first, is it worth discussing why the class constructor is never firing? What's up with that?

@eileenmcnaughton
Copy link
Collaborator

I guess the object has been cached on the form & so it is not being re-substantiated. Putting the require_onces in the constructor is an unusual pattern - normally you would stick them at the top of the file.

As an aside the Omnipay extension has Eway in it now too - but a different version of the api. It doesn't have feature parity yet but at some point that is likely to take over

@monishdeb
Copy link

Submitted PR in this regard civicrm/civicrm-core#8300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants