PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 2.2.0
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v2.2.0
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
fluent-booking / app / Http / Controllers / SchedulesController.php

SchedulesController.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 2.2.0, at app/Http/Controllers/SchedulesController.php

749 lines 25.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBooking\App\Http\Controllers;
4
5 use FluentBooking\App\Models\Booking;
6 use FluentBooking\App\Models\Calendar;
7 use FluentBooking\App\Models\CalendarSlot;
8 use FluentBooking\App\Models\BookingActivity;
9 use FluentBooking\Framework\Database\Orm\ModelNotFoundException;
10 use FluentBooking\App\Services\EmailNotificationService;
11 use FluentBooking\App\Services\Helper;
12 use FluentBooking\Framework\Support\Arr;
13 use FluentBooking\App\Services\CurrenciesHelper;
14 use FluentBooking\Framework\Http\Request\Request;
15 use FluentBooking\App\Services\PermissionManager;
16 use FluentBooking\App\Services\CalendarService;
17 use FluentBooking\App\Services\ExportHelper;
18 use FluentBooking\App\Services\Integrations\FluentCRM\CrmContactService;
19 use FluentCrm\App\Services\PermissionManager as CrmPermissionManager;
20
21 class SchedulesController extends Controller
22 {
23 public function index(Request $request)
24 {
25 $author = $this->resolveAuthor($request);
26
27 $query = $this->buildSchedulesQuery($request, $author);
28
29 $query->groupBy('group_id');
30
31 $schedules = $query->paginate();
32
33 foreach ($schedules as $schedule) {
34 $this->formatBooking($schedule);
35 }
36
37 $data = [
38 'schedules' => $schedules,
39 'timezone' => 'UTC'
40 ];
41
42 $data['calendar_event_lists'] = CalendarService::getCalendarOptionsByTitle();
43
44 if ($author == 'me') {
45 $slotOptions = CalendarService::getSlotOptions(null, get_current_user_id());
46 $data['slot_options'] = $slotOptions;
47 }
48
49 if ($request->get('page') == 1) {
50 $this->addCountsForFirstPage($author, $data);
51 }
52
53 return $data;
54 }
55
56 public function export(Request $request)
57 {
58 $limit = (int) apply_filters('fluent_booking/data_export_limit', 2000);
59
60 $author = $this->resolveAuthor($request);
61
62 $query = $this->buildSchedulesQuery($request, $author);
63
64 $relations = [
65 'calendar_event',
66 'user',
67 'booking_activities' => function ($q) {
68 $q->where('type', 'cancel_reason');
69 },
70 'booking_meta',
71 ];
72
73 if (defined('FLUENT_BOOKING_PRO_DIR_FILE')) {
74 $relations[] = 'payment_order.transaction';
75 }
76
77 $query->with($relations);
78
79 $total = (clone $query)->withoutEagerLoads()->count();
80 $limited = $total > $limit;
81
82 $bookings = $query->take($limit)->get();
83
84 $rows = $bookings->map(function ($booking) {
85 $row = ExportHelper::mapBooking($booking);
86 return apply_filters('fluent_booking/booking_export_row', $row, $booking);
87 })->all();
88
89 $rows = apply_filters('fluent_booking/booking_export_columns', $rows, $bookings);
90
91 return [
92 'bookings' => $rows,
93 'limited' => $limited,
94 'total' => $total,
95 ];
96 }
97
98 protected function resolveAuthor(Request $request)
99 {
100 $author = Arr::get($request->get('filters', []), 'author');
101
102 if (is_numeric($author)) {
103 $author = (int) $author;
104 } else {
105 $author = sanitize_text_field($author);
106 }
107
108 $hasPermission = PermissionManager::userCanSeeAllBookings();
109
110 if ($hasPermission) {
111 return $author;
112 }
113
114 if (!$author || $author == 'all') {
115 $authorCalendar = Calendar::where('user_id', get_current_user_id())
116 ->where('type', 'simple')
117 ->first();
118
119 $author = $authorCalendar ? $authorCalendar->id : '';
120 }
121
122 return $author;
123 }
124
125 protected function buildSchedulesQuery(Request $request, $author = null)
126 {
127 $filters = $request->get('filters', []);
128 $search = $request->getSafe('search');
129 $eventVal = Arr::get($filters, 'event');
130 $eventId = is_numeric($eventVal) ? (int) $eventVal : 0;
131 $eventType = sanitize_text_field(Arr::get($filters, 'event_type'));
132 $period = sanitize_text_field(Arr::get($filters, 'period', 'upcoming'));
133 $range = array_map('sanitize_text_field', Arr::get($filters, 'range', []));
134 $email = sanitize_email(Arr::get($filters, 'email', ''));
135
136 $allowedPeriods = ['upcoming', 'completed', 'cancelled', 'pending', 'no_show', 'latest_bookings', 'all'];
137 if (!in_array($period, $allowedPeriods, true)) {
138 $period = 'upcoming';
139 }
140
141 $query = Booking::with(['calendar_event']);
142
143 $hasPermission = PermissionManager::userCanSeeAllBookings();
144
145 if (!$hasPermission || $author == 'me') {
146 $query->where('host_user_id', get_current_user_id());
147 }
148
149 if ($author && $author !== 'all') {
150 if ($author != 'me') {
151 $query->where('calendar_id', $author);
152 }
153 if ($eventId > 0) {
154 $query->where('event_id', $eventId);
155 }
156 if ($eventType && $eventType !== 'all') {
157 $query->where('event_type', $eventType);
158 }
159 }
160
161 if (!empty($email) && is_email($email)) {
162 $query->where('email', $email);
163 }
164
165 do_action_ref_array('fluent_booking/schedules_query', [&$query]);
166
167 $query->applyDateRangeFilter($range);
168 $query->applyComputedStatus($period);
169 $query->applyBookingOrderByStatus($period);
170
171 if (!empty($search)) {
172 $query->searchBy($search);
173 }
174
175 return $query;
176 }
177
178 private function addCountsForFirstPage($author, &$data)
179 {
180 $bookingQuery = Booking::query()
181 ->when($author == 'me', function($query) {
182 return $query->where('host_user_id', get_current_user_id());
183 })
184 ->when($author && is_numeric($author), function($query) use ($author) {
185 return $query->where('calendar_id', $author);
186 })
187 ->distinct('group_id');
188
189 $data['pending_count'] = (clone $bookingQuery)->whereIn('status', ['pending', 'reserved'])->count('group_id');
190 $data['no_show_count'] = (clone $bookingQuery)->where('status', 'no_show')->count('group_id');
191 $data['cancelled_count'] = (clone $bookingQuery)->where('status', 'cancelled')->count('group_id');
192 }
193
194 public function patchBooking(Request $request, $bookingId)
195 {
196 $booking = Booking::findOrFail($bookingId);
197 $oldBooking = clone $booking;
198
199 $data = $request->all();
200
201 $this->validate($data, [
202 'column' => 'required',
203 ]);
204
205 do_action('fluent_booking/before_patch_booking_schedule', $booking, $data);
206
207 $value = $request->get('value');
208
209 $column = $data['column'];
210
211 if ($booking->{$column} == $value) {
212 return $this->sendError(['message' => __('No changes found', 'fluent-booking')]);
213 }
214
215 $validColumns = [
216 'internal_note',
217 'email',
218 'phone',
219 'first_name',
220 'last_name',
221 'status',
222 'payment_status'
223 ];
224
225 if (!in_array($column, $validColumns)) {
226 return $this->sendError(['message' => __('Invalid column', 'fluent-booking')]);
227 }
228
229 if ($column === 'email') {
230 if (!$value || !is_email($value)) {
231 return $this->sendError(['message' => __('Invalid email address', 'fluent-booking')]);
232 }
233 $value = sanitize_email($value);
234 } else {
235 $value = sanitize_text_field($value);
236 }
237
238 if ($column == 'status') {
239 if (!in_array($value, ['scheduled', 'completed', 'cancelled', 'rejected', 'no_show'])) {
240 return $this->sendError(['message' => __('Invalid status', 'fluent-booking')]);
241 }
242
243 if ($value == 'scheduled' && $booking->payment_method && $booking->payment_order) {
244 $order = $booking->payment_order;
245 $order->total_paid = $order->total_amount;
246 $order->completed_at = gmdate('Y-m-d H:i:s'); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
247 $order->status = 'paid';
248 $order->save();
249
250 $updateData['payment_status'] = 'paid';
251
252 do_action('fluent_booking/log_booking_activity', $this->getPaymentPaidLog($booking->id));
253
254 do_action('fluent_booking/payment/update_payment_status_paid', $booking);
255
256 } else if ($value == 'scheduled') {
257 do_action('fluent_booking/log_booking_activity', $this->getConfirmLog($booking->id));
258 }
259
260 if ($value == 'cancelled') {
261 $cancelReason = sanitize_text_field($data['cancel_reason']);
262 $booking->cancelMeeting($cancelReason, 'host', get_current_user_id());
263 }
264
265 if ($value == 'rejected') {
266 $rejectReason = sanitize_text_field($data['reject_reason']);
267 $booking->rejectMeeting($rejectReason, get_current_user_id());
268 }
269
270 if (in_array($value, ['cancelled', 'rejected'])) {
271 if ($booking->payment_method && Arr::get($data, 'refund_payment') == 'yes') {
272 do_action('fluent_booking/refund_payment_' . $booking->payment_method, $booking, $booking->calendar_event);
273 }
274 return [
275 /* translators: %s: Booking status */
276 'message' => sprintf(__('The booking has been %s', 'fluent-booking'), $value)
277 ];
278 }
279
280 $updateAll = Arr::isTrue($data, 'update_all') && $booking->isMultiGuestBooking();
281
282 if ($updateAll && in_array($value, ['no_show', 'completed'])) {
283 Booking::where('event_id', $booking->event_id)
284 ->where('group_id', $booking->group_id)
285 ->update([
286 'status' => $value
287 ]);
288 return [
289 /* translators: %s: Booking status */
290 'message' => sprintf(__('The booking has been %s', 'fluent-booking'), $value)
291 ];
292 }
293 }
294
295 if ($column == 'payment_status') {
296 if (!in_array($value, ['pending', 'paid'])) {
297 return $this->sendError(['message' => __('Invalid payment status', 'fluent-booking')]);
298 }
299
300 if ($value == 'paid') {
301 do_action('fluent_booking/log_booking_activity', $this->getPaymentPaidLog($booking->id));
302 }
303
304 if ($value == 'pending') {
305 do_action('fluent_booking/log_booking_activity', $this->getPaymentPendingLog($booking->id));
306 }
307
308 if ($booking->payment_order) {
309 do_action('fluent_booking/payment/status_changed', $booking->payment_order, $booking, $value);
310 }
311 }
312
313 $updateData[$column] = $value;
314 $booking->fill($updateData);
315 $booking->save();
316
317 if ($column === 'status') {
318 do_action('fluent_booking/booking_schedule_' . $value, $booking, $booking->calendar_event);
319
320 do_action('fluent_booking/pre_after_booking_' . $value, $booking, $booking->calendar_event);
321
322 $booking = Booking::with(['calendar_event', 'calendar'])->find($booking->id);
323
324 do_action('fluent_booking/after_booking_' . $value, $booking, $booking->calendar_event, $booking);
325 }
326
327 do_action('fluent_booking/after_patch_booking_schedule', $booking, $oldBooking);
328
329 do_action('fluent_booking/after_patch_booking_' . $column, $booking, $booking->calendar_event, $oldBooking->{$column});
330
331 return [
332 /* translators: Updated column name */
333 'message' => sprintf(__('%s has been updated', 'fluent-booking'), ucfirst($column))
334 ];
335 }
336
337 public function getBooking(Request $request, $bookingId)
338 {
339 $booking = Booking::with('calendar_event');
340
341 if (!PermissionManager::userCanSeeAllBookings()) {
342 $booking->whereHostAccess(get_current_user_id());
343 }
344
345 $booking = $booking->findOrFail($bookingId);
346 $booking = $this->formatBooking($booking);
347
348 do_action_ref_array('fluent_booking/booking_schedule', [&$booking]);
349
350 $data = [
351 'schedule' => $booking
352 ];
353
354 if (in_array('all_data', $this->request->get('with', []))) {
355 $data = array_merge($data, $this->getBookingMetaInfo($request, $bookingId));
356 }
357
358 return $data;
359 }
360
361 public function deleteBooking(Request $request, $bookingId)
362 {
363 $booking = Booking::findOrFail($bookingId);
364
365 do_action('fluent_booking/before_delete_booking', $booking);
366
367 $booking->delete();
368
369 do_action('fluent_booking/after_delete_booking', $bookingId);
370
371 if ($booking->isMultiGuestBooking()) {
372 Booking::where('event_id', $booking->event_id)->where('group_id', $booking->group_id)->delete();
373 }
374
375 return [
376 'message' => __('Booking Deleted Successfully!', 'fluent-booking')
377 ];
378 }
379
380 public function sendConfirmationEmail(Request $request, $bookingId)
381 {
382 $booking = Booking::with(['calendar', 'calendar_event'])->findOrFail($bookingId);
383
384 $emailTo = $request->get('email_to', 'guest');
385
386 $notifications = $booking->calendar_event->getNotifications();
387
388 $email = Arr::get($notifications, 'booking_conf_attendee.email', []);
389 if ($emailTo == 'host') {
390 $email = Arr::get($notifications, 'booking_conf_host.email', []);
391 }
392
393 $result = EmailNotificationService::emailOnBooked($booking, $email, $emailTo, 'scheduled', true);
394
395 if (!$result) {
396 return $this->sendError(['message' => __('Notification sending failed', 'fluent-booking')]);
397 }
398
399 return [
400 'message' => __('Notification sent successfully', 'fluent-booking')
401 ];
402 }
403
404 public function getGroupAttendees(Request $request, $groupId)
405 {
406 $booking = Booking::with('slot');
407
408 if (!PermissionManager::userCanSeeAllBookings()) {
409 $booking->whereHostAccess(get_current_user_id());
410 }
411
412 $booking = $booking->where('group_id', $groupId)->first();
413
414 if (!$booking || !$booking->isMultiGuestBooking()) {
415 return $this->sendError(['message' => __('Invalid group id or the event is not a group event', 'fluent-booking')]);
416 }
417
418 $attendees = Booking::where('group_id', $booking->group_id);
419 $search = $request->getSafe('search');
420
421 if (!empty($search)) {
422 $attendees = $attendees->searchBy($search);
423 }
424 $attendees = $attendees->paginate();
425
426 foreach ($attendees as $attendee) {
427 $attendee = $this->formatBooking($attendee);
428 }
429
430 return [
431 'attendees' => $attendees
432 ];
433 }
434
435 public function getBookingActivities(Request $request, $bookingId)
436 {
437 $this->resolveOwnedBookingOrFail($bookingId);
438
439 $activities = BookingActivity::where('booking_id', $bookingId)
440 ->orderBy('id', 'DESC')
441 ->get();
442
443 return [
444 'activities' => $activities
445 ];
446 }
447
448 public function getBookingMetaInfo(Request $request, $bookingId)
449 {
450 $booking = $this->resolveOwnedBookingOrFail($bookingId);
451
452 $activities = BookingActivity::where('booking_id', $booking->id)
453 ->orderBy('id', 'DESC')
454 ->get();
455
456 $activities->each(function ($activity) {
457 $activity->description = wp_unslash($activity->description);
458 });
459
460 $sidebarContents = [];
461 $mainBodyContents = [];
462
463 $crmProfile = CrmContactService::getProfileData($booking->email);
464 if ($crmProfile) {
465 $sidebarContents[] = [
466 'id' => 'fluent_crm_profule',
467 'title' => __('CRM Profile', 'fluent-booking'),
468 'type' => 'crm_profile',
469 'profile' => $crmProfile,
470 ];
471 }
472
473 $order = null;
474 if ($booking->payment_status && $booking->payment_order) {
475 $order = $booking->payment_order;
476 $relations = ['items', 'transaction'];
477 if (method_exists($order, 'discounts')) {
478 $relations[] = 'discounts';
479 }
480 $order->load($relations);
481 $order->currency_sign = CurrenciesHelper::getCurrencySign($order->currency);
482 }
483
484 $mainBodyContents = apply_filters('fluent_booking/booking_meta_info_main_meta', $mainBodyContents, $booking);
485 $mainBodyContents = apply_filters('fluent_booking/booking_meta_info_main_meta_' . $booking->source, $mainBodyContents, $booking);
486
487 return [
488 'activities' => $activities,
489 'sidebar_contents' => $sidebarContents,
490 'payment_order' => $order,
491 'main_body_contents' => $mainBodyContents
492 ];
493 }
494
495 /**
496 * Return the CRM contact state for a booking plus the full tag/list option
497 * sets, so the admin can manage tags/lists inline from the CRM Profile card.
498 */
499 public function getCrmContact(Request $request, $bookingId)
500 {
501 $booking = $this->resolveOwnedBookingOrFail($bookingId);
502
503 if (!CrmContactService::isActive()) {
504 return $this->sendError([
505 'message' => __('FluentCRM is not active.', 'fluent-booking')
506 ]);
507 }
508
509 $state = CrmContactService::getContactState($booking->email);
510
511 if (!$state) {
512 return $this->sendError([
513 'message' => __('No CRM contact found for this booking.', 'fluent-booking')
514 ], 404);
515 }
516
517 return $state;
518 }
519
520 /**
521 * Guest-field prefill for the CRM "Book Appointment" action.
522 * Keyed by contact id, so it carries its own CRM-read gate.
523 */
524 public function getCrmContactPrefill(Request $request)
525 {
526 if (!CrmContactService::isActive()) {
527 return $this->sendError([
528 'message' => __('FluentCRM is not active.', 'fluent-booking')
529 ]);
530 }
531
532 if (!CrmPermissionManager::currentUserCan('fcrm_read_contacts')) {
533 return $this->sendError([
534 'message' => __('You do not have permission to read CRM contacts.', 'fluent-booking')
535 ], 403);
536 }
537
538 $contactId = absint($request->get('contact_id'));
539
540 if (!$contactId) {
541 return $this->sendError([
542 'message' => __('Invalid contact.', 'fluent-booking')
543 ], 422);
544 }
545
546 $prefill = CrmContactService::getBookingPrefillData($contactId);
547
548 if (!$prefill) {
549 return $this->sendError([
550 'message' => __('No CRM contact found.', 'fluent-booking')
551 ], 404);
552 }
553
554 return [
555 'prefill' => $prefill,
556 ];
557 }
558
559 /**
560 * Typeahead search for the admin booking modal's CRM contact picker.
561 * Same intersection gate as getCrmContactPrefill: booking access (policy) AND fcrm_read_contacts.
562 */
563 public function searchCrmContacts(Request $request)
564 {
565 if (!CrmContactService::isActive()) {
566 return $this->sendError([
567 'message' => __('FluentCRM is not active.', 'fluent-booking')
568 ]);
569 }
570
571 if (!CrmPermissionManager::currentUserCan('fcrm_read_contacts')) {
572 return $this->sendError([
573 'message' => __('You do not have permission to read CRM contacts.', 'fluent-booking')
574 ], 403);
575 }
576
577 $search = sanitize_text_field($request->get('search', ''));
578
579 return [
580 'contacts' => CrmContactService::searchContacts($search),
581 ];
582 }
583
584 /**
585 * Bounded, searchable tag/list options for the CRM Profile picker.
586 */
587 public function getCrmOptions(Request $request, $bookingId)
588 {
589 $this->resolveOwnedBookingOrFail($bookingId);
590
591 if (!CrmContactService::isActive()) {
592 return $this->sendError([
593 'message' => __('FluentCRM is not active.', 'fluent-booking')
594 ]);
595 }
596
597 $type = $request->get('type') === 'lists' ? 'lists' : 'tags';
598 $search = sanitize_text_field($request->get('search', ''));
599
600 return [
601 'options' => CrmContactService::getOptions($type, $search),
602 ];
603 }
604
605 public function updateCrmTags(Request $request, $bookingId)
606 {
607 return $this->updateCrmTaxonomy($request, $bookingId, 'tags');
608 }
609
610 public function updateCrmLists(Request $request, $bookingId)
611 {
612 return $this->updateCrmTaxonomy($request, $bookingId, 'lists');
613 }
614
615 private function updateCrmTaxonomy(Request $request, $bookingId, $type)
616 {
617 $booking = $this->resolveOwnedBookingOrFail($bookingId);
618
619 if (!CrmContactService::isActive()) {
620 return $this->sendError([
621 'message' => __('FluentCRM is not active.', 'fluent-booking')
622 ]);
623 }
624
625 $requestKey = $type === 'tags' ? 'tag_ids' : 'list_ids';
626 $desired = (array) $request->get($requestKey, []);
627
628 $result = CrmContactService::syncTaxonomy($booking->email, $type, $desired);
629
630 if ($result === null) {
631 return $this->sendError([
632 'message' => __('No CRM contact found for this booking.', 'fluent-booking')
633 ], 404);
634 }
635
636 return $this->sendSuccess(array_merge([
637 'message' => __('CRM contact updated successfully.', 'fluent-booking'),
638 ], $result));
639 }
640
641 private function resolveOwnedBookingOrFail($bookingId)
642 {
643 $booking = Booking::findOrFail($bookingId);
644
645 if (PermissionManager::userCanSeeAllBookings()) {
646 return $booking;
647 }
648
649 $allowedIds = $booking->getHostIds();
650
651 if (PermissionManager::userCan('manage_own_calendar')) {
652 if ($event = CalendarSlot::find($booking->event_id)) {
653 $allowedIds = array_merge($allowedIds, $event->getHostIds());
654 }
655 }
656
657 if (in_array(get_current_user_id(), $allowedIds)) {
658 return $booking;
659 }
660
661 $exception = new ModelNotFoundException();
662 $exception->setModel(Booking::class, [$bookingId]);
663 // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
664 throw $exception;
665 }
666
667 private function formatBooking(&$booking)
668 {
669 $autoCompleteTimeOut = (int) Helper::getGlobalAdminSetting('auto_complete_timing', 60) * 60; // 10 minutes
670
671 if (in_array($booking->status, ['scheduled', 'pending']) && (time() - strtotime($booking->end_time)) > $autoCompleteTimeOut) {
672 $bookingStatus = $booking->status == 'pending' ? 'cancelled' : 'completed';
673 $booking->status = $bookingStatus;
674 $booking->save();
675 $hookName = $bookingStatus === 'cancelled' ? 'auto_cancelled' : $bookingStatus;
676 do_action('fluent_booking/booking_schedule_' . $hookName, $booking, $booking->calendar_event);
677 }
678
679 if ($booking->isMultiHostBooking()) {
680 $booking->host_profiles = $booking->getHostProfiles();
681 }
682
683 if ($booking->isMultiGuestBooking()) {
684 $booking->booked_count = Booking::where('group_id', $booking->group_id)
685 ->whereIn('status', ['scheduled', 'completed'])->count();
686 } else {
687 $booking->additional_guests = $booking->getAdditionalGuests();
688 }
689
690 $booking->title = $booking->getBookingTitle(true);
691 $booking->author = $booking->getHostDetails(false);
692 $booking->details = $booking->getConfirmationData(true);
693 $booking->location = $booking->getLocationDetailsHtml();
694 $booking->reschedule_url = $booking->getRescheduleUrl();
695 $booking->happening_status = $booking->getOngoingStatus();
696 $booking->booking_status_text = $booking->getBookingStatus();
697 $booking->payment_status_text = $booking->getPaymentStatus();
698 $booking->custom_form_data = $booking->getCustomFormData();
699
700 do_action_ref_array('fluent_booking/format_booking_schedule', [&$booking]);
701
702 return $booking;
703 }
704
705 private function getConfirmedBy()
706 {
707 $confirmedBy = 'host';
708 $userId = get_current_user_id();
709 if ($userId && $user = get_user_by('ID', $userId)) {
710 $confirmedBy = $user->display_name;
711 }
712
713 return $confirmedBy;
714 }
715
716 private function getPaymentPaidLog($bookingId)
717 {
718 return [
719 'booking_id' => $bookingId,
720 'status' => 'closed',
721 'type' => 'success',
722 'title' => __('Payment Successfully Completed', 'fluent-booking'),
723 'description' => __('Payment marked as paid by ', 'fluent-booking') . $this->getConfirmedBy()
724 ];
725 }
726
727 private function getPaymentPendingLog($bookingId)
728 {
729 return [
730 'booking_id' => $bookingId,
731 'status' => 'closed',
732 'type' => 'success',
733 'title' => __('Payment Successfully Marked as Pending', 'fluent-booking'),
734 'description' => __('Payment marked as pending by ', 'fluent-booking') . $this->getConfirmedBy()
735 ];
736 }
737
738 private function getConfirmLog($bookingId)
739 {
740 return [
741 'booking_id' => $bookingId,
742 'status' => 'closed',
743 'type' => 'success',
744 'title' => __('Booking Confirmed', 'fluent-booking'),
745 'description' => __('Booking has been confirmed by ', 'fluent-booking') . $this->getConfirmedBy()
746 ];
747 }
748 }
749