accountDetailServiceProvider = $accountDetailServiceProvider; } /** * @since 2.13.3 */ public function __invoke() { $this->validateRequest(); $requestedData = GetStripeAccountDetailsDto::fromArray(give_clean($_POST)); try { wp_send_json_success( $this->accountDetailServiceProvider ->getAccountDetailBySlug($requestedData->accountSlug) ->toArray() ); } catch (InvalidArgumentException $e) { wp_send_json_error(); } } /** * @since 2.13.0 */ private function validateRequest() { if ( ! current_user_can('manage_give_settings')) { die(); } } }