Skip to content

Commit 134f866

Browse files
committed
refactor: clean up Apple Pay domain registration debug logging
Removed excessive debug statements while keeping essential logging: - Success: logs domain that was registered - Error: logs domain and error message Verified working with logs: - Domain registration triggers automatically on settings save - Successfully registered: pseudoangularly-unquitted-trudie.ngrok-free.dev - User-facing success message shows in admin
1 parent 362a39c commit 134f866

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/Services/MoneiApplePayVerificationService.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,40 +30,30 @@ public function __construct( MoneiPaymentServices $moneiPaymentServices ) {
3030
* Automatically registers domain with Apple Pay when gateway is enabled.
3131
*/
3232
public function apple_domain_register() {
33-
WC_Monei_Logger::log( 'Apple domain registration hook triggered', 'debug' );
34-
3533
if ( ! check_admin_referer( 'woocommerce-settings' ) ) {
36-
WC_Monei_Logger::log( 'Apple domain registration: nonce verification failed', 'debug' );
3734
return;
3835
}
3936

4037
// Check if Apple/Google Pay is enabled
4138
if ( ! isset( $_POST['woocommerce_monei_apple_google_enabled'] ) ) {
42-
WC_Monei_Logger::log( 'Apple domain registration: enabled field not set', 'debug' );
4339
return;
4440
}
4541
//phpcs:ignore WordPress.Security.NonceVerification, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
4642
$enabled_value = wc_clean( wp_unslash( $_POST['woocommerce_monei_apple_google_enabled'] ) );
47-
WC_Monei_Logger::log( 'Apple domain registration: enabled value = ' . $enabled_value, 'debug' );
4843

4944
if ( 'yes' !== $enabled_value && '1' !== $enabled_value ) {
50-
WC_Monei_Logger::log( 'Apple domain registration: gateway not enabled', 'debug' );
5145
return;
5246
}
5347

5448
try {
5549
$domain = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( $_SERVER['HTTP_HOST'] ) : str_replace( array( 'https://', 'http://' ), '', get_site_url() ); // @codingStandardsIgnoreLine
5650

57-
WC_Monei_Logger::log( 'Attempting to register Apple Pay domain: ' . $domain, 'info' );
58-
59-
$result = $this->moneiPaymentServices->register_apple_domain( $domain );
51+
$this->moneiPaymentServices->register_apple_domain( $domain );
6052

61-
WC_Monei_Logger::log( 'Apple Pay domain registration successful for: ' . $domain, 'info' );
62-
WC_Monei_Logger::log( 'Registration result: ' . wp_json_encode( $result ), 'debug' );
53+
WC_Monei_Logger::log( 'Apple Pay domain registered successfully: ' . $domain, 'info' );
6354
\WC_Admin_Settings::add_message( __( 'Apple Pay domain registered successfully.', 'monei' ) );
6455
} catch ( ApiException $e ) {
65-
WC_Monei_Logger::log( 'Apple Pay domain registration failed: ' . $e->getMessage(), 'error' );
66-
WC_Monei_Logger::log( 'Exception response body: ' . $e->getResponseBody(), 'error' );
56+
WC_Monei_Logger::log( 'Apple Pay domain registration failed for ' . $domain . ': ' . $e->getMessage(), 'error' );
6757
$response_body = json_decode( $e->getResponseBody() );
6858
if ( $response_body && isset( $response_body->message ) ) {
6959
\WC_Admin_Settings::add_error( __( 'Apple Pay', 'monei' ) . ': ' . $response_body->message );

0 commit comments

Comments
 (0)