I took a quick look at this module (and sub modules). It appears to me the user is expected to enable one of the sub modules for donation, subscription and paid ads specifically.

I just need to make simple payment via paypal. I allow user to register for a training class or pay for a book. I don't care about tracking the orders using the module.

Here is my understanding: if still want to use the base module, I basically need to create a function lm_paypal_pay() like lm_paypal_donate(). My function will just bring up the paypal page and process the payment. There may be some IPN tracking afterward.

I have two questions: 1. Am I on the right track? 2. Can (should) this be a module? (it may be just an additional function in the base module)

If I am on the right track, I can start to work on this feature and contribute it back when I get it working. If it's a module, I anticipate it to be nearly identical as the donation module.

thanks!

CommentFileSizeAuthor
#1 simplepay.zip6.66 KBnewbuntu

Comments

newbuntu’s picture

StatusFileSize
new6.66 KB

I dug deeper into the donation sub module. I appears to me other than a few hard coded strings, this module can be used for generic simple fee payment.

I just renamed relevant "donations" to "simplepay", and changed the default $button_url. (The original design allows caller to override this parameter anyway). I did some quick clicks, it appeared to be working so far. If I find further problems I'll report back here.

I have attached the renamed ("plagiarized" ;) module here. I wonder this "new" module should replace the donation module; then donation would be just a special use case, like in the following example?

 if (function_exists('lm_paypal_simplepay')) {
  // 10 = amount, 'USD' is the currency followed by a description
  print 'We would really like a $10 donation ' .
    lm_paypal_simplepay(10, 'USD', 'donation to example.com', 'http://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif') .'<br/>';
  // The amount is a one element array so an text input with the one value as
  //  default
  print 'Write your own amount to give, we suggest $5' .
    lm_paypal_simplepay(array(5), 'USD', 'donation to example.com', 'http://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif') . '<br/>';
  // The amount is a multi element array so a select will be used. Note if one
  //   of the elements is itself an array that will be the default selection
  // The final two parameters are an alternative button (here we use the default)
  //   and a replacement label before the amount
  print 'We would really like a $10, or more, donation ' .
    lm_paypal_simplepay(array(5,array(10),15), 'USD', 'donation to example.com', 'http://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif', 'Donation') .'<br/>';
    
   }

The only difference between this example and the original document is the extra button URL. If you leave the URL out (like the original example), then you'll see generic paypal button (or you can supply your own button image).

Patroclas’s picture

Maybe I have misunderstood what you are trying to achieve but how does this differ from a button generated by PayPal (https://www.paypal.com/cgi-bin/webscr?cmd=_button-designer) for example?

newbuntu’s picture

I apologize if my previous post sounded misleading. The key is not about the button. I believe the "donation" module should be renamed as a generic paypal payment module.

Nothing is really changed in the "new" module (other than a few variable and function names). Technically, you don't even need to rename the module and still use it for generic payment processing (such as paying for a book, or an online training course). A generic name (like "simplepay") may sound more proper. Otherwise, it may seem a bit odd to use the donation module for generic purchase.

lyricnz’s picture

Reworking this module probably falls into the redesign raised at http://drupal.org/node/328730

newbuntu’s picture

I am still wondering about this. I understand you have another thread open for re-design discussion.

I'm thinking may be there is a long term re-design and a short-term continued development. So far, renaming donation module to a simple (one item) payment has worked for me. I only changed the verbiage, replaced "donation" everywhere in the "new" module. I am wondering if this small change should be made by now? (while everyone is waiting for the long-term final re-work).

2 cents.

john franklin’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Active » Needs review

Sounds like some refactoring is in order. We will look at it for the 2.x release.