modification of payment procedure

OCS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, michael

Forum rules
The Public Knowledge Project Support Forum is moving to

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Posts: 30
Joined: Wed May 14, 2008 8:11 am
Location: Pisa, Italy

modification of payment procedure

Postby iluber » Thu Aug 21, 2008 9:07 am

I would like to modify the payment process in OCS and since I think it coul be something that could be given back to OCS has a contibution I would like some suggestion on how to do that.

Actually it's possible for the user to use only one payment method: the one configured in the backend.
First I was planning to enhance OCS to be configured to display to the user more than one payment method, but I have changed my mind because it would be to expensive in time for me, since it would involve a change in the database schema and changes both at the user and backend sides of the interface.

Then I have thought to change the behavior of OCS so to show always the manual payment as an option to the user, even if an online payment method has been configured.

For what I see this could be done only changing the behavior of OCS in the registering user interface.

Is this something that could be added to OCS next release if properly realized ?

If yes, then I could write it and send a patch, otherwise I should implement a plugin but it could be more time expensive.
If I should implement the plugin, since, for what I see there are not hooks neither in php files nor in the templates involved in the registration process, I could use the hook in the OCS root index.php page to change the $sourceFile variable so to pass to the following require the proper argument to redirect the request to my new registration form.

Can some of the developers tell me what you guys think about all I have written above just to know if I'm on the right path?

Posts: 30
Joined: Wed May 14, 2008 8:11 am
Location: Pisa, Italy

Re: modification of payment procedure

Postby iluber » Thu Sep 04, 2008 12:34 am

any hope to receive an answer ?

Posts: 158
Joined: Thu Jul 06, 2006 1:03 pm
Location: Buenos Aires

Re: modification of payment procedure

Postby jalperin » Thu Sep 04, 2008 9:03 am


My apologies for the long delay in replying. I am the primary developer of the payment module, but I have not had a chance to reply to forum posts in the last few weeks. I hope that I can help answer your questions and concerns in a more timely fashion from here on in.

Your idea is one that I would like to have implemented in both the OCS and OJS core code as a configurable option sometime in a future release, so any work you may do to get us going down this path would be most welcome as a patch for consideration. I agree that it will be a bit more time intensive to allow for any number of payment methods, but I think it is the way we'd like go go.

I would suggest something along the lines of the following:
- convert the paymethod journal setting into an array, allowing for any number of options to be selected.
- you will have to change the UI for paymethod settings so that more than one option can be enabled at a time (probably with checkboxes)
- change the registration screen so that the user is presented with all the available options. For this you will have to go to the paymentHandler and intercept the method that displays the payment form. Instead, multiple options should be selected, each leading to the appropriate payment form.

Does this make sense? Its my initial thoughts on the subject and they are open to discussion as you try to tackle the problem and face challenges. I'll be happy to review intermediate work or a finished product once you have something ready.

Thank you for your interests

Posts: 30
Joined: Wed May 14, 2008 8:11 am
Location: Pisa, Italy

Re: modification of payment procedure

Postby iluber » Fri Sep 05, 2008 11:33 am

jalperin, I hope I didn't seem rude, it was only a way to send an alert, since I know administrators of the forum receive notifications usually of the new messages.
I perfectly agree about your suggestions: it was exactly the path I meant to follow.
I probably will ask for some clarification once I start to implement the modification.
Thank for your answer.

Posts: 30
Joined: Wed May 14, 2008 8:11 am
Location: Pisa, Italy

Re: modification of payment procedure

Postby iluber » Mon Feb 22, 2010 10:29 am

I have been solicited by user of the forum, then I post how I have solved the problem

Unfortunately I couldn't follow the path illustrated in the post because of lack of time.
So my solution is not clean as it should be and I have never had the chance to write a patch due to the fact that my repository got broken a few times and I had to restore my working copy which included a lot of changes in many points of OCS code.

What I had done is basically the following.
I didn't add a new configuration option, the user either select the manual or the paypal option.
In the template I have modified the layout so that when paypal payment mode is configured, it shows a radiogroup.
Then the user must choose either one of them.
In the execute method of the UserRegistratioForm I have inserted a call to a new method defined in class PaymentManager

function displayPaymentFormUserChosen($queuedPaymentId, &$queuedPayment, $paymentMethodPluginName) {
$paymentPlugin =& $this->getPaymentPluginByName($paymentMethodPluginName);
if ($paymentPlugin !== null && $paymentPlugin->isConfigured()) return $paymentPlugin->displayPaymentForm($queuedPaymentId, $queuedPayment);
return false;

Where the value of the $paymentMethodPluginName parameter is the value passed at form submission by selecting one of the two radios.
In this way the payment method used depends both from the configuration and the user choice.

Return to “OCS Development”

Who is online

Users browsing this forum: No registered users and 0 guests