abstract-booking-ability.php
1 week ago
approve-booking.php
4 months ago
cancel-booking.php
4 months ago
change-booking-status.php
1 week ago
create-booking.php
4 months ago
delete-booking.php
1 week ago
get-booking-stats.php
1 week ago
get-booking-statuses.php
4 months ago
get-booking.php
1 week ago
get-bookings-for-date.php
4 months ago
get-bookings-per-day.php
1 week ago
get-upcoming-bookings.php
4 months ago
list-bookings.php
4 months ago
reschedule-booking.php
1 week ago
update-booking.php
1 week ago
approve-booking.php
43 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | exit; } |
| 4 | |
| 5 | class LatePointAbilityApproveBooking extends LatePointAbstractBookingAbility { |
| 6 | |
| 7 | protected function configure(): void { |
| 8 | $this->id = 'latepoint/approve-booking'; |
| 9 | $this->label = __( 'Approve booking', 'latepoint' ); |
| 10 | $this->description = __( 'Approves a pending booking by setting its status to approved. May trigger confirmation notifications to the customer.', 'latepoint' ); |
| 11 | $this->permission = 'booking__edit'; |
| 12 | $this->read_only = false; |
| 13 | $this->destructive = false; |
| 14 | $this->idempotent = true; |
| 15 | } |
| 16 | |
| 17 | public function get_input_schema(): array { |
| 18 | return [ |
| 19 | 'type' => 'object', |
| 20 | 'properties' => [ |
| 21 | 'id' => [ |
| 22 | 'type' => 'integer', |
| 23 | 'description' => __( 'Booking ID.', 'latepoint' ), |
| 24 | ], |
| 25 | ], |
| 26 | 'required' => [ 'id' ], |
| 27 | ]; |
| 28 | } |
| 29 | |
| 30 | public function get_output_schema(): array { |
| 31 | return $this->booking_output_schema(); |
| 32 | } |
| 33 | |
| 34 | public function execute( array $args ) { |
| 35 | return ( new LatePointAbilityChangeBookingStatus() )->execute( |
| 36 | [ |
| 37 | 'id' => $args['id'], |
| 38 | 'status' => LATEPOINT_BOOKING_STATUS_APPROVED, |
| 39 | ] |
| 40 | ); |
| 41 | } |
| 42 | } |
| 43 |