Skip to content

[MIT-3381] Add authentication to Paynow status endpoint#530

Merged
rosle merged 7 commits intodevelopfrom
feature/MIT-3381-add-authentication-to-paynow-endpoint
Jul 1, 2025
Merged

[MIT-3381] Add authentication to Paynow status endpoint#530
rosle merged 7 commits intodevelopfrom
feature/MIT-3381-add-authentication-to-paynow-endpoint

Conversation

@rosle
Copy link
Copy Markdown
Contributor

@rosle rosle commented Jun 20, 2025

Description

Add authentication to endpoint for checking order status.

  • Rename endpoint from paynow-payment-status to order-status to be more generic
  • Generate WP nonce and verify the request

Related links:

Rollback procedure

default rollback procedure

@rosle rosle force-pushed the feature/MIT-3381-add-authentication-to-paynow-endpoint branch from b63a4fa to 69c0e48 Compare June 23, 2025 06:35
@rosle rosle marked this pull request as ready for review June 27, 2025 09:45
@rosle rosle requested a review from Copilot June 27, 2025 10:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds nonce-based authentication to the order status endpoint, renames it from paynow-payment-status to a more generic order-status, and updates Paynow display logic and tests accordingly.

  • Renamed and secured the REST route in Omise_Rest_Webhooks_Controller with nonce verification.
  • Updated the Paynow QR code display to include two nonces in its polling URL and adjusted its JavaScript polling logic.
  • Expanded and adjusted unit tests and bootstrap setup to cover the new endpoint and authentication behavior.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
includes/class-omise-rest-webhooks-controller.php Renamed endpoint constant, replaced old callback, added nonce checks and error responses.
includes/gateway/class-omise-payment-paynow.php Inserted nonce query parameters, updated JS polling URL and variable names.
includes/gateway/abstract-omise-payment-offline.php Added an empty constructor that only calls the parent.
assets/css/omise-css.css Adjusted green-check SVG sizing and positioning.
phpcs.xml Added exclusions for additional commenting and security sniffs.
tests/unit/includes/class-omise-rest-webhooks-controller-test.php New tests for registering and handling the authenticated order-status route.
tests/unit/includes/gateway/bootstrap-test-setup.php Introduced stubs for WP_Error and WP_REST_Server, updated mockOmiseSetting.
tests/unit/includes/gateway/class-omise-payment-test.php Removed redundant mockOmiseSetting override.
tests/unit/includes/gateway/class-omise-payment-paynow-test.php Added comprehensive Paynow display and email QR code tests.
Comments suppressed due to low confidence (2)

assets/css/omise-css.css:126

  • [nitpick] The green-check icon height was reduced from 150px to 50px; verify this change matches design requirements to prevent unintended UI issues.
	height: 50px;

phpcs.xml:41

  • [nitpick] Excluding sanitization sniffs may hide missing input validation. Ensure inputs are validated and sanitized elsewhere if you disable these rules.
  <rule ref="WordPress.Security.ValidatedSanitizedInput.InputNotSanitized">

Comment thread includes/gateway/class-omise-payment-paynow.php Outdated
Comment thread includes/gateway/class-omise-payment-paynow.php
Comment thread includes/gateway/class-omise-payment-paynow.php
Comment thread includes/gateway/abstract-omise-payment-offline.php
@rosle rosle merged commit bd41350 into develop Jul 1, 2025
3 checks passed
@rosle rosle deleted the feature/MIT-3381-add-authentication-to-paynow-endpoint branch July 1, 2025 07:51
@rosle rosle mentioned this pull request Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants