Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
*** WooPayments Changelog ***

= 9.2.1 - 2025-04-23 =
* Update - Update account session creation route definition to use POST rather than GET.

= 9.2.0 - 2025-04-09 =
* Add - Add back button for tertiary+ level pages in WooPayments settings.
* Fix - fix: cancel GooglePay/ApplePay dialog on product page if add-to-cart product validation fails
Expand Down
8 changes: 5 additions & 3 deletions client/embedded-components/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ export const createKycAccountSession = async (
isPoEligible: boolean
): Promise< AccountSession > => {
const urlParams = new URLSearchParams( window.location.search );

return await apiFetch< AccountSession >( {
path: addQueryArgs( `${ NAMESPACE }/onboarding/kyc/session`, {
path: `${ NAMESPACE }/onboarding/kyc/session`,
method: 'POST',
data: {
self_assessment: fromDotNotation( data ),
capabilities: urlParams.get( 'capabilities' ) || '',
progressive: isPoEligible,
} ),
method: 'GET',
},
} );
};
14 changes: 4 additions & 10 deletions includes/admin/class-wc-rest-payments-onboarding-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public function register_routes() {
$this->namespace,
'/' . $this->rest_base . '/kyc/session',
[
'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_embedded_kyc_session' ],
'methods' => WP_REST_Server::CREATABLE,
'callback' => [ $this, 'create_embedded_kyc_session' ],
'permission_callback' => [ $this, 'check_permission' ],
'args' => [
'progressive' => [
Expand All @@ -71,32 +71,26 @@ public function register_routes() {
'country' => [
'type' => 'string',
'description' => 'The country code where the company is legally registered.',
'required' => true,
],
'business_type' => [
'type' => 'string',
'description' => 'The company incorporation type.',
'required' => true,
],
'mcc' => [
'type' => 'string',
'description' => 'The merchant category code. This can either be a true MCC or an MCCs tree item id from the onboarding form.',
'required' => true,
],
'annual_revenue' => [
'type' => 'string',
'description' => 'The estimated annual revenue bucket id.',
'required' => true,
],
'go_live_timeframe' => [
'type' => 'string',
'description' => 'The timeframe bucket for the estimated first live transaction.',
'required' => true,
],
'site' => [
'type' => 'string',
'description' => 'The URL of the site.',
'required' => true,
],
],
],
Expand Down Expand Up @@ -226,9 +220,9 @@ public function register_routes() {
*
* @param WP_REST_Request $request Request object.
*
* @return WP_Error|WP_REST_Response
* @return WP_Error|WP_REST_Response Response object containing the account session, or an error if session creation failed.
*/
public function get_embedded_kyc_session( WP_REST_Request $request ) {
public function create_embedded_kyc_session( WP_REST_Request $request ) {
$self_assessment_data = ! empty( $request->get_param( 'self_assessment' ) ) ? wc_clean( wp_unslash( $request->get_param( 'self_assessment' ) ) ) : [];
$progressive = ! empty( $request->get_param( 'progressive' ) ) && filter_var( $request->get_param( 'progressive' ), FILTER_VALIDATE_BOOLEAN );

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "woocommerce-payments",
"version": "9.2.0",
"version": "9.2.1",
"main": "webpack.config.js",
"author": "Automattic",
"license": "GPL-3.0-or-later",
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: woocommerce payments, apple pay, credit card, google pay, payment, payment
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.3
Stable tag: 9.2.0
Stable tag: 9.2.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -87,6 +87,10 @@ You can read our Terms of Service and other policies [here](https://woocommerce.

== Changelog ==

= 9.2.1 - 2025-04-23 =
* Update - Update account session creation route definition to use POST rather than GET.


= 9.2.0 - 2025-04-09 =
* Add - Add back button for tertiary+ level pages in WooPayments settings.
* Fix - fix: cancel GooglePay/ApplePay dialog on product page if add-to-cart product validation fails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function test_get_progressive_onboarding_not_eligible() {
);
}

public function test_get_embedded_kyc_session() {
public function test_create_embedded_kyc_session() {
$kyc_session = [
'clientSecret' => 'accs_secret__XXX',
'expiresAt' => time() + 120,
Expand All @@ -158,15 +158,15 @@ public function test_get_embedded_kyc_session() {
$kyc_session
);

$request = new WP_REST_Request( 'GET' );
$request->set_query_params(
$request = new WP_REST_Request( 'POST' );
$request->set_body_params(
[
'progressive' => true,
'create_live_account' => true,
]
);

$response = $this->controller->get_embedded_kyc_session( $request );
$response = $this->controller->create_embedded_kyc_session( $request );
$this->assertSame( 200, $response->status );
$this->assertSame(
array_merge(
Expand Down
2 changes: 1 addition & 1 deletion woocommerce-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* WC tested up to: 9.7.1
* Requires at least: 6.0
* Requires PHP: 7.3
* Version: 9.2.0
* Version: 9.2.1
* Requires Plugins: woocommerce
*
* @package WooCommerce\Payments
Expand Down
Loading