♻️ Consolidate authentication name: OAuth, not ISU

This commit is contained in:
Philipp Stracker 2025-01-13 14:11:24 +01:00
parent ec029dd4c5
commit 30ab1bd51f
No known key found for this signature in database
3 changed files with 11 additions and 10 deletions

View file

@ -46,14 +46,15 @@ export const REST_DIRECT_AUTHENTICATION_PATH =
'/wc/v3/wc_paypal/authenticate/direct';
/**
* REST path to perform the ISU authentication check, using shared ID and authCode.
* REST path to perform the OAuth authentication check, using shared ID and authCode.
*
* Used by: Controls
* See: AuthenticateRestEndpoint.php
*
* @type {string}
*/
export const REST_ISU_AUTHENTICATION_PATH = '/wc/v3/wc_paypal/authenticate/isu';
export const REST_OAUTH_AUTHENTICATION_PATH =
'/wc/v3/wc_paypal/authenticate/oauth';
/**
* REST path to generate an ISU URL for the PayPal-login.

View file

@ -15,7 +15,7 @@ import {
REST_CONNECTION_URL_PATH,
REST_HYDRATE_MERCHANT_PATH,
REST_REFRESH_FEATURES_PATH,
REST_ISU_AUTHENTICATION_PATH,
REST_OAUTH_AUTHENTICATION_PATH,
REST_WEBHOOKS,
REST_WEBHOOKS_SIMULATE,
} from './constants';
@ -82,7 +82,7 @@ export const controls = {
} ) {
try {
return await apiFetch( {
path: REST_ISU_AUTHENTICATION_PATH,
path: REST_OAUTH_AUTHENTICATION_PATH,
method: 'POST',
data: {
sharedId,

View file

@ -106,7 +106,7 @@ class AuthenticationRestEndpoint extends RestEndpoint {
);
/**
* POST /wp-json/wc/v3/wc_paypal/authenticate/isu
* POST /wp-json/wc/v3/wc_paypal/authenticate/oauth
* {
* sharedId
* authCode
@ -115,10 +115,10 @@ class AuthenticationRestEndpoint extends RestEndpoint {
*/
register_rest_route(
$this->namespace,
'/' . $this->rest_base . '/isu',
'/' . $this->rest_base . '/oauth',
array(
'methods' => WP_REST_Server::EDITABLE,
'callback' => array( $this, 'connect_isu' ),
'callback' => array( $this, 'connect_oauth' ),
'permission_callback' => array( $this, 'check_permission' ),
'args' => array(
'sharedId' => array(
@ -181,14 +181,14 @@ class AuthenticationRestEndpoint extends RestEndpoint {
}
/**
* ISU login: Retrieves clientId and clientSecret using a sharedId and authCode.
* OAuth login: Retrieves clientId and clientSecret using a sharedId and authCode.
*
* This is the final step in the UI-driven login via the ISU popup, which
* This is the final step in the UI-driven login via the OAuth popup, which
* is triggered by the LoginLinkRestEndpoint URL.
*
* @param WP_REST_Request $request Full data about the request.
*/
public function connect_isu( WP_REST_Request $request ) : WP_REST_Response {
public function connect_oauth( WP_REST_Request $request ) : WP_REST_Response {
$shared_id = $request->get_param( 'sharedId' );
$auth_code = $request->get_param( 'authCode' );
$use_sandbox = $request->get_param( 'useSandbox' );