AirCalc – My First Adobe Air App
This afternoon i wondered how long it would take for me to build a simple calculator app with adobe. And guess what, it just too me about 30 minutes to whip it up. Amazingly easy. Aptana IDE did help a lot. Makes things really really simple and best of all you can download it for free.
WARNING:
The file you are about to download contains a very simple calculator. If every you get here cause you cant find the calculator in Windows. It somewhere in accesories. For those who just want to download this application Click Here
The Gods Must Be Listening
For years i have been working as a web developer, my days are filled to the brim with HTML, javascript, CSS and PHP. Mostly PHP with a bit of ASP on the side. As far i can remember i already had ideas on application for the desktop to create simple application like something to index all the contents of all my backup cds and dvds, all 800 of it. Yes guys 800 cds and dvds. Im kinda paranoid about the computer breaking down or the harddisk dying so as much as possible i back all my files. I know there are programs out there that do the above example but none quite meet what i needed to do.
I tried many programming languages from java to vb, but i just fell like climbing a very steep hill when learning these things. Also i feel, i dont know if its just me, i feel like i need to type a lot to get just a simple thing going on vb and java. No offense to those who love and worship ..
those languages. For someone like me creating a desktop application in HTML and javascript would be awesome, it was just a dream back then.
With enough prayers, ADOBE AIR came along, i actually came to know about it later than most people.. im always stuck on PHP work that i have very little time left to explore new technologies. Last weekend i managed to look into adobe air and my god it is amazing. Easier than pie. I guess all my prayers to GODS got heard.
I will be looking into what applications i can create with it. Making some application is still the best way to learn a new programming language.
Problem with the new Authorize.net AIM Payment Module
Recently, one of my oscomerce installations encountered some problems with authorize.net integration. I was using the default SIM module that
came with the release before. Trying to trace the errors is a very complicated thing with these payment modules. So i went to oscommerce.com and looked up if there are new release of the payment module.
And there is a newly released payment module for authorize.net. You can find it here. I was trilled to find out that it was released just last january 11, 2008. For a second there i felt like heaven, I guess as they say never count the chickens until the eggs are hatched. After installation, to my horror i found out that it even has a bigger problem. Maybe is just due to the incompatibility of my code to the new module which is highly likely since i the code that im using is very heavily modified.
After modifying the module to write to file the contents of $params(parameters for the auth.net gateway), $HTTP_POST_VARS(posted variables) and the $transaction_response to a log file. You can do this by adding a few simple lines to the code.
At around line 130, after the line
$params = array('x_login' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN_ID, 0, 20),
'x_tran_key' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_KEY, 0, 16),
'x_version' => '3.1',
'x_delim_data' => 'TRUE',
'x_delim_char' => ',',
'x_encap_char' => '"',
'x_relay_response' => 'FALSE',
'x_first_name' => substr($order->billing['firstname'], 0, 50),
'x_last_name' => substr($order->billing['lastname'], 0, 50),
'x_company' => substr($order->billing['company'], 0, 50),
'x_address' => substr($order->billing['street_address'], 0, 60),
'x_city' => substr($order->billing['city'], 0, 40),
'x_state' => substr($order->billing['state'], 0, 40),
'x_zip' => substr($order->billing['postcode'], 0, 20),
'x_country' => substr($order->billing['country']['title'], 0, 60),
'x_phone' => substr($order->customer['telephone'], 0, 25),
'x_cust_id' => substr($customer_id, 0, 20),
'x_customer_ip' => tep_get_ip_address(),
'x_email' => substr($order->customer['email_address'], 0, 255),
'x_description' => substr(STORE_NAME, 0, 255),
'x_amount' => substr($this->format_raw($order->info['total']), 0, 15),
'x_currency_code' => substr($currency, 0, 3),
'x_method' => 'CC',
'x_type' => ((MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_METHOD == 'Capture') ? 'AUTH_CAPTURE' : 'AUTH_ONLY'),
'x_card_num' => substr($HTTP_POST_VARS['cc_number_nh-dns'], 0, 22),
'x_exp_date' => $HTTP_POST_VARS['cc_expires_month'] . $HTTP_POST_VARS['cc_expires_year'],
'x_card_code' => substr($HTTP_POST_VARS['cc_cvc_nh-dns'], 0, 4));
Add
//log the parameters
$fp = fopen('images/log.txt', "w");
fwrite($fp, var_export($params, true));
fwrite($fp, var_export($HTTP_POST_VARS, true));
Then on line 187, after the line:
$transaction_response = $this->sendTransactionToGateway($gateway_url, $post_string);
Add
fwrite($fp, $transaction_response);
fclose($fp);
This will create a file named log.txt on the images folder.
After i reviewed that it became obvious that the problem was that oscommerce was not posting the card number etc to the confimation page so it can send the info to authorize.net. Since the card number was not sent to the confimation page authorize.net sent back an error that it requires the card number. And the reason for this is so simple. It is cause the fields echoed outside the form tag on checkout_confirmation.php.
To fix this is very simple. Open up checkout_confirmation.php
Look For:
if (isset($$payment->form_action_url)) {
$form_action_url = $$payment->form_action_url;
} else {
$form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
}
echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');
move that line to just above:
if (is_array($payment_modules->modules)) {
if ($confirmation = $payment_modules->confirmation()) {
Thats it. Simple as can be. : ) Hope this helps anyone
To fix this all you have to do is
