mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
✨ New REST endpoint to disconnect merchant
This commit is contained in:
parent
e4a6213f20
commit
e5023b5007
1 changed files with 20 additions and 0 deletions
|
@ -123,6 +123,15 @@ class AuthenticationRestEndpoint extends RestEndpoint {
|
|||
),
|
||||
)
|
||||
);
|
||||
register_rest_route(
|
||||
$this->namespace,
|
||||
'/' . $this->rest_base . '/disconnect',
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'disconnect' ),
|
||||
'permission_callback' => array( $this, 'check_permission' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -176,4 +185,15 @@ class AuthenticationRestEndpoint extends RestEndpoint {
|
|||
|
||||
return $this->return_success( $response );
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect the merchant and clear the authentication details.
|
||||
*
|
||||
* @return WP_REST_Response
|
||||
*/
|
||||
public function disconnect() : WP_REST_Response {
|
||||
$this->authentication_manager->disconnect();
|
||||
|
||||
return $this->return_success( 'OK' );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue