CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • How to properly install and config an ext of the payment process in Joomla?
Pages: [1]

Author Topic: How to properly install and config an ext of the payment process in Joomla?  (Read 3374 times)

stars

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: 4.4.2
  • CMS version: Joomla 2.5.16 Stable
  • MySQL version: 5.5.32
  • PHP version: 5.4.19
How to properly install and config an ext of the payment process in Joomla?
January 26, 2015, 08:09:25 am
Hi everyone, I'm new to the community and I'm sorry for the English translation, however, I have to develop a new payment processor using Joomla 2.5.16 Stable with CiviCRM 4.4.2.

I wanted to know if any of you can help me on how to make a successful installation of an extension of a payment processor. I have already made some steps, but I wanted to figure out if I'm on the right track and if someone can clarify some doubts about it.

I installed the new payment processor, using the tool civix in: "C: \ xampp \ htdocs \ xxxx \ administrator \ extension \ org.xxxx.payment.yyyy"
I created here the folder extension to include the module. And 'correct create here the extension or is there a specific folder for the installation of extensions in joomla CiviCRM?

In info.xml file to configure, I set the following commands:

In the "key" the name of the directory created by the following command: civix generate: module org.xxxx.payment.yyyy.
In the tag "file" the name of the file to launch during the installation of the module that will be equal to the file name and yyyy.php yyyy.civix.php always generated by civix. Correct here?
The tag namespace is essential?

<extension key = "org.xxxx.payment.yyyy" type = "payment">
<file> yyyy </ file> ...
...
<civix> <namespace> CRM / xxxx </ namespace> </ civix>

In any case, when I go to install / disable / uninstall the extension gives me the following error:

Fatal error: Class 'org_civicrm_xxxx_payment_yyyy' not foundinC:\xampp\htdocs\xxxx\administrator\components\com_civicrm\civicrm\CRM\Extension\Manager\Payment.php on line 268

Can not find the above class, in what I did wrong? Lacks a specific class or where to move the sources somewhere else?

If I go back, the module is installed, thus tainting db and folders.
(If you want to do a clean install every time I have to restore db and folder).

Thank you all.
Hello

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: How to properly install and config an ext of the payment process in Joomla?
January 26, 2015, 06:30:03 pm
Quote from: stars on January 26, 2015, 08:09:25 am
I installed the new payment processor, using the tool civix in: "C: \ xampp \ htdocs \ xxxx \ administrator \ extension \ org.xxxx.payment.yyyy"
I created here the folder extension to include the module. And 'correct create here the extension or is there a specific folder for the installation of extensions in joomla CiviCRM?

That should be fine - as long as you configure Civi to use it (/civicrm/admin/setting/path?reset=1 and /civicrm/admin/setting/url?reset=1 ).

Quote from: stars on January 26, 2015, 08:09:25 am
In info.xml file to configure, I set the following commands:

In the "key" the name of the directory created by the following command: civix generate: module org.xxxx.payment.yyyy.
In the tag "file" the name of the file to launch during the installation of the module that will be equal to the file name and yyyy.php yyyy.civix.php always generated by civix. Correct here?
The tag namespace is essential?

<extension key = "org.xxxx.payment.yyyy" type = "payment">
<file> yyyy </ file> ...
...
<civix> <namespace> CRM / xxxx </ namespace> </ civix>

In any case, when I go to install / disable / uninstall the extension gives me the following error:

Fatal error: Class 'org_civicrm_xxxx_payment_yyyy' not foundinC:\xampp\htdocs\xxxx\administrator\components\com_civicrm\civicrm\CRM\Extension\Manager\Payment.php on line 268

In Civi 4.2, we made some major changes in how extensions are organized. (The changes made extensions much more flexible+powerful, but we kept backward-compatibility with the old style.) When you ran "civix generate:module", it created code in the new style. Unfortunately, some of the payment-processor documentation follows the old style. This is the basic mismatch.

You can recognize the old-style and new-style in info.xml and in the yyyy.php file. Compare:

Code: [Select]
// Old style (Civi 3.x).
// The "type" is highly-specialized/constrained -- e.g. "payment", "report", "search".
// Comparable to Joomla extension.

// FILE: info.xml
<extension key="com.example.yyyy" type="payment">
  <name>yyyy</name>
   ...
  <typeInfo>
    <billingMode>...</billingMode>
    ...
  </typeInfo>
  <!-- full example: http://wiki.civicrm.org:8090/confluence/display/CRMDOC40/Example+of+Creating+A+Payment+Processor+Extension -->
</extension>

// FILE: yyyy.php
class com_example_yyyy extends CRM_Core_Payment {
  ...
}


Code: [Select]
// New style (Civi 4.2+).
// The only type is "module", and "module" is very flexible.
// Comparable to Drupal module, WordPress plugin, or Symfony bundle.

// FILE: info.xml
<extension key="com.example.yyyy" type="module">
  <file>yyyy</file>
   ...
</extension>

// FILE: CRM/Core/Payment/Yyyy.mgd.php
<?php
return array (
  
0 =>
  array (
    
'name' => 'yyyy',
    
'entity' => 'PaymentProcessorType',
    
'params' =>
    array (
      
'version' => 3,
      
'name' => 'yyyy',
      
'title' => 'Yyyy',
      
'description' => 'Yyyy',
      
'class_name' => 'Payment_Yyyy',
      ...
    ),
  ),
);

// FILE: CRM/Core/Payment/Yyyy.php
class CRM_Core_Payment_Yyyy extends CRM_Core_Payment {
  ...
}

There's a more complete example at https://github.com/eileenmcnaughton/nz.co.fuzion.cmcic/blob/master/ . In particular, note:

  • info.xml uses type="module"
  • https://github.com/eileenmcnaughton/nz.co.fuzion.cmcic/blob/master/CRM/Core/Payment/cmcic.mgd.php declares metadata
  • https://github.com/eileenmcnaughton/nz.co.fuzion.cmcic/blob/master/CRM/Core/Payment/Cmcic.php defines payment processorbehavior

stars

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: 4.4.2
  • CMS version: Joomla 2.5.16 Stable
  • MySQL version: 5.5.32
  • PHP version: 5.4.19
Re: How to properly install and config an ext of the payment process in Joomla?
January 27, 2015, 01:47:22 am
Thank you for your prompt response.

Another problem is when I run civix to create the form.
Create the following files:

info.xml
myextension.php
myextension.civix.php

and folders:

CRM / myextension /
templates /
xml /
build /

The output from the console is:

License Set to AGPL-3.0 (authored by FIXME <FIXME>)
If this is in error, please correct info.xml and LICENSE.txt
Initalize module org.xxx.payment.yyy
Write org.xxx.payment.yyy\ info.xml
Write org.xxx.payment.yyy\ yyy.php
Write org.xxx.payment.yyy\ yyy.civix.php
Write org.xxx.payment.yyy\ LICENSE.txt
Could not load the settings file at: /var/www/aaa/joomla/administrator/components/com_civicrm/civicrm.settings.php

It 's very strange that is attempting to load a file with a pattern instead of a pattern Unix Windows since it is a Windows web server Apache.

Anyway I went to file civicrm.settings.php reference is I modified the code as follows (I only changed the path):


define ('CIVICRM_SETTINGS_PATH', 'C: \ xampp \ htdocs \ zzz\ administrator \ components \ com_civicrm \ civicrm.settings.php');
$ error =include_once ('C: \ xampp \ htdocs \ zzz\ administrator \ components \ com_civicrm \ civicrm.settings.php');
if ($ error == false) {
     echo "Could not load the settings file at: C: \ xampp \ htdocs \ zzz\ administrator \ components \ com_civicrm \ civicrm.settings.php";
     exit ();
}

// Load class loader
require_once $ civicrm_root. '/CRM/Core/ClassLoader.php';
CRM_Core_ClassLoader :: singleton () -> register ();


I deleted the folder-created form and re-launched with the command civix generate: module, this time the following message appears, creandomi plus a folder called more "upload":

License Set to AGPL-3.0 (authored by FIXME <FIXME>)
If this is in error, please correct info.xml and LICENSE.txt
Initalize module org.xxx.payment.yyy
Write org.xxx.payment.yyy\ info.xml
Write org.xxx.payment.yyy\ yyy.php
Write org.xxx.payment.yyy\ yyy.civix.php
Write org.xxx.payment.yyy\ LICENSE.txt
Refresh extension list for "http://MySite/administrator/"
Refresh error: Warning: opendir (extension, extension): Can not find the fil
and specified. (code: 2) in C: \ xampp \ htdocs \ zzz\ administrator \ c
omponents \ com_civicrm \ CiviCRM \ CRM \ Utils \ file.php line 540

Why these differences? The Windows version is an adaptation of the Linux version?
And 'correct that civix I create folder other than those listed above?

Have you ever encountered an error similar to mine with civix?

Thank you all.

stars

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: 4.4.2
  • CMS version: Joomla 2.5.16 Stable
  • MySQL version: 5.5.32
  • PHP version: 5.4.19
Re: How to properly install and config an ext of the payment process in Joomla?
January 27, 2015, 05:33:33 am
Hi, I was inspired by this example as consigliatomi: https://github.com/eileenmcnaughton/nz.co.fuzion.cmcic/
But having set in the info file attribute type = "module", install the extension as generic module.

What I get is an extension of type "Payment" in such a way to add a new payment processor and be able to perform transactions.

I can make sure that during installation, maybe by editing yyyy.civicrm.php execute query insert into the DB tables?

In this case, what are the tables involved in addition to the following tables:

civicrm_payment_processor
civicrm_payment_processor_type

Thank You

stars

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: 4.4.2
  • CMS version: Joomla 2.5.16 Stable
  • MySQL version: 5.5.32
  • PHP version: 5.4.19
Re: How to properly install and config an ext of the payment process in Joomla?
February 16, 2015, 05:43:18 am
Hi, I found a solution (maybe not elegant) to the problem, not the solution I embarked indicatami post in response, because although I could install the module, CiviCRM not played him as payment type.

So I carry my solution to help other users if you were to come across the same problem.
This is a specific solution to the problems I faced as described in the posts here at the top.
The steps I followed are suguenti:

1. Prepare your new extension of the payment form

a. Went to "C: \ xampp \ htdocs \ mysite \ administrator" and created a new folder extension.
b. Inside the folder "extension", used the tool civix to create a new module with the following command: civix generate: module xxx.yyy.payment.name
• xxx.yyy: choose a unique key to pleasure for your extension.
• name: name of the extension (if unique is better).

2. Configuration from administration panel CiviCRM

a. Entered as an administrator in CiviCRM, then from the navigation menu on the home, went to: Administrator -> System Settings -> Folders.
b. Then under Folder extensions CiviCRM I can see the path of the folder "extension" created previously.

3. Edit the file info.xml

<? xml version = "1.0"?>
<extension key = "<xxx.yyy.payment.name>" type = "payment">
<file> name </ file>
<name> Name </ name>
<description> what you want </ description>
<license> AGPL-3.0 </ license>
<maintainer>
<author> </ author>
<email> </ email>
</ maintainer>
<urls>
<url desc = "Main Page Extension"> </ url>
<url desc = "Documentation"> </ url>
<url desc = "Support"> </ url>
<url desc = "Licensing"> http://www.gnu.org/licenses/agpl-3.0.html </ url>
</ urls>
<ReleaseDate> 01/29/2015 </ ReleaseDate>
<version> 1.0 </ version>
<develStage> alpha </ develStage>
<compatibility>
<ver> 4.2 </ ver>
<ver> 4.4 </ ver>
</ compatibility>
<comments> </ comments>
<typeinfo>
<userNameLabel> User ID </ userNameLabel>
<passwordLabel> Password </ passwordLabel>
<signatureLabel> </ signatureLabel>
<subjectLabel> </ subjectLabel>
<className> Payment_Name </ className>
<urlSiteDefault> https://www.prova.com/initInsert.do </ urlSiteDefault>
<urlApiDefault> </ urlApiDefault>
<urlRecurDefault> </ urlRecurDefault>
<urlSiteTestDefault> </ urlSiteTestDefault>
<urlApiTestDefault> </ urlApiTestDefault>
<urlRecurTestDefault> </ urlRecurTestDefault>
<urlButtonDefault> </ urlButtonDefault>
<urlButtonTestDefault> </ urlButtonTestDefault>
<billingMode> notify </ billingMode>
<isRecur> 0 </ isRecur>
<PaymentType> 1 </ PaymentType>
</ typeinfo>
<civix>
<namespace> CRM / Name </ namespace>
</ civix>
</ extension>

4. Add the classes php form of payment

a. Copy the .php file that contains the logic to execute your payment processor in "C: \ xampp \ htdocs \ mysite \ administrator \ components \ com_civicrm \ CiviCRM \ CRM \ Core \ Payment"
b. Name.php, which contains the logic to perform the method to process your request to specific payment gateway (Paypal, etc.).
c. NamePaymentIPN.php (name you like) file containing the logic to process the requests sent by the event listener ipn.
d. NamePaymentNotify.php copied the file to "C: \ xampp \ htdocs \ mysite \ administrator \ components \ com_civicrm \ CiviCRM \ extern"

Now you can install the extension of the payment form.

If you try to run / disable / uninstall the module, you will see the following error:
Fatal error: Class 'xxx.yyy.payment.name' not found inC:\xampp\htdocs\miosito\administrator\components\com_civicrm\civicrm\CRM\Extension\Manager\Payment.php on line 266
The problem in my opinion, is in the field class_name table civicrm_payment_processor_type where is saved the key module installed, ie the value of the Key field in the file info.xml, instead of respecting the naming convention as for other types of payment processors already installed as: Payment_Name.


I changed the value of the field class_name from DB by inserting "Payment_Name" instead of "xxx.yyy.payment.name".

WARNING: in this way, however, does not solve the problem entirely, because in case you want to disable the extension for example, will continue to give you a fatal error as mentioned above. The problem is located in the classes contained in the "C: \ xampp \ htdocs \ mysite \ administrator \ components \ com_civicrm \ CiviCRM \ CRM \ Extension". So a possible solution, although not recommended, would be to solve the problem by directly editing the source code or try upgrading to the latest version of the module CiviCRM if possible.

I hope to be helpful in some way. If you solved otherwise write me.
Hello everyone.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • How to properly install and config an ext of the payment process in Joomla?

This forum was archived on 2017-11-26.