| @@ -6,10 +6,8 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace Timetics\Core\Integrations\Woocommerce; |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; | |
| 11 | - | |
| 12 | 10 | use Timetics\Base\Api; |
| 13 | 11 | use Timetics\Core\Appointments\Appointment; |
| 14 | 12 | use Timetics\Utils\Singleton; |
| 15 | 13 | |
| @@ -67,38 +65,10 @@ | ||
| 67 | 65 | public function set_up_woocommerce( $requst ) { |
| 68 | 66 | $data = json_decode( $requst->get_body(), true ); |
| 69 | 67 | |
| 70 | 68 | $booking_id = ! empty( $data['booking_id'] ) ? intval( $data['booking_id'] ) : 0; |
| 71 | - $token = ! empty( $data['security_token'] ) ? sanitize_text_field( $data['security_token'] ) : ''; | |
| 72 | - | |
| 73 | - $booking = new \Timetics\Core\Bookings\Booking( $booking_id ); | |
| 74 | - // everything from the booking record itself once ownership is proven. | |
| 75 | - if ( ! $booking_id || '' === $token || ! $booking->is_booking() ) { | |
| 76 | - return new \WP_HTTP_Response( | |
| 77 | - [ | |
| 78 | - 'success' => 0, | |
| 79 | - 'status_code' => 404, | |
| 80 | - 'message' => __( 'Invalid booking.', 'timetics' ), | |
| 81 | - ], | |
| 82 | - 404 | |
| 83 | - ); | |
| 84 | - } | |
| 85 | - | |
| 86 | - $stored = (string) $booking->get_security_token(); | |
| 87 | - | |
| 88 | - if ( '' === $stored || ! hash_equals( $stored, $token ) ) { | |
| 89 | - return new \WP_HTTP_Response( | |
| 90 | - [ | |
| 91 | - 'success' => 0, | |
| 92 | - 'status_code' => 403, | |
| 93 | - 'message' => __( 'Invalid booking token.', 'timetics' ), | |
| 94 | - ], | |
| 95 | - 403 | |
| 96 | - ); | |
| 97 | - } | |
| 98 | - | |
| 99 | - $meeting_id = (int) $booking->get_appointment(); | |
| 100 | - $price = (int) $booking->get_total(); | |
| 69 | + $meeting_id = ! empty( $data['meeting_id'] ) ? intval( $data['meeting_id'] ) : 0; | |
| 70 | + $price = ! empty( $data['price'] ) ? intval( $data['price'] ) : 0; | |
| 101 | 71 | |
| 102 | 72 | // Set session for timetics data for woocommerce. |
| 103 | 73 | WC()->session->set( 'timetics_data', [ |
| 104 | 74 | 'booking_id' => $booking_id, |