Hello, I need a very simple cgi which will read an IPN post, verify it, and dump the results to a csv file.
It should store the IPN information in an object.
It will not use ASP, C# or nonstandard libraries, strictly console win32 cpp.
It will not require any nonstandard dlls or libraries, such as mfc or STL.
It will be in C++ and be decently tidy.
The module should be a VC++ 6.0 project and will run under apache 1.3 on win32. It should not use features which would not be portable to linux.
[ PLEASE SEE ATTACHED CLASS HEADERS ]
There will be a class object IPNData which has two members char* ipnNames_[MAX_ELEM], char** ipnData_[MAX_ELEM].
All items will be stored in an array of this class as char arrays.
User elements will be stored in itemData[0], including name, address, and total payment amount information.
Each itemData[1 to numCartItems] will store one item data.
itemData[1].ipnNames_[0] will be "CartItem"
itemData[1].ipnDatas_[0] will be "1"
itemData[1].ipnNames_[1] might be be "First Name"
itemData[1].ipnDatas_[1] will be "Jason"
etc.
itemData[2].ipnNames_[0] will be "CartItem"
itemData[2].ipnDatas_[0] will be "2"
etc.
The function bool addIpnData(ipnName, ipnData), stores the data increments numIpnDataElem_ each time an element is added.
The function writeCSV will take a FILE* and write the data into it as comma seperated name=value pairs (this will be used for logging).
The program must run as a stand alone CGI executable when delivered and the default action should be to dump the data on multiple CSV lines and exit.
You don't need to worry much about memory cleanup as I'll be modifying what you provide pretty extensively. This will typically be used to process shopping cart data, and there could potentially be hundreds of items in the shopping cart. There should be an array of IPNData elements in the top level of the program. The first (index 0) element should contain all customer information, including items related to the total purchase price. Each following IPNData element should be all info related single shopping cart element. These elements should have a special item "itemId", which contain the shopping cart item id's.
I will check for duplicate IPN transactions on my end.
I have a fast cgi module that I will put this in, plus I am going to store the info in a db. Do not worry about memory usage / array bounds overflow (except to avoid them), I will use proprietary libraries to address these issues, just make the bounds big enough to handle typical cases.
Most of the work here will be to verify the IPN transaction. Please use a simple library with GPL liscensing for the HTTP communication. The communication must have an adjustable timeout interval defaulted to 15 seconds.