CVS edit link for Tom.INXCO

Hi!

My name is Tom Van Schoor and I work for the company INXCO bvba (www.inxco.be) based in Belgium as a PHP developer.

When searching through the modules on drupal.org for a module to integrate the Ogone platform you find two modules:

1. e-Commerce - Ogone payment gateway (only dev edition available)
2. Ogone | Ubercart payment

Both modules use hooks from existing e-commerce modules and therefor are not usable in custom modules created by drupal programers. You could call them addons for respectively the e-commerce module and the Ubercart module.

But what if someone creates a module that needs online payment using the Ogone platform? Of course they can copy paste some of the structures used in those two modules but on he whole he would need to reinvent the wheel over and over again.

Therefor we decided to create a drupal 6 module for implementing the Ogone payment platform into drupal modules. It is not a stand alone module, but as opposed to the previous two, ours 'provides' hooks that can be used as a mechanism to do online payments with the Ogone system.
The hooks can be implemented into multiple modules on the same drupal website as it also provides a prefix system for each module that implements the hooks.

The module supports all of the functionalities provided by the Ogone e-commerce in 3-tier mode, including subscriptions or re-occuring payments. All depends on the data you provide in the first hook: hook_ogone_data.
It is fully configurable with the settings you choose in your Ogone account settings page, and the module's configuration form provides tips on how to fill out that rather complicated account settings page.

The hooks provided are:

- hook_ogone_data: Fetches the data needed to build up the form to be posted to the Ogone platform.

- hook_ogone_theme_overview: Themes the order details and adds the submit button to go to the Ogone checkout pages.

- hook_ogone_payment_accept: Handles the accepted payments.

- hook_ogone_payment_decline: Handles payments that have been declined by the Ogone system.

- hook_ogone_payment_exception: Handles payments where an exception occured. Exceptions are errors that happen on the Ogone platform, so outside the drupal environment.

- hook_ogone_payment_cancel: Handles canceled payments.

The project is ready to be tested by the drupal community and we hope people will enjoy and help improve this module.

A demonstration, complete integration guide and extra information can be found at the project site:

http://eam.werksite.be

Please feel free to contact me for further information or explanations on my e-mail: tom@inxco.be

Cheers,
Tom Van Schoor

Comments

Tom Van Schoor’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: -Module review
StatusFileSize
new14.85 KB

This is the module I want to contribute.

avpaderno’s picture

Status: Postponed (maintainer needs more info) » Needs review
Issue tags: +Module review
avpaderno’s picture

Status: Postponed (maintainer needs more info) » Needs work
Issue tags: +Module review
  1. See the Drupal coding standards to understand how a module code should be written.
  2. It seems there is a misunderstanding about hooks, how they are used, and how they are defined.
    See what reported in http://api.drupal.org/api/group/hooks/6, before the list of Drupal standard hooks. A hook doesn't do anything if is not invoked by Drupal core code, Drupal core module, or third-party modules; a custom hook will never be called from Drupal, which ignores its existence.
  3.       '#title' => t('Prefix for ') . $module . t(' orders'),
          '#description' => t('Enter a unique prefix to add to your order id for orders from module '. $module),
    

    t() has placeholders, which are used in cases like this.

Tom Van Schoor’s picture

StatusFileSize
new14.95 KB

Thanks KiamLaLuno for the review.

1. Can you give an example where i did not follow the coding standards? Because I have tried to follow them as much as possible and I used the coder module to check.
The code-style.pl script does give notices about the keys I use in arrays. They use very diverse casing and style but this is with a reason: I follow the notation of variables expected by the Ogone payment platform. And I know they don't follow any style, I also think Ogone should do something about that, however to keep Ogone users from getting confused I adopted Ogone's naming convention (if you could call it that)...

2. The defined hooks in the ogone.module file are there for instructional reason only.
The usage of these hooks is explained in detail on the project site: http://eam.werksite.be/hooks

The defining of the hooks I did following the guidelines of the book: Learning Drupal 6 Module Development by Matt Butcher. They state on page 255:

There are a few ways to make your hook user-friendly.

The first is by including details about the hook in the documentation block of the code that invokes the hook.

The second way is to create a hook function in your code. This function is not called anywhere. Instead, it serves an instructional role.

I have updated my comments slightly to make this more clear in the new zip.

Each dummy hook function has a line of comment "!!! This code is instructional only, it provides hints on how to implement this hook into your modules !!!"

On line 346 to 361 as well as on line 392 to 402 are comments showing what we envoke and where we envoke it.

3. Ok fixed that, using place holders in all t() functions

Thanks again for checking it out.

avpaderno’s picture

The example hooks are normally placed in a file that is not included from the module; for your module, it should be named ogone.api.php.

avpaderno’s picture

The coding standards have suggestions also about which functions to use; your module is not following those suggestions.

Tom Van Schoor’s picture

Aha ok thanks I will place them there.

Tom Van Schoor’s picture

StatusFileSize
new16.8 KB

Again thanks for your help KiamLaLuno.

Here is what I adjusted in the new file attached:

- Moved hook declarations to ogone.api.php.
- Changed strtoupper into drupal_strtoupper.
- Added hook_help() to provide extra information for installation and integration.
- Added hook_install() into the ogone.install file to tell users what to do after they installed.
- Checked comments with API module for doxygen compliance, added comments where they were missing.
- Double checked if all user or link input are filtered with check_plain() - this was already ok.

Any feedback is welcome :)

avpaderno’s picture

Status: Needs work » Needs review

Remember to change the status, when you upload new code; differently, your code would not be reviewed.

Tom Van Schoor’s picture

Thanks for changing it for me KiamLaLuno, I appreciate.

avpaderno’s picture

Status: Needs review » Fixed
  1.       return t($help_text, $replace);
    

    The first argument for t() must be a literal string, or the script used to extract the translatable strings will not be able to extract the string to translate.

  2. Also the backslash should be removed from the following string: '<strong class=\"drupal_link_admin_settings\">Administer >> Ogone settings >> Configuration</strong>. The module\'s configuration '; as the string delimiter is the single quote, there is no need to escape the double quote used for the class identifier.
    It would also be better to use module configuration to avoid problems with the escaped single quote.
Tom Van Schoor’s picture

StatusFileSize
new17.27 KB

For completing your final review on this, here is the zip with the last of the edits.

I will now use my cvs account to upload and start a project for this module.

Thank you KiamLaLuno.

Status: Fixed » Closed (fixed)
Issue tags: -Module review

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Assigned: Unassigned » avpaderno
Issue summary: View changes
Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.