PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.27
Booktics – Appointment Booking Calendar for Service Businesses v1.0.27
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
← All changes | core/module/stripe-addon/handler/stripe_handler.php +5 -15 1.0.3 → 1.0.27 View file →
@@ -22,14 +22,9 @@
22 22 *
23 23 * @return string The Stripe secret key
24 24 */
25 25 public static function get_stripe_secret_key() {
26 - $response = wp_remote_get( STRIPE_CONNECT_DOMAIN . '/wp-json/stripe/secret-key?type=' . Stripe_Payment_Method::account_type() );
27 - if ( is_wp_error( $response ) ) {
28 - return '';
29 - }
30 -
31 - return json_decode( wp_remote_retrieve_body( $response ) );
26 + return booktics_get_option('stripe_secret_key', '');
32 27 }
33 28
34 29 /**
35 30 * Get the Stripe Publishable key.
@@ -36,14 +31,9 @@
36 31 *
37 32 * @return string The Stripe publishable key
38 33 */
39 34 public static function get_stripe_publishable_key() {
40 - $response = wp_remote_get( STRIPE_CONNECT_DOMAIN . '/wp-json/stripe/publishable-key?type=' . Stripe_Payment_Method::account_type() );
41 - if ( is_wp_error( $response ) ) {
42 - return '';
43 - }
44 -
45 - return json_decode( wp_remote_retrieve_body( $response ) );
35 + return booktics_get_option('stripe_publishable_key', '');
46 36 }
47 37
48 38 /**
49 39 * Handle the OAuth callback from Stripe.
@@ -52,9 +42,9 @@
52 42 *
53 43 * @return \WP_REST_Response The response object
54 44 */
55 45 public static function handle_callback( $request ) {
56 - if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), 'booktics_stripe_callback' ) ) {
46 + if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), 'booktics_stripe_callback' ) ) {
57 47 return rest_ensure_response( [
58 48 'status' => 'error',
59 49 'message' => __( 'Invalid security token', 'booktics' )
60 50 ] );
@@ -73,9 +63,9 @@
73 63 if ( ! empty( $account_id ) ) {
74 64 Settings::update( 'stripe_account_id', $account_id );
75 65 Settings::update( 'stripe_account_type', $type );
76 66
77 - wp_redirect( admin_url( 'admin.php?page=booktics#/settings?tab=payment' ) );
67 + wp_safe_redirect( admin_url( 'admin.php?page=booktics#/settings?tab=payment' ) );
78 68 exit;
79 69 }
80 70
81 71 return rest_ensure_response( [
@@ -89,7 +79,7 @@
89 79 *
90 80 * @return string The authorization URL
91 81 */
92 82 public function get_connect_url( $type = 'test' ) {
93 - return STRIPE_CONNECT_DOMAIN . '/stripe/connect?type=' . $type . '&redirect_uri=' . base64_encode( $this->get_redirect_uri( $type ) );
83 + return BOOKTICS_STRIPE_CONNECT_DOMAIN . '/stripe/connect?type=' . $type . '&redirect_uri=' . base64_encode( $this->get_redirect_uri( $type ) );
94 84 }
95 85 }