Skip to content

Commit

Permalink
add capabilities rawurlencode and pass it to the MOX
Browse files Browse the repository at this point in the history
  • Loading branch information
oaratovskyi committed Dec 15, 2024
1 parent 0593629 commit 1ac712d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions client/onboarding/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ export const createAccountSession = async (
data: OnboardingFields,
isPoEligible: boolean
): Promise< AccountKycSession > => {
const urlParams = new URLSearchParams( window.location.search );
return await apiFetch< AccountKycSession >( {
path: addQueryArgs( `${ NAMESPACE }/onboarding/kyc/session`, {
self_assessment: fromDotNotation( data ),
capabilities: urlParams.get( 'capabilities' ) || '',
progressive: isPoEligible,
} ),
method: 'GET',
Expand Down
7 changes: 4 additions & 3 deletions includes/class-wc-payments-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ public function maybe_handle_onboarding() {
// These are starting capabilities for the account.
// They are collected by the payment method step of the
// WC Payments settings page native onboarding experience.
'capabilities' => wp_json_encode( $this->onboarding_service->get_capabilities_from_request() ),
'capabilities' => rawurlencode( wp_json_encode( $this->onboarding_service->get_capabilities_from_request() ) ),
'from' => WC_Payments_Onboarding_Service::FROM_WPCOM_CONNECTION,
'source' => $onboarding_source,
'redirect_to_settings_page' => $redirect_to_settings_page ? 'true' : false,
Expand Down Expand Up @@ -1543,7 +1543,8 @@ public function maybe_handle_onboarding() {
// This is because there is no interim step between the user clicking the connect link and the onboarding wizard.
! empty( $from ) ? $from : $next_step_from,
[
'source' => $onboarding_source,
'source' => $onboarding_source,
'capabilities' => rawurlencode( wp_json_encode( $this->onboarding_service->get_capabilities_from_request() ) ),
]
);
return;
Expand Down Expand Up @@ -1583,7 +1584,7 @@ public function maybe_handle_onboarding() {
// These are starting capabilities for the account.
// They are collected by the payment method step of the
// WC Payments settings page native onboarding experience.
'capabilities' => wp_json_encode( $this->onboarding_service->get_capabilities_from_request() ),
'capabilities' => rawurlencode( wp_json_encode( $this->onboarding_service->get_capabilities_from_request() ) ),
'test_mode' => $should_onboard_in_test_mode ? 'true' : false,
'source' => $onboarding_source,
'redirect_to_settings_page' => $redirect_to_settings_page ? 'true' : false,
Expand Down

0 comments on commit 1ac712d

Please sign in to comment.