Jump to content

Automatically cancel clients PayPal subscription


JulesR

Recommended Posts

Jules,

 

You're right, I'm sorry I didn't ask beforehand. I've become accustomed to non-encrypted code (with unspecified licensing) having an implied 'do what you like with this' meaning to it. We can have a forum admin take it down if you'd like; just say the word!

 

If it helps at all, author credit is, of course, ascribed to you.

 

Jordan

Edited by jas8522
Clarification
Link to comment
Share on other sites

  • Replies 57
  • Created
  • Last Reply

Top Posters In This Topic

Sure, I provided the code non-encrypted so that others could make their own local modifications if necessary, not really with the intention that someone would take the bulk of what I did and make something else of it. But no harm done :)

 

Your code seems to be based on an old version of my hook by the way. I made some tweaks and changes later on to ensure it only looks at PayPal subscriptions, etc. Also, maybe I'm not too clear on how addon modules work, but how does your modification hook into the addons and actually do its thing?

 

I had planned to turn this into an addon at some point in the next few weeks, but in the meantime feel free to work on it if you'd like.

Link to comment
Share on other sites

Ah, I see what you mean. I wasn't thinking of this as something completely new - I just added the module wrapper around your hook and adjusted the authentication system to be a bit more robust. Considering 95% of that module is all your code (if not more than that), I was just thinking of it as a slight improvement or patch.

 

Yeah the code I used was from your first post - I was forgetting that we don't get access to edit those posts after a while and thought you might have been editing that all along. I'd love it if you would take the module wrapping and integrate that with your newer code!

 

When you upload the module into the add-ons folder, WHMCS recognizes from the information at the top of the main php file. It also reads the hooks.php file and integrates them appropriately, just like any normal hook. This is what I mean by it not being a major modification (from the coding side) because the module portion itself does absolutely nothing - it's only there for easy installation. All the good stuff (your code) is in hooks.php which I only modified slightly to grab the PayPal user info from the DB.

 

For clarification, the only adjustments I made to the hook itself (found in hooks.php) are found at the top of your PPHttpPost function:

 

        $paypal_api_query = "SELECT setting,value FROM `tblpaymentgateways` WHERE gateway = 'paypal' AND setting LIKE 'api%'";
       $result = mysql_query($paypal_api_query);

       while ( $row = mysql_fetch_array($result) ) {
       	if ($row['setting'] == 'apiusername')
       		$username = $row['value'];
       	else if ($row['setting'] == 'apipassword')
       		$password = $row['value'];
       	else if ($row['setting'] == 'apisignature')
       		$signature = $row['value'];
       }

       $API_UserName = urlencode($username);
       $API_Password = urlencode($password);
       $API_Signature = urlencode($signature);

 

It would be great if you would merge that with your updated hooks file and integrate it with the module wrappings!

 

Cheers,

 

Jordan

Link to comment
Share on other sites

Hopefully you didn't feel I've tried to undermine your previous efforts - that wasn't my intention at all. I had originally planned to make it an addon module (it's much nicer to click buttons than it is to edit PHP code) but just hadn't gotten round to it. Your post inspired me I think :)

 

I do have some other ideas I plan to implement to the addon too, so those will be coming at some point. I also have some other addons I want to work on, it's just time time time....

Link to comment
Share on other sites

  • 1 year later...
  • 2 weeks later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated