PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.29
Booktics – Appointment Booking Calendar for Service Businesses v1.0.29
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 All 31 releases
booktics / core / module / stripe-addon / hook / stripe-hook.php

stripe-hook.php in Booktics – Appointment Booking Calendar for Service Businesses 1.0.29, at core/module/stripe-addon/hook/stripe-hook.php

66 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Booktics\Module\Stripe_Addon\Hook;
4
5 if ( ! defined( 'ABSPATH' ) ) exit;
6
7 use Booktics\Contracts\Hookable_Service_Contract;
8 use Booktics\Module\Stripe_Addon\Handler\Stripe_Handler;
9 use Booktics\Module\Stripe_Addon\Service\Stripe_Payment_Method;
10 use Booktics\Payment\Payment_Method_Manager;
11
12 /**
13 * Implements WordPress hooks for Stripe payment integration.
14 *
15 * This class handles registration of AJAX callbacks and filters
16 * for Stripe payment processing and settings management.
17 *
18 * @since 1.0.0
19 */
20 class Stripe_Hook implements Hookable_Service_Contract {
21
22 /**
23 * Register WordPress hooks for Stripe functionality.
24 *
25 * Registers AJAX callback for Stripe processing and filters
26 * for payment methods and settings.
27 *
28 * @return void
29 * @since 1.0.0
30 */
31 public function register() {
32 add_action( 'wp_ajax_booktics_stripe_callback', [
33 Stripe_Handler::class,
34 'handle_callback'
35 ] );
36
37 add_filter( 'booktics_payment_methods', function ( $methods ) {
38 $methods['stripe'] = Stripe_Payment_Method::class;
39
40 return $methods;
41 } );
42
43 add_filter( 'booktics_format_setting_response', [ $this, 'stripe_settings' ] );
44 }
45
46 /**
47 * Modifies settings array to include Stripe-specific settings.
48 *
49 * Adds Stripe installation status, connection URLs for test/live modes,
50 * and account ID to the settings array.
51 *
52 * @param array $settings Existing settings array.
53 *
54 * @return array Modified settings array with Stripe data.
55 * @since 1.0.0
56 */
57 public function stripe_settings( $settings ) {
58 $settings['stripe_addon_install_status'] = 1;
59 $stripe = ( new Payment_Method_Manager() )->get_payment_method( 'stripe' );
60 $settings['stripe_connect_test_url'] = $stripe::connect_account( 'test' );
61 $settings['stripe_connect_live_url'] = $stripe::connect_account( 'live' );
62 $settings['stripe_account_id'] = $stripe::account_id();
63
64 return $settings;
65 }
66 }