From 0083233fa4447e500f9f51dee637549cd5c84eae Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Tue, 22 Aug 2017 15:04:32 -0400 Subject: [PATCH] Getting ready to do checkout processing. --- ...trationsSupport.php => regCartSupport.php} | 2 +- models/admin/registrations/requests.php | 12 +- models/front/registrations/checkout.php | 5 +- .../front/registrations/checkoutProcess.php | 147 ++++++++++++++++++ 4 files changed, 158 insertions(+), 8 deletions(-) rename classes/{registrationsSupport.php => regCartSupport.php} (99%) create mode 100644 models/front/registrations/checkoutProcess.php diff --git a/classes/registrationsSupport.php b/classes/regCartSupport.php similarity index 99% rename from classes/registrationsSupport.php rename to classes/regCartSupport.php index c78aff4..1af9f95 100644 --- a/classes/registrationsSupport.php +++ b/classes/regCartSupport.php @@ -28,7 +28,7 @@ require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestCl require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestRate.php'; require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestRegistrant.php'; -class GlmRegistrationsSupport +class GlmRegCartSupport { /** diff --git a/models/admin/registrations/requests.php b/models/admin/registrations/requests.php index c72671a..305cec7 100644 --- a/models/admin/registrations/requests.php +++ b/models/admin/registrations/requests.php @@ -90,17 +90,17 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRequest $errorMsg = false; // Load registrations support class - require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/registrationsSupport.php'; - $regSupport = new GlmRegistrationsSupport($this->wpdb, $this->config); + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/regCartSupport.php'; + $regCartSupport = new GlmRegistrationsSupport($this->wpdb, $this->config); /* Test data */ /* Uncomment to create one complete sample registration request each time this action is called */ - // $regSupport->addTestData(); + // $regCartSupport->addTestData(); /* Uncomment to remove all registration data - *** WARNING - REMOVES ALL REQUEST DATA - NOT JUST TEST DATA *** */ - // $regSupport->removeRegistrationRequestData(); + // $regCartSupport->removeRegistrationRequestData(); // Check for option submitted if (isset($_REQUEST['option']) && $_REQUEST['option'] != '') { @@ -118,7 +118,7 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRequest // Check request and update holds case 'check': - $requestCart = $regSupport->checkRegistrationRequest($requestId); + $requestCart = $regCartSupport->checkRegistrationRequest($requestId); // Display/Edit a registration request case 'edit': @@ -127,7 +127,7 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRequest if ($requestId) { // Try to get the complete cart for this request - $requestCart = $regSupport->getRegistrationCart($requestId); + $requestCart = $regCartSupport->getRegistrationCart($requestId); // If a valid cart was returned if ($requestCart && $requestCart['status']) { diff --git a/models/front/registrations/checkout.php b/models/front/registrations/checkout.php index 2a91f0a..cb03584 100644 --- a/models/front/registrations/checkout.php +++ b/models/front/registrations/checkout.php @@ -1,5 +1,5 @@ + * @license http://www.gaslightmedia.com Gaslightmedia + * @release checkoutProcess.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +// Load Registrations Front-End Support class +require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/regCartSupport.php'; + +class GlmMembersAdmin_registrations_event extends GlmRegCartSupport +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Constructor + * + * @param object $d database connection + * @param array $config Configuration array + * @param bool $limitedEdit Flag to say indicate limited edit requested + * + * @return void + * @access public + */ + public function __construct($wpdb, $config, $limitedEdit = false) + { + + // If this class is not being extended along with existing $wpdb and $config + if (!$this->wpdb) { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + } + } + + /** + * Model Action + * + * This model returns an array containing the following... + * + * 'status' + * + * True if successfull and false if there was a fatal failure. + * + * 'view' + * + * A suggested view name that the contoller should use instead of the + * default view for this model or false to indicate that the default view + * should be used. + * + * 'data' + * + * Data that the model is returning for use in merging with the view to + * produce output. + * + * @wpdb object WordPress database object + * + * @return array Array containing status, suggested view, and any data + */ + + public function modelAction($actionData = false) + { + + /* + * Initial Checks + */ + + // Do we have a current login account + + // If not, then is guest checkout permitted? + + // Otheriwse back to checkout with a message + + // Do we need accounts for all registrants? + + // If so, do we have accounts for all registrants + + // If needed, create accounts + + // Is the submission valid, do we have all required information + + // All submitter data + + // All billing data + + // All policies accepted + + /* + * Store Submission + */ + + /* + * Process Payment + */ + + /* + * Send out Notifications + */ + + /* + * If all is done correctly, use model redirect to go to Step 4 - Dispaly summary + */ + + + + // Compile template data + $templateData = array( + + ); + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'front/registrations/' . $view . '.html', + 'data' => $templateData + ); + + } + + + + } -- 2.17.1