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) »
  • Ogone payment processor
Pages: [1]

Author Topic: Ogone payment processor  (Read 6611 times)

cray146

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 1
  • CiviCRM version: 4.2
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.3
Ogone payment processor
August 05, 2011, 04:56:29 am
Hi,

I've written a payment processor extension for Ogone, a payment service provider active in several European countries. The code is based heavily on the UC Merced Payment Processor, documented on the wiki: http://wiki.civicrm.org/confluence/display/CRMDOC40/Example+of+Creating+A+Payment+Processor+Extension

I'd like to donate the code for further review by the community and inclusion in core.

Attached is the info.xml file (added extension txt to allow for upload). Code is hosted on GitHub: https://github.com/cray146/CiviCRM-Ogone-Payment-Processor

Cheers,

c.

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Ogone payment processor
August 05, 2011, 05:00:45 am
Thanks for your work. I hope it would be useful to lot of people in the community.

Kurund
Found this reply helpful? Support CiviCRM

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Ogone payment processor
September 15, 2011, 07:29:12 pm
Thanks! I appreciated having another payment processor to look at.

Does the OgoneNotify.php file you include process notifications correctly?

I ask because when I attempted to follow a similar pattern, I found that my notify handler didn't load the core extension class unless I added code to do so specifically. It appeared that the extension directories weren't in my load path, but in yours it seems like you're able to just do
Code: [Select]
require_once "OgoneIPN.php";.

I've opened a thread about this at http://forum.civicrm.org/index.php/topic,21573.0.html

My solution - https://github.com/GiantRobot/civicrm_flo2cash_donate/blob/master/nz.co.giantrobot.flo2cashdonate/f2c_ipn.php#L9

EDIT: I tested Ogone and on my setup it did fail on IPN as I expected, so I've forked your repo and fired back a pull request with a fix. Hope it helps.
« Last Edit: September 15, 2011, 07:43:19 pm by grobot »
@xurizaemon ● www.fuzion.co.nz

Jeroen~

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • WoesteLand
  • CiviCRM version: CiviCRM 4.2
  • CMS version: Drupal 7
Re: Ogone payment processor
October 02, 2011, 11:48:36 am
I like this payment processor.
I get the notification in Ogone that I paid.

But when I return to my site, I get the message:
"
Failure: Could not find payment processor for contribution record:
Failure: new order data not valid
Warning: Cannot modify header information - headers already sent by (output started at OgoneIPN.php:254) in /sites/all/modules/civicrm/CRM/Utils/System.php on line 333
"

I figured out that BaseIPN.php doesn't get the variables needed. Event ID is empty.
Can't figure out where it goes wrong do. I think the $ids array isn't filled, but why?
I hope the error is fixed soon, I really could use this on my site.
And I'm willing to help test this.
« Last Edit: October 03, 2011, 10:04:28 am by grootte »

Jeroen~

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • WoesteLand
  • CiviCRM version: CiviCRM 4.2
  • CMS version: Drupal 7
Re: Ogone payment processor
October 12, 2011, 10:07:36 am
I found the bug: OgoneIPN looks for the following line in contribution source: 'Online Event Registration' but in my installation (in Dutch) source has the following line: 'Online evenement registratie: dit is een test' so source is translated!

The string is used to check witch component to use and is looking for it in the source field of the contribution table. As described in http://wiki.civicrm.org/confluence/display/CRMDOC40/Example+of+Creating+A+Payment+Processor+Extension

in the wiki a file is described: UCMPaymentCollectionNotify.php
with the function:
static function getContext($privateData) {

OgoneIPN uses exactly this function, but on a translated site this is the wrong way to do this.

If u have a translated site and want to use this payment method, translate the text in de php file.
I don't know why civicrm translates the text in the database, now source can't be used for looking for the correct component.

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Ogone payment processor
October 13, 2011, 08:37:02 pm
As per my comment in https://github.com/cray146/CiviCRM-Ogone-Payment-Processor/issues/3

Rather than hacking the processor to compare with the translated string, you can simply use CiviCRM's translation function in the test.

Swap
Code: [Select]
  if (stristr($contribution->source, 'Online Contribution')) {
    $component = 'contribute';
  }
  elseif (stristr($contribution->source, 'Online Event Registration')) {
    $component = 'event';
  }
for
Code: [Select]
  if (stristr($contribution->source, ts('Online Contribution'))) {
    $component = 'contribute';
  }
  elseif (stristr($contribution->source, ts('Online Event Registration'))) {
    $component = 'event';
  }

But I think it's not ideal to be testing against a translated text string here anyway. $contribution must have some property which represents the internal data for 'event' or 'contribution', rather than matching translateable strings.
@xurizaemon ● www.fuzion.co.nz

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Ogone payment processor
October 14, 2011, 09:37:27 am

Couple of options for this:

1. We "embed" this information in the payment processor callback (which is on a per transaction basis). That way we know from the URL what operation needs to be performed and can do cross checks

OR

2. Given the contribution ID, you can go look in the DB and see if there is a match with event or membership. You can use that information.

personally i prefer option 1, since we can then do more cross reference checks etc

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

andersiversen

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 1
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: Ogone payment processor
October 31, 2011, 09:48:41 pm
Hi Grobot, Cray and others

Thanks for the example Cray - it's very usefull!

I'm struggling with the same issues as Grobot though and even though I've followed the example here: http://forum.civicrm.org/index.php/topic,21573.0.html (or https://github.com/GiantRobot/CiviCRM-Ogone-Payment-Processor/commit/0abe532e553fa570a4b04a87a4e1645498727246) it's still not working for me.

I'm making a payment extension for Quickpay, and it works all the way up to getting back to the civicrm (event) page - the url in the browsers address bar even changes to example.com/civicrm/event/register?_qf_ThankYou_display=1&qfKey=somekeyhere - but the page is the one I left (the last step of the event registration), and the payment status is "Pending from incomplete transaction" even though it's been captured with Quickpay.

Quickpay needs a callbackurl -  what should it be ? right now it is set to   $config->userFrameworkResourceURL . "extern/QuickpayNotify.php";
Is that right ?

Thanks in advance for any help :)

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Ogone payment processor
November 01, 2011, 03:20:55 pm
Check if QuickPay offers allows you to provide both a callback URL (for payment notification / IPN) and a return URL (for the customer's browser to be directed to). Many payment processors use different URLs for these; it sounds like QuickPay is defaulting to the referrer in the absence of a specfied URL.
« Last Edit: November 01, 2011, 03:26:19 pm by grobot »
@xurizaemon ● www.fuzion.co.nz

andersiversen

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 1
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: Ogone payment processor
November 01, 2011, 07:18:50 pm
It does have a return url, it is set to this:
Code: [Select]
$returnURL = CRM_Utils_System::url( $url, "_qf_ThankYou_display=1&qfKey={$params['qfKey']}", true, null, false );in the function doTransferCheckout

The extension uses it's own redirect function in doTransferCheckout, because it uses POST to post the parameters to the payment gateway. Does it mean anything that I don't use CRM_Utils_System::redirect($this->_paymentProcessor['url_site']) like in the example in documentation ?

Thanks again

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Please post code & move QuickPay to new thread
November 02, 2011, 01:48:07 pm
It's hard to answer usefully without seeing more than a line of code, and a thread on the Ogone processor is probably not the best place to get help on QuickPay.

I suggest throwing your extension up on Github (or similar), and creating a separate thread in this forum to discuss your extension.
@xurizaemon ● www.fuzion.co.nz

andersiversen

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 1
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: Ogone payment processor
November 03, 2011, 06:54:58 pm
Thanks grobo - I've started a new thread and put the code at github - thread with links and info here:
http://forum.civicrm.org/index.php/topic,22183.0.html

RobertPattinson

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • moovieland
    • watch mission impossible 4 online
  • CiviCRM version: 3.4
  • CMS version: 4.0
  • MySQL version: 5.0
  • PHP version: 5.2.4
Re: Ogone payment processor
December 01, 2011, 04:58:09 am
Thanks for your work. I hope it would be useful to lot of people in the community.

robbiemc

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 0
  • CiviCRM version: 4.5.0
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.37
  • PHP version: 5.3.28
Re: Ogone payment processor
January 16, 2012, 09:47:56 am
Hi

I am trying to set up the payment processor for OGONE so that I may take IDEAL payments but getting a little bit lost.

I have created an extensions folder '/sites/default/files/civiextensions/' and loaded the package but I haven't really got a clue in terms of how to add a symbolic link as per the instructions below

* follow the instruction to install the extension: http://wiki.civicrm.org/confluence/display/CRMDOC40/Extensions+Admin
* make a symbolic link in <civicrm root>/packages/OgoneUtils.php to OgoneUtils.php
* make a symbolic link in <civicrm root>/extern/OgoneNotify.php to OgoneNotify.php


From the upload I don't have an '/extern/' file.

If anyone can help and point my in the right direction most appreciatted.

Cheers

Robbie

Matthias de MAUROY - CYIM

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 4
  • Working at CYIM
    • CYIM
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • MySQL version: 5.1.66-community-log
  • PHP version: 5.3
Re: Ogone payment processor
February 11, 2014, 08:25:50 am
Hello robbiemc,

I may be wrong but the extension folder should be inside of civicrm directory like "sites/all/modules/civicrm/extension" (I assume you are using Drupal... ?)

And you should create symbolic link in "civicrm/packages/" and "civicrm/extern" named OgoneUtils.php and OgoneNotify.php pointing on  "civicrm/extension/OgoneExtensionName/packages/OgoneUtils.php" and "civicrm/extension/OgoneExtensionName/OgoneNotify.php"

Hope it helps.
Matthias de MAUROY
Analyste Web Developpeur
BU WEB
Tél. : +33 (0)2 99 22 83 40
Fax : +33 (0)2 99 22 83 41
Mail : m.mauroy@cyim.com
CYIM
31, rue de la Frébardière
35135 CHANTEPIE
FRANCE

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Ogone payment processor

This forum was archived on 2017-11-26.