Fixed lib directory define, completed payment processor integration, updated database
authorChuck Scott <cscott@gaslightmedia.com>
Mon, 6 Nov 2017 21:44:31 +0000 (16:44 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Mon, 6 Nov 2017 21:44:31 +0000 (16:44 -0500)
Changed some default settings for the registration account data class.
Updated database to add new field 2 fields for Merchant Solutions in management
Fixed some compatibility issues in the paymnent gateway classes
Completed payment processor integration in checkout and texted off-line
Some updates and fixes in the checkout view.

22 files changed:
classes/data/dataAccount.php
classes/data/dataManagement.php
config/plugin.ini
defines.php
index.php
lib/paymentProcessors/Authorize.Net/AIM_guide-1.pdf [changed mode: 0755->0644]
lib/paymentProcessors/Authorize.Net/paymentGateway.php [changed mode: 0755->0644]
lib/paymentProcessors/MerchantSolutions/paymentGateway.php [changed mode: 0755->0644]
lib/paymentProcessors/None/paymentGateway.php [deleted file]
lib/paymentProcessors/Test/Test.php [deleted file]
lib/paymentProcessors/TestByCardNumber/paymentGateway.php [new file with mode: 0644]
lib/paymentProcessors/TestGood/paymentGateway.php [new file with mode: 0644]
models/front/registrations/checkout.php
models/front/registrations/checkoutProcess.php
setup/databaseScripts/create_database_V0.0.16.sql [deleted file]
setup/databaseScripts/create_database_V0.0.17.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/drop_database_V0.0.16.sql [deleted file]
setup/databaseScripts/drop_database_V0.0.17.sql [new file with mode: 0644]
setup/databaseScripts/update_database_V0.0.17.sql [new file with mode: 0644]
views/admin/management/registrations.html
views/front/registrations/checkout.html

index 77c7518..93e32f5 100644 (file)
@@ -157,7 +157,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract
             ),
              */
 
-            // Account Primary Address
+            // Member ID if account derived from a member contact
             'member_id' => array (
                 'field'     => 'member_id',
                 'type'      => 'text',
@@ -365,7 +365,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract
             'email' => array (
                 'field'     => 'email',
                 'type'      => 'text',
-                'required'  => true,
+                'required'  => false,
                 'use'       => 'a'
             ),
 
@@ -395,6 +395,15 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract
             ),
 
             // Pointer to GLM Associate member contact record if account is for a member contact
+            'contact_id' => array (
+                'field'     => 'contact_id',
+                'type'      => 'integer',
+                'required'  => false,
+                'use'       => 'lgneud'
+            ),
+
+            // Pointer to GLM Associate member contact record if account is for a member contact
+/*
             'contact_id' => array (
                 'field'     => 'contact_id',
                 'type'      => 'pointer',
@@ -404,7 +413,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract
                 'required'  => true,
                 'use'       => 'lgneud'
             ),
-
+*/
             //
             'contact_fname' => array (
                 'field'     => 'contact_fname',
index 839e78e..515c81b 100644 (file)
@@ -290,6 +290,21 @@ class GlmDataRegistrationsManagement extends GlmDataAbstract
                 'use' => 'a'
             ),
 
+            // Always Use Full Billing Info
+            'reg_merchant_solutions_conf' => array (
+                'field' => 'reg_merchant_solutions_conf',
+                'type' => 'checkbox',
+                'use' => 'a',
+                'default'  => 0,
+            ),
+
+            // Merchant Email
+            'reg_merchant_solutions_merchant_email' => array (
+                'field' => 'reg_merchant_solutions_merchant_email',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
             // Always Use Full Billing Info
             'reg_full_billing_info' => array (
                 'field' => 'reg_full_billing_info',
index ce8c073..a39400d 100644 (file)
@@ -48,6 +48,9 @@ payment_method_numb['CallFromMerchant']         = 5
 payment_method_numb['CreditCard']               = 6
 payment_method_numb['PayPal']                   = 7
 
+; Default payment method is Credit Card
+default_payment_method                          = 6
+
 ;
 ; Payment Code Types - List only
 ;
@@ -91,17 +94,24 @@ reg_ref_type_numb['Registrant']                = 50
 ;
 ; Credit Cards - Use as Bitmap Index or List
 ;
-credit_card[0]                                  = 'Visa'
-credit_card[1]                                  = 'MasterCard'
-credit_card[2]                                  = 'American Express'
-credit_card[3]                                  = 'Discover'
-credit_card[4]                                  = 'Diners Club'
+credit_card[1]                                  = 'Visa'
+credit_card[2]                                  = 'MasterCard'
+credit_card[3]                                  = 'American Express'
+credit_card[4]                                  = 'Discover'
+credit_card[5]                                  = 'Diners Club'
+
+credit_card_numb['Visa']                        = 1
+credit_card_numb['MasterCard']                  = 2
+credit_card_numb['American Express']            = 3
+credit_card_numb['Discover']                    = 4
+credit_card_numb['Diners Club']                 = 5
+
+credit_card_match[1]                            = '/^4[0-9]{12}(?:[0-9]{3})?$/'
+credit_card_match[2]                            = '/^([51|52|53|54|55]{2})([0-9]{14})$/'
+credit_card_match[3]                            = '/^([34|37]{2})([0-9]{13})$/'
+credit_card_match[4]                            = '/^([6011]{4})([0-9]{12})$/'
+credit_card_match[5]                            = '/^([30|36|38]{2})([0-9]{12})$/'
 
-credit_card_numb['Visa']                        = 0
-credit_card_numb['MasterCard']                  = 1
-credit_card_numb['American Express']            = 2
-credit_card_numb['Discover']                    = 3
-credit_card_numb['Diners Club']                 = 4
 
 ;
 ; Card Processing Methods - Use as Bitmap Index or List
@@ -118,6 +128,12 @@ proc_method_numb['MerchantSolutions']           = 3
 proc_method_numb['TestAlwaysGood']              = 4
 proc_method_numb['TestByCardNumber']            = 5
 
+proc_dir[1]                                     = 'ByMerchant'
+proc_dir[2]                                     = 'Authorize.Net'
+proc_dir[3]                                     = 'MerchantSolutions'
+proc_dir[98]                                    = 'TestGood'
+proc_dir[99]                                    = 'TestByCardNumber'
+
 ;
 ; Card processing test modes
 ;
index 4edcd47..29b717b 100644 (file)
@@ -68,7 +68,8 @@ define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_CONFIG_PATH', GLM_MEMBERS_REGISTRATIONS
 // Parameters related to the Main GLM Member DB plugin - Depending on what's going on these may already defined by the main plugin
 $pluginsPath = str_replace(GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, '', GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH);
 define('GLM_MEMBERS_REGISTRATIONS_MAIN_PLUGIN_PATH', $pluginsPath.'/glm-member-db');
-define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_LIB_PATH', GLM_MEMBERS_REGISTRATIONS_MAIN_PLUGIN_PATH.'/lib');
+define('GLM_MEMBERS_REGISTRATIONS_MAIN_PLUGIN_LIB_PATH', GLM_MEMBERS_REGISTRATIONS_MAIN_PLUGIN_PATH.'/lib');
+define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_LIB_PATH', GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH.'/lib');
 
 // Update Server
 define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_UPDATE_SERVER', 'http://www.gaslightmedia.com/update_server');
\ No newline at end of file
index 47ca90c..01c8305 100644 (file)
--- a/index.php
+++ b/index.php
@@ -44,7 +44,7 @@ if (!defined('ABSPATH')) {
  *  version from this plugin.
  */
 define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION', '0.0.1');
-define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.16');
+define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.17');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
 define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.10.10');
old mode 100755 (executable)
new mode 100644 (file)
index 0aba97d..37be0cf
@@ -132,7 +132,8 @@ class PaymentGateway
                // Check for required data\r
                if (!is_array($payment) || !is_array($payment)) {\r
                        $resp = array(\r
-                               'status' => 2,\r
+                           'gateway' => 'Authorize.Net',\r
+                           'status' => 2,\r
                                'statusText' => 'Bad Data Supplied',\r
                                'authCode' => '',\r
                                'description' => 'The required payment and contact information was not supplied.'\r
@@ -151,10 +152,11 @@ class PaymentGateway
                        case 1:\r
                                // Always return a card approval\r
                                $resp = array(\r
-                                       'status' => 1,\r
-                                       'statusText' => 'Card Approved',\r
-                                       'authCode' => '000000',\r
-                                       'description' => '(TESTMODE) Local Test - Card Approved'\r
+                    'gateway' => 'Authorize.Net',\r
+                    'status' => 1,\r
+                    'statusText' => 'Card Approved',\r
+                    'authCode' => '000000',\r
+                    'description' => '(TESTMODE) Local Test - Card Approved'\r
                                );\r
                                return $resp;\r
                                break;\r
@@ -162,10 +164,11 @@ class PaymentGateway
                        // Fail Test\r
                        case 2:\r
                                $resp = array(\r
-                                       'status' => 7,\r
-                                       'statusText' => 'Card Declined',\r
-                                       'authCode' => '',\r
-                                       'description' => '(TESTMODE) Local Test - Card Declined'\r
+                    'gateway' => 'Authorize.Net',\r
+                    'status' => 7,\r
+                    'statusText' => 'Card Declined',\r
+                    'authCode' => '',\r
+                    'description' => '(TESTMODE) Local Test - Card Declined'\r
                                );\r
                                return $resp;\r
                                break;\r
@@ -225,46 +228,51 @@ class PaymentGateway
                switch ($response->response_code) {\r
                        case 1:\r
                                $resp = array(\r
-                                       'status' => 1,\r
-                                       'statusText' => 'Card Approved',\r
-                                       'authCode' => $response->authorization_code,\r
-                                       'description' => $response->response_reason_text\r
+                    'gateway' => 'Authorize.Net',\r
+                    'status' => 1,\r
+                    'statusText' => 'Card Approved',\r
+                    'authCode' => $response->authorization_code,\r
+                    'description' => $response->response_reason_text\r
                                );\r
                                break;\r
 \r
                        case 2:\r
                                $resp = array(\r
-                                       'status' => 7,\r
-                                       'statusText' => 'Card Declined',\r
-                                       'authCode' => '',\r
-                                       'description' => $respDescr\r
+                    'gateway' => 'Authorize.Net',\r
+                    'status' => 7,\r
+                    'statusText' => 'Card Declined',\r
+                    'authCode' => '',\r
+                    'description' => $respDescr\r
                                );\r
                                break;\r
 \r
                        case 3:\r
                                $resp = array(\r
-                                       'status' => 3,\r
-                                       'statusText' => 'Transaction Error',\r
-                                       'authCode' => '',\r
-                                       'description' => $respDescr\r
+                    'gateway' => 'Authorize.Net',\r
+                    'status' => 3,\r
+                    'statusText' => 'Transaction Error',\r
+                    'authCode' => '',\r
+                    'description' => $respDescr\r
                                );\r
                                break;\r
 \r
                        case 4:\r
                                $resp = array(\r
-                                       'status' => 7,\r
-                                       'statusText' => 'Held for review',\r
-                                       'authCode' => '',\r
-                                       'description' => $response->response_reason_text\r
-                               );\r
+                    'gateway' => 'Authorize.Net',\r
+                    'status' => 7,\r
+                    'statusText' => 'Held for review',\r
+                    'authCode' => '',\r
+                    'description' => $response->response_reason_text\r
+                           );\r
                                break;\r
 \r
                        default:\r
                                $resp = array(\r
-                                       'status' => 4,\r
-                                       'statusText' => 'Bad Response',\r
-                                       'authCode' => '',\r
-                                       'description' => $respDescr\r
+                    'gateway' => 'Authorize.Net',\r
+                    'status' => 4,\r
+                    'statusText' => 'Bad Response',\r
+                    'authCode' => '',\r
+                    'description' => $respDescr\r
                                );\r
                                break;\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index 805e8cd..6968fe8
@@ -126,6 +126,11 @@ class PaymentGateway
        $this->request->acctid = $account['acctid'];\r
        $this->request->merchantpin = $account['merchantpin'];\r
 \r
+       // Test to see if soap support has been installed\r
+       if (!extension_loaded('soap')) {\r
+           trigger_error('*** PHP SOAP not installed and required by MerchantSolutions payment gateway! ***', E_USER_ERROR);\r
+       }\r
+\r
         // Setup options related to doing the SOAP calls\r
         ini_set('soap.wsdl_cache_enabled', 1);\r
         use_soap_error_handler(false);\r
@@ -238,10 +243,11 @@ class PaymentGateway
                case 1:\r
                        // Always return a card approval\r
                        $resp = array(\r
-                               'status' => 1,\r
-                               'statusText' => 'Card Approved',\r
-                               'authCode' => '000000',\r
-                               'description' => '(TESTMODE) Local Test - Card Approved'\r
+                    'gateway' => 'MerchantSolutions',\r
+                    'status' => 1,\r
+                    'statusText' => 'Card Approved',\r
+                    'authCode' => '000000',\r
+                    'description' => '(TESTMODE) Local Test - Card Approved'\r
                        );\r
                        return $resp;\r
                        break;\r
@@ -249,10 +255,11 @@ class PaymentGateway
                // Fail Test\r
                case 2:\r
                        $resp = array(\r
-                               'status' => 7,\r
-                               'statusText' => 'Card Declined',\r
-                               'authCode' => '',\r
-                               'description' => '(TESTMODE) Local Test - Card Declined'\r
+                    'gateway' => 'MerchantSolutions',\r
+                    'status' => 7,\r
+                    'statusText' => 'Card Declined',\r
+                    'authCode' => '',\r
+                    'description' => '(TESTMODE) Local Test - Card Declined'\r
                        );\r
                        return $resp;\r
                        break;\r
@@ -289,10 +296,11 @@ class PaymentGateway
             if (strtoupper($this->result) == 'APPROVED') {\r
 \r
                $resp = array(\r
-                               'status' => 1,\r
-                               'statusText' => 'Card Approved',\r
-                               'authCode' => $this->response->authcode,\r
-                               'description' => $this->response->status\r
+                    'gateway' => 'MerchantSolutions',\r
+                    'status' => 1,\r
+                    'statusText' => 'Card Approved',\r
+                    'authCode' => $this->response->authcode,\r
+                    'description' => $this->response->status\r
                );\r
                return $resp;\r
 \r
@@ -301,10 +309,11 @@ class PaymentGateway
 \r
                $x = explode(":", $this->response->result);\r
                                $resp = array(\r
-                                               'status' => 7,\r
-                                               'statusText' => 'Card Declined',\r
-                                               'authCode' => '',\r
-                                               'description' => $x[2]\r
+                    'gateway' => 'MerchantSolutions',\r
+                    'status' => 7,\r
+                    'statusText' => 'Card Declined',\r
+                    'authCode' => '',\r
+                    'description' => $x[2]\r
                                );\r
                                return $resp;\r
 \r
@@ -316,20 +325,22 @@ class PaymentGateway
 \r
                        // Return communications failure\r
                $resp = array(\r
-                               'status' => 3,\r
-                               'statusText' => 'Transaction Error',\r
-                               'authCode' => '',\r
-                               'description' => 'Unable to communicate with credit card processing service.'\r
+                'gateway' => 'MerchantSolutions',\r
+                'status' => 3,\r
+                'statusText' => 'Transaction Error',\r
+                'authCode' => '',\r
+                'description' => 'Unable to communicate with credit card processing service.'\r
                        );\r
                return $resp;\r
 \r
         }\r
 \r
         $resp = array(\r
-                       'status' => 4,\r
-                       'statusText' => 'Bad Response',\r
-                       'authCode' => '',\r
-                       'description' => 'Received unknown response from the credit card processing service.'\r
+            'gateway' => 'MerchantSolutions',\r
+            'status' => 4,\r
+            'statusText' => 'Bad Response',\r
+            'authCode' => '',\r
+            'description' => 'Received unknown response from the credit card processing service.'\r
         );\r
         return $resp;\r
 \r
diff --git a/lib/paymentProcessors/None/paymentGateway.php b/lib/paymentProcessors/None/paymentGateway.php
deleted file mode 100755 (executable)
index 7b76de7..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php\r
-/**\r
- * Event Management System\r
- * No Payment PaymentGateway class\r
- *\r
- * @category Front-End\r
- * @package  EventManagement\r
- * @author   Chuck Scott <cscott@gaslightmedia.com>\r
- * @license  http://www.gaslightmedia.com Gaslightmedia\r
- * @release  SVN: $Id: classes/paymentProcessors/no_payment.php,v 1.0 2011/01/25 19:31:47 cscott Exp $\r
- * @link     <>\r
- */\r
-\r
-/**\r
- * No Payment PaymentGateway class\r
- *\r
- * PHP version 5\r
- *\r
- * @category Event Management Admin Tickets\r
- * @package  EventManagement\r
- * @author   Chuck Scott <cscott@gaslightmedia.com>\r
- * @license  http://www.gaslightmedia.com Gaslightmedia\r
- * @release  SVN: $Id: classes/paymentProcessors/no_payment.php,v 1.0 2011/01/25 19:31:47 cscott Exp $\r
- * @link     <>\r
- */\r
-\r
-/**\r
- * No Payment Gateway class\r
- *\r
- * PHP version 5\r
- */\r
-\r
-class PaymentGateway\r
-{\r
-\r
-    /**\r
-     * Constructor\r
-     *\r
-     * @param $account Array of account information - Not used for Test Processor\r
-     *\r
-     * @return boolean    Returns value of $success parameter\r
-     * @access public\r
-     */\r
-    function __construct($account = false)\r
-    {\r
-\r
-       // Nothing to do here\r
-        return $this->success;\r
-\r
-    }\r
-\r
-    /*\r
-     * No Payment Required\r
-     *\r
-     * @param array    $pmt Payment information\r
-     *\r
-     * array(\r
-     *                 'gateway' => {selected payment gateway},\r
-     *                 'name' => {name of venue}\r
-     *                 'charge' => {amount to charge card}\r
-     *                 'cctype' => {type of card - text}\r
-     *                 'ccnumb' => {card number - digits only}\r
-     *                 'ccexp' => {expiration date as m/Y}\r
-     *                 'ccode' => {security code on back of card}\r
-     * )\r
-     *\r
-     * This Processor always returns a "Card Approved" status\r
-     * and synthesizes a corresponding response.\r
-     *\r
-        *      1       Card Approved\r
-     *\r
-     * @return array    Returns array of results\r
-     */\r
-    function processPayment($pmt)\r
-    {\r
-\r
-       // Get last digit of card number that indicates desired response\r
-       $respCode = 'NO-PAYMENT';\r
-\r
-       // Approved flag\r
-       $approved = false;\r
-\r
-               $resp = array(\r
-                       'status' => 1,\r
-                       'statusText' => 'No Payment',\r
-                       'authCode' => '000000',\r
-                       'description' => 'No Payment Required'\r
-               );\r
-\r
-       return $resp;\r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/lib/paymentProcessors/Test/Test.php b/lib/paymentProcessors/Test/Test.php
deleted file mode 100755 (executable)
index 162594c..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-<?php\r
-/**\r
- * Event Management System\r
- * Test Payment Processing class\r
- *\r
- * @category Front-End\r
- * @package  EventManagement\r
- * @author   Chuck Scott <cscott@gaslightmedia.com>\r
- * @license  http://www.gaslightmedia.com Gaslightmedia\r
- * @release  SVN: $Id: classes/paymentProcessors/test.php,v 1.0 2011/01/25 19:31:47 cscott Exp $\r
- * @link     <>\r
- */\r
-\r
-/**\r
- * EventManagementAuthorizeNetPaymentProcessing class\r
- *\r
- * PHP version 5\r
- *\r
- * @category Event Management Admin Tickets\r
- * @package  EventManagement\r
- * @author   Chuck Scott <cscott@gaslightmedia.com>\r
- * @license  http://www.gaslightmedia.com Gaslightmedia\r
- * @release  SVN: $Id: classes/paymentProcessors/test.php,v 1.0 2011/01/25 19:31:47 cscott Exp $\r
- * @link     <>\r
- */\r
-\r
-/**\r
- * Test Payment Gateway class\r
- *\r
- * PHP version 5\r
- */\r
-\r
-class PaymentGateway\r
-{\r
-\r
-    /**\r
-     * Constructor\r
-     *\r
-     * @param $account Array of account information - Not used for Test Processor\r
-     *\r
-     * @return boolean    Returns value of $success parameter\r
-     * @access public\r
-     */\r
-    function __construct($account = false)\r
-    {\r
-\r
-       // Nothing to do here for the test processor\r
-        return $this->success;\r
-\r
-    }\r
-\r
-    /*\r
-     * Process Credit Card Payment\r
-     *\r
-     * @param array    $pmt Payment information\r
-     *\r
-     * array(\r
-     *                 'gateway' => {selected payment gateway},\r
-     *                 'name' => {name of venue}\r
-     *                 'charge' => {amount to charge card}\r
-     *                 'cctype' => {type of card - text}\r
-     *                 'ccnumb' => {card number - digits only}\r
-     *                 'ccexp' => {expiration date as m/Y}\r
-     *                 'ccode' => {security code on back of card}\r
-     * )\r
-     *\r
-     * This Test Processor looks at the last digit of the card number\r
-     * and synthesizes a corresponding response.\r
-     *\r
-        *      1       Card Approved\r
-        *      2       Bad Data Supplied\r
-        *      3       Communications Failure\r
-        *  4   Bad response or no response from processor\r
-        *  5   Transaction validation not accepted\r
-        *  6   Merchant authentication failure or bad account\r
-        *  7   Card Declined\r
-     *\r
-     * @return array    Returns array of results\r
-     */\r
-    function processPayment($pmt)\r
-    {\r
-\r
-       // Get last digit of card number that indicates desired response\r
-       $respCode = substr($pmt['ccnumb'], 15, 1);\r
-\r
-       // Approved flag\r
-       $approved = false;\r
-\r
-       // Prepare synthesized response\r
-       switch ($respCode) {\r
-\r
-               case 1:\r
-\r
-                       $resp = array(\r
-                               'status' => 1,\r
-                               'statusText' => 'Card Approved',\r
-                               'authCode' => '00110011',\r
-                               'description' => 'Card Approved'\r
-                       );\r
-                       break;\r
-\r
-               case 2:\r
-\r
-                       $resp = array(\r
-                               'status' => 2,\r
-                               'statusText' => 'Bad data supplied',\r
-                               'authCode' => '',\r
-                               'description' => 'Card number was not recognizable'\r
-                       );\r
-                       break;\r
-\r
-               case 3:\r
-\r
-                       $resp = array(\r
-                                       'status' => 3,\r
-                                       'statusText' => 'Communications failure',\r
-                                       'authCode' => '',\r
-                                       'description' => 'We were unable to communicate with the credit card processing service.'\r
-                       );\r
-                       break;\r
-\r
-               case 4:\r
-\r
-                       $resp = array(\r
-                               'status' => 4,\r
-                               'statusText' => 'Bad Response',\r
-                               'authCode' => '',\r
-                               'description' => 'We received an unrecognizable response from the credit card processing service.'\r
-                       );\r
-                       break;\r
-\r
-               case 5:\r
-\r
-                       $resp = array(\r
-                                       'status' => 5,\r
-                                       'statusText' => 'Transaction not valid',\r
-                                       'authCode' => '',\r
-                                       'description' => 'We were unable to validate the response from the credit card processor.'\r
-                       );\r
-                       break;\r
-\r
-               case 6:\r
-\r
-                       $resp = array(\r
-                                       'status' => 6,\r
-                                       'statusText' => 'Merchant account problem',\r
-                                       'authCode' => '00110011',\r
-                                       'description' => 'The merchant account for this venue was not recognized by the credit card processor.'\r
-                       );\r
-                       break;\r
-\r
-               case 7:\r
-\r
-                       $resp = array(\r
-                                       'status' => 7,\r
-                                       'statusText' => 'Card Declined',\r
-                                       'authCode' => '',\r
-                                       'description' => 'Your credit card purchase was declined.'\r
-                       );\r
-                       break;\r
-\r
-               default:        // Consider any other last digit as approved\r
-\r
-                       $resp = array(\r
-                               'status' => 1,\r
-                               'statusText' => 'Card Approved',\r
-                               'authCode' => '00110011',\r
-                               'description' => 'Card Approved'\r
-                       );\r
-                       break;\r
-\r
-       }\r
-\r
-       return $resp;\r
-    }\r
-\r
-}\r
-\r
-\r
-?>
\ No newline at end of file
diff --git a/lib/paymentProcessors/TestByCardNumber/paymentGateway.php b/lib/paymentProcessors/TestByCardNumber/paymentGateway.php
new file mode 100644 (file)
index 0000000..9098c5f
--- /dev/null
@@ -0,0 +1,190 @@
+<?php\r
+/**\r
+ * Event Management System\r
+ * Test Payment Processing class\r
+ *\r
+ * @category Front-End\r
+ * @package  EventManagement\r
+ * @author   Chuck Scott <cscott@gaslightmedia.com>\r
+ * @license  http://www.gaslightmedia.com Gaslightmedia\r
+ * @release  SVN: $Id: classes/paymentProcessors/test.php,v 1.0 2011/01/25 19:31:47 cscott Exp $\r
+ * @link     <>\r
+ */\r
+\r
+/**\r
+ * EventManagementAuthorizeNetPaymentProcessing class\r
+ *\r
+ * PHP version 5\r
+ *\r
+ * @category Event Management Admin Tickets\r
+ * @package  EventManagement\r
+ * @author   Chuck Scott <cscott@gaslightmedia.com>\r
+ * @license  http://www.gaslightmedia.com Gaslightmedia\r
+ * @release  SVN: $Id: classes/paymentProcessors/test.php,v 1.0 2011/01/25 19:31:47 cscott Exp $\r
+ * @link     <>\r
+ */\r
+\r
+/**\r
+ * Test Payment Gateway class\r
+ *\r
+ * PHP version 5\r
+ */\r
+\r
+class PaymentGateway\r
+{\r
+\r
+    /**\r
+     * Constructor\r
+     *\r
+     * @param $account Array of account information - Not used for Test Processor\r
+     *\r
+     * @return boolean    Returns value of $success parameter\r
+     * @access public\r
+     */\r
+    function __construct($account = false)\r
+    {\r
+\r
+       // Nothing to do here for the test processor\r
+        return true;\r
+\r
+    }\r
+\r
+    /*\r
+     * Process Credit Card Payment\r
+     *\r
+     * @param array    $pmt Payment information\r
+     *\r
+     * array(\r
+     *                 'gateway' => {selected payment gateway},\r
+     *                 'name' => {name of venue}\r
+     *                 'charge' => {amount to charge card}\r
+     *                 'cctype' => {type of card - text}\r
+     *                 'ccnumb' => {card number - digits only}\r
+     *                 'ccexp' => {expiration date as m/Y}\r
+     *                 'ccode' => {security code on back of card}\r
+     * )\r
+     *\r
+     * @param array $contact Billing contact information (not used in this class)\r
+     *\r
+     * This Test Processor looks at the last digit of the card number\r
+     * and synthesizes a corresponding response.\r
+     *\r
+        *      1       Card Approved\r
+        *      2       Bad Data Supplied\r
+        *      3       Communications Failure\r
+        *  4   Bad response or no response from processor\r
+        *  5   Transaction validation not accepted\r
+        *  6   Merchant authentication failure or bad account\r
+        *  7   Card Declined\r
+     *\r
+     * @return array    Returns array of results\r
+     */\r
+    function processPayment($pmt, $contact = false)\r
+    {\r
+\r
+       // Get last digit of card number that indicates desired response\r
+       $respCode = substr($pmt['ccnumb'], 15, 1);\r
+\r
+       // Approved flag\r
+       $approved = false;\r
+\r
+       // Prepare synthesized response\r
+       switch ($respCode) {\r
+\r
+               case 1:\r
+\r
+                       $resp = array(\r
+                           'gateway' => 'Card # Tests',\r
+                               'status' => 1,\r
+                               'statusText' => 'Card Approved',\r
+                               'authCode' => '00110011',\r
+                               'description' => 'Card Approved'\r
+                       );\r
+                       break;\r
+\r
+               case 2:\r
+\r
+                       $resp = array(\r
+                           'gateway' => 'Card # Tests',\r
+                           'status' => 2,\r
+                    'statusText' => 'Bad data supplied',\r
+                               'authCode' => '',\r
+                               'description' => 'Card number was not recognizable'\r
+                       );\r
+                       break;\r
+\r
+               case 3:\r
+\r
+                       $resp = array(\r
+                    'gateway' => 'Card # Tests',\r
+                    'status' => 3,\r
+                    'statusText' => 'Communications failure',\r
+                    'authCode' => '',\r
+                    'description' => 'We were unable to communicate with the credit card processing service.'\r
+                       );\r
+                       break;\r
+\r
+               case 4:\r
+\r
+                       $resp = array(\r
+                    'gateway' => 'Card # Tests',\r
+                    'status' => 4,\r
+                    'statusText' => 'Bad Response',\r
+                    'authCode' => '',\r
+                    'description' => 'We received an unrecognizable response from the credit card processing service.'\r
+                       );\r
+                       break;\r
+\r
+               case 5:\r
+\r
+                       $resp = array(\r
+                    'gateway' => 'Card # Tests',\r
+                    'status' => 5,\r
+                    'statusText' => 'Transaction not valid',\r
+                    'authCode' => '',\r
+                    'description' => 'We were unable to validate the response from the credit card processor.'\r
+                       );\r
+                       break;\r
+\r
+               case 6:\r
+\r
+                       $resp = array(\r
+                    'gateway' => 'Card # Tests',\r
+                    'status' => 6,\r
+                    'statusText' => 'Merchant account problem',\r
+                    'authCode' => '00110011',\r
+                    'description' => 'The merchant account for this venue was not recognized by the credit card processor.'\r
+                       );\r
+                       break;\r
+\r
+               case 7:\r
+\r
+                       $resp = array(\r
+                    'gateway' => 'Card # Tests',\r
+                    'status' => 7,\r
+                    'statusText' => 'Card Declined',\r
+                    'authCode' => '',\r
+                    'description' => 'Your credit card purchase was declined.'\r
+                       );\r
+                       break;\r
+\r
+               default:        // Consider any other last digit as approved\r
+\r
+                       $resp = array(\r
+                    'gateway' => 'Card # Tests',\r
+                    'status' => 1,\r
+                    'statusText' => 'Card Approved',\r
+                    'authCode' => '00110011',\r
+                    'description' => 'Card Approved'\r
+                       );\r
+                       break;\r
+\r
+       }\r
+\r
+       return $resp;\r
+    }\r
+\r
+}\r
+\r
+\r
+?>
\ No newline at end of file
diff --git a/lib/paymentProcessors/TestGood/paymentGateway.php b/lib/paymentProcessors/TestGood/paymentGateway.php
new file mode 100644 (file)
index 0000000..2dd38a8
--- /dev/null
@@ -0,0 +1,96 @@
+<?php\r
+/**\r
+ * Event Management System\r
+ * No Payment PaymentGateway class\r
+ *\r
+ * @category Front-End\r
+ * @package  EventManagement\r
+ * @author   Chuck Scott <cscott@gaslightmedia.com>\r
+ * @license  http://www.gaslightmedia.com Gaslightmedia\r
+ * @release  SVN: $Id: classes/paymentProcessors/no_payment.php,v 1.0 2011/01/25 19:31:47 cscott Exp $\r
+ * @link     <>\r
+ */\r
+\r
+/**\r
+ * No Payment PaymentGateway class\r
+ *\r
+ * PHP version 5\r
+ *\r
+ * @category Event Management Admin Tickets\r
+ * @package  EventManagement\r
+ * @author   Chuck Scott <cscott@gaslightmedia.com>\r
+ * @license  http://www.gaslightmedia.com Gaslightmedia\r
+ * @release  SVN: $Id: classes/paymentProcessors/no_payment.php,v 1.0 2011/01/25 19:31:47 cscott Exp $\r
+ * @link     <>\r
+ */\r
+\r
+/**\r
+ * No Payment Gateway class\r
+ *\r
+ * PHP version 5\r
+ */\r
+\r
+class PaymentGateway\r
+{\r
+\r
+    /**\r
+     * Constructor\r
+     *\r
+     * @param $account Array of account information - Not used for Test Processor\r
+     *\r
+     * @return boolean    Returns value of $success parameter\r
+     * @access public\r
+     */\r
+    function __construct($account = false)\r
+    {\r
+\r
+       // Nothing to do here\r
+        return true;\r
+\r
+    }\r
+\r
+    /*\r
+     * No Payment Required\r
+     *\r
+     * @param array    $pmt Payment information\r
+     *\r
+     * array(\r
+     *                 'gateway' => {selected payment gateway},\r
+     *                 'name' => {name of venue}\r
+     *                 'charge' => {amount to charge card}\r
+     *                 'cctype' => {type of card - text}\r
+     *                 'ccnumb' => {card number - digits only}\r
+     *                 'ccexp' => {expiration date as m/Y}\r
+     *                 'ccode' => {security code on back of card}\r
+     * )\r
+     *\r
+     * @param array $contact Billing contact information (not used in this class)\r
+     *\r
+     * This Processor always returns a "Card Approved" status\r
+     * and synthesizes a corresponding response.\r
+     *\r
+        *      1       Card Approved\r
+     *\r
+     * @return array    Returns array of results\r
+     */\r
+    function processPayment($pmt, $contact = false)\r
+    {\r
+\r
+       // Get last digit of card number that indicates desired response\r
+       $respCode = 'NO-PAYMENT';\r
+\r
+       // Approved flag\r
+       $approved = false;\r
+\r
+               $resp = array(\r
+                   'gateway' => 'Card Good',\r
+                   'status' => 1,\r
+                       'statusText' => 'No Payment',\r
+                       'authCode' => '000000',\r
+                       'description' => 'No Payment Required'\r
+               );\r
+\r
+       return $resp;\r
+    }\r
+\r
+}
\ No newline at end of file
index 907812a..f50cf23 100644 (file)
@@ -55,6 +55,8 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport
         $regAccountId   = false;
         $regAccount     = false;
         $messages       = array();
+        $payMethod      = false;
+        $compCode       = false;
 
         $Account = new GlmDataRegistrationsAccount($this->wpdb, $this->config);
 
@@ -109,6 +111,9 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport
             }
         }
 
+        // Get any already submitted comp code
+        /**** NEED TO DO THIS ****/
+
         $view = 'checkout';
 
         if ($haveCart) {
@@ -134,13 +139,13 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport
 
             $regAccount = $Account->newEntry();
 
-            require_once GLM_MEMBERS_CONTACTS_PLUGIN_LIB_PATH.'/EasyPassword/EasyPassword.php';
+            require_once GLM_MEMBERS_REGISTRATIONS_MAIN_PLUGIN_LIB_PATH.'/EasyPassword/EasyPassword.php';
             $EasyPassword = new EasyPassword();
             $regAccount['fieldData']['password'] = $EasyPassword->generateEasyPassword($type = 'firstlast');
 
         }
 
-        // Setup credit cart input fields - Use dataRegRequest to generate the field data
+        // Setup credit card input fields - Use dataRegRequest to generate the field data
         require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php';
         $RegRequest = new GlmDataRegistrationsRegRequest($this->wpdb, $this->config);
         $regReq = $RegRequest->newEntry();
@@ -154,13 +159,62 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport
             }
         }
 
-        // Add credit card field data to $regAccount['fieldData'] for use on form
-        $regAccount['fieldData']['cc_type'] = $cc_type;
+        // If credit card data was submitted, use that
+        if (isset($actionData['cardData']) && is_array($actionData['cardData'])) {
+
+            // Set selected card type
+            reset($cc_type['list']);
+
+            foreach ($cc_type['list'] as $k=>$v) {
+
+                $cc_type['list'][$k]['default'] = false;
+                if ($k == $actionData['cardData']['cc_type']) {
+                    $cc_type['list'][$k]['default'] = true;
+                }
+            }
+
+            $regReq['fieldData']['cc_type'] = $cc_type;
+            $regReq['fieldData']['cc_name'] = $actionData['cardData']['cc_name'];
+            $regReq['fieldData']['cc_numb'] = $actionData['cardData']['cc_numb'];
+            $regReq['fieldData']['cc_exp'] = $actionData['cardData']['cc_exp'];
+            $regReq['fieldData']['cc_cvv'] = $actionData['cardData']['cc_cvv'];
+        }
+
+        // Set default payment method
+        $payMethod = $this->config['default_payment_method'];
+
+        // Get any payment method specified or selected on checkout attempt
+        if (isset($actionData['payMethod'])) {
+            $payMethod = $actionData['payMethod'];
+        }
+
+        // Add credit card and other payment field data to $regAccount['fieldData'] for use on form
+        $regAccount['fieldData']['cc_type'] = $regReq['fieldData']['cc_type'];
+        $regAccount['fieldRequired']['cc_type'] = true;
+        $regAccount['fieldFail']['cc_type'] = '';
+
         $regAccount['fieldData']['cc_name'] = $regReq['fieldData']['cc_name'];
+        $regAccount['fieldRequired']['cc_name'] = true;
+        $regAccount['fieldFail']['cc_name'] = '';
+
         $regAccount['fieldData']['cc_numb'] = $regReq['fieldData']['cc_numb'];
+        $regAccount['fieldRequired']['cc_numb'] = true;
+        $regAccount['fieldFail']['cc_numb'] = '';
+
         $regAccount['fieldData']['cc_exp'] = $regReq['fieldData']['cc_exp'];
+        $regAccount['fieldRequired']['cc_exp'] = true;
+        $regAccount['fieldFail']['cc_exp'] = '';
+
         $regAccount['fieldData']['cc_cvv'] = $regReq['fieldData']['cc_cvv'];
+        $regAccount['fieldRequired']['cc_cvv'] = true;
+        $regAccount['fieldFail']['cc_cvv'] = '';
+
         $regAccount['fieldData']['cc_conf'] = $regReq['fieldData']['cc_conf'];
+
+        $regAccount['fieldData']['comp_code'] = $compCode;
+        $regAccount['fieldRequired']['comp_code'] = true;
+        $regAccount['fieldFail']['comp_code'] = '';
+
 // *** If redirected back, be sure to get the submitted data
 
         // Accounts list not needed
@@ -187,6 +241,7 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport
             'assetUrl'      => GLM_MEMBERS_REGISTRATIONS_PLUGIN_ASSETS_URL,
             'haveMessages'  => count($messages) > 0,
             'messages'      => $messages,
+            'payMethod'     => $payMethod,
             'payMethods'    => $management['reg_payment_methods']['bitmap'],
             'payMethodsNumb' => $this->config['payment_method_numb']
         );
index d695894..60b0bc6 100644 (file)
@@ -86,6 +86,7 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
     public function modelAction($actionData = false)
     {
 
+        $messages       = array();
         $haveCheckout   = false;
         $requestId      = false;
         $accountId      = false;
@@ -93,8 +94,11 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
         $modelRedirect  = false;
         $view           = 'checkout';
         $page           = "checkout";
-        $messages       = array();
+        $payMethod      = false;
+        $payMethodName  = false;
         $regPayment     = false;
+        $cardData       = false;
+        $cardTypeMatch  = false;
 
         $Account = new GlmDataRegistrationsAccount($this->wpdb, $this->config);
 
@@ -131,11 +135,18 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
 
                 $accountId = ($_SESSION['LoginAccount']['id'] - 0);
 
-                // Try to update the account information
+                // Try to update the account information and if that works get the data for editing again
                 if ($accountId > 0) {
+
                     $regAccount = $Account->updateEntry($accountId);
+
+                    // If there was a problem, indicate that
                     if (!$regAccount) {
                         $messages[] = 'Unable to recall your account information. Please try again later.';
+
+                    // Otherwise get the data again prepaired for editing
+                    } else {
+                        $regAccount = $Account->editEntry($accountId);
                     }
                 }
 
@@ -182,6 +193,179 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
          * Process Payment?
          */
 
+        require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataManagement.php';
+        $Management = new GlmDataRegistrationsManagement($this->wpdb, $this->config);
+        $management = $Management->getEntry(1);
+
+        // Get payment method selected
+        if (isset($_REQUEST['payMethod'])) {
+            $payMethod = ($_REQUEST['payMethod'] - 0);
+        }
+
+        // Make sure that the selected payment method is available
+        if ($payMethod > 0 && ($management['reg_payment_methods']['bitmap'][$payMethod]['default'])) {
+            $payMethodName = $management['reg_payment_methods']['bitmap'][$payMethod]['name'];
+        } else {
+            $payMethod = false;
+        }
+
+        // Execute selected payment method
+        switch ($payMethod) {
+
+            // No Charge
+            case $this->config['payment_method_numb']['NoCharge']:
+                break;
+
+            // Comp Code
+            case $this->config['payment_method_numb']['CompCode']:
+                break;
+
+            // Cash
+            case $this->config['payment_method_numb']['Cash']:
+                break;
+
+            // Check
+            case $this->config['payment_method_numb']['Check']:
+                break;
+
+            // Call From Merchant
+            case $this->config['payment_method_numb']['CallFromMerchant']:
+                break;
+
+            // Credit Card
+            case $this->config['payment_method_numb']['CreditCard']:
+
+                // Get the selected credit card processor type
+                $ccProcessor = $this->config['settings']['reg_proc_methods'];
+
+                // Setup the required account information for the selected payment processor
+                switch ($ccProcessor) {
+
+                    case $this->config['proc_method_numb']['Authorize.net']:
+
+                        // Get account data
+                        $account = array(
+                            'login' => $this->config['settings']['reg_authorize_net_login'],
+                            'key'   => $this->config['settings']['reg_authorize_net_key'],
+                            'test'  => $this->config['settings']['reg_authorize_net_test'],
+                            'conf'  => $this->config['settings']['reg_authorize_net_conf'],
+                            'email' => $this->config['settings']['reg_authorize_net_merchant_email']
+                        );
+
+                        break;
+
+                    case $this->config['proc_method_numb']['MerchantSolutions']:
+
+                        // Get account data
+                        $account = array(
+                            'acctid'        => $this->config['settings']['reg_merchant_solutions_acctid'],
+                            'merchantpin'   => $this->config['settings']['reg_merchant_solutions_merchantpin'],
+                            'test'          => $this->config['settings']['reg_merchant_solutions_test'],
+                            'conf'          => $this->config['settings']['reg_merchant_solutions_conf'],
+                            'email'         => $this->config['settings']['reg_merchant_solutions_merchant_email']
+                        );
+
+                        break;
+
+                    // These don't require account data
+                    case $this->config['proc_method_numb']['Merchant']:
+                    case $this->config['proc_method_numb']['TestAlwaysGood']:
+                    case $this->config['proc_method_numb']['TestByCardNumber']:
+                    default:
+                        $account = array();
+                        break;
+
+                }
+
+                // Get the credit card input
+                $cardData = array(
+                    'cc_type' => filter_input(INPUT_POST, 'cc_type', FILTER_SANITIZE_NUMBER_INT),
+                    'cc_name' => filter_input(INPUT_POST, 'cc_name', FILTER_SANITIZE_STRING),
+                    'cc_numb' => filter_input(INPUT_POST, 'cc_numb', FILTER_SANITIZE_NUMBER_INT),
+                    'cc_exp'  => filter_input(INPUT_POST, 'cc_exp', FILTER_SANITIZE_STRING),
+                    'cc_cvv'  => filter_input(INPUT_POST, 'cc_cvv', FILTER_SANITIZE_NUMBER_INT)
+                );
+
+                // Check all credit card input
+                if (
+                    $cardData['cc_type'] && $cardData['cc_type'] > 0 &&
+                    $cardData['cc_name'] && $cardData['cc_name'] != '' &&
+                    $cardData['cc_numb'] && $cardData['cc_numb'] > 0 &&
+                    $cardData['cc_exp'] && $cardData['cc_exp'] != '' &&
+                    $cardData['cc_cvv'] && $cardData['cc_cvv'] > 0
+                    ) {
+
+
+                    if (!isset($this->config['credit_card_match'][$cardData['cc_type']]) ||
+                        !preg_match($this->config['credit_card_match'][$cardData['cc_type']], $cardData['cc_numb'])
+                        ) {
+                            $messages[] = 'The credit card number you entered does not match the selected type of credit card.';
+                    }
+
+                } else {
+                    $messages[] = 'You did not supply all required credit card information.';
+                }
+
+                // Get the correct billing data
+                // Build array of billing information using either the account data or the billing data as requested
+                $billPrefix = 'bill_';
+                if (isset($_REQUEST['billing_same']) && $_REQUEST['billing_same']) {
+                    $billPrefix = '';
+                }
+
+                $billing = array(
+                    'fname'     => $regAccount['fieldData'][$billPrefix.'fname'],
+                    'lname'     => $regAccount['fieldData'][$billPrefix.'lname'],
+                    'addr1'     => $regAccount['fieldData'][$billPrefix.'addr1'],
+                    'addr2'     => $regAccount['fieldData'][$billPrefix.'addr2'],
+                    'city'      => $regAccount['fieldData'][$billPrefix.'city'],
+                    'state'     => $regAccount['fieldData'][$billPrefix.'state']['value'],
+                    'country'   => $regAccount['fieldData'][$billPrefix.'country']['value'],
+                    'zip'       => $regAccount['fieldData'][$billPrefix.'zip'],
+                    'phone'     => $regAccount['fieldData'][$billPrefix.'phone'],
+                    'email'     => $regAccount['fieldData']['email']
+                );
+
+                if (count($messages) == 0) {
+
+                    // Determine the directory of the payment processor to load and instatiate it.
+                    if ($ccProcessor && isset($this->config['proc_dir'][$ccProcessor])) {
+                        require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_LIB_PATH.'/paymentProcessors/'.$this->config['proc_dir'][$ccProcessor].'/paymentGateway.php';
+                        $CcProcessor = new PaymentGateway($account);
+                    }
+
+                    $payment = array(
+                        'name' => $this->config['settings']['reg_org_name'],        // Name of venue
+                        'charge' => $this->cart['totalCharges'],                    // Total charges this venue
+                        'cctype' => $cardData['cc_type'],    // Card Type
+                        'ccname' => $cardData['cc_name'],   // Name on Card
+                        'ccnumb' => $cardData['cc_numb'],   // Card Number
+                        'ccexp' => $cardData['cc_exp'],     // Expriation Date
+                        'cccode' => $cardData['cc_cvv'],   // CCV - security code
+                        'invoice' => 0101010101                // Invoice # is session ID (or some part thereof)
+                    );
+
+                    // Now try to run the card processor
+                    $ccResult = $CcProcessor->processPayment($payment, $billing);
+echo "<pre>".print_r($ccResult,1)."</pre>";
+
+/**** NEED TO FIX INVOICE # ABOVE ****/
+                }
+
+                break;
+
+            // Pay Pal
+            case $this->config['payment_method_numb']['PayPal']:
+                break;
+
+            // Payment Method unknown
+            default:
+//                $payMethod = false;
+                break;
+
+        }
+
+
         if (count($messages) == 0) {
 
 
@@ -203,7 +387,9 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
                 'haveMessages'  => count($messages),
                 'messages'      => $messages,
                 'regAccount'    => $regAccount,
-                'regPayment'    => $regPayment
+                'regPayment'    => $regPayment,
+                'payMethod'     => $payMethod,
+                'cardData'      => $cardData
             );
             return array(
                 'status'        => true,
@@ -213,12 +399,19 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
                 'data'          => $templateData
             );
         }
+
+        // Update the cart flags and include updated billing data
+/**** NEED TO DO THIS ****/
+
 echo "<p>Checkout Done...</p>";
+
         // Compile template data
         $templateData = array(
             'page'          => $page,
             'haveMessages'  => count($messages),
-            'messages'      => $messages
+            'messages'      => $messages,
+            'payMethod'     => $payMethod,
+            'payMethodName' => $payMethodName
         );
 
         // Return status, any suggested view, and any data to controller
diff --git a/setup/databaseScripts/create_database_V0.0.16.sql b/setup/databaseScripts/create_database_V0.0.16.sql
deleted file mode 100644 (file)
index 3ca1fcd..0000000
+++ /dev/null
@@ -1,716 +0,0 @@
--- Gaslight Media Registration Database
--- File Created: 01/18/2017 14:40:00
--- Database Version: 0.0.16
--- Database Creation Script
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
---
-/*
- * General Database Organization
- * -----------------------------
- *
- * management - General options and configuration - Site manager access only
- *
- * misc - Misc settings and text - Site owner may update
- *
- * payment codes - Promotional payment codes - Used with various things
- *      --> Event, Submission, Event Registration, Event Registrant, Account or global
- *
- * reg_event - Describes registration for that event
- *      reg_time - One record for each date/time this event has people registered - Primarily tracks attendee counts and charge totals
- *      reg_class - Type of registration for this event (one or more)
- *          reg_rates - Date range / rate for a reg class (one or more)
- *
- * reg_account - Describes someone who submits / pays for a registration
- * Make these two things the same table....
- * registrant - A person who is registered for an event
- *
- * reg_request - Information on a specific request for registrations
- *      reg_request_event - Event selected (one or more)
- *          reg_request_class - Class of registration (one or more)
- *              reg_request_rate - Specific registration date/rate (one or more)
- *                  reg_request_registrant - Registrant (one or more)
- *
- * NOTE: additional fields and added fields data will be coming from the Custom Fields add-on
- *
- * Overall Flow
- * ------------
- *
- * User selects an event
- * If the event has available registrations
- *  User selects a date for the registration (or if only one that's selected automatically)
- *    User can log back into registrations at this point if they've been there before and have a password, create an account, or continue as guest ???
- *      User selects an available rate type and adds one or more registrants for that rate type
- *      User may loop back to select additional rate type(s) and registrants
- *    User may go back to date selection and request additional rate types and registrants for the addional dates
- *  User may go back to select additional dates and do registrations for those dates as above
- * User may go back to select other events and do registrations for them as above
- * User may select the "Cart" and deselect something added to it
- * User may checkout
- *
- */
-
-/*
- * NOTE: Anything below here may not be completed or accurate yet. I'm still working though this
- * Lines commented out are selected for possible deletion.
- * The INSERT statements are not up-to-date with the tables.
- * The "config/plugin.ini" file in this plugin is also a work in progress.
- */
-
--- Management Options
--- General configurationm parameters for the Registrations application
--- Only one entry in this table!
-CREATE TABLE {prefix}management (
-    id INT NOT NULL AUTO_INCREMENT,
-    canonical_reg_page TINYTEXT NULL,                           -- Canonical page slug for registrations
-    -- System Owner Information
-    reg_org_name TINYTEXT NULL,                                     -- Customer Information - Name of Organization
-    reg_org_short TINYTEXT NULL,
-    reg_org_address TINYTEXT NULL,
-    reg_org_city TINYTEXT NULL,
-    reg_org_state TINYTEXT NULL,
-    reg_org_zip TINYTEXT NULL,
-    reg_org_phone TINYTEXT NULL,
-    reg_org_toll_free TINYTEXT NULL,
-    reg_org_internal_email TINYTEXT NULL,
-    reg_org_from_email TINYTEXT NULL,
-    reg_payment_methods SMALLINT NULL,                               -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
-    reg_proc_methods SMALLINT NULL,                                  -- Payment processing methods available - Bitmap - see proc_method in plugin.ini
-    reg_cc_accepts SMALLINT NULL,                                   -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
-    -- Authorize.net Credentials
-    reg_authorize_net_login TINYTEXT NULL,
-    reg_authorize_net_key TINYTEXT NULL,
-    reg_authorize_net_test TINYINT NULL,                            -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
-    reg_authorize_net_conf BOOLEAN NULL,                            -- Flag to send payment confirmation Email from Authorize.net
-    reg_authorize_net_merchant_email TINYTEXT NULL,                 -- E-Mail Authorize.net will send copy of confirmation E-Mail
-    -- Merchant Solutions Credentials
-    reg_merchant_solutions_acctid TINYTEXT NULL,                    -- Merchant Solutions credentials
-    reg_merchant_solutions_merchantpin TINYTEXT NULL,
-    reg_merchant_solutions_test TINYINT NULL,                       -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
-    -- Billing settings
-    reg_full_billing_info BOOLEAN NULL,                             -- Always request full billing information in checkout page regardless of the following settings
-    reg_bill_info_req_no_charge SMALLINT NULL,                       -- Bitmap of fields to use in checkout for these types of payments - See billing_field in plugin.conf
-    reg_bill_info_req_comp_code SMALLINT NULL,
-    reg_bill_info_req_cash SMALLINT NULL,
-    reg_bill_info_req_check SMALLINT NULL,
-    reg_bill_info_req_credit_card SMALLINT NULL,
-    reg_bill_info_req_merchant_call SMALLINT NULL,
-    -- Misc Options
-    reg_medical_info BOOLEAN NULL,                                  -- This site can ask for "Medical Info" - set in main category of an event
-    PRIMARY KEY (id)
-);
-
-----
-
--- Terms used in site modifiable on Management page in admin - Only 1 entry in this table
--- Terms in this table should be all self-explanatory
-CREATE TABLE {prefix}settings_terms (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_term_registrations_name TINYTEXT NULL,                      -- Term "Event Registration"
-    reg_term_registration TINYTEXT NULL,
-    reg_term_registration_cap TINYTEXT NULL,
-    reg_term_registration_plur TINYTEXT NULL,
-    reg_term_registration_plur_cap TINYTEXT NULL,
-    reg_term_register TINYTEXT NULL,
-    reg_term_register_cap TINYTEXT NULL,
-    reg_term_registers TINYTEXT NULL,                               -- Intransitive verb of register
-    reg_term_registering TINYTEXT NULL,
-    reg_term_registering_cap TINYTEXT NULL,
-    reg_term_registered TINYTEXT NULL,
-    reg_term_registered_cap TINYTEXT NULL,
-    reg_term_attendee TINYTEXT NULL,
-    reg_term_attendee_cap TINYTEXT NULL,
-    reg_term_attendee_plur TINYTEXT NULL,
-    reg_term_attendee_plur_cap TINYTEXT NULL,
-    reg_term_attending TINYTEXT NULL,
-    reg_term_attended TINYTEXT NULL,
-    reg_term_registered_user TINYTEXT NULL,
-    reg_term_registered_user_cap TINYTEXT NULL,
-    reg_term_registered_user_plur TINYTEXT NULL,
-    reg_term_registered_user_plur_cap TINYTEXT NULL,
-    reg_term_id TINYTEXT NULL,
-    reg_term_id_cap TINYTEXT NULL,
-    reg_term_id_plur TINYTEXT NULL,
-    reg_term_id_plur_cap TINYTEXT NULL,
-    reg_term_password TINYTEXT NULL,
-    reg_term_password_cap TINYTEXT NULL,
-    reg_term_password_plur TINYTEXT NULL,
-    reg_term_password_plur_cap TINYTEXT NULL,
-    reg_term_instructor TINYTEXT NULL,
-    reg_term_instructor_cap TINYTEXT NULL,
-    reg_term_instructor_plur TINYTEXT NULL,
-    reg_term_instructor_plur_cap TINYTEXT NULL,
-    reg_term_payment_code TINYTEXT NULL,
-    reg_term_payment_code_cap TINYTEXT NULL,
-    reg_term_payment_code_plur TINYTEXT NULL,
-    reg_term_payment_code_plur_cap TINYTEXT NULL,
-    reg_term_registration_button TINYTEXT NULL,
-    reg_term_contact_information TINYTEXT NULL,
-    PRIMARY KEY (id)
-);
-
-----
-
--- Misc system-wide customer configurable configuration
--- Various text and flags to be configured by customer
--- Only one entry in this table!
-CREATE TABLE {prefix}misc (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_bulletin TEXT NULL,                                     -- Text to display at top of first registration page
-    cart_page_text TEXT NULL,                                   -- Text to display at top of cart page
-    checkout_page_text TEXT NULL,                               -- Text to display at top of checkout page
-    summary_page_text TEXT NULL,                                -- Text to display at top of summary page (after checkout)
-    reg_terms TEXT NULL,                                        -- Registration terms and conditions
-    notify_subject TEXT NULL,                                   -- Subject of notification E-Mail to site owner
-    notify_text TEXT NULL,                                      -- Notification E-Mail text for site owner
-    instr_notify_subject TEXT NULL,                             -- Subject of notification E-Mail to instructor
-    instr_notify_text TEXT NULL,                                -- Notification E-Mail text for instructor
-    submission_notify_subject TEXT NULL,                        -- Subject of notification E-Mail to person submitting the registrations
-    submission_notify_text TEXT NULL,                           -- Notification E-Mail text to person submitting the registrations
-    registrant_notify_subject TEXT NULL,                        -- Subject of notification E-Mail to registrant
-    registrant_notify_text TEXT NULL,                           -- Text of notification E-Mail to registrant
-    submission_ack_subject TEXT NULL,                           -- Subject of acknowledgement E-Mail to person submitting the registrations
-    submission_ack_text TEXT NULL,                              -- Text of acknowledgement E-Mail text to person submitting the registrations
-    registrant_ack_subject TEXT NULL,                           -- Subject of acknowledgement E-Mail to registrant
-    registrant_ack_text TEXT NULL,                              -- Text of acknowledgement E-Mail to registrant
-    PRIMARY KEY (id)
-);
-
-----
-
--- Payment Codes
--- Promotional payment codes for free/discounted payment
-CREATE TABLE {prefix}payment_code (
-    id INT NOT NULL AUTO_INCREMENT,
-    code_type TINYINT NULL,                                     -- Type of adjustment - Free only to start with - See pay_code_type in plugin.ini
-    ref_type TINYINT NULL,                                      -- See payment_ref_type in plugin.ini
-    ref_dest INT NULL,                                          -- Pointer to the specific entity of ref_type
-    code TINYTEXT NULL,                                         -- Text code user must enter to use
-    amount FLOAT,                                               -- Amount of discount if not type "Free" - Either $ amount or percent
-    descr TEXT NULL,
-    PRIMARY KEY (id),
-    INDEX (ref_dest),
-    INDEX (code(10))
-);
-
-----
-
--- Registration event specific information
--- One record for each event in Events add-on
--- Only created when an event is selected to offer registrations
-CREATE TABLE {prefix}reg_event (
-    id INT NOT NULL AUTO_INCREMENT,
-    event INT NULL,                                             -- Pointer to event in Events add-on - False if event record in Events add-on no longer exists
-    event_name TINYTEXT NULL,                                   -- Name of Event so it will always be in the cart data
-    event_code TINYTEXT NULL,                                   -- A short code used to reference this event - can be used to directly select an event to register for
-    notify_email TINYTEXT NULL,                                 -- E-Mail addresses to recieve notification of a registration other than org_internal_email in management, comma separated
-    admin_active BOOLEAN NULL,                                  -- Active flag for admin from Events - If logged in Admin user for this event and this is true then admin user may enter registrations even if active is off.
-    active BOOLEAN NULL,                                        -- Active flag to indicate that this event is available for registrations
-    time_specific BOOLEAN NULL,                                 -- Registration for this event is not date/time specific. Can attend any date/time of event.
-    attendees BOOLEAN NULL,                                     -- Registration requires attendees - Otherwise the person submitting the registration is the registrant
-    attendee_max MEDIUMINT NULL,                                -- Attendee limit - 0 = unlimited
-    attendee_max_per_reg TINYINT NULL,                          -- Maximum attendees per registration submission - 0 = unlimited
-    reg_hold_minutes MEDIUMINT NULL,                            -- Number of minutes hold time for an inactive cart before registrant count hold expires (after which cart attempts to hold again on next access)
-    cart_hold_days MEDIUMINT NULL,                              -- Number of days hold time for inactive cart before cart is purged
-    reg_hours_before MEDIUMINT NULL,                            -- Number of hours before an event that is the latest a registration may be submitted.     
-    registration_account_options SMALLINT NULL,                 -- Bitmap of how user accounts may be used for this event - See registration_account_option in plugin.ini
-    payment_methods SMALLINT NULL,                              -- Bitmap of payment methods available to users for this event - See payment_method in plugin.ini
-    restricted_payment_methods SMALLINT NULL,                   -- Bitmap of restricted (admin use only) payment methods for this event - see payment_method
-    descr TEXT NULL,                                            -- Registrations specific description field for this event
-    terms TEXT NULL,                                            -- Terms and Conditions for registration
-    first_datetime DATETIME NULL,                               -- Start of first listed date/time for this event
-    last_datetime DATETIME NULL,                                -- Start of last listed date/time for this event
-    reg_file TINYTEXT NULL,                                     -- Name of a downloadable file
-    reg_file_title TINYTEXT NULL,                               -- Title for downloadable file
-    form_revision SMALLINT NULL,                                -- Current MagicForm form revision
-    notes TEXT NULL,                                            -- System operator's notes for this event - Not visible to users
-    PRIMARY KEY (id),
-    INDEX (event),
-    INDEX (event_code(10))
-);
-
-----
-
--- Registration Event Time - Information and summary data for a specific event instance (relates to a perticular time record in events)
--- A pseudo entry is created if registration is not date/time sensitive for this event. The pseudo entry does not point to an event time.
--- These are created the first time a person tries to register for an event instance (time)
--- One or more for each event
-CREATE TABLE {prefix}reg_time (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_event INT NULL,                                         -- Pointer to reg_event table
-    event_time INT NULL,                                        -- ID of events times table entry in Events add-on - If false (0), then this is a pseudo entry to use for all registrations (non-date/time specific)
-    start_datetime DATETIME NULL,                               -- Date and time when event instance starts
-    end_datetime DATETIME NULL,                                 -- Date and time when event instance ends
-    all_day BOOLEAN NULL,                                       -- All Day flag - Informational
-    attendees BOOLEAN NULL,                                     -- Flag if tracking attendees or if only one per registration submission (registers account submitting) - get from reg_event
-    attendee_max MEDIUMINT NULL,                                -- Attendee count limit - 0 = unlimited - get from reg_event record
-    attendee_count MEDIUMINT NULL,                              -- Current attendee count - calculated on the fly and stored here for reference
-    attendees_pending MEDIUMINT NULL,                           -- Current number of attendees for this time in active pending carts (Not checked out and attendees slots held)
-    attendees_available MEDIUMINT NULL,                         -- Currently available attendee count (limit - current - pending)
-    total_base_charge DOUBLE NULL,                              -- Total base charges
-    total_per_attendee DOUBLE NULL,                             -- Total per-attendee charges
-    total_other DOUBLE NULL,                                    -- Total other charges (meals, extras, fees, ...)
-    total_taxes DOUBLE NULL,                                    -- Total taxes charged
-    total_charges DOUBLE NULL,                                  -- Total charges (sum of all above)
-    total_discounts DOUBLE NULL,                                -- Total discounts of all types (applied payment codes, etc...)
-    total_payments DOUBLE NULL,                                 -- Total net payments (total charges - total discounts)
-    descr TEXT NULL,                                            -- Optional description field for this time entry
-    PRIMARY KEY (id),
-    INDEX (reg_event),
-    INDEX (event_time),
-    INDEX (start_datetime)
-);
-
-----
-
--- Pending Attendees - In carts but not checked out
--- Attendee counts may be held for a particular reg_time entry for carts that have not been checked out
--- These are held for reg_event reg_hold_minutes, afterwhich they are timed out and removed from this table
--- Cart entries are given the ID's for these entries when a hold is requested, if the entry is gone, the hold has expired
-CREATE TABLE {prefix}reg_time_pending (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_event INT NULL,                                         -- Pointer to reg_event table
-    reg_time INT NULL,                                          -- ID of time record
-    registrant INT NULL,                                        -- ID of reg_request_registrant record                                                  -- 
-    expire_time DATETIME NULL,                                  -- Time at which this hold expires
-    PRIMARY KEY (id),
-    INDEX (reg_event),
-    INDEX (reg_time)
-);
-
-----
-
--- Registration Class - Type of registration for a specific event - Equates to "Rate Options" in the old system
--- One or more for each event
-CREATE TABLE {prefix}reg_class (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_event INT NULL,                                         -- Pointer to reg_event table
-    name TINYTEXT NULL,                                         -- Name of this registration type
-    descr TEXT NULL,                                            -- Description
-    PRIMARY KEY (id),
-    INDEX (reg_event)
-);
-
-----
-
--- Rates and dates for a particular reg_class
--- One or more per reg_class - **** Days should not overlap for a particular reg_class
-CREATE TABLE {prefix}reg_rate (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_event INT NULL,                                         -- Pointer to reg_event table
-    reg_class INT NULL,                                         -- Pointer to reg_class table
-    name TINYTEXT NULL,                                         -- Namme of this rate
-    start_days INT NULL,                                        -- # of days before event time rate becomes available - may be selected as a date then coverted for storage
-    end_days INT NULL,                                          -- # of days before event time rate becomes unavailable
-    base_rate FLOAT,                                            -- Base rate to register
-    per_registrant FLOAT,                                       -- Rate per registrant
-    registrant_credits TINYINT NULL,                            -- Number of registrants included in base rate
-    PRIMARY KEY (id),
-    INDEX (reg_event),
-    INDEX (reg_class)
-);
-
-----
-
--- An account for a person submitting a registration or a registrant for an event
--- Depending on the use of these entries may not have all data included
--- A single account may be referenced as a person submitting registrations and/or a person registered for an event
-CREATE TABLE {prefix}account (
-    id INT NOT NULL AUTO_INCREMENT,
-    active BOOLEAN NULL,                                        -- Is active flag (may be accessed or used) - default is true
-    validated BOOLEAN NULL,                                     -- Flag indicating that the account has been validated - Set to false when recovering password
-    validation_code TINYTEXT NULL,                              -- Validation code and timestamp ("{validation code}-{timestamp}) - Clear this after validation
-    registered_by INT NULL,                                     -- Account
-    member_id TINYTEXT NULL,                                    -- Free-form field for a member ID (not a GLM Associate member ID)
-    fname TINYTEXT NULL,                                        -- Account primary address
-    lname TINYTEXT NULL,
-    org TINYTEXT NULL,
-    title TINYTEXT NULL,
-    addr1 TINYTEXT NULL,
-    addr2 TINYTEXT NULL,
-    city TINYTEXT NULL,
-    state TINYTEXT NULL,
-    zip TINYTEXT NULL,
-    country TINYTEXT NULL,
-    phone TINYTEXT NULL,
-    fax TINYTEXT NULL,
-    bill_fname TINYTEXT NULL,                                   -- Last used billing information - Also stored in each registration request
-    bill_lname TINYTEXT NULL,
-    bill_org TINYTEXT NULL,
-    bill_title TINYTEXT NULL,
-    bill_addr1 TINYTEXT NULL,
-    bill_addr2 TINYTEXT NULL,
-    bill_city TINYTEXT NULL,
-    bill_state TINYTEXT NULL,
-    bill_zip TINYTEXT NULL,
-    bill_country TINYTEXT NULL,
-    bill_phone TINYTEXT NULL,
-    bill_fax TINYTEXT NULL,
-    email TINYTEXT NULL,
-    password TINYTEXT NULL,                                     -- Crypted password for login back into this account
-    email_ok BOOLEAN NULL,
-    is_member BOOLEAN NULL,                                     -- Is a member of the entity that owns the site
-    contact_id INT NULL,                                        -- Pointer to GLM Associate member contact record if account is for a member contact
-    contact_fname TINYTEXT NULL,
-    contact_lname TINYTEXT NULL,
-    contact_org TINYTEXT NULL,
-    contact_title TINYTEXT NULL,
-    contact_addr1 TINYTEXT NULL,
-    contact_addr2 TINYTEXT NULL,
-    contact_city TINYTEXT NULL,
-    contact_state TINYTEXT NULL,
-    contact_zip TINYTEXT NULL,
-    contact_country TINYTEXT NULL,
-    contact_phone TINYTEXT NULL,
-    contact_fax TINYTEXT NULL,
-    contact_email TINYTEXT NULL,
-    contact_email_ok BOOLEAN NULL,
-    guardian TINYTEXT NULL,
-    emer_contact TINYTEXT NULL,
-    emer_phone TINYTEXT NULL,
-    med_history TINYTEXT NULL,
-    allergy_med TINYTEXT NULL,
-    date_created DATE NULL,
-    notes TEXT NULL,                                            -- System operator's notes for this account - not visible to account owner
-    user_trace_info TINYTEXT NULL,                              -- IP Address of user computer and timestamp of last update
-    PRIMARY KEY (id),
-    INDEX (registered_by),
-    INDEX (member_id(10)),
-    INDEX (fname(10)),
-    INDEX (lname(10)),
-    INDEX (org(10)),
-    INDEX (city(10)),
-    INDEX (state(5)),
-    INDEX (zip(5)),
-    INDEX (email(10)),
-    INDEX (contact_id)
-);
-
-----
-
--- A request for registration
--- Has one or more reg_detail records associated with it
-CREATE TABLE {prefix}reg_request (
-    id INT NOT NULL AUTO_INCREMENT,
-    account INT NULL,                                           -- Pointer to user account (reg_account) who submitted the registrations. If 0 then guest request (prior to checkout)
-    validated BOOLEAN NULL,                                     -- Flag that indicates if request passed last validation with checkRegistrationRequest()
-    validation_message TEXT NULL,                               -- Reasons that request did not pass validation with checkRegistrationRequest() - Serialized array
-    bill_fname TINYTEXT NULL,                                   -- Billing information used for this registration submission - Updates account billing address - Kept here for each request
-    bill_lname TINYTEXT NULL,
-    bill_org TINYTEXT NULL,
-    bill_title TINYTEXT NULL,
-    bill_addr1 TINYTEXT NULL,
-    bill_addr2 TINYTEXT NULL,
-    bill_city TINYTEXT NULL,
-    bill_state TINYTEXT NULL,
-    bill_zip TINYTEXT NULL,
-    bill_country TINYTEXT NULL,
-    date_submitted DATE NULL,
-    pay_method INT NULL,                                        -- See payment_method in plugin.ini
-    payment_code TINYTEXT NULL,                                 -- Payment_code (code text) - if submitted and validated
-    status SMALLINT NULL,                                       -- See submission_status in plugin.ini
-    total DOUBLE PRECISION NULL,                                -- Total charge including all fees and taxes
-    cc_type TINYINT NULL,                                       -- Credit Card type (if used) - See credit_card in plugin.ini
-    cc_name TINYTEXT NULL,
-    cc_numb TINYTEXT NULL,
-    cc_exp TINYTEXT NULL,
-    cc_cvv TINYTEXT NULL,
-    cc_conf TINYTEXT NULL,                                      -- Confirmation code back from card processor
-    summary TEXT NULL,                                          -- HTML summary of cart contents, costs and payment - Use same HTML displayed to user
-    mf_data TEXT NULL,                                          -- Any MagicForm data associated with registrant
-    notes TEXT NULL,                                            -- System operator's notes for this registration request
-    user_trace_info TINYTEXT NULL,                              -- IP Address of user computer and timestamp
-    date_created DATETIME NULL,                                 -- Date request was first created
-    last_update DATETIME NULL,                                  -- Last update date/time - Used for timing out pending carts and attendee counts
-    PRIMARY KEY (id),
-    INDEX (account),
-    INDEX (date_submitted)
-);
-
-----
-
--- Registration for a specific event
--- Has one or more reg_selected_rate records associated with it 
-CREATE TABLE {prefix}reg_request_event (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_request INT NULL,                                       -- Pointer to reg_request table
-    reg_event INT NULL,                                         -- Pointer to reg_event
-    event_name TINYTEXT NULL,                                   -- Name of Event so it will always be in the cart data
-    notes TEXT NULL,                                            -- System operator's notes for this registration request
-    PRIMARY KEY (id),
-    INDEX (reg_request),
-    INDEX (reg_event),
-    INDEX (reg_time)
-);
-
-----
-
---  A particular reg_class selected
---  Has one or more reg_request_rate records associated with it 
-CREATE TABLE {prefix}reg_request_class (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_event INT NULL,                                         -- Pointer to reg_event entry
-    reg_request INT NULL,                                       -- Pointer to the registration request record
-    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
-    class INT NULL,                                             -- Pointer to event reg_class table - False (0) if registration class no longer exits
-    class_name TINYTEXT NULL,                                   -- Name of event class at the time selected
-    notes TEXT NULL,                                            -- System operator's notes for this registration request
-    PRIMARY KEY (id),
-    INDEX (reg_event),
-    INDEX (reg_time),
-    INDEX (reg_request_event)
-);
-
-----
-
---  A particular reg_rate selected
---  Has one or more reg_request_registrant records associated with it
-CREATE TABLE {prefix}reg_request_rate (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_event INT NULL,                                         -- Pointer to reg_event entry
-    reg_request INT NULL,                                       -- Pointer to the registration request record
-    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
-    reg_request_class INT NULL,                                 -- Pointer to reg_request_class table entry
-    rate INT NULL,                                              -- Pointer to event reg_rate table - False (0) if registration rate no longer exists
-    rate_name TINYTEXT NULL,                                    -- Name of event class rate at the time selected
-    base_rate FLOAT,                                            -- Base rate at time of registration
-    per_registrant FLOAT,                                       -- Per Registrant Rate at time of registration
-    registrant_credits TINYINT NULL,                            -- Number of registrants included in base rate at time of registration
-    notes TEXT NULL,                                            -- System operator's notes for this registration request
-    PRIMARY KEY (id),
-    INDEX (reg_event),
-    INDEX (reg_time),
-    INDEX (reg_request_event),
-    INDEX (reg_request_class)
-);
-
-----
-
---  A specific registrant for a selected registration rate
-CREATE TABLE {prefix}reg_request_registrant (
-    id INT NOT NULL AUTO_INCREMENT,
-    account INT NULL,                                           -- Pointer to the account entry for the person being registered - False (0) if account no longer exists or registrant account not needed
-    reg_event INT NULL,                                         -- Pointer to reg_event entry
-    reg_time INT NULL,                                          -- Pointer reg_time entry
-    event_datetime DATETIME NULL,                               -- Date and time of event time selected so it will always be in the cart
-    reg_request INT NULL,                                       -- Pointer to the registration request record
-    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
-    reg_request_class INT NULL,                                 -- Pointer to reg_request_class table entry
-    reg_request_rate INT NULL,                                  -- Pointer to reg_request_rate table entry
-    fname TINYTEXT NULL,                                        -- First name of registrant at the time of selection
-    lname TINYTEXT NULL,                                        -- Last name of registrant at the time of selection
-    notes TEXT NULL,                                            -- System operator's notes for this registration request
-    PRIMARY KEY (id),
-    INDEX (account),
-    INDEX (reg_event),
-    INDEX (reg_time),
-    INDEX (reg_request),
-    INDEX (reg_request_event),
-    INDEX (reg_request_class),
-    INDEX (reg_request_rate)
-);
-
-----
-
--- Insert into management table
-INSERT INTO {prefix}management
-    (
-    canonical_reg_page,
-    reg_org_name,
-    reg_org_short,
-    reg_org_address,
-    reg_org_city,
-    reg_org_state,
-    reg_org_zip,
-    reg_org_phone,
-    reg_org_toll_free,
-    reg_org_internal_email,
-    reg_org_from_email,
-    reg_payment_methods,
-    reg_proc_methods,
-    reg_cc_accepts,
-    reg_authorize_net_login,
-    reg_authorize_net_key,
-    reg_authorize_net_test,
-    reg_authorize_net_conf,
-    reg_authorize_net_merchant_email,
-    reg_merchant_solutions_acctid,
-    reg_merchant_solutions_merchantpin,
-    reg_merchant_solutions_test,
-    reg_full_billing_info,
-    reg_bill_info_req_no_charge,
-    reg_bill_info_req_comp_code,
-    reg_bill_info_req_cash,
-    reg_bill_info_req_check,
-    reg_bill_info_req_credit_card,
-    reg_bill_info_req_merchant_call,
-    reg_medical_info
-    )
-    VALUES
-    (
-    'registrations',                                            -- reg_canonical_reg_page,
-    'Gaslight Media',                                           -- reg_org_name,
-    'GLM',                                                      -- reg_org_short,
-    '120 E. Lake St.',                                          -- reg_org_address,
-    'Petoskey',                                                 -- reg_org_city,
-    'MI',                                                       -- reg_org_state,
-    '49770',                                                    -- reg_org_zip,
-    '231-487-0692',                                             -- reg_org_phone,
-    '800-123-1234',                                             -- reg_org_toll_free,
-    'internal@gaslightmedia.com',                               -- reg_org_internal_email,
-    'info@gaslightmedia.com',                                   -- reg_org_from_email,
-    0,                                                          -- reg_payment_methods,
-    0,                                                          -- reg_proc_methods,
-    0,                                                          -- reg_cc_accepts,
-    '',                                                         -- reg_authorize_net_login,
-    '',                                                         -- reg_authorize_net_key,
-    1,                                                          -- reg_authorize_net_test,
-    true,                                                       -- reg_authorize_net_conf
-    '',                                                         -- reg_authorize_net_merchant_email,
-    '',                                                         -- reg_merchant_solutions_acctid,
-    '',                                                         -- reg_merchant_solutions_merchantpin,
-    1,                                                          -- reg_merchant_solutions_test,
-    true,                                                       -- reg_full_billing_info,
-    0,                                                          -- reg_bill_info_req_no_charge,
-    0,                                                          -- reg_bill_info_req_comp_code,
-    0,                                                          -- reg_bill_info_req_cash,
-    0,                                                          -- reg_bill_info_req_check,
-    0,                                                          -- reg_bill_info_req_credit_card,
-    0,                                                          -- reg_bill_info_req_merchant_call,
-    true                                                        -- reg_medical_info,
-    );
-
-----
-
--- Insert into settings_terms table
-INSERT INTO {prefix}settings_terms
-    (
-    reg_term_registrations_name,
-    reg_term_registration,
-    reg_term_registration_cap,
-    reg_term_registration_plur,
-    reg_term_registration_plur_cap,
-    reg_term_register,
-    reg_term_register_cap,
-    reg_term_registers,
-    reg_term_registering,
-    reg_term_registering_cap,
-    reg_term_registered,
-    reg_term_registered_cap,
-    reg_term_attendee,
-    reg_term_attendee_cap,
-    reg_term_attendee_plur,
-    reg_term_attendee_plur_cap,
-    reg_term_attending,
-    reg_term_attended,
-    reg_term_registered_user,
-    reg_term_registered_user_cap,
-    reg_term_registered_user_plur,
-    reg_term_registered_user_plur_cap,
-    reg_term_id,
-    reg_term_id_cap,
-    reg_term_id_plur,
-    reg_term_id_plur_cap,
-    reg_term_password,
-    reg_term_password_cap,
-    reg_term_password_plur,
-    reg_term_password_plur_cap,
-    reg_term_instructor,
-    reg_term_instructor_cap,
-    reg_term_instructor_plur,
-    reg_term_instructor_plur_cap,
-    reg_term_payment_code,
-    reg_term_payment_code_cap,
-    reg_term_payment_code_plur,
-    reg_term_payment_code_plur_cap,
-    reg_term_registration_button,
-    reg_term_contact_information
-    )
-    VALUES
-    (
-    'Event Registrations',                                      -- reg_term_registrations_name
-    'registration',                                             -- reg_term_registration
-    'Registration',                                             -- reg_term_registration_cap
-    'registrations',                                            -- reg_term_registration_plur
-    'Registrations',                                            -- reg_term_registration_plur_cap
-    'register',                                                 -- reg_term_registe
-    'Register',                                                 -- reg_term_register_cap
-    'registers',                                                -- reg_term_registers
-    'registering',                                              -- reg_term_registering
-    'Registering',                                              -- reg_term_registering_cap
-    'registered',                                               -- reg_term_registered
-    'Registered',                                               -- reg_term_registered_cap
-    'attendee',                                                 -- reg_term_attendee
-    'Attendee',                                                 -- reg_term_attendee_cap
-    'attendees',                                                -- reg_term_attendee_plur
-    'Attendees',                                                -- reg_term_attendee_plur_cap
-    'attending',                                                -- reg_term_attending
-    'attended',                                                 -- reg_term_attended
-    'user',                                                     -- reg_term_registered_user
-    'User',                                                     -- reg_term_registered_user_cap
-    'users',                                                    -- reg_term_registered_user_plur
-    'Users',                                                    -- reg_term_registered_user_plur_cap
-    'ID',                                                       -- reg_term_id
-    'ID',                                                       -- reg_term_id_cap
-    'IDs',                                                      -- reg_term_id_plur
-    'IDs',                                                      -- reg_term_id_plur_cap
-    'password',                                                 -- reg_term_password
-    'passwords',                                                -- reg_term_password_cap
-    'Password',                                                 -- reg_term_password_plur
-    'Passwords',                                                -- reg_term_password_plur_cap
-    'instructor',                                               -- reg_term_instructor
-    'Instructor',                                               -- reg_term_instructor_cap
-    'instructors',                                              -- reg_term_instructor_plur
-    'Instructors',                                              -- reg_term_instructor_plur_cap
-    'payment code',                                             -- reg_term_payment_code
-    'Payment code',                                             -- reg_term_payment_code_cap
-    'payment codes',                                            -- reg_term_payment_code_plur
-    'Payment codes',                                            -- reg_term_payment_code_plur_cap
-    'Register for Event',                                       -- reg_term_registration_button
-    'Contact Information'                                       -- reg_term_contact_information
-    );
-
-----
-
--- Insert into misc table
-INSERT INTO {prefix}misc
-    (
-    reg_bulletin,
-    cart_page_text,
-    checkout_page_text,
-    summary_page_text,
-    reg_terms,
-    notify_subject,
-    notify_text,
-    instr_notify_subject,
-    instr_notify_text,
-    submission_notify_subject,
-    submission_notify_text,
-    registrant_notify_subject,
-    registrant_notify_text,
-    submission_ack_subject,
-    submission_ack_text,
-    registrant_ack_subject,
-    registrant_ack_text
-    )
-    VALUES
-    (
-    'Registration Bulletin Text',
-    'Text for top of Cart Page',
-    'Text for top of Checkout Page',
-    'Text for top of Summary Page',
-    'Terms and Conditions',
-    'Subject of notification to site owner of a registration',
-    'Text of notification to site owner of a registration',
-    'Subject of notification to instructor of registration',
-    'Text for notification to instructor of registration',
-    'Subject of notification to person submitting registration',
-    'Text of notification to person submitting registration',
-    'Subject for notification to registrant',
-    'Text for notification to registrant',
-    'Subject of acknowledgement to person submitting registration',
-    'Text of acknowledgement to person submitting registration',
-    'Subject of acknowledgement to registrant',
-    'Text of acknowledgement to registrant'
-    );
diff --git a/setup/databaseScripts/create_database_V0.0.17.sql b/setup/databaseScripts/create_database_V0.0.17.sql
new file mode 100644 (file)
index 0000000..3c203e1
--- /dev/null
@@ -0,0 +1,718 @@
+-- Gaslight Media Registration Database
+-- File Created: 01/18/2017 14:40:00
+-- Database Version: 0.0.16
+-- Database Creation Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+--
+/*
+ * General Database Organization
+ * -----------------------------
+ *
+ * management - General options and configuration - Site manager access only
+ *
+ * misc - Misc settings and text - Site owner may update
+ *
+ * payment codes - Promotional payment codes - Used with various things
+ *      --> Event, Submission, Event Registration, Event Registrant, Account or global
+ *
+ * reg_event - Describes registration for that event
+ *      reg_time - One record for each date/time this event has people registered - Primarily tracks attendee counts and charge totals
+ *      reg_class - Type of registration for this event (one or more)
+ *          reg_rates - Date range / rate for a reg class (one or more)
+ *
+ * reg_account - Describes someone who submits / pays for a registration
+ * Make these two things the same table....
+ * registrant - A person who is registered for an event
+ *
+ * reg_request - Information on a specific request for registrations
+ *      reg_request_event - Event selected (one or more)
+ *          reg_request_class - Class of registration (one or more)
+ *              reg_request_rate - Specific registration date/rate (one or more)
+ *                  reg_request_registrant - Registrant (one or more)
+ *
+ * NOTE: additional fields and added fields data will be coming from the Custom Fields add-on
+ *
+ * Overall Flow
+ * ------------
+ *
+ * User selects an event
+ * If the event has available registrations
+ *  User selects a date for the registration (or if only one that's selected automatically)
+ *    User can log back into registrations at this point if they've been there before and have a password, create an account, or continue as guest ???
+ *      User selects an available rate type and adds one or more registrants for that rate type
+ *      User may loop back to select additional rate type(s) and registrants
+ *    User may go back to date selection and request additional rate types and registrants for the addional dates
+ *  User may go back to select additional dates and do registrations for those dates as above
+ * User may go back to select other events and do registrations for them as above
+ * User may select the "Cart" and deselect something added to it
+ * User may checkout
+ *
+ */
+
+/*
+ * NOTE: Anything below here may not be completed or accurate yet. I'm still working though this
+ * Lines commented out are selected for possible deletion.
+ * The INSERT statements are not up-to-date with the tables.
+ * The "config/plugin.ini" file in this plugin is also a work in progress.
+ */
+
+-- Management Options
+-- General configurationm parameters for the Registrations application
+-- Only one entry in this table!
+CREATE TABLE {prefix}management (
+    id INT NOT NULL AUTO_INCREMENT,
+    canonical_reg_page TINYTEXT NULL,                              -- Canonical page slug for registrations
+    -- System Owner Information
+    reg_org_name TINYTEXT NULL,                                     -- Customer Information - Name of Organization
+    reg_org_short TINYTEXT NULL,
+    reg_org_address TINYTEXT NULL,
+    reg_org_city TINYTEXT NULL,
+    reg_org_state TINYTEXT NULL,
+    reg_org_zip TINYTEXT NULL,
+    reg_org_phone TINYTEXT NULL,
+    reg_org_toll_free TINYTEXT NULL,
+    reg_org_internal_email TINYTEXT NULL,
+    reg_org_from_email TINYTEXT NULL,
+    reg_payment_methods SMALLINT NULL,                              -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
+    reg_proc_methods SMALLINT NULL,                                 -- Creadit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
+    reg_cc_accepts SMALLINT NULL,                                   -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
+    -- Authorize.net Credentials
+    reg_authorize_net_login TINYTEXT NULL,
+    reg_authorize_net_key TINYTEXT NULL,
+    reg_authorize_net_test TINYINT NULL,                            -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
+    reg_authorize_net_conf BOOLEAN NULL,                            -- Flag to send payment confirmation Email from Authorize.net
+    reg_authorize_net_merchant_email TINYTEXT NULL,                 -- E-Mail Authorize.net will send copy of confirmation E-Mail
+    -- Merchant Solutions Credentials
+    reg_merchant_solutions_acctid TINYTEXT NULL,                    -- Merchant Solutions credentials
+    reg_merchant_solutions_merchantpin TINYTEXT NULL,
+    reg_merchant_solutions_test TINYINT NULL,                       -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
+    reg_merchant_solutions_conf BOOLEAN NULL,                       -- Flag to send payment confirmation Email
+    reg_merchant_solutions_merchant_email TINYTEXT NULL,            -- Merchant Solutions will send copy of confirmation E-Mail
+    -- Billing settings
+    reg_full_billing_info BOOLEAN NULL,                             -- Always request full billing information in checkout page regardless of the following settings
+    reg_bill_info_req_no_charge SMALLINT NULL,                      -- Bitmap of fields to use in checkout for these types of payments - See billing_field in plugin.conf
+    reg_bill_info_req_comp_code SMALLINT NULL,
+    reg_bill_info_req_cash SMALLINT NULL,
+    reg_bill_info_req_check SMALLINT NULL,
+    reg_bill_info_req_credit_card SMALLINT NULL,
+    reg_bill_info_req_merchant_call SMALLINT NULL,
+    -- Misc Options
+    reg_medical_info BOOLEAN NULL,                                  -- This site can ask for "Medical Info" - set in main category of an event
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Terms used in site modifiable on Management page in admin - Only 1 entry in this table
+-- Terms in this table should be all self-explanatory
+CREATE TABLE {prefix}settings_terms (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_term_registrations_name TINYTEXT NULL,                      -- Term "Event Registration"
+    reg_term_registration TINYTEXT NULL,
+    reg_term_registration_cap TINYTEXT NULL,
+    reg_term_registration_plur TINYTEXT NULL,
+    reg_term_registration_plur_cap TINYTEXT NULL,
+    reg_term_register TINYTEXT NULL,
+    reg_term_register_cap TINYTEXT NULL,
+    reg_term_registers TINYTEXT NULL,                               -- Intransitive verb of register
+    reg_term_registering TINYTEXT NULL,
+    reg_term_registering_cap TINYTEXT NULL,
+    reg_term_registered TINYTEXT NULL,
+    reg_term_registered_cap TINYTEXT NULL,
+    reg_term_attendee TINYTEXT NULL,
+    reg_term_attendee_cap TINYTEXT NULL,
+    reg_term_attendee_plur TINYTEXT NULL,
+    reg_term_attendee_plur_cap TINYTEXT NULL,
+    reg_term_attending TINYTEXT NULL,
+    reg_term_attended TINYTEXT NULL,
+    reg_term_registered_user TINYTEXT NULL,
+    reg_term_registered_user_cap TINYTEXT NULL,
+    reg_term_registered_user_plur TINYTEXT NULL,
+    reg_term_registered_user_plur_cap TINYTEXT NULL,
+    reg_term_id TINYTEXT NULL,
+    reg_term_id_cap TINYTEXT NULL,
+    reg_term_id_plur TINYTEXT NULL,
+    reg_term_id_plur_cap TINYTEXT NULL,
+    reg_term_password TINYTEXT NULL,
+    reg_term_password_cap TINYTEXT NULL,
+    reg_term_password_plur TINYTEXT NULL,
+    reg_term_password_plur_cap TINYTEXT NULL,
+    reg_term_instructor TINYTEXT NULL,
+    reg_term_instructor_cap TINYTEXT NULL,
+    reg_term_instructor_plur TINYTEXT NULL,
+    reg_term_instructor_plur_cap TINYTEXT NULL,
+    reg_term_payment_code TINYTEXT NULL,
+    reg_term_payment_code_cap TINYTEXT NULL,
+    reg_term_payment_code_plur TINYTEXT NULL,
+    reg_term_payment_code_plur_cap TINYTEXT NULL,
+    reg_term_registration_button TINYTEXT NULL,
+    reg_term_contact_information TINYTEXT NULL,
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Misc system-wide customer configurable configuration
+-- Various text and flags to be configured by customer
+-- Only one entry in this table!
+CREATE TABLE {prefix}misc (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_bulletin TEXT NULL,                                     -- Text to display at top of first registration page
+    cart_page_text TEXT NULL,                                   -- Text to display at top of cart page
+    checkout_page_text TEXT NULL,                               -- Text to display at top of checkout page
+    summary_page_text TEXT NULL,                                -- Text to display at top of summary page (after checkout)
+    reg_terms TEXT NULL,                                        -- Registration terms and conditions
+    notify_subject TEXT NULL,                                   -- Subject of notification E-Mail to site owner
+    notify_text TEXT NULL,                                      -- Notification E-Mail text for site owner
+    instr_notify_subject TEXT NULL,                             -- Subject of notification E-Mail to instructor
+    instr_notify_text TEXT NULL,                                -- Notification E-Mail text for instructor
+    submission_notify_subject TEXT NULL,                        -- Subject of notification E-Mail to person submitting the registrations
+    submission_notify_text TEXT NULL,                           -- Notification E-Mail text to person submitting the registrations
+    registrant_notify_subject TEXT NULL,                        -- Subject of notification E-Mail to registrant
+    registrant_notify_text TEXT NULL,                           -- Text of notification E-Mail to registrant
+    submission_ack_subject TEXT NULL,                           -- Subject of acknowledgement E-Mail to person submitting the registrations
+    submission_ack_text TEXT NULL,                              -- Text of acknowledgement E-Mail text to person submitting the registrations
+    registrant_ack_subject TEXT NULL,                           -- Subject of acknowledgement E-Mail to registrant
+    registrant_ack_text TEXT NULL,                              -- Text of acknowledgement E-Mail to registrant
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Payment Codes
+-- Promotional payment codes for free/discounted payment
+CREATE TABLE {prefix}payment_code (
+    id INT NOT NULL AUTO_INCREMENT,
+    code_type TINYINT NULL,                                     -- Type of adjustment - Free only to start with - See pay_code_type in plugin.ini
+    ref_type TINYINT NULL,                                      -- See payment_ref_type in plugin.ini
+    ref_dest INT NULL,                                          -- Pointer to the specific entity of ref_type
+    code TINYTEXT NULL,                                         -- Text code user must enter to use
+    amount FLOAT,                                               -- Amount of discount if not type "Free" - Either $ amount or percent
+    descr TEXT NULL,
+    PRIMARY KEY (id),
+    INDEX (ref_dest),
+    INDEX (code(10))
+);
+
+----
+
+-- Registration event specific information
+-- One record for each event in Events add-on
+-- Only created when an event is selected to offer registrations
+CREATE TABLE {prefix}reg_event (
+    id INT NOT NULL AUTO_INCREMENT,
+    event INT NULL,                                             -- Pointer to event in Events add-on - False if event record in Events add-on no longer exists
+    event_name TINYTEXT NULL,                                   -- Name of Event so it will always be in the cart data
+    event_code TINYTEXT NULL,                                   -- A short code used to reference this event - can be used to directly select an event to register for
+    notify_email TINYTEXT NULL,                                 -- E-Mail addresses to recieve notification of a registration other than org_internal_email in management, comma separated
+    admin_active BOOLEAN NULL,                                  -- Active flag for admin from Events - If logged in Admin user for this event and this is true then admin user may enter registrations even if active is off.
+    active BOOLEAN NULL,                                        -- Active flag to indicate that this event is available for registrations
+    time_specific BOOLEAN NULL,                                 -- Registration for this event is not date/time specific. Can attend any date/time of event.
+    attendees BOOLEAN NULL,                                     -- Registration requires attendees - Otherwise the person submitting the registration is the registrant
+    attendee_max MEDIUMINT NULL,                                -- Attendee limit - 0 = unlimited
+    attendee_max_per_reg TINYINT NULL,                          -- Maximum attendees per registration submission - 0 = unlimited
+    reg_hold_minutes MEDIUMINT NULL,                            -- Number of minutes hold time for an inactive cart before registrant count hold expires (after which cart attempts to hold again on next access)
+    cart_hold_days MEDIUMINT NULL,                              -- Number of days hold time for inactive cart before cart is purged
+    reg_hours_before MEDIUMINT NULL,                            -- Number of hours before an event that is the latest a registration may be submitted.     
+    registration_account_options SMALLINT NULL,                 -- Bitmap of how user accounts may be used for this event - See registration_account_option in plugin.ini
+    payment_methods SMALLINT NULL,                              -- Bitmap of payment methods available to users for this event - See payment_method in plugin.ini
+    restricted_payment_methods SMALLINT NULL,                   -- Bitmap of restricted (admin use only) payment methods for this event - see payment_method
+    descr TEXT NULL,                                            -- Registrations specific description field for this event
+    terms TEXT NULL,                                            -- Terms and Conditions for registration
+    first_datetime DATETIME NULL,                               -- Start of first listed date/time for this event
+    last_datetime DATETIME NULL,                                -- Start of last listed date/time for this event
+    reg_file TINYTEXT NULL,                                     -- Name of a downloadable file
+    reg_file_title TINYTEXT NULL,                               -- Title for downloadable file
+    form_revision SMALLINT NULL,                                -- Current MagicForm form revision
+    notes TEXT NULL,                                            -- System operator's notes for this event - Not visible to users
+    PRIMARY KEY (id),
+    INDEX (event),
+    INDEX (event_code(10))
+);
+
+----
+
+-- Registration Event Time - Information and summary data for a specific event instance (relates to a perticular time record in events)
+-- A pseudo entry is created if registration is not date/time sensitive for this event. The pseudo entry does not point to an event time.
+-- These are created the first time a person tries to register for an event instance (time)
+-- One or more for each event
+CREATE TABLE {prefix}reg_time (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_event INT NULL,                                         -- Pointer to reg_event table
+    event_time INT NULL,                                        -- ID of events times table entry in Events add-on - If false (0), then this is a pseudo entry to use for all registrations (non-date/time specific)
+    start_datetime DATETIME NULL,                               -- Date and time when event instance starts
+    end_datetime DATETIME NULL,                                 -- Date and time when event instance ends
+    all_day BOOLEAN NULL,                                       -- All Day flag - Informational
+    attendees BOOLEAN NULL,                                     -- Flag if tracking attendees or if only one per registration submission (registers account submitting) - get from reg_event
+    attendee_max MEDIUMINT NULL,                                -- Attendee count limit - 0 = unlimited - get from reg_event record
+    attendee_count MEDIUMINT NULL,                              -- Current attendee count - calculated on the fly and stored here for reference
+    attendees_pending MEDIUMINT NULL,                           -- Current number of attendees for this time in active pending carts (Not checked out and attendees slots held)
+    attendees_available MEDIUMINT NULL,                         -- Currently available attendee count (limit - current - pending)
+    total_base_charge DOUBLE NULL,                              -- Total base charges
+    total_per_attendee DOUBLE NULL,                             -- Total per-attendee charges
+    total_other DOUBLE NULL,                                    -- Total other charges (meals, extras, fees, ...)
+    total_taxes DOUBLE NULL,                                    -- Total taxes charged
+    total_charges DOUBLE NULL,                                  -- Total charges (sum of all above)
+    total_discounts DOUBLE NULL,                                -- Total discounts of all types (applied payment codes, etc...)
+    total_payments DOUBLE NULL,                                 -- Total net payments (total charges - total discounts)
+    descr TEXT NULL,                                            -- Optional description field for this time entry
+    PRIMARY KEY (id),
+    INDEX (reg_event),
+    INDEX (event_time),
+    INDEX (start_datetime)
+);
+
+----
+
+-- Pending Attendees - In carts but not checked out
+-- Attendee counts may be held for a particular reg_time entry for carts that have not been checked out
+-- These are held for reg_event reg_hold_minutes, afterwhich they are timed out and removed from this table
+-- Cart entries are given the ID's for these entries when a hold is requested, if the entry is gone, the hold has expired
+CREATE TABLE {prefix}reg_time_pending (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_event INT NULL,                                         -- Pointer to reg_event table
+    reg_time INT NULL,                                          -- ID of time record
+    registrant INT NULL,                                        -- ID of reg_request_registrant record                                                  -- 
+    expire_time DATETIME NULL,                                  -- Time at which this hold expires
+    PRIMARY KEY (id),
+    INDEX (reg_event),
+    INDEX (reg_time)
+);
+
+----
+
+-- Registration Class - Type of registration for a specific event - Equates to "Rate Options" in the old system
+-- One or more for each event
+CREATE TABLE {prefix}reg_class (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_event INT NULL,                                         -- Pointer to reg_event table
+    name TINYTEXT NULL,                                         -- Name of this registration type
+    descr TEXT NULL,                                            -- Description
+    PRIMARY KEY (id),
+    INDEX (reg_event)
+);
+
+----
+
+-- Rates and dates for a particular reg_class
+-- One or more per reg_class - **** Days should not overlap for a particular reg_class
+CREATE TABLE {prefix}reg_rate (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_event INT NULL,                                         -- Pointer to reg_event table
+    reg_class INT NULL,                                         -- Pointer to reg_class table
+    name TINYTEXT NULL,                                         -- Namme of this rate
+    start_days INT NULL,                                        -- # of days before event time rate becomes available - may be selected as a date then coverted for storage
+    end_days INT NULL,                                          -- # of days before event time rate becomes unavailable
+    base_rate FLOAT,                                            -- Base rate to register
+    per_registrant FLOAT,                                       -- Rate per registrant
+    registrant_credits TINYINT NULL,                            -- Number of registrants included in base rate
+    PRIMARY KEY (id),
+    INDEX (reg_event),
+    INDEX (reg_class)
+);
+
+----
+
+-- An account for a person submitting a registration or a registrant for an event
+-- Depending on the use of these entries may not have all data included
+-- A single account may be referenced as a person submitting registrations and/or a person registered for an event
+CREATE TABLE {prefix}account (
+    id INT NOT NULL AUTO_INCREMENT,
+    active BOOLEAN NULL,                                        -- Is active flag (may be accessed or used) - default is true
+    validated BOOLEAN NULL,                                     -- Flag indicating that the account has been validated - Set to false when recovering password
+    validation_code TINYTEXT NULL,                              -- Validation code and timestamp ("{validation code}-{timestamp}) - Clear this after validation
+    registered_by INT NULL,                                     -- Account
+    member_id TINYTEXT NULL,                                    -- Free-form field for a member ID (not a GLM Associate member ID)
+    fname TINYTEXT NULL,                                        -- Account primary address
+    lname TINYTEXT NULL,
+    org TINYTEXT NULL,
+    title TINYTEXT NULL,
+    addr1 TINYTEXT NULL,
+    addr2 TINYTEXT NULL,
+    city TINYTEXT NULL,
+    state TINYTEXT NULL,
+    zip TINYTEXT NULL,
+    country TINYTEXT NULL,
+    phone TINYTEXT NULL,
+    fax TINYTEXT NULL,
+    bill_fname TINYTEXT NULL,                                   -- Last used billing information - Also stored in each registration request
+    bill_lname TINYTEXT NULL,
+    bill_org TINYTEXT NULL,
+    bill_title TINYTEXT NULL,
+    bill_addr1 TINYTEXT NULL,
+    bill_addr2 TINYTEXT NULL,
+    bill_city TINYTEXT NULL,
+    bill_state TINYTEXT NULL,
+    bill_zip TINYTEXT NULL,
+    bill_country TINYTEXT NULL,
+    bill_phone TINYTEXT NULL,
+    bill_fax TINYTEXT NULL,
+    email TINYTEXT NULL,
+    password TINYTEXT NULL,                                     -- Crypted password for login back into this account
+    email_ok BOOLEAN NULL,
+    is_member BOOLEAN NULL,                                     -- Is a member of the entity that owns the site
+    contact_id INT NULL,                                        -- Pointer to GLM Associate member contact record if account is for a member contact
+    contact_fname TINYTEXT NULL,
+    contact_lname TINYTEXT NULL,
+    contact_org TINYTEXT NULL,
+    contact_title TINYTEXT NULL,
+    contact_addr1 TINYTEXT NULL,
+    contact_addr2 TINYTEXT NULL,
+    contact_city TINYTEXT NULL,
+    contact_state TINYTEXT NULL,
+    contact_zip TINYTEXT NULL,
+    contact_country TINYTEXT NULL,
+    contact_phone TINYTEXT NULL,
+    contact_fax TINYTEXT NULL,
+    contact_email TINYTEXT NULL,
+    contact_email_ok BOOLEAN NULL,
+    guardian TINYTEXT NULL,
+    emer_contact TINYTEXT NULL,
+    emer_phone TINYTEXT NULL,
+    med_history TINYTEXT NULL,
+    allergy_med TINYTEXT NULL,
+    date_created DATE NULL,
+    notes TEXT NULL,                                            -- System operator's notes for this account - not visible to account owner
+    user_trace_info TINYTEXT NULL,                              -- IP Address of user computer and timestamp of last update
+    PRIMARY KEY (id),
+    INDEX (registered_by),
+    INDEX (member_id(10)),
+    INDEX (fname(10)),
+    INDEX (lname(10)),
+    INDEX (org(10)),
+    INDEX (city(10)),
+    INDEX (state(5)),
+    INDEX (zip(5)),
+    INDEX (email(10)),
+    INDEX (contact_id)
+);
+
+----
+
+-- A request for registration
+-- Has one or more reg_detail records associated with it
+CREATE TABLE {prefix}reg_request (
+    id INT NOT NULL AUTO_INCREMENT,
+    account INT NULL,                                           -- Pointer to user account (reg_account) who submitted the registrations. If 0 then guest request (prior to checkout)
+    validated BOOLEAN NULL,                                     -- Flag that indicates if request passed last validation with checkRegistrationRequest()
+    validation_message TEXT NULL,                               -- Reasons that request did not pass validation with checkRegistrationRequest() - Serialized array
+    bill_fname TINYTEXT NULL,                                   -- Billing information used for this registration submission - Updates account billing address - Kept here for each request
+    bill_lname TINYTEXT NULL,
+    bill_org TINYTEXT NULL,
+    bill_title TINYTEXT NULL,
+    bill_addr1 TINYTEXT NULL,
+    bill_addr2 TINYTEXT NULL,
+    bill_city TINYTEXT NULL,
+    bill_state TINYTEXT NULL,
+    bill_zip TINYTEXT NULL,
+    bill_country TINYTEXT NULL,
+    date_submitted DATE NULL,
+    pay_method INT NULL,                                        -- See payment_method in plugin.ini
+    payment_code TINYTEXT NULL,                                 -- Payment_code (code text) - if submitted and validated
+    status SMALLINT NULL,                                       -- See submission_status in plugin.ini
+    total DOUBLE PRECISION NULL,                                -- Total charge including all fees and taxes
+    cc_type TINYINT NULL,                                       -- Credit Card type (if used) - See credit_card in plugin.ini
+    cc_name TINYTEXT NULL,
+    cc_numb TINYTEXT NULL,
+    cc_exp TINYTEXT NULL,
+    cc_cvv TINYTEXT NULL,
+    cc_conf TINYTEXT NULL,                                      -- Confirmation code back from card processor
+    summary TEXT NULL,                                          -- HTML summary of cart contents, costs and payment - Use same HTML displayed to user
+    mf_data TEXT NULL,                                          -- Any MagicForm data associated with registrant
+    notes TEXT NULL,                                            -- System operator's notes for this registration request
+    user_trace_info TINYTEXT NULL,                              -- IP Address of user computer and timestamp
+    date_created DATETIME NULL,                                 -- Date request was first created
+    last_update DATETIME NULL,                                  -- Last update date/time - Used for timing out pending carts and attendee counts
+    PRIMARY KEY (id),
+    INDEX (account),
+    INDEX (date_submitted)
+);
+
+----
+
+-- Registration for a specific event
+-- Has one or more reg_selected_rate records associated with it 
+CREATE TABLE {prefix}reg_request_event (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_request INT NULL,                                       -- Pointer to reg_request table
+    reg_event INT NULL,                                         -- Pointer to reg_event
+    event_name TINYTEXT NULL,                                   -- Name of Event so it will always be in the cart data
+    notes TEXT NULL,                                            -- System operator's notes for this registration request
+    PRIMARY KEY (id),
+    INDEX (reg_request),
+    INDEX (reg_event),
+    INDEX (reg_time)
+);
+
+----
+
+--  A particular reg_class selected
+--  Has one or more reg_request_rate records associated with it 
+CREATE TABLE {prefix}reg_request_class (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_event INT NULL,                                         -- Pointer to reg_event entry
+    reg_request INT NULL,                                       -- Pointer to the registration request record
+    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
+    class INT NULL,                                             -- Pointer to event reg_class table - False (0) if registration class no longer exits
+    class_name TINYTEXT NULL,                                   -- Name of event class at the time selected
+    notes TEXT NULL,                                            -- System operator's notes for this registration request
+    PRIMARY KEY (id),
+    INDEX (reg_event),
+    INDEX (reg_time),
+    INDEX (reg_request_event)
+);
+
+----
+
+--  A particular reg_rate selected
+--  Has one or more reg_request_registrant records associated with it
+CREATE TABLE {prefix}reg_request_rate (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_event INT NULL,                                         -- Pointer to reg_event entry
+    reg_request INT NULL,                                       -- Pointer to the registration request record
+    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
+    reg_request_class INT NULL,                                 -- Pointer to reg_request_class table entry
+    rate INT NULL,                                              -- Pointer to event reg_rate table - False (0) if registration rate no longer exists
+    rate_name TINYTEXT NULL,                                    -- Name of event class rate at the time selected
+    base_rate FLOAT,                                            -- Base rate at time of registration
+    per_registrant FLOAT,                                       -- Per Registrant Rate at time of registration
+    registrant_credits TINYINT NULL,                            -- Number of registrants included in base rate at time of registration
+    notes TEXT NULL,                                            -- System operator's notes for this registration request
+    PRIMARY KEY (id),
+    INDEX (reg_event),
+    INDEX (reg_time),
+    INDEX (reg_request_event),
+    INDEX (reg_request_class)
+);
+
+----
+
+--  A specific registrant for a selected registration rate
+CREATE TABLE {prefix}reg_request_registrant (
+    id INT NOT NULL AUTO_INCREMENT,
+    account INT NULL,                                           -- Pointer to the account entry for the person being registered - False (0) if account no longer exists or registrant account not needed
+    reg_event INT NULL,                                         -- Pointer to reg_event entry
+    reg_time INT NULL,                                          -- Pointer reg_time entry
+    event_datetime DATETIME NULL,                               -- Date and time of event time selected so it will always be in the cart
+    reg_request INT NULL,                                       -- Pointer to the registration request record
+    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
+    reg_request_class INT NULL,                                 -- Pointer to reg_request_class table entry
+    reg_request_rate INT NULL,                                  -- Pointer to reg_request_rate table entry
+    fname TINYTEXT NULL,                                        -- First name of registrant at the time of selection
+    lname TINYTEXT NULL,                                        -- Last name of registrant at the time of selection
+    notes TEXT NULL,                                            -- System operator's notes for this registration request
+    PRIMARY KEY (id),
+    INDEX (account),
+    INDEX (reg_event),
+    INDEX (reg_time),
+    INDEX (reg_request),
+    INDEX (reg_request_event),
+    INDEX (reg_request_class),
+    INDEX (reg_request_rate)
+);
+
+----
+
+-- Insert into management table
+INSERT INTO {prefix}management
+    (
+    canonical_reg_page,
+    reg_org_name,
+    reg_org_short,
+    reg_org_address,
+    reg_org_city,
+    reg_org_state,
+    reg_org_zip,
+    reg_org_phone,
+    reg_org_toll_free,
+    reg_org_internal_email,
+    reg_org_from_email,
+    reg_payment_methods,
+    reg_proc_methods,
+    reg_cc_accepts,
+    reg_authorize_net_login,
+    reg_authorize_net_key,
+    reg_authorize_net_test,
+    reg_authorize_net_conf,
+    reg_authorize_net_merchant_email,
+    reg_merchant_solutions_acctid,
+    reg_merchant_solutions_merchantpin,
+    reg_merchant_solutions_test,
+    reg_full_billing_info,
+    reg_bill_info_req_no_charge,
+    reg_bill_info_req_comp_code,
+    reg_bill_info_req_cash,
+    reg_bill_info_req_check,
+    reg_bill_info_req_credit_card,
+    reg_bill_info_req_merchant_call,
+    reg_medical_info
+    )
+    VALUES
+    (
+    'registrations',                                            -- reg_canonical_reg_page,
+    'Gaslight Media',                                           -- reg_org_name,
+    'GLM',                                                      -- reg_org_short,
+    '120 E. Lake St.',                                          -- reg_org_address,
+    'Petoskey',                                                 -- reg_org_city,
+    'MI',                                                       -- reg_org_state,
+    '49770',                                                    -- reg_org_zip,
+    '231-487-0692',                                             -- reg_org_phone,
+    '800-123-1234',                                             -- reg_org_toll_free,
+    'internal@gaslightmedia.com',                               -- reg_org_internal_email,
+    'info@gaslightmedia.com',                                   -- reg_org_from_email,
+    0,                                                          -- reg_payment_methods,
+    0,                                                          -- reg_proc_methods,
+    0,                                                          -- reg_cc_accepts,
+    '',                                                         -- reg_authorize_net_login,
+    '',                                                         -- reg_authorize_net_key,
+    1,                                                          -- reg_authorize_net_test,
+    true,                                                       -- reg_authorize_net_conf
+    '',                                                         -- reg_authorize_net_merchant_email,
+    '',                                                         -- reg_merchant_solutions_acctid,
+    '',                                                         -- reg_merchant_solutions_merchantpin,
+    1,                                                          -- reg_merchant_solutions_test,
+    true,                                                       -- reg_full_billing_info,
+    0,                                                          -- reg_bill_info_req_no_charge,
+    0,                                                          -- reg_bill_info_req_comp_code,
+    0,                                                          -- reg_bill_info_req_cash,
+    0,                                                          -- reg_bill_info_req_check,
+    0,                                                          -- reg_bill_info_req_credit_card,
+    0,                                                          -- reg_bill_info_req_merchant_call,
+    true                                                        -- reg_medical_info,
+    );
+
+----
+
+-- Insert into settings_terms table
+INSERT INTO {prefix}settings_terms
+    (
+    reg_term_registrations_name,
+    reg_term_registration,
+    reg_term_registration_cap,
+    reg_term_registration_plur,
+    reg_term_registration_plur_cap,
+    reg_term_register,
+    reg_term_register_cap,
+    reg_term_registers,
+    reg_term_registering,
+    reg_term_registering_cap,
+    reg_term_registered,
+    reg_term_registered_cap,
+    reg_term_attendee,
+    reg_term_attendee_cap,
+    reg_term_attendee_plur,
+    reg_term_attendee_plur_cap,
+    reg_term_attending,
+    reg_term_attended,
+    reg_term_registered_user,
+    reg_term_registered_user_cap,
+    reg_term_registered_user_plur,
+    reg_term_registered_user_plur_cap,
+    reg_term_id,
+    reg_term_id_cap,
+    reg_term_id_plur,
+    reg_term_id_plur_cap,
+    reg_term_password,
+    reg_term_password_cap,
+    reg_term_password_plur,
+    reg_term_password_plur_cap,
+    reg_term_instructor,
+    reg_term_instructor_cap,
+    reg_term_instructor_plur,
+    reg_term_instructor_plur_cap,
+    reg_term_payment_code,
+    reg_term_payment_code_cap,
+    reg_term_payment_code_plur,
+    reg_term_payment_code_plur_cap,
+    reg_term_registration_button,
+    reg_term_contact_information
+    )
+    VALUES
+    (
+    'Event Registrations',                                      -- reg_term_registrations_name
+    'registration',                                             -- reg_term_registration
+    'Registration',                                             -- reg_term_registration_cap
+    'registrations',                                            -- reg_term_registration_plur
+    'Registrations',                                            -- reg_term_registration_plur_cap
+    'register',                                                 -- reg_term_registe
+    'Register',                                                 -- reg_term_register_cap
+    'registers',                                                -- reg_term_registers
+    'registering',                                              -- reg_term_registering
+    'Registering',                                              -- reg_term_registering_cap
+    'registered',                                               -- reg_term_registered
+    'Registered',                                               -- reg_term_registered_cap
+    'attendee',                                                 -- reg_term_attendee
+    'Attendee',                                                 -- reg_term_attendee_cap
+    'attendees',                                                -- reg_term_attendee_plur
+    'Attendees',                                                -- reg_term_attendee_plur_cap
+    'attending',                                                -- reg_term_attending
+    'attended',                                                 -- reg_term_attended
+    'user',                                                     -- reg_term_registered_user
+    'User',                                                     -- reg_term_registered_user_cap
+    'users',                                                    -- reg_term_registered_user_plur
+    'Users',                                                    -- reg_term_registered_user_plur_cap
+    'ID',                                                       -- reg_term_id
+    'ID',                                                       -- reg_term_id_cap
+    'IDs',                                                      -- reg_term_id_plur
+    'IDs',                                                      -- reg_term_id_plur_cap
+    'password',                                                 -- reg_term_password
+    'passwords',                                                -- reg_term_password_cap
+    'Password',                                                 -- reg_term_password_plur
+    'Passwords',                                                -- reg_term_password_plur_cap
+    'instructor',                                               -- reg_term_instructor
+    'Instructor',                                               -- reg_term_instructor_cap
+    'instructors',                                              -- reg_term_instructor_plur
+    'Instructors',                                              -- reg_term_instructor_plur_cap
+    'payment code',                                             -- reg_term_payment_code
+    'Payment code',                                             -- reg_term_payment_code_cap
+    'payment codes',                                            -- reg_term_payment_code_plur
+    'Payment codes',                                            -- reg_term_payment_code_plur_cap
+    'Register for Event',                                       -- reg_term_registration_button
+    'Contact Information'                                       -- reg_term_contact_information
+    );
+
+----
+
+-- Insert into misc table
+INSERT INTO {prefix}misc
+    (
+    reg_bulletin,
+    cart_page_text,
+    checkout_page_text,
+    summary_page_text,
+    reg_terms,
+    notify_subject,
+    notify_text,
+    instr_notify_subject,
+    instr_notify_text,
+    submission_notify_subject,
+    submission_notify_text,
+    registrant_notify_subject,
+    registrant_notify_text,
+    submission_ack_subject,
+    submission_ack_text,
+    registrant_ack_subject,
+    registrant_ack_text
+    )
+    VALUES
+    (
+    'Registration Bulletin Text',
+    'Text for top of Cart Page',
+    'Text for top of Checkout Page',
+    'Text for top of Summary Page',
+    'Terms and Conditions',
+    'Subject of notification to site owner of a registration',
+    'Text of notification to site owner of a registration',
+    'Subject of notification to instructor of registration',
+    'Text for notification to instructor of registration',
+    'Subject of notification to person submitting registration',
+    'Text of notification to person submitting registration',
+    'Subject for notification to registrant',
+    'Text for notification to registrant',
+    'Subject of acknowledgement to person submitting registration',
+    'Text of acknowledgement to person submitting registration',
+    'Subject of acknowledgement to registrant',
+    'Text of acknowledgement to registrant'
+    );
index 1c44fac..5af2dd2 100644 (file)
@@ -29,7 +29,8 @@ $glmMembersRegistrationsDbVersions = array(
     '0.0.13' => array('version' => '0.0.13', 'tables' => 20, 'date' => '10/03/2017'),
     '0.0.14' => array('version' => '0.0.14', 'tables' => 20, 'date' => '10/13/2017'),
     '0.0.15' => array('version' => '0.0.15', 'tables' => 15, 'date' => '10/18/2017'),
-    '0.0.16' => array('version' => '0.0.16', 'tables' => 15, 'date' => '10/24/2017')
+    '0.0.16' => array('version' => '0.0.16', 'tables' => 15, 'date' => '10/24/2017'),
+    '0.0.17' => array('version' => '0.0.17', 'tables' => 15, 'date' => '11/3/2017')
 );
 
 
diff --git a/setup/databaseScripts/drop_database_V0.0.16.sql b/setup/databaseScripts/drop_database_V0.0.16.sql
deleted file mode 100644 (file)
index 1451bb2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
--- Gaslight Media Members Database
--- File Created: 12/09/14 15:27:15
--- Database Version: 1.1.23
--- Database Deletion Script
--- Note: Tables with DELETE CASCADE must appear before referenced table
-
-DROP TABLE IF EXISTS
-    {prefix}management,
-    {prefix}settings_terms,
-    {prefix}misc,
-    {prefix}payment_code,
-    {prefix}reg_event,
-    {prefix}reg_time,
-    {prefix}reg_time_pending,
-    {prefix}reg_class,
-    {prefix}reg_rate,
-    {prefix}account,
-    {prefix}reg_request,
-    {prefix}reg_request_event,
-    {prefix}reg_request_class,
-    {prefix}reg_request_rate,
-    {prefix}reg_request_registrant
-;
-
diff --git a/setup/databaseScripts/drop_database_V0.0.17.sql b/setup/databaseScripts/drop_database_V0.0.17.sql
new file mode 100644 (file)
index 0000000..1451bb2
--- /dev/null
@@ -0,0 +1,24 @@
+-- Gaslight Media Members Database
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 1.1.23
+-- Database Deletion Script
+-- Note: Tables with DELETE CASCADE must appear before referenced table
+
+DROP TABLE IF EXISTS
+    {prefix}management,
+    {prefix}settings_terms,
+    {prefix}misc,
+    {prefix}payment_code,
+    {prefix}reg_event,
+    {prefix}reg_time,
+    {prefix}reg_time_pending,
+    {prefix}reg_class,
+    {prefix}reg_rate,
+    {prefix}account,
+    {prefix}reg_request,
+    {prefix}reg_request_event,
+    {prefix}reg_request_class,
+    {prefix}reg_request_rate,
+    {prefix}reg_request_registrant
+;
+
diff --git a/setup/databaseScripts/update_database_V0.0.17.sql b/setup/databaseScripts/update_database_V0.0.17.sql
new file mode 100644 (file)
index 0000000..881fc7b
--- /dev/null
@@ -0,0 +1,13 @@
+-- Gaslight Media Members Database  - Registratiuons Add-On
+-- File Created: 10/03/17 11:00:00
+-- Database Version: 0.0.16
+-- Database Update From Previous Version Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+ALTER TABLE {prefix}management ADD COLUMN reg_merchant_solutions_conf BOOLEAN;
+
+----
+
+ALTER TABLE {prefix}management ADD COLUMN reg_merchant_solutions_merchant_email TINYTEXT;
index 94386ad..f809ef7 100644 (file)
                             </select>
                         </td>
                     </tr>
-                    <tr>
+                    <tr class="authorize-net">
                         <td></td>
                         <th><p>Authorize.net</p></th>
                     </tr>
-                    <tr>
-                    <tr>
-                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.reg_authorize_net_login} glm-required{/if}">Authorize.net Login:</th>
+                    <tr class="authorize-net">
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.reg_authorize_net_login} glm-required{/if}">Login:</th>
                         <td {if $regSettings.fieldFail.reg_authorize_net_login}class="glm-form-bad-input"{/if}>
                             <input type="text" name="reg_authorize_net_login" value="{$regSettings.fieldData.reg_authorize_net_login}" class="glm-form-text-input-medium">
                             {if $regSettings.fieldFail.reg_authorize_net_login}<p>{$regSettings.fieldFail.reg_authorize_net_login}</p>{/if}
                         </td>
                     </tr>
-                    <tr>
-                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.reg_authorize_net_key} glm-required{/if}">Authorize.net Key:</th>
+                    <tr class="authorize-net">
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.reg_authorize_net_key} glm-required{/if}">Key:</th>
                         <td {if $regSettings.fieldFail.reg_authorize_net_key}class="glm-form-bad-input"{/if}>
                             <input type="text" name="reg_authorize_net_key" value="{$regSettings.fieldData.reg_authorize_net_key}" class="glm-form-text-input-medium">
                             {if $regSettings.fieldFail.reg_authorize_net_key}<p>{$regSettings.fieldFail.reg_authorize_net_key}</p>{/if}
                         </td>
                     </tr>
-                    <tr>
-                        <th>Authorize.net Test Mode:</th>
+                    <tr class="authorize-net">
+                        <th>Test Mode:</th>
                         <td>
                             <select id="default-authorize-net-test" data-id="reg_authorize_net_test" name="reg_authorize_net_test">
                                 <option value=""></option>
                             </select>
                         </td>
                     </tr>
-                    <tr>
+                    <tr class="authorize-net">
                         <th>Send Confirmation E-Mail</th>
                         <td>
                             <input type="checkbox" name="reg_authorize_net_conf"{if $regSettings.fieldData.reg_authorize_net_conf.value} checked="checked"{/if}>
                         </td>
                     </tr>
-                    <tr>
-                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.reg_authorize_net_merchant_email} glm-required{/if}">Authorize.net Merchant Email:</th>
+                    <tr class="authorize-net">
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.reg_authorize_net_merchant_email} glm-required{/if}">Merchant Email:</th>
                         <td {if $regSettings.fieldFail.reg_authorize_net_merchant_email}class="glm-form-bad-input"{/if}>
                             <input type="text" name="reg_authorize_net_merchant_email" value="{$regSettings.fieldData.reg_authorize_net_merchant_email}" class="glm-form-text-input-medium">
                             {if $regSettings.fieldFail.reg_authorize_net_merchant_email}<p>{$regSettings.fieldFail.reg_authorize_net_merchant_email}</p>{/if}
                         </td>
                     </tr>
-                    <tr>
+                    <tr class="merchant-solutions">
                         <td></td>
                         <th><p>Merchant Solutions</p></th>
                     </tr>
-                    <tr>
-                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.reg_merchant_solutions_acctid} glm-required{/if}">Merchant Solutions Account ID:</th>
+                    <tr class="merchant-solutions">
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.reg_merchant_solutions_acctid} glm-required{/if}"> Account ID:</th>
                         <td {if $regSettings.fieldFail.reg_merchant_solutions_acctid}class="glm-form-bad-input"{/if}>
                             <input type="text" name="reg_merchant_solutions_acctid" value="{$regSettings.fieldData.reg_merchant_solutions_acctid}" class="glm-form-text-input-medium">
                             {if $regSettings.fieldFail.reg_merchant_solutions_acctid}<p>{$regSettings.fieldFail.reg_merchant_solutions_acctid}</p>{/if}
                         </td>
                     </tr>
-                    <tr>
-                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.reg_merchant_solutions_merchantpin} glm-required{/if}">Merchant Solutions Merchant PIN:</th>
+                    <tr class="merchant-solutions">
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.reg_merchant_solutions_merchantpin} glm-required{/if}">Merchant PIN:</th>
                         <td {if $regSettings.fieldFail.reg_merchant_solutions_merchantpin}class="glm-form-bad-input"{/if}>
                             <input type="text" name="reg_merchant_solutions_merchantpin" value="{$regSettings.fieldData.reg_merchant_solutions_merchantpin}" class="glm-form-text-input-medium">
                             {if $regSettings.fieldFail.reg_merchant_solutions_merchantpin}<p>{$regSettings.fieldFail.reg_merchant_solutions_merchantpin}</p>{/if}
                         </td>
                     </tr>
-                    <tr>
-                        <th>Merchant Solutions Test Mode:</th>
+                    <tr class="merchant-solutions">
+                        <th>Test Mode:</th>
                         <td>
                             <select id="default-merchant-solutions-test" data-id="reg_merchant_solutions_test" name="reg_merchant_solutions_test">
                                 <option value=""></option>
                             </select>
                         </td>
                     </tr>
+                    <tr class="merchant-solutions">
+                        <th>Send Confirmation E-Mail</th>
+                        <td>
+                            <input type="checkbox" name="reg_merchant_solutions_conf"{if $regSettings.fieldData.reg_merchant_solutions_conf.value} checked="checked"{/if}>
+                        </td>
+                    </tr>
+                    <tr class="merchant-solutions">
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.reg_merchant_solutions_merchant_email} glm-required{/if}">Merchant Email:</th>
+                        <td {if $regSettings.fieldFail.reg_merchant_solutions_merchant_email}class="glm-form-bad-input"{/if}>
+                            <input type="text" name="reg_merchant_solutions_merchant_email" value="{$regSettings.fieldData.reg_merchant_solutions_merchant_email}" class="glm-form-text-input-medium">
+                            {if $regSettings.fieldFail.reg_merchant_solutions_merchant_email}<p>{$regSettings.fieldFail.reg_merchant_solutions_merchant_email}</p>{/if}
+                        </td>
+                    </tr>
                     <tr>
                         <td></td>
                         <th><p>Billing Information Fields</p></th>
     </tr>
 </table>
 
+<script type="text/javascript">
+    jQuery(function($){
+
+        function showSelectedCardProcessor() {
+
+            // Get the value from the selected Payment Method
+            var processor = $('#reg_proc_methods').val();
+            
+            // This is a hack, we should be looking at the plugin.ini for these numbers but I'm just too lazy today
+            if (processor == 2) {
+                $('.authorize-net').removeClass('glm-hidden');
+                $('.merchant-solutions').addClass('glm-hidden');
+            } else if (processor == 3) {
+                $('.authorize-net').addClass('glm-hidden');
+                $('.merchant-solutions').removeClass('glm-hidden');
+            } else {
+                $('.authorize-net').addClass('glm-hidden');
+                $('.merchant-solutions').addClass('glm-hidden');
+            }
+
+        }
+        
+        // When payment method selection changes
+        $('#reg_proc_methods').on('change', function() {
+            showSelectedCardProcessor();
+        });
+
+        // Start with all pay method inputs dissabled
+        $( document ).ready(function() {
+            showSelectedCardProcessor();
+        });
+        
+    });
+</script>
+
 {include file='admin/management/footer.html'}
\ No newline at end of file
index 549d72d..2772ed1 100644 (file)
@@ -11,8 +11,8 @@
     </div>
 {/if}
 
-{if $haveCart}
-    <form href="{$regUrl}" method="post">
+{if $haveCart}              
+    <form id="checkoutForm" href="{$regUrl}" method="post">
         <input type="hidden" name="page" value="checkoutProcess">
 
         <a href="#cart-summary">See summary of registration request and charges below</a>
                 </div>
                 <div class="glm-large-6 glm-columns" style="">
                     <div class="glm-reg-row"><div class="glm-large-12 glm-columns"><h4>Billing Information</h4></div></div>
-                    <div class="glm-reg-row"><div class="glm-large-12 glm-columns"><input type="checkbox" name="billing_same">&nbsp;Same as Account Information</div></div>
+                    <div class="glm-reg-row"><div class="glm-large-12 glm-columns"><input type="checkbox" name="billing_same" value="1">&nbsp;Same as Account Information</div></div>
                     <div class="glm-reg-row">
                         <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_fname} glm-reg-required{/if}">First Name:</div>
                         <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_fname} glm-reg-fail{/if}"><input type="text" name="bill_fname" value="{$regAccount.fieldData.bill_fname}"{if $regAccount.fieldRequired.bill_fname} required{/if}></div>
                 <div class="glm-large-6 glm-columns">
                     <h4>Payment Information</h4>
      
-    {if $payMethods.{$payMethodsNumb.NoCharge}.default}
-                    <h5><input type="radio" name="payMethod_{$payMethodsNumb.NoCharge}"/> {$payMethods.{$payMethodsNumb.NoCharge}.name}</h5>
+    {$pm = $payMethodsNumb.NoCharge}
+    {if $payMethods.{$pm}.default}
+                    <h5><input id="payMethodButton_{$pm}" type="radio" name="payMethod" value="{$pm}" class="payMethodSelector" required {if $payMethod == {$pm}} checked{/if}><label for="payMethodButton_{$pm}">  {$payMethods.{$pm}.name}</label></h5>
+                    <div id="payMethod_{$pm}" class="payMethodSelection glm-hidden">
+                        <p>*** No Charge ****</p>
+                    </div>
     {/if}
-    {if $payMethods.{$payMethodsNumb.CompCode}.default}
-                    <h5><input type="radio" name="payMethod_{$payMethodsNumb.CompCode}"/> {$payMethods.{$payMethodsNumb.CompCode}.name}</h5>
+    {$pm = $payMethodsNumb.CompCode}
+    {if $payMethods.{$pm}.default}
+                    <h5><input id="payMethodButton_{$pm}" type="radio" name="payMethod" value="{$pm}" class="payMethodSelector" required {if $payMethod == {$pm}} checked{/if}><label for="payMethodButton_{$pm}"> {$payMethods.{$pm}.name}</label></h5>
+                    <div id="payMethod_{$pm}" class="payMethodSelection glm-hidden">
+                        <div class="glm-reg-row">
+                            <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.comp_code} glm-reg-required{/if}">Enter code:</div>
+                            <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.comp_code} glm-reg-fail{/if}">
+                                <input type="text" name="comp_code" value="{$regAccount.fieldData.comp_code}"{if $regAccount.fieldRequired.comp_code} required{/if} class="payMethodInput payMethodInput_{$pm}">
+                            </div>
+                        </div>
+                    </div>
     {/if}
-    {if $payMethods.{$payMethodsNumb.Cash}.default}
-                    <h5><input type="radio" name="payMethod_{$payMethodsNumb.Cash}"/> {$payMethods.{$payMethodsNumb.Cash}.name}</h5>
+    {$pm = $payMethodsNumb.Cash}
+    {if $payMethods.{$pm}.default}
+                    <h5><input id="payMethodButton_{$pm}" type="radio" name="payMethod" value="{$pm}" class="payMethodSelector" required {if $payMethod == {$pm}} checked{/if}><label for="payMethodButton_{$pm}">  {$payMethods.{$pm}.name}</label></h5>
+                    <div id="payMethod_{$pm}" class="payMethodSelection glm-hidden">
+                        <p>*** Cash ****</p>
+                    </div>
+                    
     {/if}
-    {if $payMethods.{$payMethodsNumb.Check}.default}
-                    <h5><input type="radio" name="payMethod_{$payMethodsNumb.Check}"/> {$payMethods.{$payMethodsNumb.Check}.name}</h5>
+    {$pm = $payMethodsNumb.Check}
+    {if $payMethods.{$pm}.default}
+                    <h5><input id="payMethodButton_{$pm}" type="radio" name="payMethod" value="{$pm}" class="payMethodSelector" required {if $payMethod == {$pm}} checked{/if}><label for="payMethodButton_{$pm}">  {$payMethods.{$pm}.name}</label></h5>
+                    <div id="payMethod_{$pm}" class="payMethodSelection glm-hidden">
+                        <p>*** No Check ****</p>
+                    </div>
     {/if}
-    {if $payMethods.{$payMethodsNumb.CallFromMerchant}.default}
-                    <h5><input type="radio" name="payMethod_{$payMethodsNumb.CallFromMerchant}"/> {$payMethods.{$payMethodsNumb.CallFromMerchant}.name}</h5>
+    {$pm = $payMethodsNumb.CallFromMerchant}
+    {if $payMethods.{$pm}.default}
+                    <h5><input id="payMethodButton_{$pm}" type="radio" name="payMethod" value="{$pm}" class="payMethodSelector" required {if $payMethod == {$pm}} checked{/if}><label for="payMethodButton_{$pm}">  {$payMethods.{$pm}.name}</label></h5>
+                    <div id="payMethod_{$pm}" class="payMethodSelection glm-hidden">
+                        <p>*** Call From Merchant ****</p>
+                    </div>
     {/if}
-    {if $payMethods.{$payMethodsNumb.CreditCard}.default}
-                    <h5><input type="radio" name="payMethod_{$payMethodsNumb.CreditCard}"/> {$payMethods.{$payMethodsNumb.CreditCard}.name}</h5>
-                    <div class="glm-reg-row">
-                        <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_type} glm-reg-required{/if}">Card Type:</div>
-                        <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_type} glm-reg-fail{/if}">
-                            <select name="cc_type">
-                                <option value=""></option>
-                    {foreach $regAccount.fieldData.cc_type.list as $c}
-                                <option value="{$c.value}"{if $regAccount.fieldData.cc_type.value == $c.value} selected="selected"{/if}>
-                                    {$c.name}
-                                </option>
-                    {/foreach}
-                            </select>
+    {$pm = $payMethodsNumb.CreditCard}
+    {if $payMethods.{$pm}.default}
+                    <h5><input id="payMethodButton_{$pm}" type="radio" name="payMethod" value="{$pm}" class="payMethodSelector" required {if $payMethod == {$pm}} checked{/if}><label for="payMethodButton_{$pm}">  {$payMethods.{$pm}.name}</label></h5>
+                    <div id="payMethod_{$pm}" class="payMethodSelection glm-hidden">
+                        <div class="glm-reg-row">
+                            <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_name} glm-reg-required{/if}">Name on Card:</div>
+                            <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_name} glm-reg-fail{/if}">
+                                <input type="text" name="cc_name" value="{$regAccount.fieldData.cc_name}"{if $regAccount.fieldRequired.cc_name} required{/if} class="payMethodInput payMethodInput_{$pm}">
+                            </div>
                         </div>
+                        <div class="glm-reg-row">
+                            <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_type} glm-reg-required{/if}">Card Type:</div>
+                            <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_type} glm-reg-fail{/if}">
+                                <select name="cc_type" class="payMethodInput payMethodInput_{$pm}">
+                                    <option value=""></option>
+                        {foreach $regAccount.fieldData.cc_type.list as $c}
+                                    <option value="{$c.value}"{if $c.default} selected="selected"{/if}>
+                                        {$c.name}
+                                    </option>
+                        {/foreach}
+                                </select>
+                            </div>
+                        </div>
+                        <div class="glm-reg-row">
+                            <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_numb} glm-reg-required{/if}">Card Number:</div>
+                            <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_numb} glm-reg-fail{/if}">
+                                <input type="text" placeholder="Numbers Only" name="cc_numb" value="{$regAccount.fieldData.cc_numb}"{if $regAccount.fieldRequired.cc_numb} required{/if} class="payMethodInput payMethodInput_{$pm}">
+                           </div>
+                        </div>
+                        <div class="glm-reg-row">
+                            <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_exp} glm-reg-required{/if}">Card Expiration:</div>
+                            <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_exp} glm-reg-fail{/if}">
+                                <input type="text" placeholder="MM/YY" name="cc_exp" value="{$regAccount.fieldData.cc_exp}"{if $regAccount.fieldRequired.cc_exp} required{/if} class="payMethodInput payMethodInput_{$pm}">
+                            </div>
+                        </div>
+                        <div class="glm-reg-row">
+                            <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_cvv} glm-reg-required{/if}">CVV:</div>
+                            <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_cvv} glm-reg-fail{/if}">
+                                <input type="text" placeholder="3 digit number on back of card" name="cc_cvv" value="{$regAccount.fieldData.cc_cvv}"{if $regAccount.fieldRequired.cc_cvv} required{/if} class="payMethodInput payMethodInput_{$pm}">
+                            </div>
+                        </div>                    
                     </div>
-                    <div class="glm-reg-row">
-                        <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_name} glm-reg-required{/if}">Name on Card:</div>
-                        <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_name} glm-reg-fail{/if}"><input type="text" name="cc_name" value="{$regAccount.fieldData.cc_name}"{if $regAccount.fieldRequired.cc_name} required{/if}></div>
-                    </div>
-                    <div class="glm-reg-row">
-                        <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_numb} glm-reg-required{/if}">Card Number:</div>
-                        <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_numb} glm-reg-fail{/if}"><input type="text" placeholder="Numbers Only" name="cc_numb" value="{$regAccount.fieldData.cc_numb}"{if $regAccount.fieldRequired.cc_numb} required{/if}></div>
-                    </div>
-                    <div class="glm-reg-row">
-                        <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_exp} glm-reg-required{/if}">Card Expiration:</div>
-                        <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_exp} glm-reg-fail{/if}"><input type="text" placeholder="MM/YY" name="cc_exp" value="{$regAccount.fieldData.cc_exp}"{if $regAccount.fieldRequired.cc_exp} required{/if}></div>
-                    </div>
-                    <div class="glm-reg-row">
-                        <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_cvv} glm-reg-required{/if}">CVV:</div>
-                        <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_name} glm-reg-fail{/if}"><input type="text" placeholder="3 digit number on back of card" name="cc_name" value="{$regAccount.fieldData.cc_name}"{if $regAccount.fieldRequired.cc_name} required{/if}></div>
-                    </div>                    
     {/if}
-    {if $payMethods.{$payMethodsNumb.PayPal}.default}
-                    <h5><input type="radio" name="payMethod_{$payMethodsNumb.PayPal}"/> {$payMethods.{$payMethodsNumb.PayPal}.name}</h5>
+    {$pm = $payMethodsNumb.PayPal}
+    {if $payMethods.{$pm}.default}
+                    <h5><input id="payMethodButton_{$pm}" type="radio" name="payMethod" value="{$pm}" class="payMethodSelector" required {if $payMethod == {$pm}} checked{/if}><label for="payMethodButton_{$pm}">  {$payMethods.{$pm}.name}</label></h5>
+                    <div id="payMethod_{$pm}" class="payMethodSelection glm-hidden">
+                        <p>*** Pay Pal ****</p>
+                    </div>
     {/if}
     
     
                 <div class="glm-large-12 glm-columns">
                     <div class="glm-reg-row">
                         <h4>Terms and Conditions (*** Added fields for events ***)</h4>
-                        You <span class="glm-reg-required">must check</span> the boxes below to confirm that you agree to the listed Terms and Conditions for each event.
+                        You <span class="glm-reg-required">must check</span> the boxes below to confirm that you agree to the Terms and Conditions for each event.
                     </div>
     {foreach $cart.events as $event}
+      {if $event.event_terms != ''}
                     <div class="glm-reg-row">
                         <div class="glm-large-1">&nbsp;</div>
                         <div class="glm-large-11 glm-columns glm-reg-nowrap">
                             <h5>{$event.event_name}:</h5>
-                            <input type="checkbox" name="terms_{$event.id}" value="accept" required> {$event.event_terms} {$event.id}<br>
+                            <input id="terms_{$event.id}" type="checkbox" name="terms_{$event.id}" value="accept" required><label for="terms_{$event.id}"> {$event.event_terms}</label><br>
                             *** Any added fields go here ***
 
                         </div>
                     </div>
+      {/if}
     {/foreach}
                 </div>
             </div>
             <div style="text-align: right;">(There is no charge for your request.)</div>
     {/if}
 
-    {if $cart.blockCheckout}
-            <div>
-                <div class="glm-reg-warning">You have not yet submitted your registration. See above for issues! <img src="{$assetUrl}/fingerUpRed.svg" style="height: 2em;"></div>
-            </div>
-    {else}
             <div class="glm-right" style="white-space; nowrap;">
-                <span class="glm-reg-warning">You have one more step to complete your registration!</span> <img src="{$assetUrl}/fingerRightRed.svg" style="height: 2em;"> <input type="submit" value="Submit Registration Request" class="button tiny">
+                <span class="glm-reg-warning">You have one more step to complete your registration!</span> <img src="{$assetUrl}/fingerRightRed.svg" style="height: 2em;"> <input id="regSubmitButton" type="submit" value="Submit Registration Request" class="button tiny">
             </div>
-    {/if}
+    
 
         </form>
+        
+        <div id="regSubmitDialog" title="Please wait...">Please wait while we process your registration request. If you don't see a new page, your registration request may not have been processed.</div>
+        <div id="regSubmitFailDialog" title="Oops!">
+            <h3>Something may have gone wrong.</h3>
+            <p>
+                It may be that your registration request was received and processed and you didn't receive our response yet.
+                If you still don't see a response in a while, try returning to the cart using the button above.
+                If still don't see any response, please check your E-Mail to see if you have been sent a confirmation. 
+            </p>
+            <p>
+                In any case, we will never process your request more than once. If you can return to the cart, it should say if 
+                your request was recieved and processed. If not, you may try the checkout process again or come back later.
+            </p>
+        </div>
 
         <h4 id="cart-summary">Registration Summary</h4>
         <table class="glm-admin-table" width="100%">
                     <td>{$registrant.fname} {$registrant.lname}</td>
                     <td>{$registrant.event_time}</td>
                     <td style="text-align: right;">
-                        {if $registrant.registrantDiscount > 0}
-                            {$registrant.registrantDiscount|number_format:2}
+                        {if $registrant.registrantDiscounts > 0}
+                            {$registrant.registrantDiscounts|number_format:2}
                         {else}
                             &nbsp;
                         {/if}
 
     </div>
 </div>
+
+<script type="text/javascript">
+    jQuery(function($){
+
+        // When payment method selection changes
+        $('.payMethodSelector').on('change', function() {
+
+            // Get the value from the selected Payment Method
+            var payMethod = $(this).val() 
+            
+            // Hide all pay method inputs and dissable them all
+            $('.payMethodSelection').addClass('glm-hidden');
+            $('.payMethodInput').attr('disabled', true);
+
+            // Show the selected pay method inputs and enable just those
+            $('#payMethod_' + payMethod).removeClass('glm-hidden');
+            $('.payMethodInput_' + payMethod).removeAttr('disabled');
+            
+        });
+
+        // Dissable checkout button when first clicked to prevent multiple attempts
+        $("#checkoutForm").submit(function(){
+
+            // Show submit dialog box
+            $( "#regSubmitDialog" ).dialog( "open" );
+
+            // Set timeout to show failure dialog box after some time - 30 seconds
+            window.setTimeout(function() {
+                $( "#regSubmitDialog" ).dialog('close');
+                $( "#regSubmitFailDialog" ).dialog( "open" );
+            }, 30000);
+
+            // Dissable the checkout button and replace button text
+            $('#regSubmitButton').attr('disabled', true);
+            $('#regSubmitButton').val('Processing ... please Wait!');
+            
+        });
+
+        // Start with all pay method inputs dissabled
+        $( document ).ready(function() {
+
+            // Dialog box to show when submitting checkout page
+            $( "#regSubmitDialog" ).dialog({ 
+                autoOpen: false, 
+                width: 600
+            });
+
+            // Dialog box to show if no answer from checkout submission after some time
+            $( "#regSubmitFailDialog" ).dialog({ 
+                autoOpen: false, 
+                width: 600
+            });
+
+            // Start with all payment method sections hidden
+            $('.payMethodInput').attr('disabled', true);
+
+            // When a payment method is selected, show that section
+            if ({$payMethod}) {
+                $('#payMethod_' + {$payMethod}).removeClass('glm-hidden');
+                $('.payMethodInput_' + {$payMethod}).removeAttr('disabled');
+            }
+
+        });
+        
+    });
+</script>
\ No newline at end of file