OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



automatically start service after subcription

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

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

automatically start service after subcription

Postby manson_soup » Sun Oct 19, 2008 6:26 pm

Dear all,

Do you know if I need to start the reading service "automatically" immediately after reader subcription, What can I do?
The bank system will return a message "paid successfully". do I need to write a new code to control the database table "subcriptions"? does it work if I insert new row to table subcriptions directly but not via ojs interface?

Thanks,
Manson
manson_soup
 
Posts: 29
Joined: Mon May 19, 2008 8:06 pm

Re: automatically start service after subcription

Postby jalperin » Mon Oct 20, 2008 12:07 pm

Manson,

You might want to take a look at the way the PayPal plugin works. You'll see how the IPN (PayPal's name for how they post to the site that a payment is received) is handled in this plugin (with a PayPalHandler defined to recognize and act at this URL). You can then do whatever you desire once a successful "payment received" noticed is found.

In this code you can manipulate the subscriptions. However, you should not simply insert into the subscriptions table via an SQL statement. You should use the available classes and methods (i.e. create/update a Subscription object). This will take care of the database for you in a way that will keep everything in OJS internally consistent.

If you need more detailed information, post back here and I will dig into the code and pull out a few lines of code to help guide you.

Good luck!
jalperin
 
Posts: 156
Joined: Thu Jul 06, 2006 1:03 pm
Location: Buenos Aires

Re: automatically start service after subcription

Postby manson_soup » Wed Oct 22, 2008 1:18 am

Dear jalperin,

I found that "Class>payment" and "Class>subscription" containing related code. do I need to create a page for user to select which journal they want to buy or OJS 2.2.2 has create this page?
I think the process like this:
1. the payer select the journal and the price are listed? (question: does OJS provide this form or I need to create it myself?)
2. payer by credit card (this service will provide by the bank)
3. message return from the bank (this service will provide)
4. if AP - Transaction Approved, allow the payer read the journal "automatically". (question: where is the related code ? can OJS automatically allow user read after they paid?)
5. send email to the payer (question: where is the related code ?)

would you answer my question in step 1, 4 , 5?

Manson
manson_soup
 
Posts: 29
Joined: Mon May 19, 2008 8:06 pm

Re: automatically start service after subcription

Postby jalperin » Wed Oct 22, 2008 6:54 am

Manson,

1. the payer select the journal and the price are listed? (question: does OJS provide this form or I need to create it myself?)

OJS does not currently provide this form. This is something we would very much like to add, so if you do this, then I would greatly appreciate it if you could share the code with us. Essentially, you'd have to display something similar to the Subscription Type form to the public and let them click on a link that leads them to a payment. There is already a payment point for subscriptions (in the case the subscription already exists and the user is simply renewing). See pages/UserHandler.inc.php. There is a method there called payRenewSubscription().

2. payer by credit card (this service will provide by the bank)

This should be implemented as a PayMethod plugin. See the PayPal method for more details on how this should be implemented. You'll have to implement a handle() and a displayPaymentForm() methods, among others.

3. message return from the bank (this service will provide)

You will handle the return from the bank inside the handle method mentioned above. You have to point the bank to the appropriate URL (something like, I don't remember exactly, http://www.yourjournal.com/index.php/ab ... PluginName).

4. if AP - Transaction Approved, allow the payer read the journal "automatically". (question: where is the related code ? can OJS automatically allow user read after they paid?)

If you've created the queuedPayment correctly (re: question 1), then you can do $ojsPaymentManager->fulfillQueuedPayment($queuedPayment, $this->getName()). That line is taken from PayPalPlugin.inc.php. This will extend the subscription in the appropriate way. This method can be found in: classes/payment/ojs/OJSPaymentManager.inc.php

5. send email to the payer (question: where is the related code ?)

There are numerous examples in the code of how to compose an email. For example, the PayPal plugin itself sends out an email to the journal manager if something goes wrong. You can look at the Mail and the MailTemplate classes throughout the code.

Good luck!
jalperin
 
Posts: 156
Joined: Thu Jul 06, 2006 1:03 pm
Location: Buenos Aires


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest