| @@ -172,22 +172,8 @@ | ||
| 172 | 172 | 'permission_callback' => [ $this, 'check_permissions' ], |
| 173 | 173 | ], |
| 174 | 174 | ], |
| 175 | 175 | |
| 176 | - // Privacy settings (data retention, consent, privacy/terms fields). | |
| 177 | - '/settings/privacy' => [ | |
| 178 | - [ | |
| 179 | - 'methods' => WP_REST_Server::READABLE, | |
| 180 | - 'callback' => [ $this, 'get_privacy_settings' ], | |
| 181 | - 'permission_callback' => [ $this, 'check_permissions' ], | |
| 182 | - ], | |
| 183 | - [ | |
| 184 | - 'methods' => WP_REST_Server::EDITABLE, | |
| 185 | - 'callback' => [ $this, 'update_privacy_settings' ], | |
| 186 | - 'permission_callback' => [ $this, 'check_permissions' ], | |
| 187 | - ], | |
| 188 | - ], | |
| 189 | - | |
| 190 | 176 | // Send test email. |
| 191 | 177 | '/settings/email/test' => [ |
| 192 | 178 | 'methods' => WP_REST_Server::CREATABLE, |
| 193 | 179 | 'callback' => [ $this, 'send_test_email' ], |
| @@ -196,49 +182,8 @@ | ||
| 196 | 182 | ]; |
| 197 | 183 | } |
| 198 | 184 | |
| 199 | 185 | /** |
| 200 | - * Get the Privacy settings (stored values merged over the defaults). | |
| 201 | - * | |
| 202 | - * @param WP_REST_Request $request Request object. | |
| 203 | - * @return WP_REST_Response | |
| 204 | - * @since 1.2.0 | |
| 205 | - */ | |
| 206 | - public function get_privacy_settings( $request ) { | |
| 207 | - unset( $request ); // Unused parameter. | |
| 208 | - | |
| 209 | - return new WP_REST_Response( | |
| 210 | - [ | |
| 211 | - 'success' => true, | |
| 212 | - 'settings' => \SureDonation\Inc\Privacy\Privacy_Settings::get_settings(), | |
| 213 | - ], | |
| 214 | - 200 | |
| 215 | - ); | |
| 216 | - } | |
| 217 | - | |
| 218 | - /** | |
| 219 | - * Update the Privacy settings. | |
| 220 | - * | |
| 221 | - * @param WP_REST_Request $request Request object. | |
| 222 | - * @return WP_REST_Response | |
| 223 | - * @since 1.2.0 | |
| 224 | - */ | |
| 225 | - public function update_privacy_settings( $request ) { | |
| 226 | - $params = $request->get_json_params(); | |
| 227 | - $sanitized = \SureDonation\Inc\Privacy\Privacy_Settings::sanitize( is_array( $params ) ? $params : [] ); | |
| 228 | - | |
| 229 | - Helper::update_suredonation_option( \SureDonation\Inc\Privacy\Privacy_Settings::OPTION_KEY, $sanitized ); | |
| 230 | - | |
| 231 | - return new WP_REST_Response( | |
| 232 | - [ | |
| 233 | - 'success' => true, | |
| 234 | - 'settings' => $sanitized, | |
| 235 | - ], | |
| 236 | - 200 | |
| 237 | - ); | |
| 238 | - } | |
| 239 | - | |
| 240 | - /** | |
| 241 | 186 | * Get the form-validation default messages. |
| 242 | 187 | * |
| 243 | 188 | * Returns the stored admin overrides merged over the translatable defaults |
| 244 | 189 | * so every configurable message always has a value in the editor. |
| @@ -354,11 +299,10 @@ | ||
| 354 | 299 | return new WP_REST_Response( |
| 355 | 300 | [ |
| 356 | 301 | 'success' => true, |
| 357 | 302 | 'settings' => [ |
| 358 | - 'currency' => $settings['currency'] ?? 'USD', | |
| 359 | - 'payment_mode' => $settings['payment_mode'] ?? 'test', | |
| 360 | - 'currency_sign_position' => Payment_Helper::get_currency_sign_position(), | |
| 303 | + 'currency' => $settings['currency'] ?? 'USD', | |
| 304 | + 'payment_mode' => $settings['payment_mode'] ?? 'test', | |
| 361 | 305 | ], |
| 362 | 306 | ], |
| 363 | 307 | 200 |
| 364 | 308 | ); |
| @@ -399,16 +343,8 @@ | ||
| 399 | 343 | if ( isset( $params['payment_mode'] ) ) { |
| 400 | 344 | $mode = sanitize_text_field( $params['payment_mode'] ); |
| 401 | 345 | if ( in_array( $mode, [ 'test', 'live' ], true ) ) { |
| 402 | 346 | $current_settings['payment_mode'] = $mode; |
| 403 | - } | |
| 404 | - } | |
| 405 | - | |
| 406 | - // Update currency sign position if provided. | |
| 407 | - if ( isset( $params['currency_sign_position'] ) ) { | |
| 408 | - $position = sanitize_text_field( $params['currency_sign_position'] ); | |
| 409 | - if ( in_array( $position, Payment_Helper::ALLOWED_SIGN_POSITIONS, true ) ) { | |
| 410 | - $current_settings['currency_sign_position'] = $position; | |
| 411 | 347 | } |
| 412 | 348 | } |
| 413 | 349 | |
| 414 | 350 | $success = Payment_Helper::update_all_payment_settings( $current_settings ); |