api_wrapper = $api_wrapper; $this->options_storage = $options_storage; } /** * @param string $email * @param string $password * @param string $password_confirmation * * @throws Account_Validation_Exception * @throws Account_Authorization_Exception * @throws Account_Exception */ public function create_account( $email, $password, $password_confirmation ) { $this->api_wrapper->create_client( $email, $password, $password_confirmation ); $this->create_integration( $email, $password ); } /** * @param string $email * @param string $password * * @throws Account_Validation_Exception * @throws Account_Authorization_Exception * @throws Account_Exception */ public function create_integration( $email, $password ) { $this->api_wrapper->generate_oauth_setup_token( $email, $password ); $integration = $this->api_wrapper->create_integration(); $this->api_wrapper->generate_integration_specific_token( $email, $password, $integration->getId() ); Dispatcher::dispatch( new Integration_Was_Created( $integration ) ); } }