File indexing completed on 2024-06-16 05:29:48

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 
0023 /**
0024  * Class Local_Verification_Queue_Command_WebsiteAuthCodeExist
0025  * @deprecated
0026  */
0027 class Local_Verification_Queue_Command_WebsiteAuthCodeExist implements Local_Queue_CommandInterface
0028 {
0029 
0030     /** @var \Local_Db_Table_Row_ValidateInterface */
0031     private $productData;
0032     /** @var  string */
0033     private $websiteUrl;
0034     /** @var  string */
0035     private $authCode;
0036 
0037     /**
0038      * @param Local_Db_Table_Row_ValidateInterface $productData
0039      * @param $websiteUrl
0040      * @param $authCode
0041      * @throws Exception
0042      */
0043     function __construct($productData, $websiteUrl, $authCode)
0044     {
0045         if (empty($productData)) {
0046             throw new Exception(__FILE__ . '(' . __LINE__ . '): ' . 'The productData is necessary');
0047         }
0048         $this->productData = $productData;
0049         $this->websiteUrl = $websiteUrl;
0050         $this->authCode = $authCode;
0051     }
0052 
0053     public function doCommand()
0054     {
0055         $websiteValidation = new Local_Verification_WebsiteProject();
0056         $verificationResult = $websiteValidation->testForAuthCodeExist($this->websiteUrl, $this->authCode);
0057         $this->productData->setVerifiedStatus($verificationResult);
0058     }
0059 
0060     /**
0061      * @param $productId
0062      * @param $verificationResult
0063      *
0064      */
0065     public function updateProductData($productId, $verificationResult)
0066     {
0067         $memberTable = new Default_Model_Product();
0068         /** @var Zend_Db_Table_Row $rowMember */
0069         $rowMember = $memberTable->find($productId)->current();
0070         $rowMember->validated_at = new Zend_Db_Expr('NOW()');
0071         $rowMember->validated = $verificationResult;
0072         $rowMember->save();
0073     }
0074 
0075     public function getWebsiteUrl()
0076     {
0077         return $this->websiteUrl;
0078     }
0079 
0080     public function setWebsiteUrl($websiteUrl)
0081     {
0082         $this->websiteUrl = $websiteUrl;
0083     }
0084 
0085     public function getProductData()
0086     {
0087         return $this->productData;
0088     }
0089 
0090     public function setProductData($memberId)
0091     {
0092         $this->productData = $memberId;
0093     }
0094 
0095     public function getAuthCode()
0096     {
0097         return $this->authCode;
0098     }
0099 
0100     public function setAuthCode($authCode)
0101     {
0102         $this->authCode = $authCode;
0103     }
0104 
0105 }