From: Chuck Scott No Response Received! ', 'success' );
}
diff --git a/classes/glmMesGateway.php b/classes/glmMesGateway.php
index fa3f8cd..c83ad79 100644
--- a/classes/glmMesGateway.php
+++ b/classes/glmMesGateway.php
@@ -20,53 +20,42 @@
* Extends the WooCommerce base gateway class. See the following URL.
* http://docs.woothemes.com/wc-apidocs/class-WC_Payment_Gateway.html
*
+ * Development Credentials
+ * Merchant Name Gaslight Media
+ * Profile ID 94100012117800000059
+ * Profile Key cBCBDBscxFpIRCJzcBqnKFORrBcNJXCt
+ * Request URL https://cert.merchante-solutions.com/mes-api/tridentApi
+ *
*/
class GlmMesGateway extends WC_Payment_Gateway
{
/**
- * Gateway ID
- *
- * @var $id
- * @access public
- */
- public $id = 'merchant_e_solutions';
- /**
- * Gateway Title
+ * Cards Accepted
*
- * @var $title
+ * @var $visa
+ * @var $mastercard
+ * @var $amex
* @access public
*/
- public $title;
- /**
- * Gateway Description
+ public $visa = false;
+ public $mastercard = false;
+ public $amex = false;
+ /**
+ * Transaction Mode
*
- * @var $description
+ * @var $transaction_mode
* @access public
*/
- public $description;
+ public $transaction_mode;
/**
* Gateway Icon URL
*
* @var $icon
* @access public
*/
- public $icon = false;
- /**
- * Show Payment Fields
- *
- * @var $has_fields
- * @access public
- */
- public $has_fields = true;
- /**
- * Title of this Payment Gateway
- *
- * @var $method_title
- * @access public
- */
- public $method_title = 'Merchant e-Solutions';
- /**
+ public $icon;
+ /**
* Profile ID
*
* @var $profile_id
@@ -87,6 +76,30 @@ class GlmMesGateway extends WC_Payment_Gateway
* @access public
*/
public $url;
+ /**
+ * Credit Card Months
+ *
+ * @var $cc_months
+ * @access public
+ */
+ public $cc_months;
+ /**
+ * Credit Card Exp Years
+ *
+ * @var $cc_start_year
+ * @var $cc_end_year
+ * @access public
+ */
+ public $cc_start_year;
+ public $cc_end_year;
+ /**
+ * Cleaned User Input Array
+ *
+ * @var $glm_mes_in
+ * @access public
+ */
+ public $glm_mes_in;
+
public function __construct ()
@@ -94,12 +107,38 @@ class GlmMesGateway extends WC_Payment_Gateway
// Add filter for our gateway
add_filter( 'woocommerce_payment_gateways', array( $this, 'glmMesAddGateway') );
+ $this->id = GLM_MES_ID;
+
+ // Title of gateway and description displayed in WooCommerce Checkout configuration pages
+ $this->method_title = __( GLM_MES_SHORT_NAME, GLM_MES_ID );
+ $this->method_description = __( GLM_MES_DESCRIPTION, GLM_MES_ID );
+
+ // Icon displayed with gateway in checkout page
+ $this -> icon = GLM_MES_ICON;
+
+ // Displays checkout fields for "direct" integration
+ $this->has_fields = true;
+
+ // Supports the default credit card form
+ $this->supports = array( 'default_credit_card_form' );
+
// Setup Fields and Settings
$this->init_form_fields();
$this->init_settings();
- $this -> title = $this -> settings['title'];
- $this -> description = $this -> settings['description'];
+ // Get the title and description for this checkout method to use in checkout page
+ $this->title = $this->get_option( 'title' );
+ $this->description = $this->get_option( 'description' );
+
+ // Add credit cards available to the description
+ $this->description .= ' '
+ .($this->settings['visa'] == 'yes' ? 'Credit Cards Accepted
' : '')
+ .($this->settings['mastercard'] == 'yes' ? '
' : '')
+ .($this->settings['amex'] == 'yes' ? '
' : '')
+ .'
'.print_r($this,1).'
'.print_r($custOrder,1).'', 'success' ); } // Create transaction object - require_once (GLM_MES_PLUGIN_CLASS_PATH . '/MesTridentGateway.php'); + require_once (GLM_MES_CLASS_PATH . '/MesTridentGateway.php'); $trans = new TpgSale( $this->profile_id, $this->profile_key, $this->settings ); // Set transaction data - $trans->setAvsRequest( '123 Main Street', '55555' ); - $trans->setRequestField('cvv2', '123'); - $trans->setRequestField('invoice_number','123456'); - $trans->setTransactionData( "4012888812348882", "1212", "1.00" ); + $trans->setAvsRequest( $custOrder->billing_address_1, $custOrder->billing_postcode ); + $trans->setRequestField('cvv2', $cc_cvc); + $trans->setRequestField('invoice_number', $invNumb); + $trans->setTransactionData( $ccNumb, $cc_exp, $custOrder->order_total ); // Call the MeS Gateway $trans->setHost($this->host); @@ -316,14 +432,15 @@ class GlmMesGateway extends WC_Payment_Gateway $trans->execute(); if (GLM_MES_DEBUG_VERBOSE) { - wc_add_notice('GLM MeS Gateway: Transaction Response
'.$this->ErrorMessage.'
'.print_r($tran->ResponseFields,1).'', 'success'); + wc_add_notice('GLM MeS Gateway: Response Fields
'.print_r($tran2->ResponseFields,1).'', 'success'); } // Check result - if( $tran->isApproved() ) { + if( $trans->isApproved() ) { $paymentState = 'approved'; } else { $paymentState = 'fail'; + $errorMsg = $trans->ResponseFields['auth_response_text']; } // Take action based on payment state @@ -353,7 +470,12 @@ class GlmMesGateway extends WC_Payment_Gateway case 'fail': // Tell the user we had a payment failure - wc_add_notice( __('Payment error:', 'woothemes') . $error_message, 'error' ); + wc_add_notice( __("
Reason: ".$errorMsg.'
Please check your credit card information and try again.', 'woothemes') . $error_message, 'error' ); + + if (GLM_MES_DEBUG && !GLM_MES_DEBUG_VERBOSE) { + wc_add_notice('GLM MeS Gateway: Response Fields
'.print_r($trans->ResponseFields,1).'', 'success'); + } + return; break; diff --git a/defines.php b/defines.php index c1c0035..53400ec 100644 --- a/defines.php +++ b/defines.php @@ -5,15 +5,30 @@ * Set standard defined parameters */ -define('GLM_MES_PLUGIN_NAME', 'Gaslight Media WooCommerce Merchant e-Solutions Gateway'); -define('GLM_MES_PLUGIN_DIR', 'glm-woocommerce-merchant-e-solutions-gateway'); +define('GLM_MES_NAME', 'Gaslight Media WooCommerce Merchant e-Solutions Gateway'); +define('GLM_MES_SHORT_NAME', 'GLM Merchant e-Solutions'); +define('GLM_MES_DESCRIPTION', 'A Merchant e-Solutions payment Gateway plug-in for WooCommerce.'); +define('GLM_MES_ID', 'glm-merchant_e_solutions'); // Plugin Versions -define('GLM_MES_PLUGIN_VERSION', 0.1); -define('GLM_MES_PLUGIN_DB_VERSION', 0.1); +define('GLM_MES_VERSION', 0.1); // Directories -define('GLM_MES_PLUGIN_PATH', dirname(__FILE__)); -define('GLM_MES_PLUGIN_CLASS_PATH', GLM_MES_PLUGIN_PATH.'/classes'); +define('GLM_MES_DIR', 'glm-woocommerce-merchant-e-solutions-gateway'); +define('GLM_MES_PATH', dirname(__FILE__)); +define('GLM_MES_CLASS_PATH', GLM_MES_PATH.'/classes'); +define('GLM_MES_ASSETS_PATH', GLM_MES_PATH.'/assets'); + +// URLs +$pUrl = plugins_url( GLM_MES_DIR ); +define('GLM_MES_URL', $pUrl); +define('GLM_MES_ASSETS_URL', GLM_MES_URL.'/assets'); + +// Optional Gateway Icon +//define('GLM_MES_ICON', GLM_MES_ASSETS_URL.'/{place_icon_filename_here'); +define('GLM_MES_ICON', null); + +// Other Settings +define('GLM_MES_EXPIRE_YEARS', 10); ?> \ No newline at end of file diff --git a/index.php b/index.php index 34454e6..c12332b 100644 --- a/index.php +++ b/index.php @@ -64,7 +64,7 @@ require_once('defines.php'); // Activate function glmMesPluginActivate () { - require_once (GLM_MES_PLUGIN_PATH . '/activate.php'); + require_once (GLM_MES_PATH . '/activate.php'); new glmMesPluginActivate(); } register_activation_hook(__FILE__, 'glmMesPluginActivate'); @@ -72,7 +72,7 @@ register_activation_hook(__FILE__, 'glmMesPluginActivate'); // Deactivate function glmMesPluginDeactivate () { - require_once (GLM_MES_PLUGIN_PATH . '/deactivate.php'); + require_once (GLM_MES_PATH . '/deactivate.php'); $x = new glmMesPluginDeactivate(); return false; } @@ -95,7 +95,7 @@ add_action( 'plugins_loaded', 'initMesGateway' ); */ function initMesGateway() { - require_once (GLM_MES_PLUGIN_CLASS_PATH . '/glmMesGateway.php'); + require_once (GLM_MES_CLASS_PATH . '/glmMesGateway.php'); new glmMesGateway(); } diff --git a/views/paymentForm.html b/views/paymentForm.html deleted file mode 100644 index 4448b20..0000000 --- a/views/paymentForm.html +++ /dev/null @@ -1,78 +0,0 @@ - - - -
Safe and Secure Credit Card Payment.
-TEST MODE ENABLED
- - -customer_message; ?>
++ +
+
+ + +
++ + +
++ + + +
++ + +
+