Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders\WooPayments
WooPaymentsRestController::handle_onboarding_test_account_init
Handle the onboarding test account initialize action.
Метод класса: WooPaymentsRestController{}
Хуков нет.
Возвращает
WP_Error|WP_REST_Response. The response or error.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->handle_onboarding_test_account_init( $request );
- $request(WP_REST_Request) (обязательный)
- The request object.
Код WooPaymentsRestController::handle_onboarding_test_account_init() WooPaymentsRestController::handle onboarding test account init WC 10.8.1
protected function handle_onboarding_test_account_init( WP_REST_Request $request ) {
$location = $request->get_param( 'location' );
if ( empty( $location ) ) {
// Fall back to the providers country if no location is provided.
$location = $this->payments->get_country();
}
$source = $request->get_param( 'source' );
try {
// Mark the step as started, if not already.
$this->woopayments->mark_onboarding_step_started( WooPaymentsService::ONBOARDING_STEP_TEST_ACCOUNT, $location, false, $source );
$result = $this->woopayments->onboarding_test_account_init( $location, $source );
} catch ( ApiException $e ) {
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
}
return rest_ensure_response(
array_merge(
array( 'success' => true ),
$result
)
);
}