Skip to content

t523e: Log PayPal-Debug-Id response header from API calls#732

Merged
superdav42 merged 1 commit intomainfrom
bugfix/731-paypal-debug-id
Apr 1, 2026
Merged

t523e: Log PayPal-Debug-Id response header from API calls#732
superdav42 merged 1 commit intomainfrom
bugfix/731-paypal-debug-id

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

Summary

Captures the PayPal-Debug-Id response header from every PayPal REST API call and logs it to the PayPal log channel. PayPal support requires this header value when investigating API issues.

Changes

  • inc/gateways/class-paypal-rest-gateway.php — In api_request():
    • Extract PayPal-Debug-Id via wp_remote_retrieve_header() after every successful HTTP response
    • Log it at info level: PayPal-Debug-Id: <value>
    • Include it in error log messages: API Error (400): ... [Debug-Id: <value>]
    • Expose it in the WP_Error data array under debug_id key for callers

Acceptance Criteria

  • PayPal-Debug-Id extracted from every API response via wp_remote_retrieve_header()
  • Debug ID logged alongside existing API response logging

Runtime Testing

Risk level: Low — logging-only change, no business logic altered.
Verification: self-assessed — the change adds a wp_remote_retrieve_header() call (standard WP function) and two $this->log() calls. No conditional logic, no data mutation, no side effects beyond logging.

Files Changed

  • inc/gateways/class-paypal-rest-gateway.php (+10, -3)

Closes #731
Part of #725


aidevops.sh v3.5.556 plugin for OpenCode v1.3.0 with claude-sonnet-4-6 spent 10m on this as a headless worker.

@superdav42
Copy link
Copy Markdown
Collaborator Author

Completion Summary

  • What: Added PayPal-Debug-Id response header capture and logging in api_request() method
  • Issue: t523e: Log PayPal-Debug-Id response header from API calls #731
  • Files changed: inc/gateways/class-paypal-rest-gateway.php
  • Testing: self-assessed — logging-only change using standard WP wp_remote_retrieve_header() function; no business logic altered
  • Key decisions: Debug ID logged at info level on success, included in error log message on failure, and exposed in WP_Error data array for callers

This summary was written by the worker at PR creation time for the deterministic merge pass.

@superdav42
Copy link
Copy Markdown
Collaborator Author

PR is CONFLICTING with main (likely due to PR #733 merging changes to the same PayPal gateway files). Worker should rebase and resolve conflicts.

PayPal support requires the PayPal-Debug-Id header from API responses
for debugging. Extract it via wp_remote_retrieve_header() after every
REST API call and log it alongside the existing request logging.

Also include the debug ID in error log messages and expose it in the
WP_Error data array so callers can surface it if needed.

Closes #731
Part of #725
@superdav42 superdav42 force-pushed the bugfix/731-paypal-debug-id branch from 23988a7 to 5cd6708 Compare April 1, 2026 17:53
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Warning

Rate limit exceeded

@superdav42 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 43 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 12 minutes and 43 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 21a035bd-1724-4fca-af38-510e8e2b7706

📥 Commits

Reviewing files that changed from the base of the PR and between 3758247 and 5cd6708.

📒 Files selected for processing (1)
  • inc/gateways/class-paypal-rest-gateway.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/731-paypal-debug-id

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@superdav42 superdav42 merged commit 7abeac2 into main Apr 1, 2026
5 of 7 checks passed
@superdav42
Copy link
Copy Markdown
Collaborator Author

Closing Summary

What was done:

  • Added PayPal-Debug-Id response header capture in api_request() via wp_remote_retrieve_header()
  • Logged at info level with method+endpoint context: PayPal-Debug-Id: <id> [POST /v2/checkout/orders]
  • Included in error log messages: API Error (400): ... [Debug-Id: <id>]
  • Exposed in WP_Error data array under debug_id key for callers

Testing Evidence: self-assessed — logging-only change using standard WP function. No business logic altered, no conditional paths changed.

Key decisions:

  • Resolved rebase conflict by using HEAD version's log format (includes method+endpoint context) which is more informative
  • Kept debug_id in WP_Error data array so callers can surface it if needed

Files changed: inc/gateways/class-paypal-rest-gateway.php (+4, -3 net after rebase)

Blockers: None

Follow-up: None required

Closes #731


aidevops.sh v3.5.556 plugin for OpenCode v1.3.0 with claude-sonnet-4-6 spent 15m on this as a headless worker.

@superdav42 superdav42 deleted the bugfix/731-paypal-debug-id branch April 1, 2026 17:55
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Performance Test Results

Performance test results for 9311c2b are in 🛎️!

Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown.

URL: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 40 (-1 / -3% ) 37.77 MB 901.00 ms (+45.50 ms / +5% ) 167.50 ms (+15.00 ms / +9% ) 1082.50 ms (+36.00 ms / +3% ) 2024.00 ms (+56.00 ms / +3% ) 1937.95 ms (+62.90 ms / +3% ) 89.70 ms (-1.95 ms / -2% )
1 56 49.02 MB 935.00 ms (+46.00 ms / +5% ) 146.50 ms 1084.50 ms (+48.50 ms / +4% ) 2076.00 ms (+80.00 ms / +4% ) 1997.90 ms (+93.80 ms / +5% ) 81.70 ms (-2.45 ms / -3% )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

t523e: Log PayPal-Debug-Id response header from API calls

1 participant