ApplicationService.php
1 year ago
DataModifier.php
2 years ago
DomainService.php
2 years ago
EventListener.php
1 year ago
InfrastructureService.php
2 years ago
Licence.php
1 year ago
Licence.php
216 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Infrastructure\Licence\Lite; |
| 4 | |
| 5 | use AmeliaBooking\Application\Commands; |
| 6 | use AmeliaBooking\Domain\Collection\Collection; |
| 7 | use AmeliaBooking\Domain\Common\Exceptions\InvalidArgumentException; |
| 8 | use AmeliaBooking\Infrastructure\Common\Container; |
| 9 | use AmeliaBooking\Infrastructure\Routes; |
| 10 | use AmeliaBooking\Infrastructure\WP\Translations\BackendStrings; |
| 11 | use Slim\App; |
| 12 | |
| 13 | /** |
| 14 | * Class Licence |
| 15 | * |
| 16 | * @package AmeliaBooking\Infrastructure\Licence\Lite |
| 17 | */ |
| 18 | class Licence |
| 19 | { |
| 20 | public static $premium = false; |
| 21 | |
| 22 | /** |
| 23 | * @param Container $c |
| 24 | */ |
| 25 | public static function getCommands($c) |
| 26 | { |
| 27 | return [ |
| 28 | // Test |
| 29 | Commands\Test\TestCommand::class => new Commands\Test\TestCommandHandler($c), |
| 30 | // Stash |
| 31 | Commands\Stash\UpdateStashCommand::class => new Commands\Stash\UpdateStashCommandHandler($c), |
| 32 | // Bookable/Category |
| 33 | Commands\Bookable\Category\AddCategoryCommand::class => new Commands\Bookable\Category\AddCategoryCommandHandler($c), |
| 34 | Commands\Bookable\Category\DeleteCategoryCommand::class => new Commands\Bookable\Category\DeleteCategoryCommandHandler($c), |
| 35 | Commands\Bookable\Category\GetCategoriesCommand::class => new Commands\Bookable\Category\GetCategoriesCommandHandler($c), |
| 36 | Commands\Bookable\Category\GetCategoryCommand::class => new Commands\Bookable\Category\GetCategoryCommandHandler($c), |
| 37 | Commands\Bookable\Category\UpdateCategoriesPositionsCommand::class => new Commands\Bookable\Category\UpdateCategoriesPositionsCommandHandler($c), |
| 38 | Commands\Bookable\Category\UpdateCategoryCommand::class => new Commands\Bookable\Category\UpdateCategoryCommandHandler($c), |
| 39 | // Bookable/Service |
| 40 | Commands\Bookable\Service\AddServiceCommand::class => new Commands\Bookable\Service\AddServiceCommandHandler($c), |
| 41 | Commands\Bookable\Service\DeleteServiceCommand::class => new Commands\Bookable\Service\DeleteServiceCommandHandler($c), |
| 42 | Commands\Bookable\Service\GetServiceCommand::class => new Commands\Bookable\Service\GetServiceCommandHandler($c), |
| 43 | Commands\Bookable\Service\GetServiceDeleteEffectCommand::class => new Commands\Bookable\Service\GetServiceDeleteEffectCommandHandler($c), |
| 44 | Commands\Bookable\Service\GetServicesCommand::class => new Commands\Bookable\Service\GetServicesCommandHandler($c), |
| 45 | Commands\Bookable\Service\UpdateServiceCommand::class => new Commands\Bookable\Service\UpdateServiceCommandHandler($c), |
| 46 | Commands\Bookable\Service\UpdateServiceStatusCommand::class => new Commands\Bookable\Service\UpdateServiceStatusCommandHandler($c), |
| 47 | Commands\Bookable\Service\UpdateServicesPositionsCommand::class => new Commands\Bookable\Service\UpdateServicesPositionsCommandHandler($c), |
| 48 | // Booking/Event |
| 49 | Commands\Booking\Event\AddEventCommand::class => new Commands\Booking\Event\AddEventCommandHandler($c), |
| 50 | Commands\Booking\Event\GetEventCommand::class => new Commands\Booking\Event\GetEventCommandHandler($c), |
| 51 | Commands\Booking\Event\GetEventsCommand::class => new Commands\Booking\Event\GetEventsCommandHandler($c), |
| 52 | Commands\Booking\Event\UpdateEventCommand::class => new Commands\Booking\Event\UpdateEventCommandHandler($c), |
| 53 | Commands\Booking\Event\UpdateEventStatusCommand::class => new Commands\Booking\Event\UpdateEventStatusCommandHandler($c), |
| 54 | Commands\Booking\Event\DeleteEventBookingCommand::class => new Commands\Booking\Event\DeleteEventBookingCommandHandler($c), |
| 55 | Commands\Booking\Event\UpdateEventBookingCommand::class => new Commands\Booking\Event\UpdateEventBookingCommandHandler($c), |
| 56 | Commands\Booking\Event\DeleteEventCommand::class => new Commands\Booking\Event\DeleteEventCommandHandler($c), |
| 57 | Commands\Booking\Event\GetEventDeleteEffectCommand::class => new Commands\Booking\Event\GetEventDeleteEffectCommandHandler($c), |
| 58 | Commands\Booking\Event\GetCalendarEventsCommand::class => new Commands\Booking\Event\GetCalendarEventsCommandHandler($c), |
| 59 | // Booking/Appointment |
| 60 | Commands\Booking\Appointment\AddAppointmentCommand::class => new Commands\Booking\Appointment\AddAppointmentCommandHandler($c), |
| 61 | Commands\Booking\Appointment\AddBookingCommand::class => new Commands\Booking\Appointment\AddBookingCommandHandler($c), |
| 62 | Commands\Booking\Appointment\DeleteBookingCommand::class => new Commands\Booking\Appointment\DeleteBookingCommandHandler($c), |
| 63 | Commands\Booking\Appointment\CancelBookingCommand::class => new Commands\Booking\Appointment\CancelBookingCommandHandler($c), |
| 64 | Commands\Booking\Appointment\CancelBookingRemotelyCommand::class => new Commands\Booking\Appointment\CancelBookingRemotelyCommandHandler($c), |
| 65 | Commands\Booking\Appointment\RejectBookingRemotelyCommand::class => new Commands\Booking\Appointment\RejectBookingRemotelyCommandHandler($c), |
| 66 | Commands\Booking\Appointment\ApproveBookingRemotelyCommand::class => new Commands\Booking\Appointment\ApproveBookingRemotelyCommandHandler($c), |
| 67 | Commands\Booking\Appointment\DeleteAppointmentCommand::class => new Commands\Booking\Appointment\DeleteAppointmentCommandHandler($c), |
| 68 | Commands\Booking\Appointment\GetAppointmentCommand::class => new Commands\Booking\Appointment\GetAppointmentCommandHandler($c), |
| 69 | Commands\Booking\Appointment\GetAppointmentsCommand::class => new Commands\Booking\Appointment\GetAppointmentsCommandHandler($c), |
| 70 | Commands\Booking\Appointment\GetPackageAppointmentsCommand::class => new Commands\Booking\Appointment\GetPackageAppointmentsCommandHandler($c), |
| 71 | Commands\Booking\Appointment\GetIcsCommand::class => new Commands\Booking\Appointment\GetIcsCommandHandler($c), |
| 72 | Commands\Booking\Appointment\GetTimeSlotsCommand::class => new Commands\Booking\Appointment\GetTimeSlotsCommandHandler($c), |
| 73 | Commands\Booking\Appointment\UpdateAppointmentCommand::class => new Commands\Booking\Appointment\UpdateAppointmentCommandHandler($c), |
| 74 | Commands\Booking\Appointment\UpdateAppointmentStatusCommand::class => new Commands\Booking\Appointment\UpdateAppointmentStatusCommandHandler($c), |
| 75 | Commands\Booking\Appointment\UpdateAppointmentTimeCommand::class => new Commands\Booking\Appointment\UpdateAppointmentTimeCommandHandler($c), |
| 76 | Commands\Booking\Appointment\ReassignBookingCommand::class => new Commands\Booking\Appointment\ReassignBookingCommandHandler($c), |
| 77 | Commands\Booking\Appointment\SuccessfulBookingCommand::class => new Commands\Booking\Appointment\SuccessfulBookingCommandHandler($c), |
| 78 | // Entities |
| 79 | Commands\Entities\GetEntitiesCommand::class => new Commands\Entities\GetEntitiesCommandHandler($c), |
| 80 | // Notification |
| 81 | Commands\Notification\GetNotificationsCommand::class => new Commands\Notification\GetNotificationsCommandHandler($c), |
| 82 | Commands\Notification\SendUndeliveredNotificationsCommand::class => new Commands\Notification\SendUndeliveredNotificationsCommandHandler($c), |
| 83 | Commands\Notification\SendTestEmailCommand::class => new Commands\Notification\SendTestEmailCommandHandler($c), |
| 84 | Commands\Notification\UpdateNotificationCommand::class => new Commands\Notification\UpdateNotificationCommandHandler($c), |
| 85 | Commands\Notification\UpdateNotificationStatusCommand::class => new Commands\Notification\UpdateNotificationStatusCommandHandler($c), |
| 86 | Commands\Notification\SendAmeliaSmsApiRequestCommand::class => new Commands\Notification\SendAmeliaSmsApiRequestCommandHandler($c), |
| 87 | Commands\Notification\UpdateSMSNotificationHistoryCommand::class => new Commands\Notification\UpdateSMSNotificationHistoryCommandHandler($c), |
| 88 | Commands\Notification\GetSMSNotificationsHistoryCommand::class => new Commands\Notification\GetSMSNotificationsHistoryCommandHandler($c), |
| 89 | // Payment |
| 90 | Commands\Payment\AddPaymentCommand::class => new Commands\Payment\AddPaymentCommandHandler($c), |
| 91 | Commands\Payment\DeletePaymentCommand::class => new Commands\Payment\DeletePaymentCommandHandler($c), |
| 92 | Commands\Payment\GetPaymentCommand::class => new Commands\Payment\GetPaymentCommandHandler($c), |
| 93 | Commands\Payment\GetPaymentsCommand::class => new Commands\Payment\GetPaymentsCommandHandler($c), |
| 94 | Commands\Payment\UpdatePaymentCommand::class => new Commands\Payment\UpdatePaymentCommandHandler($c), |
| 95 | Commands\Payment\CalculatePaymentAmountCommand::class => new Commands\Payment\CalculatePaymentAmountCommandHandler($c), |
| 96 | Commands\Square\SquarePaymentCommand::class => new Commands\Square\SquarePaymentCommandHandler($c), |
| 97 | Commands\Square\SquarePaymentNotifyCommand::class => new Commands\Square\SquarePaymentNotifyCommandHandler($c), |
| 98 | //Square |
| 99 | Commands\Square\DisconnectFromSquareAccountCommand::class => new Commands\Square\DisconnectFromSquareAccountCommandHandler($c), |
| 100 | Commands\Square\FetchAccessTokenSquareCommand::class => new Commands\Square\FetchAccessTokenSquareCommandHandler($c), |
| 101 | Commands\Square\GetSquareAuthURLCommand::class => new Commands\Square\GetSquareAuthURLCommandHandler($c), |
| 102 | Commands\Square\SquareRefundWebhookCommand::class => new Commands\Square\SquareRefundWebhookCommandHandler($c), |
| 103 | // Settings |
| 104 | Commands\Settings\GetSettingsCommand::class => new Commands\Settings\GetSettingsCommandHandler($c), |
| 105 | Commands\Settings\UpdateSettingsCommand::class => new Commands\Settings\UpdateSettingsCommandHandler($c), |
| 106 | // Status |
| 107 | Commands\Stats\AddStatsCommand::class => new Commands\Stats\AddStatsCommandHandler($c), |
| 108 | Commands\Stats\GetStatsCommand::class => new Commands\Stats\GetStatsCommandHandler($c), |
| 109 | // User/Customer |
| 110 | Commands\User\Customer\AddCustomerCommand::class => new Commands\User\Customer\AddCustomerCommandHandler($c), |
| 111 | Commands\User\Customer\GetCustomerCommand::class => new Commands\User\Customer\GetCustomerCommandHandler($c), |
| 112 | Commands\User\Customer\GetCustomersCommand::class => new Commands\User\Customer\GetCustomersCommandHandler($c), |
| 113 | Commands\User\Customer\UpdateCustomerCommand::class => new Commands\User\Customer\UpdateCustomerCommandHandler($c), |
| 114 | // User |
| 115 | Commands\User\DeleteUserCommand::class => new Commands\User\DeleteUserCommandHandler($c), |
| 116 | Commands\User\GetCurrentUserCommand::class => new Commands\User\GetCurrentUserCommandHandler($c), |
| 117 | Commands\User\GetUserDeleteEffectCommand::class => new Commands\User\GetUserDeleteEffectCommandHandler($c), |
| 118 | Commands\User\GetWPUsersCommand::class => new Commands\User\GetWPUsersCommandHandler($c), |
| 119 | // User/Provider |
| 120 | Commands\User\Provider\AddProviderCommand::class => new Commands\User\Provider\AddProviderCommandHandler($c), |
| 121 | Commands\User\Provider\UpdateProviderCommand::class => new Commands\User\Provider\UpdateProviderCommandHandler($c), |
| 122 | // What's new |
| 123 | Commands\WhatsNew\GetWhatsNewCommand::class => new Commands\WhatsNew\GetWhatsNewCommandHandler($c), |
| 124 | ]; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * @param App $app |
| 129 | * @param Container $container |
| 130 | */ |
| 131 | public static function setRoutes(App $app, Container $container) |
| 132 | { |
| 133 | Routes\Booking\Booking::routes($app); |
| 134 | |
| 135 | Routes\Booking\Appointment\Appointment::routes($app); |
| 136 | |
| 137 | Routes\Booking\Event\Event::routes($app); |
| 138 | |
| 139 | Routes\Bookable\Category::routes($app); |
| 140 | |
| 141 | Routes\Entities\Entities::routes($app); |
| 142 | |
| 143 | Routes\Stash\Stash::routes($app); |
| 144 | |
| 145 | Routes\Notification\Notification::routes($app); |
| 146 | |
| 147 | Routes\Payment\Payment::routes($app); |
| 148 | |
| 149 | Routes\Square\Square::routes($app); |
| 150 | |
| 151 | Routes\Import\Import::routes($app); |
| 152 | |
| 153 | Routes\Bookable\Service::routes($app); |
| 154 | |
| 155 | Routes\Settings\Settings::routes($app); |
| 156 | |
| 157 | Routes\Stats\Stats::routes($app); |
| 158 | |
| 159 | Routes\TimeSlots\TimeSlots::routes($app); |
| 160 | |
| 161 | Routes\User\User::routes($app); |
| 162 | |
| 163 | Routes\WhatsNew\WhatsNew::routes($app); |
| 164 | |
| 165 | Routes\Test\Test::routes($app); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * @return array |
| 170 | */ |
| 171 | public static function getLiteMenuItem() |
| 172 | { |
| 173 | return [ |
| 174 | 'parentSlug' => 'amelia', |
| 175 | 'pageTitle' => 'Lite vs Premium', |
| 176 | 'menuTitle' => BackendStrings::getCommonStrings()['lite_vs_premium'], |
| 177 | 'capability' => 'amelia_read_lite_vs_premium', |
| 178 | 'menuSlug' => 'wpamelia-lite-vs-premium', |
| 179 | ]; |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * @return array |
| 184 | */ |
| 185 | public static function getEmployeesMenuItem() |
| 186 | { |
| 187 | return []; |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * @param Collection $providers |
| 192 | * |
| 193 | * @return Collection |
| 194 | * @throws InvalidArgumentException |
| 195 | */ |
| 196 | public static function getEmployees($providers) |
| 197 | { |
| 198 | /** @var Collection $availableProviders */ |
| 199 | $availableProviders = new Collection(); |
| 200 | |
| 201 | if ($providers->length()) { |
| 202 | $availableProviders->addItem($providers->getItem($providers->keys()[0]), $providers->keys()[0]); |
| 203 | } |
| 204 | |
| 205 | return $availableProviders; |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * @return string |
| 210 | */ |
| 211 | public static function getPaddleUrl() |
| 212 | { |
| 213 | return AMELIA_URL . 'public/js/paddle/paddle.js'; |
| 214 | } |
| 215 | } |
| 216 |