Ok – after much delay, here is the highly anticipated first release:
<?php/*** The ps_suregate class, containing the payment processing code* for transactions with Suregate.net** @version $Id: ps_suregate.php 2010-25-12* @package VirtueMart* @subpackage payment* @copyright Copyright (C) 2009 created by: Soeren - All rights reserved.* Modified for Suregate.net by TheWebDoctor.us* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php* VirtueMart is free software. This version may have been modified pursuant* to the GNU General Public License, and as distributed it includes or* is derivative of works licensed under the GNU General Public License or* other free or open source software licenses.* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.** http://virtuemart.net*/if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );class ps_suregate {var $payment_code = "AN";/** Show all configuration parameters for this payment method* @returns boolean False when the Payment method has no configration*/function show_configuration() {global $VM_LANG, $sess;$db = new ps_DB;$payment_method_id = vmGet( $_REQUEST, 'payment_method_id', null );/** Read current Configuration ***/require_once(CLASSPATH ."payment/".__CLASS__.".cfg.php");?><table class="adminform"><tr class="row0"><td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_ENABLE_AUTORIZENET_TESTMODE') ?></td><td><select name="AN_TEST_REQUEST" class="inputbox" ><option <?php if (AN_TEST_REQUEST == 'TRUE') echo "selected=\"selected\""; ?> value="TRUE"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES') ?></option><option <?php if (AN_TEST_REQUEST == 'FALSE') echo "selected=\"selected\""; ?> value="FALSE"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO') ?></option></select></td><td><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_ENABLE_AUTORIZENET_TESTMODE_EXPLAIN') ?></td></tr><tr class="row1"><td class="labelcell">Suregate.net Server Hostname</td><td><input type="text" name="AN_HOSTNAME" value="<?php echo defined('AN_HOSTNAME') ? AN_HOSTNAME : 'https://secure.suregate.net:443/smartPayments/transact.asmx/ProcessCreditCard?' ?>" /></td><td>Name of the Suregate.net Server, the requests are sent to. Default Value: <strong>https://secure.suregate.net:443/smartPayments/transact.asmx/ProcessCreditCard?</strong><br /></td></tr><tr class="row0"><td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_AUTORIZENET_USERNAME') ?></td><td><input type="text" name="AN_LOGIN" class="inputbox" value="<?php echo AN_LOGIN ?>" /></td><td><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_AUTORIZENET_USERNAME_EXPLAIN') ?></td></tr><tr class="row1"><td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_AUTORIZENET_KEY') ?></td><td><a class="button" id="changekey" href="<?php $sess->purl($_SERVER['PHP_SELF']."?page=store.payment_method_keychange&pshop_mode=admin&payment_method_id=$payment_method_id") ?>" ><?php echo $VM_LANG->_('PHPSHOP_CHANGE_TRANSACTION_KEY') ?><a/></td><td> </td></tr><tr class="row0"><td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_CVV2') ?></td><td><select name="AN_CHECK_CARD_CODE" class="inputbox"><option <?php if (AN_CHECK_CARD_CODE == 'YES') echo "selected=\"selected\""; ?> value="YES"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES') ?></option><option <?php if (AN_CHECK_CARD_CODE == 'NO') echo "selected=\"selected\""; ?> value="NO"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO') ?></option></select></td><td><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_CVV2_TOOLTIP') ?></td></tr><tr class="row1"><td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_AN_RECURRING') ?></td><td><select name="AN_RECURRING" class="inputbox"><option <?php if (AN_RECURRING == 'YES') echo "selected=\"selected\""; ?> value="YES"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES') ?></option><option <?php if (AN_RECURRING == 'NO') echo "selected=\"selected\""; ?> value="NO"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO') ?></option></select></td><td><?php echo $VM_LANG->_('PHPSHOP_PAYMENT_AN_RECURRING_TOOLTIP') ?></td></tr><tr class="row0"><td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_AUTORIZENET_AUTENTICATIONTYPE') ?></td><td><select name="AN_TYPE" class="inputbox"><option <?php if (AN_TYPE == 'AUTH_CAPTURE') echo "selected=\"selected\""; ?> value="AUTH_CAPTURE">AUTH_CAPTURE</option><option <?php if (AN_TYPE == 'AUTH_ONLY') echo "selected=\"selected\""; ?> value="AUTH_ONLY">AUTH_ONLY</option></select></td><td><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_AUTORIZENET_AUTENTICATIONTYPE_EXPLAIN') ?></td></tr><tr><td colspan="3"><hr/></td></tr><tr class="row1"><td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYMENT_ORDERSTATUS_SUCC') ?></td><td><select name="AN_VERIFIED_STATUS" class="inputbox" ><?php$q = "SELECT order_status_name,order_status_code FROM #__{vm}_order_status ORDER BY list_order";$db->query($q);$order_status_code = Array();$order_status_name = Array();while ($db->next_record()) {$order_status_code[] = $db->f("order_status_code");$order_status_name[] = $db->f("order_status_name");}for ($i = 0; $i < sizeof($order_status_code); $i++) {echo "<option value=\"" . $order_status_code[$i];if (AN_VERIFIED_STATUS == $order_status_code[$i])echo "\" selected=\"selected\">";elseecho "\">";echo $order_status_name[$i] . "</option>\n";}?></select></td><td><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYMENT_ORDERSTATUS_SUCC_EXPLAIN') ?></td></tr><tr class="row0"><td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYMENT_ORDERSTATUS_FAIL') ?></td><td><select name="AN_INVALID_STATUS" class="inputbox" ><?phpfor ($i = 0; $i < sizeof($order_status_code); $i++) {echo "<option value=\"" . $order_status_code[$i];if (AN_INVALID_STATUS == $order_status_code[$i])echo "\" selected=\"selected\">";elseecho "\">";echo $order_status_name[$i] . "</option>\n";} ?></select></td><td><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_PAYMENT_ORDERSTATUS_FAIL_EXPLAIN') ?></td></tr><tr class="row1"><td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_AUTORIZENET_RESPCODES') ?></td><td><select name="AN_SHOW_ERROR_CODE" class="inputbox"><option <?php if (AN_SHOW_ERROR_CODE == 'YES') echo "selected=\"selected\""; ?> value="YES"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES') ?></option><option <?php if (AN_SHOW_ERROR_CODE == 'NO') echo "selected=\"selected\""; ?> value="NO"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO') ?></option></select></td><td><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_AUTORIZENET_RESPCODES_EXPLAIN') ?></td></tr><tr class="row0"><td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_AUTORIZENET_EMAIL_MERCHANT') ?></td><td><select name="AN_EMAIL_MERCHANT" class="inputbox"><option <?php if (AN_EMAIL_MERCHANT == 'YES') echo "selected=\"selected\""; ?> value="YES"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES') ?></option><option <?php if (AN_EMAIL_MERCHANT == 'NO') echo "selected=\"selected\""; ?> value="NO"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO') ?></option></select></td><td><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_AUTORIZENET_EMAIL_MERCHANT_EXPLAIN') ?></td></tr><tr class="row1"><td class="labelcell"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_AUTORIZENET_EMAIL_CUSTOMER') ?></td><td><select name="AN_EMAIL_CUSTOMER" class="inputbox"><option <?php if (AN_EMAIL_CUSTOMER == 'YES') echo "selected=\"selected\""; ?> value="YES"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES') ?></option><option <?php if (AN_EMAIL_CUSTOMER == 'NO') echo "selected=\"selected\""; ?> value="NO"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO') ?></option></select></td><td><?php echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_AUTORIZENET_EMAIL_CUSTOMER_EXPLAIN') ?></td></tr></table><?php// return false if there's no configurationreturn true;}function has_configuration() {// return false if there's no configurationreturn true;}/*** Returns the "is_writeable" status of the configuration file* @param void* @returns boolean True when the configuration file is writeable, false when not*/function configfile_writeable() {return is_writeable( CLASSPATH."payment/".__CLASS__.".cfg.php" );}/*** Returns the "is_readable" status of the configuration file* @param void* @returns boolean True when the configuration file is writeable, false when not*/function configfile_readable() {return is_readable( CLASSPATH."payment/".__CLASS__.".cfg.php" );}/*** Writes the configuration file for this payment method* @param array An array of objects* @returns boolean True when writing was successful*/function write_configuration( &$d ) {$my_config_array = array("AN_TEST_REQUEST" => $d['AN_TEST_REQUEST'],"AN_LOGIN" => $d['AN_LOGIN'],"AN_HOSTNAME" => $d['AN_HOSTNAME'],"AN_TYPE" => $d['AN_TYPE'],"AN_CHECK_CARD_CODE" => $d['AN_CHECK_CARD_CODE'],"AN_VERIFIED_STATUS" => $d['AN_VERIFIED_STATUS'],"AN_INVALID_STATUS" => $d['AN_INVALID_STATUS'],"AN_RECURRING" => $d['AN_RECURRING'],"AN_EMAIL_MERCHANT" => $d['AN_EMAIL_MERCHANT'],"AN_EMAIL_CUSTOMER" => $d['AN_EMAIL_CUSTOMER'],"AN_SHOW_ERROR_CODE" => $d['AN_SHOW_ERROR_CODE']);$config = "<?php\n";$config .= "if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); \n\n";foreach( $my_config_array as $key => $value ) {$config .= "define ('$key', '$value');\n";}$config .= "?>";if ($fp = fopen(CLASSPATH ."payment/".__CLASS__.".cfg.php", "w")) {fputs($fp, $config, strlen($config));fclose ($fp);return true;}else {return false;}}/**************************************************************************** name: process_payment()** created by: Soeren** description: process transaction with Suregate.net** parameters: $order_number, the number of the order, we're processing here** $order_total, the total $ of the order** returns:***************************************************************************/function process_payment($order_number, $order_total, &$d) {global $vendor_mail, $vendor_currency, $VM_LANG, $vmLogger;$database = new ps_DB;$ps_vendor_id = $_SESSION["ps_vendor_id"];$auth = $_SESSION['auth'];$ps_checkout = new ps_checkout;// Get the Configuration File for authorize.netrequire_once(CLASSPATH ."payment/".__CLASS__.".cfg.php");// connector classrequire_once(CLASSPATH ."connectionTools.class.php");// Get the Transaction Key securely from the database$database->query( "SELECT ".VM_DECRYPT_FUNCTION."(payment_passkey,'".ENCODE_KEY."') as passkey FROM #__{vm}_payment_methodWHERE payment_class='".__CLASS__."'AND payment_enabled = 'Y'" );$transaction = $database->record[0];if( empty($transaction->passkey)) {$vmLogger->err( $VM_LANG->_('PHPSHOP_PAYMENT_ERROR',false).'. Technical Note: The required transaction key is empty! The payment method settings must bereviewed.' );return false;}// Get user billing information$dbbt = new ps_DB;$qt = "SELECT * FROM #__{vm}_user_info WHERE user_id=".$auth["user_id"]." AND address_type='BT'";$dbbt->query($qt);$dbbt->next_record();$user_info_id = $dbbt->f("user_info_id");if( $user_info_id != $d["ship_to_info_id"]) {// Get user billing information$dbst = new ps_DB;$qt = "SELECT * FROM #__{vm}_user_info WHERE user_info_id='".$d["ship_to_info_id"]."' AND address_type='ST'";$dbst->query($qt);$dbst->next_record();}else {$dbst = $dbbt;}// Option to send email to merchant from gatewayif (AN_EMAIL_MERCHANT == 'NO') {$vendor_mail = "";}if (AN_EMAIL_CUSTOMER == 'YES') {$email_customer = "TRUE";} else {$email_customer = "FALSE";}//Authnet vars to send$formdata = array ('UserName' => AN_LOGIN,'Password' => $transaction->passkey,'TransType'=> 'Sale','CardNum' => $_SESSION['ccdata']['order_payment_number'],'ExpDate' => ($_SESSION['ccdata']['order_payment_expire_month']) . substr ($_SESSION['ccdata']['order_payment_expire_year'],2),'Amount' => $order_total,'MagData' => '','NameOnCard' => $_SESSION['ccdata']['order_payment_name'],'InvNum' => substr($order_number, 0, 20),'PNRef' => '','Zip' => substr($dbbt->f("zip"), 0, 20),'Street' => substr($dbbt->f("address_1"), 0, 60),'CVNum' => '','ExtData' => '',);//build the post string$poststring = '';foreach($formdata AS $key => $val){$poststring .= urlencode($key) . "=" . urlencode($val) . "&";}// strip off trailing ampersand$poststring = substr($poststring, 0, -1);if (defined('AN_HOSTNAME')) {$host = AN_HOSTNAME;} else {$host = 'https://secure.suregate.net:443/smartPayments/transact.asmx/ProcessCreditCard?';}$result = vmConnector::handleCommunication( "https://secure.suregate.net:443/smartPayments/transact.asmx/ProcessCreditCard?", $poststring );if( !$result ) {$vmLogger->err('The transaction could not be completed.' );$vmLogger->notice( var_export($result,true) );return false;}$response=new SimpleXMLElement($result);// Approved - Success!if ($response->Result=='0') {$d["order_payment_log"] = $VM_LANG->_('PHPSHOP_PAYMENT_TRANSACTION_SUCCESS').": ";$vmLogger->debug( $d['order_payment_log']);return True;}// Payment Declinedelseif ($response->Result='12') {if (AN_SHOW_ERROR_CODE == 'YES') {$vmLogger->notice( var_export($result,true) );}$d["order_payment_log"] = $response;return False;}}}
Heck, I just figured conventional practicality is what everyone else expects – especially in business. The competition likes to talk about their competition going down in flames while suddenly discovering the holy grail of twitter and facebook. And by holy grail I mean your online office post it note and wadded paper wastebasket. Anyways, Keep It Simple Stupid.
In other news, have you noticed all the people driving in from out of town? ‘GSP Arena Tops 750K’ Coming soon…
Man I do love Greenville – especially disc golf in Greenville. I wanna put Timmons up for a while, and so does my average
A blog is most like a magazine. You would pick up a magazine and read the articles and look at the pictures. You would look at a blog website and read the articles and look at the pictures. If you like the articles, you would subscribe to the magazine so that you get the new articles in your mailbox every month. With a blog you would subscribe to get the new articles emailed to you as soon as they are written. You would give a magazine to a friend to look at an article you liked. You would share an article on a blog by clicking a “share this” link to post the link to the article on your facebook wall, or you would copy and paste the link in an email to your friends.
The one thing a blog does that a magazine does not is let you leave comments on the articles. So you might read a blog article and all the comments below the article one day – then go back the next day to read new comments or to respond to comments about your comment.
Here is about the best video on what about a Blog is:
For some strange reason I woke up around 5:30 this morning, rolled over and checked the news on my laptop. BANG – an 8.8 magnitude earthquake hits Chile causing a massive Pacific Tidal Wave Warning that we could easily be watching the aftermath of on the news for the next few days…if God forbid one does hit.
In the event this quake causes major damage or loss of life, we always recommend donating to the Red Cross for relief effort.
As a service to your visitors it could be worthwhile to offer a live rss feed of any current news. This not only gives patrons to your web page information they would have otherwise gone elsewhere else to find, but also gives them other reasons to refer your site to friends in their social sphere! In Joomla you would first go to Twitter Search to get the rss, then create a custom feed module to syndicate that content.
Here is a quick alternative example using the rss feed widget from feedzilla and the search results for Chile.
1. Open source MLM, Downline, Network Marketing module for VirtueMart.
2. Developed and conceived here.
3. Download from here.
4. Support Development here.
