From 30ab1bd51f5e1aadf081b009efcbc3a9cc086cd5 Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Mon, 13 Jan 2025 14:11:24 +0100
Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Consolidate=20authenticati?=
=?UTF-8?q?on=20name:=20OAuth,=20not=20ISU?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../resources/js/data/common/constants.js | 5 +++--
.../resources/js/data/common/controls.js | 4 ++--
.../src/Endpoint/AuthenticationRestEndpoint.php | 12 ++++++------
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/modules/ppcp-settings/resources/js/data/common/constants.js b/modules/ppcp-settings/resources/js/data/common/constants.js
index 6101ed31a..9faa698e5 100644
--- a/modules/ppcp-settings/resources/js/data/common/constants.js
+++ b/modules/ppcp-settings/resources/js/data/common/constants.js
@@ -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.
diff --git a/modules/ppcp-settings/resources/js/data/common/controls.js b/modules/ppcp-settings/resources/js/data/common/controls.js
index 62d4a8f84..dc2f04710 100644
--- a/modules/ppcp-settings/resources/js/data/common/controls.js
+++ b/modules/ppcp-settings/resources/js/data/common/controls.js
@@ -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,
diff --git a/modules/ppcp-settings/src/Endpoint/AuthenticationRestEndpoint.php b/modules/ppcp-settings/src/Endpoint/AuthenticationRestEndpoint.php
index 5ffd48baa..7ac964b2d 100644
--- a/modules/ppcp-settings/src/Endpoint/AuthenticationRestEndpoint.php
+++ b/modules/ppcp-settings/src/Endpoint/AuthenticationRestEndpoint.php
@@ -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' );