mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-24 08:53:05 +03:00
Removed the deprecated engine directory from the project (including tests and the composer autoloading configuration)
This commit is contained in:
parent
3cd1e19066
commit
e65c178e8f
56 changed files with 0 additions and 3082 deletions
|
@ -26,14 +26,6 @@
|
|||
"services"
|
||||
],
|
||||
"minimum-stability": "stable",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"EA\\Engine\\": [
|
||||
"engine/",
|
||||
"tests/engine/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.3",
|
||||
"ext-curl": "*",
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
use CI_Controller;
|
||||
use EA\Engine\Types\NonEmptyText;
|
||||
use EA_Controller;
|
||||
|
||||
/**
|
||||
* API v1 Authorization Class
|
||||
*
|
||||
* This class will handle the authorization procedure of the API.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Authorization {
|
||||
/**
|
||||
* Framework Instance
|
||||
*
|
||||
* @var EA_Controller
|
||||
*/
|
||||
protected $CI;
|
||||
|
||||
/**
|
||||
* Class Constructor
|
||||
*
|
||||
* @param CI_Controller $CI
|
||||
*/
|
||||
public function __construct(EA_Controller $CI)
|
||||
{
|
||||
$this->CI = $CI;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform Basic Authentication
|
||||
*
|
||||
* @param NonEmptyText $username Admin Username
|
||||
* @param NonEmptyText $password Admin Password
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function basic(NonEmptyText $username, NonEmptyText $password)
|
||||
{
|
||||
$this->CI->load->library('accounts');
|
||||
|
||||
if ( ! $this->CI->accounts->check_login($username->get(), $password->get()))
|
||||
{
|
||||
throw new \RuntimeException('The provided credentials do not match any admin user!', 401, 'Unauthorized');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
/**
|
||||
* API v1 Exception Class
|
||||
*
|
||||
* This exception variation will hold the information needed for exception handling in the API.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Exception extends \Exception {
|
||||
/**
|
||||
* Header Description
|
||||
*
|
||||
* e.g. 'Unauthorized'
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $header;
|
||||
|
||||
/**
|
||||
* Class Constructor
|
||||
*
|
||||
* @link http://php.net/manual/en/class.exception.php
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param string $header
|
||||
* @param \Exception|null $previous
|
||||
*/
|
||||
public function __construct($message = NULL, $code = 500, $header = '', \Exception $previous = NULL)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
$this->header = $header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the header string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_header()
|
||||
{
|
||||
return $this->header;
|
||||
}
|
||||
}
|
|
@ -1,155 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Parsers;
|
||||
|
||||
/**
|
||||
* Admins Parser
|
||||
*
|
||||
* This class will handle the encoding and decoding from the API requests.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Admins implements ParsersInterface {
|
||||
/**
|
||||
* Encode Response Array
|
||||
*
|
||||
* @param array &$response The response to be encoded.
|
||||
*/
|
||||
public function encode(array &$response)
|
||||
{
|
||||
$encoded_response = [
|
||||
'id' => array_key_exists('id', $response) ? (int)$response['id'] : NULL,
|
||||
'firstName' => $response['first_name'],
|
||||
'lastName' => $response['last_name'],
|
||||
'email' => $response['email'],
|
||||
'mobile' => $response['mobile_number'],
|
||||
'phone' => $response['phone_number'],
|
||||
'address' => $response['address'],
|
||||
'city' => $response['city'],
|
||||
'state' => $response['state'],
|
||||
'zip' => $response['zip_code'],
|
||||
'notes' => $response['notes'],
|
||||
'timezone' => $response['timezone'],
|
||||
'settings' => [
|
||||
'username' => $response['settings']['username'],
|
||||
'notifications' => filter_var($response['settings']['notifications'], FILTER_VALIDATE_BOOLEAN),
|
||||
'calendarView' => $response['settings']['calendar_view']
|
||||
]
|
||||
];
|
||||
|
||||
$response = $encoded_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Request
|
||||
*
|
||||
* @param array &$request The request to be decoded.
|
||||
* @param array $base Optional (null), if provided it will be used as a base array.
|
||||
*/
|
||||
public function decode(array &$request, array $base = NULL)
|
||||
{
|
||||
$decoded_request = $base ?: [];
|
||||
|
||||
if (array_key_exists('id', $request))
|
||||
{
|
||||
$decoded_request['id'] = $request['id'];
|
||||
}
|
||||
|
||||
if (array_key_exists('firstName', $request))
|
||||
{
|
||||
$decoded_request['first_name'] = $request['firstName'];
|
||||
}
|
||||
|
||||
if (array_key_exists('lastName', $request))
|
||||
{
|
||||
$decoded_request['last_name'] = $request['lastName'];
|
||||
}
|
||||
|
||||
if (array_key_exists('email', $request))
|
||||
{
|
||||
$decoded_request['email'] = $request['email'];
|
||||
}
|
||||
|
||||
if (array_key_exists('mobile', $request))
|
||||
{
|
||||
$decoded_request['mobile_number'] = $request['mobile'];
|
||||
}
|
||||
|
||||
if (array_key_exists('phone', $request))
|
||||
{
|
||||
$decoded_request['phone_number'] = $request['phone'];
|
||||
}
|
||||
|
||||
if (array_key_exists('address', $request))
|
||||
{
|
||||
$decoded_request['address'] = $request['address'];
|
||||
}
|
||||
|
||||
if (array_key_exists('city', $request))
|
||||
{
|
||||
$decoded_request['city'] = $request['city'];
|
||||
}
|
||||
|
||||
if (array_key_exists('state', $request))
|
||||
{
|
||||
$decoded_request['state'] = $request['state'];
|
||||
}
|
||||
|
||||
if (array_key_exists('zip', $request))
|
||||
{
|
||||
$decoded_request['zip_code'] = $request['zip'];
|
||||
}
|
||||
|
||||
if (array_key_exists('notes', $request))
|
||||
{
|
||||
$decoded_request['notes'] = $request['notes'];
|
||||
}
|
||||
|
||||
if (array_key_exists('timezone', $request))
|
||||
{
|
||||
$decoded_request['timezone'] = $request['timezone'];
|
||||
}
|
||||
|
||||
if (array_key_exists('settings', $request))
|
||||
{
|
||||
if (empty($decoded_request['settings']))
|
||||
{
|
||||
$decoded_request['settings'] = [];
|
||||
}
|
||||
|
||||
if (array_key_exists('username', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['username'] = $request['settings']['username'];
|
||||
}
|
||||
|
||||
if (array_key_exists('password', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['password'] = $request['settings']['password'];
|
||||
}
|
||||
|
||||
if (array_key_exists('notifications', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['notifications'] = filter_var($request['settings']['notifications'],
|
||||
FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
if (array_key_exists('calendarView', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['calendar_view'] = $request['settings']['calendarView'];
|
||||
}
|
||||
}
|
||||
|
||||
$request = $decoded_request;
|
||||
}
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Parsers;
|
||||
|
||||
/**
|
||||
* Appointments Parser
|
||||
*
|
||||
* This class will handle the encoding and decoding from the API requests.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Appointments implements ParsersInterface {
|
||||
/**
|
||||
* Encode Response Array
|
||||
*
|
||||
* @param array &$response The response to be encoded.
|
||||
*/
|
||||
public function encode(array &$response)
|
||||
{
|
||||
$encoded_response = [
|
||||
'id' => array_key_exists('id', $response) ? (int)$response['id'] : NULL,
|
||||
'book' => $response['book_datetime'],
|
||||
'start' => $response['start_datetime'],
|
||||
'end' => $response['end_datetime'],
|
||||
'hash' => $response['hash'],
|
||||
'location' => $response['location'],
|
||||
'notes' => $response['notes'],
|
||||
'customerId' => $response['id_users_customer'] !== NULL ? (int)$response['id_users_customer'] : NULL,
|
||||
'providerId' => $response['id_users_provider'] !== NULL ? (int)$response['id_users_provider'] : NULL,
|
||||
'serviceId' => $response['id_services'] !== NULL ? (int)$response['id_services'] : NULL,
|
||||
'googleCalendarId' => $response['id_google_calendar'] !== NULL ? (int)$response['id_google_calendar'] : NULL
|
||||
];
|
||||
|
||||
if (isset($response['provider']))
|
||||
{
|
||||
$provider_parser = new Providers();
|
||||
$provider_parser->encode($response['provider']);
|
||||
$encoded_response['provider'] = $response['provider'];
|
||||
}
|
||||
|
||||
if (isset($response['customer']))
|
||||
{
|
||||
$customer_parser = new Customers();
|
||||
$customer_parser->encode($response['customer']);
|
||||
$encoded_response['customer'] = $response['customer'];
|
||||
}
|
||||
|
||||
if (isset($response['service']))
|
||||
{
|
||||
$service_parser = new Services();
|
||||
$service_parser->encode($response['service']);
|
||||
$encoded_response['service'] = $response['service'];
|
||||
}
|
||||
|
||||
$response = $encoded_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Request
|
||||
*
|
||||
* @param array &$request The request to be decoded.
|
||||
* @param array $base Optional (null), if provided it will be used as a base array.
|
||||
*/
|
||||
public function decode(array &$request, array $base = NULL)
|
||||
{
|
||||
$decoded_request = $base ?: [];
|
||||
|
||||
if (array_key_exists('id', $request))
|
||||
{
|
||||
$decoded_request['id'] = $request['id'];
|
||||
}
|
||||
|
||||
if (array_key_exists('book', $request))
|
||||
{
|
||||
$decoded_request['book_datetime'] = $request['book'];
|
||||
}
|
||||
|
||||
if (array_key_exists('start', $request))
|
||||
{
|
||||
$decoded_request['start_datetime'] = $request['start'];
|
||||
}
|
||||
|
||||
if (array_key_exists('end', $request))
|
||||
{
|
||||
$decoded_request['end_datetime'] = $request['end'];
|
||||
}
|
||||
|
||||
if (array_key_exists('hash', $request))
|
||||
{
|
||||
$decoded_request['hash'] = $request['hash'];
|
||||
}
|
||||
|
||||
if (array_key_exists('location', $request))
|
||||
{
|
||||
$decoded_request['location'] = $request['location'];
|
||||
}
|
||||
|
||||
if (array_key_exists('notes', $request))
|
||||
{
|
||||
$decoded_request['notes'] = $request['notes'];
|
||||
}
|
||||
|
||||
if (array_key_exists('customerId', $request))
|
||||
{
|
||||
$decoded_request['id_users_customer'] = $request['customerId'];
|
||||
}
|
||||
|
||||
if (array_key_exists('providerId', $request))
|
||||
{
|
||||
$decoded_request['id_users_provider'] = $request['providerId'];
|
||||
}
|
||||
|
||||
if (array_key_exists('serviceId', $request))
|
||||
{
|
||||
$decoded_request['id_services'] = $request['serviceId'];
|
||||
}
|
||||
|
||||
if (array_key_exists('googleCalendarId', $request))
|
||||
{
|
||||
$decoded_request['id_google_calendar'] = $request['googleCalendarId'];
|
||||
}
|
||||
|
||||
$decoded_request['is_unavailable'] = FALSE;
|
||||
|
||||
$request = $decoded_request;
|
||||
}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Parsers;
|
||||
|
||||
/**
|
||||
* Categories Parser
|
||||
*
|
||||
* This class will handle the encoding and decoding from the API requests.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Categories implements ParsersInterface {
|
||||
/**
|
||||
* Encode Response Array
|
||||
*
|
||||
* @param array &$response The response to be encoded.
|
||||
*/
|
||||
public function encode(array &$response)
|
||||
{
|
||||
$encoded_response = [
|
||||
'id' => array_key_exists('id', $response) ? (int)$response['id'] : NULL,
|
||||
'name' => $response['name'],
|
||||
'description' => array_key_exists('description', $response) ? $response['description'] : NULL
|
||||
];
|
||||
|
||||
$response = $encoded_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Request
|
||||
*
|
||||
* @param array &$request The request to be decoded.
|
||||
* @param array $base Optional (null), if provided it will be used as a base array.
|
||||
*/
|
||||
public function decode(array &$request, array $base = NULL)
|
||||
{
|
||||
$decoded_request = $base ?: [];
|
||||
|
||||
if (array_key_exists('id', $request))
|
||||
{
|
||||
$decoded_request['id'] = $request['id'];
|
||||
}
|
||||
|
||||
if (array_key_exists('name', $request))
|
||||
{
|
||||
$decoded_request['name'] = $request['name'];
|
||||
}
|
||||
|
||||
if (array_key_exists('description', $request))
|
||||
{
|
||||
$decoded_request['description'] = $request['description'];
|
||||
}
|
||||
|
||||
$request = $decoded_request;
|
||||
}
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Parsers;
|
||||
|
||||
/**
|
||||
* Customers Parser
|
||||
*
|
||||
* This class will handle the encoding and decoding from the API requests.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Customers implements ParsersInterface {
|
||||
/**
|
||||
* Encode Response Array
|
||||
*
|
||||
* @param array &$response The response to be encoded.
|
||||
*/
|
||||
public function encode(array &$response)
|
||||
{
|
||||
$encoded_response = [
|
||||
'id' => array_key_exists('id', $response) ? (int)$response['id'] : NULL,
|
||||
'firstName' => $response['first_name'],
|
||||
'lastName' => $response['last_name'],
|
||||
'email' => $response['email'],
|
||||
'phone' => $response['phone_number'],
|
||||
'address' => $response['address'],
|
||||
'city' => $response['city'],
|
||||
'zip' => $response['zip_code'],
|
||||
'notes' => $response['notes']
|
||||
];
|
||||
|
||||
$response = $encoded_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Request
|
||||
*
|
||||
* @param array &$request The request to be decoded.
|
||||
* @param array $base Optional (null), if provided it will be used as a base array.
|
||||
*/
|
||||
public function decode(array &$request, array $base = NULL)
|
||||
{
|
||||
$decoded_request = $base ?: [];
|
||||
|
||||
if ( array_key_exists('id', $request))
|
||||
{
|
||||
$decoded_request['id'] = $request['id'];
|
||||
}
|
||||
|
||||
if ( array_key_exists('firstName', $request))
|
||||
{
|
||||
$decoded_request['first_name'] = $request['firstName'];
|
||||
}
|
||||
|
||||
if ( array_key_exists('lastName', $request))
|
||||
{
|
||||
$decoded_request['last_name'] = $request['lastName'];
|
||||
}
|
||||
|
||||
if ( array_key_exists('email', $request))
|
||||
{
|
||||
$decoded_request['email'] = $request['email'];
|
||||
}
|
||||
|
||||
if ( array_key_exists('phone', $request))
|
||||
{
|
||||
$decoded_request['phone_number'] = $request['phone'];
|
||||
}
|
||||
|
||||
if ( array_key_exists('address', $request))
|
||||
{
|
||||
$decoded_request['address'] = $request['address'];
|
||||
}
|
||||
|
||||
if ( array_key_exists('city', $request))
|
||||
{
|
||||
$decoded_request['city'] = $request['city'];
|
||||
}
|
||||
|
||||
if ( array_key_exists('zip', $request))
|
||||
{
|
||||
$decoded_request['zip_code'] = $request['zip'];
|
||||
}
|
||||
|
||||
if ( array_key_exists('notes', $request))
|
||||
{
|
||||
$decoded_request['notes'] = $request['notes'];
|
||||
}
|
||||
|
||||
$request = $decoded_request;
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Parsers;
|
||||
|
||||
/**
|
||||
* Parsers Interface
|
||||
*
|
||||
* Every parser needs the "encode" and "decode" methods.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
interface ParsersInterface {
|
||||
/**
|
||||
* Encode Response Array
|
||||
*
|
||||
* @param array &$response The response to be encoded.
|
||||
*/
|
||||
public function encode(array &$response);
|
||||
|
||||
/**
|
||||
* Decode Request
|
||||
*
|
||||
* @param array &$request The request to be decoded.
|
||||
* @param array $base Optional (null), if provided it will be used as a base array.
|
||||
*/
|
||||
public function decode(array &$request, array $base = NULL);
|
||||
}
|
|
@ -1,226 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Parsers;
|
||||
|
||||
/**
|
||||
* Providers Parser
|
||||
*
|
||||
* This class will handle the encoding and decoding from the API requests.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Providers implements ParsersInterface {
|
||||
/**
|
||||
* Encode Response Array
|
||||
*
|
||||
* @param array &$response The response to be encoded.
|
||||
*/
|
||||
public function encode(array &$response)
|
||||
{
|
||||
$encoded_response = [
|
||||
'id' => array_key_exists('id', $response) ? (int)$response['id'] : NULL,
|
||||
'firstName' => $response['first_name'],
|
||||
'lastName' => $response['last_name'],
|
||||
'email' => $response['email'],
|
||||
'mobile' => $response['mobile_number'],
|
||||
'phone' => $response['phone_number'],
|
||||
'address' => $response['address'],
|
||||
'city' => $response['city'],
|
||||
'state' => $response['state'],
|
||||
'zip' => $response['zip_code'],
|
||||
'notes' => $response['notes'],
|
||||
'timezone' => $response['timezone'],
|
||||
];
|
||||
|
||||
if (array_key_exists('services', $response))
|
||||
{
|
||||
$encoded_response['services'] = $response['services'];
|
||||
}
|
||||
|
||||
if (array_key_exists('settings', $response))
|
||||
{
|
||||
$encoded_response['settings'] = [
|
||||
'username' => $response['settings']['username'],
|
||||
'notifications' => filter_var($response['settings']['notifications'], FILTER_VALIDATE_BOOLEAN),
|
||||
'calendarView' => $response['settings']['calendar_view'],
|
||||
'googleSync' => array_key_exists('google_sync', $response['settings'])
|
||||
? filter_var($response['settings']['google_sync'], FILTER_VALIDATE_BOOLEAN)
|
||||
: NULL,
|
||||
'googleCalendar' => array_key_exists('google_calendar', $response['settings'])
|
||||
? $response['settings']['google_calendar']
|
||||
: NULL,
|
||||
'googleToken' => array_key_exists('google_token', $response['settings'])
|
||||
? $response['settings']['google_token']
|
||||
: NULL,
|
||||
'syncFutureDays' => array_key_exists('sync_future_days', $response['settings'])
|
||||
? (int)$response['settings']['sync_future_days']
|
||||
: NULL,
|
||||
'syncPastDays' => array_key_exists('sync_past_days', $response['settings'])
|
||||
? (int)$response['settings']['sync_past_days']
|
||||
: NULL,
|
||||
'workingPlan' => array_key_exists('working_plan', $response['settings'])
|
||||
? json_decode($response['settings']['working_plan'], TRUE)
|
||||
: NULL,
|
||||
'workingPlanExceptions' => array_key_exists('working_plan_exceptions', $response['settings'])
|
||||
? json_decode($response['settings']['working_plan_exceptions'], TRUE)
|
||||
: NULL,
|
||||
];
|
||||
}
|
||||
|
||||
$response = $encoded_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Request
|
||||
*
|
||||
* @param array &$request The request to be decoded.
|
||||
* @param array $base Optional (null), if provided it will be used as a base array.
|
||||
*/
|
||||
public function decode(array &$request, array $base = NULL)
|
||||
{
|
||||
$decoded_request = $base ?: [];
|
||||
|
||||
if (array_key_exists('id', $request))
|
||||
{
|
||||
$decoded_request['id'] = $request['id'];
|
||||
}
|
||||
|
||||
if (array_key_exists('firstName', $request))
|
||||
{
|
||||
$decoded_request['first_name'] = $request['firstName'];
|
||||
}
|
||||
|
||||
if (array_key_exists('lastName', $request))
|
||||
{
|
||||
$decoded_request['last_name'] = $request['lastName'];
|
||||
}
|
||||
|
||||
if (array_key_exists('email', $request))
|
||||
{
|
||||
$decoded_request['email'] = $request['email'];
|
||||
}
|
||||
|
||||
if (array_key_exists('mobile', $request))
|
||||
{
|
||||
$decoded_request['mobile_number'] = $request['mobile'];
|
||||
}
|
||||
|
||||
if (array_key_exists('phone', $request))
|
||||
{
|
||||
$decoded_request['phone_number'] = $request['phone'];
|
||||
}
|
||||
|
||||
if (array_key_exists('address', $request))
|
||||
{
|
||||
$decoded_request['address'] = $request['address'];
|
||||
}
|
||||
|
||||
if (array_key_exists('city', $request))
|
||||
{
|
||||
$decoded_request['city'] = $request['city'];
|
||||
}
|
||||
|
||||
if (array_key_exists('state', $request))
|
||||
{
|
||||
$decoded_request['state'] = $request['state'];
|
||||
}
|
||||
|
||||
if (array_key_exists('zip', $request))
|
||||
{
|
||||
$decoded_request['zip_code'] = $request['zip'];
|
||||
}
|
||||
|
||||
if (array_key_exists('notes', $request))
|
||||
{
|
||||
$decoded_request['notes'] = $request['notes'];
|
||||
}
|
||||
|
||||
if (array_key_exists('timezone', $request))
|
||||
{
|
||||
$decoded_request['timezone'] = $request['timezone'];
|
||||
}
|
||||
|
||||
if (array_key_exists('services', $request))
|
||||
{
|
||||
$decoded_request['services'] = $request['services'];
|
||||
}
|
||||
|
||||
if (array_key_exists('settings', $request))
|
||||
{
|
||||
if (empty($decoded_request['settings']))
|
||||
{
|
||||
$decoded_request['settings'] = [];
|
||||
}
|
||||
|
||||
if (array_key_exists('username', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['username'] = $request['settings']['username'];
|
||||
}
|
||||
|
||||
if (array_key_exists('password', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['password'] = $request['settings']['password'];
|
||||
}
|
||||
|
||||
if (array_key_exists('calendarView', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['calendar_view'] = $request['settings']['calendarView'];
|
||||
}
|
||||
|
||||
if (array_key_exists('notifications', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['notifications'] = filter_var($request['settings']['notifications'],
|
||||
FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
if (array_key_exists('googleSync', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['google_sync'] = filter_var($request['settings']['googleSync'],
|
||||
FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
if (array_key_exists('googleCalendar', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['google_calendar'] = $request['settings']['googleCalendar'];
|
||||
}
|
||||
|
||||
if (array_key_exists('googleToken', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['google_token'] = $request['settings']['googleToken'];
|
||||
}
|
||||
|
||||
if (array_key_exists('syncFutureDays', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['sync_future_days'] = $request['settings']['syncFutureDays'];
|
||||
}
|
||||
|
||||
if (array_key_exists('syncPastDays', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['sync_past_days'] = $request['settings']['syncPastDays'];
|
||||
}
|
||||
|
||||
if (array_key_exists('workingPlan', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['working_plan'] = json_encode($request['settings']['workingPlan']);
|
||||
}
|
||||
|
||||
if (array_key_exists('workingPlanExceptions', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['working_plan_exceptions'] = json_encode($request['settings']['workingPlanExceptions']);
|
||||
}
|
||||
}
|
||||
|
||||
$request = $decoded_request;
|
||||
}
|
||||
}
|
|
@ -1,161 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Parsers;
|
||||
|
||||
/**
|
||||
* Secretaries Parser
|
||||
*
|
||||
* This class will handle the encoding and decoding from the API requests.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Secretaries implements ParsersInterface {
|
||||
/**
|
||||
* Encode Response Array
|
||||
*
|
||||
* @param array &$response The response to be encoded.
|
||||
*/
|
||||
public function encode(array &$response)
|
||||
{
|
||||
$encoded_response = [
|
||||
'id' => array_key_exists('id', $response) ? (int)$response['id'] : NULL,
|
||||
'firstName' => $response['first_name'],
|
||||
'lastName' => $response['last_name'],
|
||||
'email' => $response['email'],
|
||||
'mobile' => $response['mobile_number'],
|
||||
'phone' => $response['phone_number'],
|
||||
'address' => $response['address'],
|
||||
'city' => $response['city'],
|
||||
'state' => $response['state'],
|
||||
'zip' => $response['zip_code'],
|
||||
'notes' => $response['notes'],
|
||||
'providers' => $response['providers'],
|
||||
'timezone' => $response['timezone'],
|
||||
'settings' => [
|
||||
'username' => $response['settings']['username'],
|
||||
'notifications' => filter_var($response['settings']['notifications'], FILTER_VALIDATE_BOOLEAN),
|
||||
'calendarView' => $response['settings']['calendar_view']
|
||||
]
|
||||
];
|
||||
|
||||
$response = $encoded_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Request
|
||||
*
|
||||
* @param array &$request The request to be decoded.
|
||||
* @param array $base Optional (null), if provided it will be used as a base array.
|
||||
*/
|
||||
public function decode(array &$request, array $base = NULL)
|
||||
{
|
||||
$decoded_request = $base ?: [];
|
||||
|
||||
if (array_key_exists('id', $request))
|
||||
{
|
||||
$decoded_request['id'] = $request['id'];
|
||||
}
|
||||
|
||||
if (array_key_exists('firstName', $request))
|
||||
{
|
||||
$decoded_request['first_name'] = $request['firstName'];
|
||||
}
|
||||
|
||||
if (array_key_exists('lastName', $request))
|
||||
{
|
||||
$decoded_request['last_name'] = $request['lastName'];
|
||||
}
|
||||
|
||||
if (array_key_exists('email', $request))
|
||||
{
|
||||
$decoded_request['email'] = $request['email'];
|
||||
}
|
||||
|
||||
if (array_key_exists('mobile', $request))
|
||||
{
|
||||
$decoded_request['mobile_number'] = $request['mobile'];
|
||||
}
|
||||
|
||||
if (array_key_exists('phone', $request))
|
||||
{
|
||||
$decoded_request['phone_number'] = $request['phone'];
|
||||
}
|
||||
|
||||
if (array_key_exists('address', $request))
|
||||
{
|
||||
$decoded_request['address'] = $request['address'];
|
||||
}
|
||||
|
||||
if (array_key_exists('city', $request))
|
||||
{
|
||||
$decoded_request['city'] = $request['city'];
|
||||
}
|
||||
|
||||
if (array_key_exists('state', $request))
|
||||
{
|
||||
$decoded_request['state'] = $request['state'];
|
||||
}
|
||||
|
||||
if (array_key_exists('zip', $request))
|
||||
{
|
||||
$decoded_request['zip_code'] = $request['zip'];
|
||||
}
|
||||
|
||||
if (array_key_exists('notes', $request))
|
||||
{
|
||||
$decoded_request['notes'] = $request['notes'];
|
||||
}
|
||||
|
||||
if (array_key_exists('timezone', $request))
|
||||
{
|
||||
$decoded_request['timezone'] = $request['timezone'];
|
||||
}
|
||||
|
||||
if (array_key_exists('providers', $request))
|
||||
{
|
||||
$decoded_request['providers'] = $request['providers'];
|
||||
}
|
||||
|
||||
if (array_key_exists('settings', $request))
|
||||
{
|
||||
if (empty($decoded_request['settings']))
|
||||
{
|
||||
$decoded_request['settings'] = [];
|
||||
}
|
||||
|
||||
if (array_key_exists('username', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['username'] = $request['settings']['username'];
|
||||
}
|
||||
|
||||
if (array_key_exists('password', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['password'] = $request['settings']['password'];
|
||||
}
|
||||
|
||||
if (array_key_exists('notifications', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['notifications'] = filter_var($request['settings']['notifications'],
|
||||
FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
if (array_key_exists('calendarView', $request['settings']))
|
||||
{
|
||||
$decoded_request['settings']['calendar_view'] = $request['settings']['calendarView'];
|
||||
}
|
||||
}
|
||||
|
||||
$request = $decoded_request;
|
||||
}
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Parsers;
|
||||
|
||||
/**
|
||||
* Services Parser
|
||||
*
|
||||
* This class will handle the encoding and decoding from the API requests.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Services implements ParsersInterface {
|
||||
/**
|
||||
* Encode Response Array
|
||||
*
|
||||
* @param array &$response The response to be encoded.
|
||||
*/
|
||||
public function encode(array &$response)
|
||||
{
|
||||
$encoded_response = [
|
||||
'id' => array_key_exists('id', $response) ? (int)$response['id'] : NULL,
|
||||
'name' => $response['name'],
|
||||
'duration' => (int)$response['duration'],
|
||||
'price' => (float)$response['price'],
|
||||
'currency' => $response['currency'],
|
||||
'description' => $response['description'],
|
||||
'location' => $response['location'],
|
||||
'availabilitiesType' => $response['availabilities_type'],
|
||||
'attendantsNumber' => (int)$response['attendants_number'],
|
||||
'categoryId' => $response['id_service_categories'] !== NULL ? (int)$response['id_service_categories'] : NULL
|
||||
];
|
||||
|
||||
$response = $encoded_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Request
|
||||
*
|
||||
* @param array &$request The request to be decoded.
|
||||
* @param array $base Optional (null), if provided it will be used as a base array.
|
||||
*/
|
||||
public function decode(array &$request, array $base = NULL)
|
||||
{
|
||||
$decoded_request = $base ?: [];
|
||||
|
||||
if (array_key_exists('id', $request))
|
||||
{
|
||||
$decoded_request['id'] = $request['id'];
|
||||
}
|
||||
|
||||
if (array_key_exists('name', $request))
|
||||
{
|
||||
$decoded_request['name'] = $request['name'];
|
||||
}
|
||||
|
||||
if (array_key_exists('duration', $request))
|
||||
{
|
||||
$decoded_request['duration'] = $request['duration'];
|
||||
}
|
||||
|
||||
if (array_key_exists('price', $request))
|
||||
{
|
||||
$decoded_request['price'] = $request['price'];
|
||||
}
|
||||
|
||||
if (array_key_exists('currency', $request))
|
||||
{
|
||||
$decoded_request['currency'] = $request['currency'];
|
||||
}
|
||||
|
||||
if (array_key_exists('description', $request))
|
||||
{
|
||||
$decoded_request['description'] = $request['description'];
|
||||
}
|
||||
|
||||
if (array_key_exists('location', $request))
|
||||
{
|
||||
$decoded_request['location'] = $request['location'];
|
||||
}
|
||||
|
||||
if (array_key_exists('availabilitiesType', $request))
|
||||
{
|
||||
$decoded_request['availabilities_type'] = $request['availabilitiesType'];
|
||||
}
|
||||
|
||||
if (array_key_exists('attendantsNumber', $request))
|
||||
{
|
||||
$decoded_request['attendants_number'] = $request['attendantsNumber'];
|
||||
}
|
||||
|
||||
if (array_key_exists('categoryId', $request))
|
||||
{
|
||||
$decoded_request['id_service_categories'] = $request['categoryId'];
|
||||
}
|
||||
|
||||
$request = $decoded_request;
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Parsers;
|
||||
|
||||
/**
|
||||
* Settings Parser
|
||||
*
|
||||
* This class will handle the encoding and decoding from the API requests.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Settings implements ParsersInterface {
|
||||
/**
|
||||
* Encode Response Array
|
||||
*
|
||||
* @param array &$response The response to be encoded.
|
||||
*/
|
||||
public function encode(array &$response)
|
||||
{
|
||||
$encoded_response = [
|
||||
'name' => $response['name'],
|
||||
'value' => $response['value']
|
||||
];
|
||||
|
||||
$response = $encoded_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Request
|
||||
*
|
||||
* @param array &$request The request to be decoded.
|
||||
* @param array $base Optional (null), if provided it will be used as a base array.
|
||||
*/
|
||||
public function decode(array &$request, array $base = NULL)
|
||||
{
|
||||
$decoded_request = $base ?: [];
|
||||
|
||||
if (array_key_exists('name', $request))
|
||||
{
|
||||
$decoded_request['name'] = $request['name'];
|
||||
}
|
||||
|
||||
if (array_key_exists('value', $request))
|
||||
{
|
||||
$decoded_request['value'] = $request['value'];
|
||||
}
|
||||
|
||||
$request = $decoded_request;
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Parsers;
|
||||
|
||||
/**
|
||||
* Unavailabilities Parser
|
||||
*
|
||||
* This class will handle the encoding and decoding from the API requests.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Unavailabilities implements ParsersInterface {
|
||||
/**
|
||||
* Encode Response Array
|
||||
*
|
||||
* @param array &$response The response to be encoded.
|
||||
*/
|
||||
public function encode(array &$response)
|
||||
{
|
||||
$encoded_response = [
|
||||
'id' => array_key_exists('id', $response) ? (int)$response['id'] : NULL,
|
||||
'book' => $response['book_datetime'],
|
||||
'start' => $response['start_datetime'],
|
||||
'end' => $response['end_datetime'],
|
||||
'notes' => $response['notes'],
|
||||
'providerId' => array_key_exists('id_users_provider', $response)
|
||||
? (int)$response['id_users_provider']
|
||||
: NULL,
|
||||
'googleCalendarId' => array_key_exists('id_google_calendar', $response)
|
||||
? (int)$response['id_google_calendar']
|
||||
: NULL
|
||||
];
|
||||
|
||||
$response = $encoded_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Request
|
||||
*
|
||||
* @param array &$request The request to be decoded.
|
||||
* @param array $base Optional (null), if provided it will be used as a base array.
|
||||
*/
|
||||
public function decode(array &$request, array $base = NULL)
|
||||
{
|
||||
$decodedRequest = $base ?: [];
|
||||
|
||||
if (array_key_exists('id', $request))
|
||||
{
|
||||
$decodedRequest['id'] = $request['id'];
|
||||
}
|
||||
|
||||
if (array_key_exists('book', $request))
|
||||
{
|
||||
$decodedRequest['book_datetime'] = $request['book'];
|
||||
}
|
||||
|
||||
if (array_key_exists('start', $request))
|
||||
{
|
||||
$decodedRequest['start_datetime'] = $request['start'];
|
||||
}
|
||||
|
||||
if (array_key_exists('end', $request))
|
||||
{
|
||||
$decodedRequest['end_datetime'] = $request['end'];
|
||||
}
|
||||
|
||||
if (array_key_exists('notes', $request))
|
||||
{
|
||||
$decodedRequest['notes'] = $request['notes'];
|
||||
}
|
||||
|
||||
if (array_key_exists('providerId', $request))
|
||||
{
|
||||
$decodedRequest['id_users_provider'] = $request['providerId'];
|
||||
}
|
||||
|
||||
if (array_key_exists('googleCalendarId', $request))
|
||||
{
|
||||
$decodedRequest['id_google_calendar'] = $request['googleCalendarId'];
|
||||
}
|
||||
|
||||
$decodedRequest['is_unavailable'] = TRUE;
|
||||
|
||||
$request = $decodedRequest;
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Processors;
|
||||
|
||||
/**
|
||||
* Filter Processor
|
||||
*
|
||||
* This class will handle custom filters upon the response array. In some specific cases it might be
|
||||
* easier to apply some custom filtering in order to get the required results.
|
||||
*
|
||||
* @todo Implement this processor class.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Filter implements ProcessorsInterface {
|
||||
/**
|
||||
* Process Response Array
|
||||
*
|
||||
* @param array &$response The response array to be processed.
|
||||
*/
|
||||
public static function process(array &$response)
|
||||
{
|
||||
// Not implemented yet.
|
||||
}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Processors;
|
||||
|
||||
/**
|
||||
* Minimize Processor
|
||||
*
|
||||
* This processor will check for the "fields" GET parameters and provide only the required fields in
|
||||
* every response entry. This might come in handy when the client needs specific information and not
|
||||
* the whole objects.
|
||||
*
|
||||
* Make sure that the response parameter is a sequential array and not a single entry by the time this
|
||||
* processor is executed.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Minimize implements ProcessorsInterface {
|
||||
/**
|
||||
* Process Response Array
|
||||
*
|
||||
* Example:
|
||||
* http://ea-installation.com/api/v1/appointments?fields=id,book,start,end
|
||||
*
|
||||
*
|
||||
* @param array &$response The response array to be processed.
|
||||
*/
|
||||
public static function process(array &$response)
|
||||
{
|
||||
if ( ! isset($_GET['fields']) || empty($response))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$fields = explode(',', $_GET['fields']);
|
||||
|
||||
$temporary_response = [];
|
||||
|
||||
foreach ($response as &$entry)
|
||||
{
|
||||
$temporary_entry = [];
|
||||
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$field = trim($field);
|
||||
if (isset($entry[$field]))
|
||||
{
|
||||
$temporary_entry[$field] = $entry[$field];
|
||||
}
|
||||
}
|
||||
|
||||
$temporary_response[] = $temporary_entry;
|
||||
}
|
||||
|
||||
$response = $temporary_response;
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Processors;
|
||||
|
||||
/**
|
||||
* Paginate Processor
|
||||
*
|
||||
* This class will handle the pagination GET parameters ("page", "length"). The "page" parameter
|
||||
* is required in order for the pagination to work. The "length" is optional and the default value
|
||||
* is 20 entries per page.
|
||||
*
|
||||
* Make sure that the response parameter is a sequential array and not a single entry by the time this
|
||||
* processor is executed.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Paginate implements ProcessorsInterface {
|
||||
/**
|
||||
* Process Response Array
|
||||
*
|
||||
* Example:
|
||||
* http://example.org/api/v1/appointments?page=3&length=30
|
||||
*
|
||||
* @param array &$response The response array to be processed.
|
||||
*/
|
||||
public static function process(array &$response)
|
||||
{
|
||||
if ( ! isset($_GET['page']) || empty($response))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$page = (int)$_GET['page'];
|
||||
$length = isset($_GET['length']) ? (int)$_GET['length'] : 20;
|
||||
|
||||
$chunks = array_chunk($response, $length);
|
||||
|
||||
$response = isset($chunks[$page - 1]) ? $chunks[$page - 1] : [];
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Processors;
|
||||
|
||||
/**
|
||||
* Interface ProcessorsInterface
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @package EA\Engine\Api\V1\Processors
|
||||
*/
|
||||
interface ProcessorsInterface {
|
||||
public static function process(array &$response);
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Processors;
|
||||
|
||||
/**
|
||||
* Search Processor
|
||||
*
|
||||
* This class will search the response with the "q" GET parameter and only provide the entries
|
||||
* that match the keyword. Make sure that the response parameter is a sequential array and not
|
||||
* a single entry by the time this processor is executed.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Search implements ProcessorsInterface {
|
||||
/**
|
||||
* Process Response Array
|
||||
*
|
||||
* @param array &$response The response array to be processed.
|
||||
*/
|
||||
public static function process(array &$response)
|
||||
{
|
||||
if ( ! isset($_GET['q']) || empty($response))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$searched_response = [];
|
||||
$keyword = (string)$_GET['q'];
|
||||
|
||||
foreach ($response as $entry)
|
||||
{
|
||||
if (self::recursive_array_search($entry, $keyword) !== FALSE)
|
||||
{
|
||||
$searched_response[] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
$response = $searched_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive Array Search
|
||||
*
|
||||
* @param array $haystack Array to search in.
|
||||
* @param string $needle Keyword to be searched.
|
||||
*
|
||||
* @return int|bool Returns the index of the search occurrence or false it nothing was found.
|
||||
*/
|
||||
protected static function recursive_array_search(array $haystack, $needle)
|
||||
{
|
||||
foreach ($haystack as $key => $value)
|
||||
{
|
||||
$currentKey = $key;
|
||||
|
||||
if (is_array($value) && self::recursive_array_search($value, $needle) !== FALSE)
|
||||
{
|
||||
return $currentKey;
|
||||
}
|
||||
|
||||
if (is_string($value) && stripos($value, $needle) !== FALSE)
|
||||
{
|
||||
return $currentKey;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1\Processors;
|
||||
|
||||
/**
|
||||
* Sort Processor
|
||||
*
|
||||
* This class will sort the response array with the provided GET parameters. Make sure that the
|
||||
* response parameter is a sequential array and not a single entry by the time this processor is
|
||||
* executed.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Sort implements ProcessorsInterface {
|
||||
/**
|
||||
* Supports up to 3 columns for sorting.
|
||||
*
|
||||
* Example:
|
||||
* http://ea-installation.com/api/v1/appointments?sort=-start,+notes,-hash
|
||||
*
|
||||
* @param array &$response The response array to be processed.
|
||||
*/
|
||||
public static function process(array &$response)
|
||||
{
|
||||
if ( ! isset($_GET['sort']) || empty($response))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$sort = explode(',', (string)$_GET['sort']);
|
||||
|
||||
$sort_direction1 = substr($sort[0], 0, 1) === '-' ? SORT_DESC : SORT_ASC;
|
||||
|
||||
if (isset($sort[1]))
|
||||
{
|
||||
$sort_direction2 = substr($sort[1], 0, 1) === '-' ? SORT_DESC : SORT_ASC;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sort_direction2 = NULL;
|
||||
}
|
||||
|
||||
if (isset($sort[2]))
|
||||
{
|
||||
$sort_direction3 = substr($sort[2], 0, 1) === '-' ? SORT_DESC : SORT_ASC;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sort_direction3 = NULL;
|
||||
}
|
||||
|
||||
foreach ($response as $index => $entry)
|
||||
{
|
||||
$sort_order1[$index] = $entry[substr($sort[0], 1)];
|
||||
|
||||
if ($sort_direction2)
|
||||
{
|
||||
$sort_order2[$index] = $entry[substr($sort[1], 1)];
|
||||
}
|
||||
|
||||
if ($sort_direction3)
|
||||
{
|
||||
$sort_order3[$index] = $entry[substr($sort[2], 1)];
|
||||
}
|
||||
}
|
||||
|
||||
$arguments = [
|
||||
&$sort_order1,
|
||||
&$sort_direction1
|
||||
];
|
||||
|
||||
if ($sort_direction2)
|
||||
{
|
||||
$arguments[] = $sort_order2;
|
||||
$arguments[] = $sort_direction2;
|
||||
}
|
||||
|
||||
if ($sort_direction3)
|
||||
{
|
||||
$arguments[] = $sort_order3;
|
||||
$arguments[] = $sort_direction3;
|
||||
}
|
||||
|
||||
$arguments[] = &$response;
|
||||
|
||||
call_user_func_array('array_multisort', $arguments);
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
/**
|
||||
* Request Class
|
||||
*
|
||||
* This class handles the common request handling before the data are manipulated and
|
||||
* returned back with the Response class.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Request {
|
||||
/**
|
||||
* Get request body as an associative array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_body()
|
||||
{
|
||||
return json_decode(file_get_contents('php://input'), TRUE);
|
||||
}
|
||||
}
|
|
@ -1,154 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
use EA\Engine\Types\NonEmptyText;
|
||||
|
||||
/**
|
||||
* API v1 Response
|
||||
*
|
||||
* Use chain-calls of the class methods to easily manipulate the provided response array. This class will
|
||||
* use directly the provided GET parameters for easier manipulation.
|
||||
*
|
||||
* Example:
|
||||
* $parser = new \EA\Engine\Api\V1\Parsers\Appointments;
|
||||
* $response = new \EA\Engine\Api\V1\Response($data);
|
||||
* $response->format($parser)->search()->sort()->paginate()->minimize()->output();
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Response {
|
||||
/**
|
||||
* Contains the response information.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $response;
|
||||
|
||||
/**
|
||||
* Class Constructor
|
||||
*
|
||||
* @param array $response Provide unfiltered data to be processed as an array.
|
||||
*/
|
||||
public function __construct(array $response)
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode the response entries to the API compatible structure.
|
||||
*
|
||||
* @param Parsers\ParsersInterface $parser Provide the corresponding parser class.
|
||||
*
|
||||
* @return \EA\Engine\Api\V1\Response
|
||||
*/
|
||||
public function encode(Parsers\ParsersInterface $parser)
|
||||
{
|
||||
foreach ($this->response as &$entry)
|
||||
{
|
||||
$parser->encode($entry);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a response search.
|
||||
*
|
||||
* @return \EA\Engine\Api\V1\Response
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
Processors\Search::process($this->response);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a response sort.
|
||||
*
|
||||
* @return \EA\Engine\Api\V1\Response
|
||||
*/
|
||||
public function sort()
|
||||
{
|
||||
Processors\Sort::process($this->response);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a response paginate.
|
||||
*
|
||||
* @return \EA\Engine\Api\V1\Response
|
||||
*/
|
||||
public function paginate()
|
||||
{
|
||||
Processors\Paginate::process($this->response);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a response minimize.
|
||||
*
|
||||
* @return \EA\Engine\Api\V1\Response
|
||||
*/
|
||||
public function minimize()
|
||||
{
|
||||
Processors\Minimize::process($this->response);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a single entry instead of an array of entries.
|
||||
*
|
||||
* This is useful whenever the client requests only a single entry. Make sure that you call this method
|
||||
* right before the output() in order to avoid side-effects with the other processor methods of this class.
|
||||
*
|
||||
* @param int $id Provide the ID value of the request UI and if is not null the response will be
|
||||
* converted into an associative array.
|
||||
*
|
||||
* @return \EA\Engine\Api\V1\Response
|
||||
*/
|
||||
public function singleEntry($id)
|
||||
{
|
||||
if ($id !== NULL)
|
||||
{
|
||||
$this->response = array_shift($this->response);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the response as a JSON with the provided status header.
|
||||
*
|
||||
* @param \EA\Engine\Types\NonEmptyText $status Optional (null), if provided it must contain the status
|
||||
* header value. Default string: '200 OK'.
|
||||
*
|
||||
* @return \EA\Engine\Api\V1\Response
|
||||
*/
|
||||
public function output(NonEmptyText $status = NULL)
|
||||
{
|
||||
$header = $status ? $status->get() : '200 OK';
|
||||
|
||||
header('HTTP/1.0 ' . $header);
|
||||
header('Content-Type: application/json');
|
||||
|
||||
echo json_encode($this->response, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -1,334 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Notifications;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use EA\Engine\Types\Email as EmailAddress;
|
||||
use EA\Engine\Types\NonEmptyText;
|
||||
use EA\Engine\Types\Text;
|
||||
use EA\Engine\Types\Url;
|
||||
use EA_Controller;
|
||||
use Exception;
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Email Notifications Class
|
||||
*
|
||||
* This library handles all the notification email deliveries on the system.
|
||||
*
|
||||
* Important: The email configuration settings are located at: /application/config/email.php
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class Email {
|
||||
/**
|
||||
* Framework Instance
|
||||
*
|
||||
* @var EA_Controller
|
||||
*/
|
||||
protected $CI;
|
||||
|
||||
/**
|
||||
* Contains email configuration.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Class Constructor
|
||||
*
|
||||
* @param \CI_Controller $CI
|
||||
* @param array $config Contains the email configuration to be used.
|
||||
*/
|
||||
public function __construct(\CI_Controller $CI, array $config)
|
||||
{
|
||||
$this->CI = $CI;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an email with the appointment details.
|
||||
*
|
||||
* This email template also needs an email title and an email text in order to complete
|
||||
* the appointment details.
|
||||
*
|
||||
* @param array $appointment Contains the appointment data.
|
||||
* @param array $provider Contains the provider data.
|
||||
* @param array $service Contains the service data.
|
||||
* @param array $customer Contains the customer data.
|
||||
* @param array $settings Contains settings of the company. At the time the "company_name", "company_link" and
|
||||
* "company_email" values are required in the array.
|
||||
* @param \EA\Engine\Types\Text $title The email title may vary depending the receiver.
|
||||
* @param \EA\Engine\Types\Text $message The email message may vary depending the receiver.
|
||||
* @param \EA\Engine\Types\Url $appointment_link_address This link is going to enable the receiver to make changes
|
||||
* to the appointment record.
|
||||
* @param \EA\Engine\Types\Email $recipient_email The recipient email address.
|
||||
* @param \EA\Engine\Types\Text $ics_stream Stream contents of the ICS file.
|
||||
* @param string|null $timezone Custom timezone for the notification.
|
||||
*
|
||||
* @throws \PHPMailer\PHPMailer\Exception
|
||||
*/
|
||||
public function send_appointment_details(
|
||||
array $appointment,
|
||||
array $provider,
|
||||
array $service,
|
||||
array $customer,
|
||||
array $settings,
|
||||
Text $title,
|
||||
Text $message,
|
||||
Url $appointment_link_address,
|
||||
EmailAddress $recipient_email,
|
||||
Text $ics_stream,
|
||||
$timezone = NULL
|
||||
)
|
||||
{
|
||||
$timezones = $this->CI->timezones->to_array();
|
||||
|
||||
switch ($settings['date_format'])
|
||||
{
|
||||
case 'DMY':
|
||||
$date_format = 'd/m/Y';
|
||||
break;
|
||||
case 'MDY':
|
||||
$date_format = 'm/d/Y';
|
||||
break;
|
||||
case 'YMD':
|
||||
$date_format = 'Y/m/d';
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Invalid date_format value: ' . $settings['date_format']);
|
||||
}
|
||||
|
||||
switch ($settings['time_format'])
|
||||
{
|
||||
case 'military':
|
||||
$time_format = 'H:i';
|
||||
break;
|
||||
case 'regular':
|
||||
$time_format = 'g:i a';
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Invalid time_format value: ' . $settings['time_format']);
|
||||
}
|
||||
|
||||
$appointment_timezone = new DateTimeZone($provider['timezone']);
|
||||
$appointment_start = new DateTime($appointment['start_datetime'], $appointment_timezone);
|
||||
$appointment_end = new DateTime($appointment['end_datetime'], $appointment_timezone);
|
||||
|
||||
if ($timezone && $timezone !== $provider['timezone'])
|
||||
{
|
||||
$appointment_timezone = new DateTimeZone($timezone);
|
||||
$appointment_start->setTimezone($appointment_timezone);
|
||||
$appointment_end->setTimezone($appointment_timezone);
|
||||
}
|
||||
|
||||
$html = $this->CI->load->view('emails/appointment_details', [
|
||||
'email_title' => $title->get(),
|
||||
'email_message' => $message->get(),
|
||||
'appointment_service' => $service['name'],
|
||||
'appointment_provider' => $provider['first_name'] . ' ' . $provider['last_name'],
|
||||
'appointment_start_date' => $appointment_start->format($date_format . ' ' . $time_format),
|
||||
'appointment_end_date' => $appointment_end->format($date_format . ' ' . $time_format),
|
||||
'appointment_timezone' => $timezones[empty($timezone) ? $provider['timezone'] : $timezone],
|
||||
'appointment_link' => $appointment_link_address->get(),
|
||||
'company_link' => $settings['company_link'],
|
||||
'company_name' => $settings['company_name'],
|
||||
'customer_name' => $customer['first_name'] . ' ' . $customer['last_name'],
|
||||
'customer_email' => $customer['email'],
|
||||
'customer_phone' => $customer['phone_number'],
|
||||
'customer_address' => $customer['address'],
|
||||
], TRUE);
|
||||
|
||||
$mailer = $this->create_mailer();
|
||||
$mailer->From = $settings['company_email'];
|
||||
$mailer->FromName = $settings['company_name'];
|
||||
$mailer->AddAddress($recipient_email->get());
|
||||
$mailer->Subject = $title->get();
|
||||
$mailer->Body = $html;
|
||||
$mailer->addStringAttachment($ics_stream->get(), 'invitation.ics');
|
||||
|
||||
if ( ! $mailer->Send())
|
||||
{
|
||||
throw new RuntimeException('Email could not been sent. Mailer Error (Line ' . __LINE__ . '): '
|
||||
. $mailer->ErrorInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an email notification to both provider and customer on appointment removal.
|
||||
*
|
||||
* Whenever an appointment is cancelled or removed, both the provider and customer
|
||||
* need to be informed. This method sends the same email twice.
|
||||
*
|
||||
* <strong>IMPORTANT!</strong> This method's arguments should be taken
|
||||
* from database before the appointment record is deleted.
|
||||
*
|
||||
* @param array $appointment The record data of the removed appointment.
|
||||
* @param array $provider The record data of the appointment provider.
|
||||
* @param array $service The record data of the appointment service.
|
||||
* @param array $customer The record data of the appointment customer.
|
||||
* @param array $settings Some settings that are required for this function. As of now this array must contain
|
||||
* the following values: "company_link", "company_name", "company_email".
|
||||
* @param \EA\Engine\Types\Email $recipient_email The email address of the email recipient.
|
||||
* @param \EA\Engine\Types\Text $reason The reason why the appointment is deleted.
|
||||
* @param string|null $timezone Custom timezone.
|
||||
*
|
||||
* @throws \PHPMailer\PHPMailer\Exception
|
||||
*/
|
||||
public function send_delete_appointment(
|
||||
array $appointment,
|
||||
array $provider,
|
||||
array $service,
|
||||
array $customer,
|
||||
array $settings,
|
||||
EmailAddress $recipient_email,
|
||||
Text $reason,
|
||||
$timezone = NULL
|
||||
)
|
||||
{
|
||||
$timezones = $this->CI->timezones->to_array();
|
||||
|
||||
switch ($settings['date_format'])
|
||||
{
|
||||
case 'DMY':
|
||||
$date_format = 'd/m/Y';
|
||||
break;
|
||||
case 'MDY':
|
||||
$date_format = 'm/d/Y';
|
||||
break;
|
||||
case 'YMD':
|
||||
$date_format = 'Y/m/d';
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Invalid date_format value: ' . $settings['date_format']);
|
||||
}
|
||||
|
||||
switch ($settings['time_format'])
|
||||
{
|
||||
case 'military':
|
||||
$time_format = 'H:i';
|
||||
break;
|
||||
case 'regular':
|
||||
$time_format = 'g:i a';
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Invalid time_format value: ' . $settings['time_format']);
|
||||
}
|
||||
|
||||
$appointment_timezone = new DateTimeZone($provider['timezone']);
|
||||
$appointment_start = new DateTime($appointment['start_datetime'], $appointment_timezone);
|
||||
|
||||
if ($timezone && $timezone !== $provider['timezone'])
|
||||
{
|
||||
$appointment_timezone = new DateTimeZone($timezone);
|
||||
$appointment_start->setTimezone($appointment_timezone);
|
||||
}
|
||||
|
||||
$html = $this->CI->load->view('emails/delete_appointment', [
|
||||
'appointment_service' => $service['name'],
|
||||
'appointment_provider' => $provider['first_name'] . ' ' . $provider['last_name'],
|
||||
'appointment_date' => $appointment_start->format($date_format . ' ' . $time_format),
|
||||
'appointment_duration' => $service['duration'] . ' ' . lang('minutes'),
|
||||
'appointment_timezone' => $timezones[empty($timezone) ? $provider['timezone'] : $timezone],
|
||||
'company_link' => $settings['company_link'],
|
||||
'company_name' => $settings['company_name'],
|
||||
'customer_name' => $customer['first_name'] . ' ' . $customer['last_name'],
|
||||
'customer_email' => $customer['email'],
|
||||
'customer_phone' => $customer['phone_number'],
|
||||
'customer_address' => $customer['address'],
|
||||
'reason' => $reason->get(),
|
||||
], TRUE);
|
||||
|
||||
$mailer = $this->create_mailer();
|
||||
|
||||
// Send email to recipient.
|
||||
$mailer->From = $settings['company_email'];
|
||||
$mailer->FromName = $settings['company_name'];
|
||||
$mailer->AddAddress($recipient_email->get()); // "Name" argument crushes the phpmailer class.
|
||||
$mailer->Subject = lang('appointment_cancelled_title');
|
||||
$mailer->Body = $html;
|
||||
|
||||
if ( ! $mailer->Send())
|
||||
{
|
||||
throw new RuntimeException('Email could not been sent. Mailer Error (Line ' . __LINE__ . '): '
|
||||
. $mailer->ErrorInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sends an email with the new password of a user.
|
||||
*
|
||||
* @param \EA\Engine\Types\NonEmptyText $password Contains the new password.
|
||||
* @param \EA\Engine\Types\Email $recipientEmail The receiver's email address.
|
||||
* @param array $settings The company settings to be included in the email.
|
||||
*
|
||||
* @throws \PHPMailer\PHPMailer\Exception
|
||||
*/
|
||||
public function send_password(NonEmptyText $password, EmailAddress $recipientEmail, array $settings)
|
||||
{
|
||||
$html = $this->CI->load->view('emails/new_password', [
|
||||
'email_title' => lang('new_account_password'),
|
||||
'email_message' => str_replace('$password', '<strong>' . $password->get() . '</strong>', lang('new_password_is')),
|
||||
'company_name' => $settings['company_name'],
|
||||
'company_email' => $settings['company_email'],
|
||||
'company_link' => $settings['company_link'],
|
||||
], TRUE);
|
||||
|
||||
$mailer = $this->create_mailer();
|
||||
|
||||
$mailer->From = $settings['company_email'];
|
||||
$mailer->FromName = $settings['company_name'];
|
||||
$mailer->AddAddress($recipientEmail->get()); // "Name" argument crushes the phpmailer class.
|
||||
$mailer->Subject = lang('new_account_password');
|
||||
$mailer->Body = $html;
|
||||
|
||||
if ( ! $mailer->Send())
|
||||
{
|
||||
throw new RuntimeException('Email could not been sent. Mailer Error (Line ' . __LINE__ . '): '
|
||||
. $mailer->ErrorInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create PHP Mailer Instance
|
||||
*
|
||||
* @return PHPMailer
|
||||
*/
|
||||
protected function create_mailer()
|
||||
{
|
||||
$mailer = new PHPMailer();
|
||||
|
||||
if ($this->config['protocol'] === 'smtp')
|
||||
{
|
||||
$mailer->isSMTP();
|
||||
$mailer->SMTPDebug = $this->config['smtp_debug'];
|
||||
$mailer->Host = $this->config['smtp_host'];
|
||||
$mailer->SMTPAuth = $this->config['smtp_auth'];
|
||||
$mailer->Username = $this->config['smtp_user'];
|
||||
$mailer->Password = $this->config['smtp_pass'];
|
||||
$mailer->SMTPSecure = $this->config['smtp_crypto'];
|
||||
$mailer->Port = $this->config['smtp_port'];
|
||||
$mailer->Sender = $settings['company_email'];
|
||||
$mailer->SetFrom($settings['company_email'], $settings['company_name'], FALSE);
|
||||
}
|
||||
|
||||
$mailer->IsHTML($this->config['mailtype'] === 'html');
|
||||
$mailer->CharSet = $this->config['charset'];
|
||||
|
||||
return $mailer;
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
/**
|
||||
* Class Boolean
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @package EA\Engine\Types
|
||||
*/
|
||||
class Boolean extends Type {
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function validate($value)
|
||||
{
|
||||
return is_bool($value);
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
|
||||
/**
|
||||
* Class Decimal
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @package EA\Engine\Types
|
||||
*/
|
||||
class Decimal extends Type {
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function validate($value)
|
||||
{
|
||||
return is_float($value);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
/**
|
||||
* Class Email
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @package EA\Engine\Types
|
||||
*/
|
||||
class Email extends NonEmptyText {
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function validate($value)
|
||||
{
|
||||
return parent::validate($value) && filter_var($value, FILTER_VALIDATE_EMAIL);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
/**
|
||||
* Class Integer
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @package EA\Engine\Types
|
||||
*/
|
||||
class Integer extends Type {
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function validate($value)
|
||||
{
|
||||
return is_numeric($value) && ! is_float($value);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
/**
|
||||
* Class NonEmptyText
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @package EA\Engine\Types
|
||||
*/
|
||||
class NonEmptyText extends Text {
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function validate($value)
|
||||
{
|
||||
return parent::validate($value) && $value !== '';
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
/**
|
||||
* Class Text
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @package EA\Engine\Types
|
||||
*/
|
||||
class Text extends Type {
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function validate($value)
|
||||
{
|
||||
return is_string($value);
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
/**
|
||||
* Abstract Type Class
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* This class needs to be extended by the type classes which must implement the validation logic.
|
||||
*/
|
||||
abstract class Type {
|
||||
/**
|
||||
* Class Constructor
|
||||
*
|
||||
* @param mixed $value The type value to be validated.
|
||||
*/
|
||||
public function __construct($value)
|
||||
{
|
||||
if ( ! $this->validate($value))
|
||||
{
|
||||
throw new \InvalidArgumentException(__CLASS__ . ': Invalid argument value provided (' . $value . ')');
|
||||
}
|
||||
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type value.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the validation logic in the children classes.
|
||||
*
|
||||
* @param mixed $value The value to be validated.
|
||||
*
|
||||
* @return bool Returns whether the value is valid or not.
|
||||
*/
|
||||
abstract protected function validate($value);
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
/**
|
||||
* Class UnsignedInteger
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @package EA\Engine\Types
|
||||
*/
|
||||
class UnsignedInteger extends Integer {
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function validate($value)
|
||||
{
|
||||
return parent::validate($value) && $value > -1;
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
/**
|
||||
* Class Url
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @package EA\Engine\Types
|
||||
*/
|
||||
class Url extends NonEmptyText {
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function validate($value)
|
||||
{
|
||||
return parent::validate($value) && filter_var($value, FILTER_VALIDATE_URL);
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
use EA\Engine\Types\NonEmptyText;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AuthorizationTest extends TestCase {
|
||||
public function testBasicMethodPerformsBasicAuthentication()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
public function testBasicMethodReturnsForbiddenResponse()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FilterTest extends TestCase {
|
||||
public function test()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class MinimizeTest extends TestCase {
|
||||
public function test()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PaginationTest extends TestCase {
|
||||
public function test()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ResponseTest extends TestCase {
|
||||
public function test()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SearchTest extends TestCase {
|
||||
public function test()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SortTest extends TestCase {
|
||||
public function test()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"id": 143,
|
||||
"firstname": "Chris",
|
||||
"lastname": "Doe",
|
||||
"email": "chris@doe.com",
|
||||
"mobile": "012345679-0",
|
||||
"phone": "0123456789-1",
|
||||
"address": "Some Str. 123",
|
||||
"city": "Some City",
|
||||
"state": "Some City",
|
||||
"zip": "12345",
|
||||
"notes": "Test admin notes.",
|
||||
"settings": {
|
||||
"username": "chrisdoe",
|
||||
"notifications": true
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"id": 1,
|
||||
"book": "2016-07-08 12:57:00",
|
||||
"start": "2016-07-08 18:00:00",
|
||||
"end": "2016-07-08 18:30:00",
|
||||
"hash": "asdf809a8sdf987a9d8f7",
|
||||
"notes": "These are some test notes.",
|
||||
"customerId": 56,
|
||||
"providerId": 4,
|
||||
"serviceId": 7,
|
||||
"googleCalendarId": 134
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"id": 5,
|
||||
"name": "Test Category",
|
||||
"description": "This category includes test services"
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"id": 97,
|
||||
"firstname": "John",
|
||||
"lastname": "Doe",
|
||||
"email": "john@doe.com",
|
||||
"phone": "0123456789",
|
||||
"address": "Some Str. 123",
|
||||
"city": "Some City",
|
||||
"zip": "12345",
|
||||
"notes": "Test customer notes."
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
{
|
||||
"id": 143,
|
||||
"firstname": "Chloe",
|
||||
"lastname": "Doe",
|
||||
"email": "chloe@doe.com",
|
||||
"mobile": "012345679-0",
|
||||
"phone": "0123456789-1",
|
||||
"address": "Some Str. 123",
|
||||
"city": "Some City",
|
||||
"state": "Some State",
|
||||
"zip": "12345",
|
||||
"notes": "Test provider notes.",
|
||||
"services": [
|
||||
1,
|
||||
5,
|
||||
9
|
||||
],
|
||||
"settings": {
|
||||
"username": "chloedoe",
|
||||
"notifications": true,
|
||||
"googleSync": true,
|
||||
"googleCalendar": "calendar-id",
|
||||
"googleToken": "23897dfasdf7a98gas98d9",
|
||||
"syncFutureDays": 10,
|
||||
"syncPastDays": 10,
|
||||
"workingPlan": {
|
||||
"monday": {
|
||||
"start": "09:00",
|
||||
"end": "18:00",
|
||||
"breaks": [
|
||||
{
|
||||
"start": "14:30",
|
||||
"end": "15:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tuesday": {
|
||||
"start": "09:00",
|
||||
"end": "18:00",
|
||||
"breaks": [
|
||||
{
|
||||
"start": "14:30",
|
||||
"end": "15:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
"wednesday": null,
|
||||
"thursday": {
|
||||
"start": "09:00",
|
||||
"end": "18:00",
|
||||
"breaks": [
|
||||
{
|
||||
"start": "14:30",
|
||||
"end": "15:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
"friday": {
|
||||
"start": "09:00",
|
||||
"end": "18:00",
|
||||
"breaks": [
|
||||
{
|
||||
"start": "14:30",
|
||||
"end": "15:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
"saturday": null,
|
||||
"sunday": null
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"id": 143,
|
||||
"firstname": "Chris",
|
||||
"lastname": "Doe",
|
||||
"email": "chris@doe.com",
|
||||
"mobile": "012345679-0",
|
||||
"phone": "0123456789-1",
|
||||
"address": "Some Str. 123",
|
||||
"city": "Some City",
|
||||
"zip": "12345",
|
||||
"notes": "Test secretary notes.",
|
||||
"providers": [
|
||||
53,
|
||||
17
|
||||
],
|
||||
"settings": {
|
||||
"username": "chrisdoe",
|
||||
"notifications": true
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"id": 74,
|
||||
"name": "Male Haircut",
|
||||
"duration": 60,
|
||||
"price": 10.00,
|
||||
"currency": "Euro",
|
||||
"description": "Male haircut trends.",
|
||||
"categoryId": null
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"name": "book_advance_timeout",
|
||||
"value": "100"
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"id": 1,
|
||||
"book": "2016-07-08 12:57:00",
|
||||
"start": "2016-07-08 18:00:00",
|
||||
"end": "2016-07-08 18:30:00",
|
||||
"notes": "These are some test notes.",
|
||||
"providerId": 4,
|
||||
"googleCalendarId": 474
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BooleanTest extends TestCase {
|
||||
public function testBoolType()
|
||||
{
|
||||
$type = new Boolean(TRUE);
|
||||
$this->assertEquals(TRUE, $type->get());
|
||||
}
|
||||
|
||||
public function testBoolTypeThrowsExceptionWithInvalidValue()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new Boolean(NULL);
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DecimalTest extends TestCase {
|
||||
public function testFloatType()
|
||||
{
|
||||
$type = new Decimal(100.00);
|
||||
$this->assertEquals(100.00, $type->get());
|
||||
}
|
||||
|
||||
public function testFloatTypeThrowsExceptionWithInvalidValue()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new Decimal(NULL);
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EmailTest extends TestCase {
|
||||
public function testEmailType()
|
||||
{
|
||||
$type = new Email('john@doe.com');
|
||||
$this->assertEquals('john@doe.com', $type->get());
|
||||
}
|
||||
|
||||
public function testEmailTypeThrowsExceptionWithInvalidEmail()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new Email('abcdef');
|
||||
}
|
||||
|
||||
public function testEmailTypeThrowsExceptionWithInvalidValue()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new Email(NULL);
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class IntegerTest extends TestCase {
|
||||
public function testIntType()
|
||||
{
|
||||
$type = new Integer(1);
|
||||
$this->assertEquals(1, $type->get());
|
||||
}
|
||||
|
||||
public function testIntTypeThrowsExceptionWithFloat()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new Integer(100.00);
|
||||
}
|
||||
|
||||
public function testIntTypeThrowsExceptionWithWithString()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new Integer('invalid');
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class NonEmptyTextTest extends TestCase {
|
||||
public function testNonEmptyStringType()
|
||||
{
|
||||
$type = new NonEmptyText('Hello!');
|
||||
$this->assertEquals('Hello!', $type->get());
|
||||
}
|
||||
|
||||
public function testNonEmptyStringTypeThrowsExceptionWithEmptyString()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new NonEmptyText('');
|
||||
}
|
||||
|
||||
public function testNonEmptyStringTypeThrowsExceptionWithInvalidValue()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new NonEmptyText(NULL);
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class TextTest extends TestCase {
|
||||
public function testStringType()
|
||||
{
|
||||
$type = new Text('Hello!');
|
||||
$this->assertEquals('Hello!', $type->get());
|
||||
}
|
||||
|
||||
public function testStringTypeThrowsExceptionWithInvalidValue()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new Text(NULL);
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class UnsignedIntegerTest extends TestCase {
|
||||
public function testUnsignedIntType()
|
||||
{
|
||||
$type = new UnsignedInteger(1);
|
||||
$this->assertEquals(1, $type->get());
|
||||
}
|
||||
|
||||
public function testUnsignedIntTypeThrowsExceptionWithNegative()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new UnsignedInteger(-1);
|
||||
}
|
||||
|
||||
public function testUnsignedIntTypeThrowsExceptionWithWithString()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new UnsignedInteger('invalid');
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class UrlTest extends TestCase {
|
||||
public function testUrlType()
|
||||
{
|
||||
$type = new Url('http://localhost');
|
||||
$this->assertEquals('http://localhost', $type->get());
|
||||
}
|
||||
|
||||
public function testUrlTypeThrowsExceptionWithInvalidUrl()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new Url('abcdef');
|
||||
}
|
||||
|
||||
public function testUrlTypeThrowsExceptionWithInvalidValue()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new Url(NULL);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue