I was asked to fix some code for a web site as the previous developer had left a couple of holes in it and presumably the client was unhappy with him so I was asked to take a look. Whilst looking at the known problems I've uncovered others too. Most of these are easily fixable but the main problem, the reason I was hired for, was that the instant payment notification from PayPal wasn't working. So I've spent all day today trying to look through someone elses code and work out why it's not working.
Once I'd checked it over I figured I'd learn how to test it for free as I've always used my own money previously. After a bit of investigate I discovered the PayPal Sandbox which can be set up at http://developer.paypal.com. In a nutshell, you register with the sandbox, then set up a test user and test business. Give each a bank account and the test user a credit card (all default info preset), turn IPN on in the test business and then set your paypal script to point to https://www.sandbox.paypal.com/webscr instead of https://www.paypal.com/webscr. Then you can run it all as normal except that it doesn't cost you. The only thing I couldn't get to work was for the status to come back as VERIFIED. It kept saying INVALID. This I believe was down to the fact that the IPN script wasn't sending the info back to the sandbox server and so the information was getting confused, however the rest of it worked fine and the payment status was saying completed so at least I know in the future to ignore the actual VERIFIED / INVALID status and just act on whether it's completed or not.
Anyhow, once I'd sussed this I moved on to the live system, ensured that the basics worked (just paying 1p per transaction) and then started uncommenting the previous extra code to see where it fell over. I've spent all day on this to finally work out that the database connection include was infact a function (why, why would anyone create it as a function?!! it doubles the number of lines used for a simple db connection!!!), and this function wasn't actually being run, just included, therefore there was no database connection and subsequently no database selected.
In the process of all this I completely forgot about how credit card cloners work and sent 4 payments of 1p off my business account card and now my card is locked down too until I get through to customer services in the morning! (good job there's no money in there!!). Incidentally you're better off loading your account with £5 and use that. All money paid out can be refunded for free as well, so you'll just lose the fee for putting the money into paypal (only because I had to use a credit card at that point!).
All in all a long day. And the cherry on the cake is a web site that I've been working on since August, for very little money, has just had a list of 'web site observations' sent back, all 7 pages of it! The best one was "please capitalise the first letter of every sentence". The text of course was supplied by them originally and copied and formatted by us, i.e. no cases were changed. Plus this was typed up in Word so in theory they purposely went through and made every letter lowercase as Word automatically capitalises the first letter of every sentence! Plus various other additions… I'll be glad when it's done, paid for and gone. At least then i can refuse work off them in the future if I feel like it. I have far too much to do and far more work worth a lot more than they'd ever pay out. Perhaps I'll send them in the direction of the developer whose code I'm now being paid to fix…?!!








